diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e934579a..40f836cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,9 @@ jobs: # For the latest version information see: https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule # Versions before 22 are not tested as they run on PHP versions lower than 8.0 # Versions before 24 are not tested as they do not support `.well-known` entries + # Version 24 comes with PHP 8.0, which is no longer supported; # Latest is not tested here, as that could cause failures unrelated to project changes nextcloud_version: - - 24 - 25 steps: @@ -80,7 +80,6 @@ jobs: fail-fast: false matrix: nextcloud_version: - - 24 - 25 test: - 'solidtestsuite/solid-crud-tests:v7.0.5' @@ -88,7 +87,7 @@ jobs: - 'solidtestsuite/webid-provider-tests:v2.1.0' # Prevent EOL or non-stable versions of Nextcloud to fail the test-suite - continue-on-error: ${{ contains(fromJson('[24, 25]'), matrix.nextcloud_version) == false }} + continue-on-error: ${{ contains(fromJson('[25]'), matrix.nextcloud_version) == false }} steps: - name: Create docker tag from git reference diff --git a/.github/workflows/dependancy-security-check.yml b/.github/workflows/dependancy-security-check.yml index 8875ea49..56817247 100644 --- a/.github/workflows/dependancy-security-check.yml +++ b/.github/workflows/dependancy-security-check.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - php: ['8.0', '8.1'] + php: ['8.1'] steps: - name: Checkout code diff --git a/.github/workflows/php-version-sniff.yml b/.github/workflows/php-version-sniff.yml index 5b2b8adc..30cfd373 100644 --- a/.github/workflows/php-version-sniff.yml +++ b/.github/workflows/php-version-sniff.yml @@ -17,7 +17,7 @@ jobs: php-codesniffer: strategy: matrix: - php: [ '8.0', '8.1' ] + php: [ '8.1' ] runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 diff --git a/solid/appinfo/info.xml b/solid/appinfo/info.xml index d701532b..d8b3f73d 100644 --- a/solid/appinfo/info.xml +++ b/solid/appinfo/info.xml @@ -18,10 +18,10 @@ IMPORTANT: See https://github.com/pdsinterop/solid-nextcloud/blob/main/INSTALL.m integration https://github.com/pdsinterop/solid-nextcloud/issues - + - OCASolidSettings + \OCA\Solid\Settings diff --git a/solid/composer.json b/solid/composer.json index eeeb1429..c9538907 100644 --- a/solid/composer.json +++ b/solid/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "ext-dom": "*", "ext-json": "*", "ext-mbstring": "*", @@ -31,8 +31,8 @@ "lcobucci/jwt": "^4.1", "pdsinterop/flysystem-nextcloud": "^0.2", "pdsinterop/flysystem-rdf": "^0.5", - "pdsinterop/solid-auth": "v0.10.2", - "pdsinterop/solid-crud": "^0.7.1", + "pdsinterop/solid-auth": "v0.10.3", + "pdsinterop/solid-crud": "^0.7.3", "psr/log": "^1.1" }, "require-dev": { diff --git a/solid/composer.lock b/solid/composer.lock index 0a02c9ef..91256164 100644 --- a/solid/composer.lock +++ b/solid/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "91d04abf77def2bd750d8bfd4fbc099e", + "content-hash": "aeae368dde0a3e5505b6dc9870dfb279", "packages": [ { "name": "arc/base", @@ -217,16 +217,16 @@ }, { "name": "defuse/php-encryption", - "version": "v2.3.1", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/defuse/php-encryption.git", - "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2" + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/defuse/php-encryption/zipball/77880488b9954b7884c25555c2a0ea9e7053f9d2", - "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/f53396c2d34225064647a05ca76c1da9d99e5828", + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828", "shasum": "" }, "require": { @@ -235,7 +235,8 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^4|^5|^6|^7|^8|^9" + "phpunit/phpunit": "^5|^6|^7|^8|^9|^10", + "yoast/phpunit-polyfills": "^2.0.0" }, "bin": [ "bin/generate-defuse-key" @@ -277,9 +278,9 @@ ], "support": { "issues": "https://github.com/defuse/php-encryption/issues", - "source": "https://github.com/defuse/php-encryption/tree/v2.3.1" + "source": "https://github.com/defuse/php-encryption/tree/v2.4.0" }, - "time": "2021-04-09T23:57:26+00:00" + "time": "2023-06-19T06:10:36+00:00" }, { "name": "easyrdf/easyrdf", @@ -434,22 +435,22 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.24.0", + "version": "2.26.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "6028af6c3b5ced4d063a680d2483cce67578b902" + "reference": "6584d44eb8e477e89d453313b858daac6183cddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/6028af6c3b5ced4d063a680d2483cce67578b902", - "reference": "6028af6c3b5ced4d063a680d2483cce67578b902", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/6584d44eb8e477e89d453313b858daac6183cddc", + "reference": "6584d44eb8e477e89d453313b858daac6183cddc", "shasum": "" }, "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "conflict": { "zendframework/zend-diactoros": "*" @@ -464,11 +465,11 @@ "ext-gd": "*", "ext-libxml": "*", "http-interop/http-factory-tests": "^0.9.0", - "laminas/laminas-coding-standard": "^2.4.0", + "laminas/laminas-coding-standard": "^2.5", "php-http/psr7-integration-tests": "^1.2", - "phpunit/phpunit": "^9.5.27", + "phpunit/phpunit": "^9.5.28", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.4" + "vimeo/psalm": "^5.6" }, "type": "library", "extra": { @@ -527,35 +528,38 @@ "type": "community_bridge" } ], - "time": "2022-12-20T12:22:40+00:00" + "time": "2023-10-29T16:17:44+00:00" }, { "name": "lcobucci/clock", - "version": "2.2.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/lcobucci/clock.git", - "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3" + "reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/clock/zipball/fb533e093fd61321bfcbac08b131ce805fe183d3", - "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/039ef98c6b57b101d10bd11d8fdfda12cbd996dc", + "reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc", "shasum": "" }, "require": { - "php": "^8.0", - "stella-maris/clock": "^0.1.4" + "php": "~8.1.0 || ~8.2.0", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" }, "require-dev": { "infection/infection": "^0.26", - "lcobucci/coding-standard": "^8.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^9.5" + "lcobucci/coding-standard": "^9.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-deprecation-rules": "^1.1.1", + "phpstan/phpstan-phpunit": "^1.3.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.27" }, "type": "library", "autoload": { @@ -576,7 +580,7 @@ "description": "Yet another clock abstraction", "support": { "issues": "https://github.com/lcobucci/clock/issues", - "source": "https://github.com/lcobucci/clock/tree/2.2.0" + "source": "https://github.com/lcobucci/clock/tree/3.0.0" }, "funding": [ { @@ -588,7 +592,7 @@ "type": "patreon" } ], - "time": "2022-04-19T19:34:17+00:00" + "time": "2022-12-19T15:00:24+00:00" }, { "name": "lcobucci/jwt", @@ -865,26 +869,26 @@ }, { "name": "league/mime-type-detection", - "version": "1.11.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd" + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e", + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" }, "type": "library", "autoload": { @@ -905,7 +909,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0" }, "funding": [ { @@ -917,41 +921,41 @@ "type": "tidelift" } ], - "time": "2022-04-17T13:12:02+00:00" + "time": "2023-10-17T14:13:20+00:00" }, { "name": "league/oauth2-server", - "version": "8.3.6", + "version": "8.5.4", "source": { "type": "git", "url": "https://github.com/thephpleague/oauth2-server.git", - "reference": "28c5441716c10d0c936bd731860dc385d0f6d1a8" + "reference": "ab7714d073844497fd222d5d0a217629089936bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth2-server/zipball/28c5441716c10d0c936bd731860dc385d0f6d1a8", - "reference": "28c5441716c10d0c936bd731860dc385d0f6d1a8", + "url": "https://api.github.com/repos/thephpleague/oauth2-server/zipball/ab7714d073844497fd222d5d0a217629089936bc", + "reference": "ab7714d073844497fd222d5d0a217629089936bc", "shasum": "" }, "require": { - "defuse/php-encryption": "^2.2.1", - "ext-json": "*", + "defuse/php-encryption": "^2.3", "ext-openssl": "*", - "lcobucci/jwt": "^3.4.6 || ^4.0.4", + "lcobucci/clock": "^2.2 || ^3.0", + "lcobucci/jwt": "^4.3 || ^5.0", "league/event": "^2.2", - "league/uri": "^6.4", - "php": "^7.2 || ^8.0", - "psr/http-message": "^1.0.1" + "league/uri": "^6.7 || ^7.0", + "php": "^8.0", + "psr/http-message": "^1.0.1 || ^2.0" }, "replace": { "league/oauth2server": "*", "lncd/oauth2": "*" }, "require-dev": { - "laminas/laminas-diactoros": "^2.4.1", + "laminas/laminas-diactoros": "^3.0.0", "phpstan/phpstan": "^0.12.57", "phpstan/phpstan-phpunit": "^0.12.16", - "phpunit/phpunit": "^8.5.13", + "phpunit/phpunit": "^9.6.6", "roave/security-advisories": "dev-master" }, "type": "library", @@ -997,7 +1001,7 @@ ], "support": { "issues": "https://github.com/thephpleague/oauth2-server/issues", - "source": "https://github.com/thephpleague/oauth2-server/tree/8.3.6" + "source": "https://github.com/thephpleague/oauth2-server/tree/8.5.4" }, "funding": [ { @@ -1005,57 +1009,48 @@ "type": "github" } ], - "time": "2022-11-14T19:42:00+00:00" + "time": "2023-08-25T22:35:12+00:00" }, { "name": "league/uri", - "version": "6.7.2", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bf414ba956d902f5d98bf9385fcf63954f09dce5", + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5", "shasum": "" }, "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.0" + "league/uri-interfaces": "^7.3", + "php": "^8.1" }, "conflict": { "league/uri-schemes": "^1.0" }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.3.2", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "^1.1", - "phpstan/phpstan": "^1.2.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.10", - "psr/http-factory": "^1.0" - }, "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1095,8 +1090,8 @@ "support": { "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.7.2" + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.4.0" }, "funding": [ { @@ -1104,46 +1099,44 @@ "type": "github" } ], - "time": "2022-09-13T19:50:42+00:00" + "time": "2023-12-01T06:24:25+00:00" }, { "name": "league/uri-interfaces", - "version": "2.3.0", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/bd8c487ec236930f7bbc42b8d374fa882fbba0f3", + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src/" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1157,17 +1150,32 @@ "homepage": "https://nyamsprod.com" } ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", "rfc3986", "rfc3987", + "rfc6570", "uri", - "url" + "url", + "ws" ], "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.0" }, "funding": [ { @@ -1175,7 +1183,7 @@ "type": "github" } ], - "time": "2021-06-28T04:27:21+00:00" + "time": "2023-11-24T15:40:42+00:00" }, { "name": "mjrider/flysystem-factory", @@ -1248,6 +1256,7 @@ "issues": "https://github.com/mjrider/flysystem-factory/issues", "source": "https://github.com/mjrider/flysystem-factory/tree/v0.7.1" }, + "abandoned": true, "time": "2022-03-10T07:15:51+00:00" }, { @@ -1487,16 +1496,16 @@ }, { "name": "pdsinterop/solid-auth", - "version": "v0.10.2", + "version": "v0.10.3", "source": { "type": "git", "url": "https://github.com/pdsinterop/php-solid-auth.git", - "reference": "797e19f74bee5593da320ed69f8ebfaefff99d03" + "reference": "8ed8a4c540a65713fa7f7ef5a47fc4f8040a760d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdsinterop/php-solid-auth/zipball/797e19f74bee5593da320ed69f8ebfaefff99d03", - "reference": "797e19f74bee5593da320ed69f8ebfaefff99d03", + "url": "https://api.github.com/repos/pdsinterop/php-solid-auth/zipball/8ed8a4c540a65713fa7f7ef5a47fc4f8040a760d", + "reference": "8ed8a4c540a65713fa7f7ef5a47fc4f8040a760d", "shasum": "" }, "require": { @@ -1530,22 +1539,22 @@ "description": "OAuth2, OpenID and OIDC for Solid Server implementations.", "support": { "issues": "https://github.com/pdsinterop/php-solid-auth/issues", - "source": "https://github.com/pdsinterop/php-solid-auth/tree/v0.10.2" + "source": "https://github.com/pdsinterop/php-solid-auth/tree/v0.10.3" }, - "time": "2023-01-27T14:24:00+00:00" + "time": "2024-01-17T13:11:20+00:00" }, { "name": "pdsinterop/solid-crud", - "version": "v0.7.1", + "version": "v0.7.3", "source": { "type": "git", "url": "https://github.com/pdsinterop/php-solid-crud.git", - "reference": "71f8b040ad3fb64e5a6a826dda733149b7f09fa7" + "reference": "c5369ef7b46d3d77a7686c3f4531e818e1797e27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdsinterop/php-solid-crud/zipball/71f8b040ad3fb64e5a6a826dda733149b7f09fa7", - "reference": "71f8b040ad3fb64e5a6a826dda733149b7f09fa7", + "url": "https://api.github.com/repos/pdsinterop/php-solid-crud/zipball/c5369ef7b46d3d77a7686c3f4531e818e1797e27", + "reference": "c5369ef7b46d3d77a7686c3f4531e818e1797e27", "shasum": "" }, "require": { @@ -1577,38 +1586,38 @@ "description": "Solid HTTPS REST API specification compliant implementation for handling Resource CRUD", "support": { "issues": "https://github.com/pdsinterop/php-solid-crud/issues", - "source": "https://github.com/pdsinterop/php-solid-crud/tree/v0.7.1" + "source": "https://github.com/pdsinterop/php-solid-crud/tree/v0.7.3" }, - "time": "2023-01-27T14:24:42+00:00" + "time": "2024-01-17T10:48:57+00:00" }, { "name": "phrity/net-uri", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sirn-se/phrity-net-uri.git", - "reference": "c6ecf127e7c99a41ce04d3cdcda7f51108dd96f7" + "reference": "3f458e0c4d1ddc0e218d7a5b9420127c63925f43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirn-se/phrity-net-uri/zipball/c6ecf127e7c99a41ce04d3cdcda7f51108dd96f7", - "reference": "c6ecf127e7c99a41ce04d3cdcda7f51108dd96f7", + "url": "https://api.github.com/repos/sirn-se/phrity-net-uri/zipball/3f458e0c4d1ddc0e218d7a5b9420127c63925f43", + "reference": "3f458e0c4d1ddc0e218d7a5b9420127c63925f43", "shasum": "" }, "require": { - "php": "^7.4|^8.0", + "php": "^7.4 | ^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 | ^2.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.0", - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^9.0 | ^10.0", "squizlabs/php_codesniffer": "^3.0" }, "type": "library", "autoload": { "psr-4": { - "": "src/" + "Phrity\\Net\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1632,9 +1641,9 @@ ], "support": { "issues": "https://github.com/sirn-se/phrity-net-uri/issues", - "source": "https://github.com/sirn-se/phrity-net-uri/tree/1.2.0" + "source": "https://github.com/sirn-se/phrity-net-uri/tree/1.3.0" }, - "time": "2022-11-30T07:20:06+00:00" + "time": "2023-08-21T10:33:06+00:00" }, { "name": "phrity/util-errorhandler", @@ -1854,21 +1863,21 @@ }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -1888,7 +1897,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -1903,31 +1912,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1956,9 +1965,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "psr/log", @@ -2119,53 +2128,6 @@ ], "time": "2020-11-03T09:10:25+00:00" }, - { - "name": "stella-maris/clock", - "version": "0.1.7", - "source": { - "type": "git", - "url": "https://github.com/stella-maris-solutions/clock.git", - "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/fa23ce16019289a18bb3446fdecd45befcdd94f8", - "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8", - "shasum": "" - }, - "require": { - "php": "^7.0|^8.0", - "psr/clock": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "StellaMaris\\Clock\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andreas Heigl", - "role": "Maintainer" - } - ], - "description": "A pre-release of the proposed PSR-20 Clock-Interface", - "homepage": "https://gitlab.com/stella-maris/clock", - "keywords": [ - "clock", - "datetime", - "point in time", - "psr20" - ], - "support": { - "source": "https://github.com/stella-maris-solutions/clock/tree/0.1.7" - }, - "time": "2022-11-25T16:15:06+00:00" - }, { "name": "textalk/websocket", "version": "1.6.3", @@ -2390,16 +2352,16 @@ }, { "name": "doctrine/dbal", - "version": "3.5.3", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e" + "reference": "0ac3c270590e54910715e9a1a044cc368df282b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/88fa7e5189fd5ec6682477044264dc0ed4e3aa1e", - "reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/0ac3c270590e54910715e9a1a044cc368df282b2", + "reference": "0ac3c270590e54910715e9a1a044cc368df282b2", "shasum": "" }, "require": { @@ -2412,13 +2374,15 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "11.0.0", - "jetbrains/phpstorm-stubs": "2022.3", - "phpstan/phpstan": "1.9.4", - "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "9.5.27", + "doctrine/coding-standard": "12.0.0", + "fig/log-test": "^1", + "jetbrains/phpstorm-stubs": "2023.1", + "phpstan/phpstan": "1.10.42", + "phpstan/phpstan-strict-rules": "^1.5", + "phpunit/phpunit": "9.6.13", "psalm/plugin-phpunit": "0.18.4", - "squizlabs/php_codesniffer": "3.7.1", + "slevomat/coding-standard": "8.13.1", + "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^5.4|^6.0", "symfony/console": "^4.4|^5.4|^6.0", "vimeo/psalm": "4.30.0" @@ -2481,7 +2445,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.5.3" + "source": "https://github.com/doctrine/dbal/tree/3.7.2" }, "funding": [ { @@ -2497,29 +2461,33 @@ "type": "tidelift" } ], - "time": "2023-01-12T10:21:44+00:00" + "time": "2023-11-19T08:06:58+00:00" }, { "name": "doctrine/deprecations", - "version": "v1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -2538,36 +2506,35 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + "source": "https://github.com/doctrine/deprecations/tree/1.1.2" }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2023-09-27T20:04:15+00:00" }, { "name": "doctrine/event-manager", - "version": "1.2.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "conflict": { "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.28" }, "type": "library", "autoload": { @@ -2616,7 +2583,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + "source": "https://github.com/doctrine/event-manager/tree/2.0.0" }, "funding": [ { @@ -2632,34 +2599,34 @@ "type": "tidelift" } ], - "time": "2022-10-12T20:51:15+00:00" + "time": "2022-10-12T20:59:15+00:00" }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -2686,7 +2653,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -2702,20 +2669,20 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -2753,7 +2720,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -2761,7 +2728,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nextcloud/server", @@ -2787,25 +2754,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -2813,7 +2782,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2837,9 +2806,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "phar-io/manifest", @@ -2954,23 +2923,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "version": "9.2.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -2985,8 +2954,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -3019,7 +2988,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" }, "funding": [ { @@ -3027,7 +2997,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2023-12-22T06:47:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3272,16 +3242,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.28", + "version": "9.6.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", "shasum": "" }, "require": { @@ -3296,7 +3266,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -3314,8 +3284,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -3323,7 +3293,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -3354,7 +3324,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" }, "funding": [ { @@ -3370,7 +3341,7 @@ "type": "tidelift" } ], - "time": "2023-01-14T12:32:24+00:00" + "time": "2023-12-01T16:55:19+00:00" }, { "name": "sebastian/cli-parser", @@ -3615,20 +3586,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -3660,7 +3631,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -3668,20 +3639,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -3726,7 +3697,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -3734,20 +3705,20 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -3789,7 +3760,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -3797,7 +3768,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -3878,16 +3849,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -3930,7 +3901,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -3938,24 +3909,24 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -3987,7 +3958,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -3995,7 +3966,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -4111,16 +4082,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -4159,10 +4130,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -4170,7 +4141,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -4229,16 +4200,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -4273,7 +4244,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -4281,7 +4252,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -4338,16 +4309,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -4376,7 +4347,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -4384,7 +4355,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], @@ -4393,12 +4364,12 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.0", + "php": "^8.1", "ext-dom": "*", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/solid/js/launcher.js b/solid/js/launcher.js index 3f296f08..556daab4 100644 --- a/solid/js/launcher.js +++ b/solid/js/launcher.js @@ -36,8 +36,8 @@ window.addEventListener("simply-content-loaded", function() { return session; } else { return fetcher.login({ - webId: webId, - // oidcIssuer: 'https://nextcloud.local', + // webId: webId, + oidcIssuer: document.location.href.replace(document.location.pathname, ''), redirect: document.location.href }); } @@ -271,7 +271,7 @@ window.addEventListener("simply-content-loaded", function() { const { TypeIndexParser, SolidType } = SolidTypeIndexParser; var typeIndexUrl = api.url + typeIndex; const parser = new TypeIndexParser({ typeIndexUrl }); - const solidType = new SolidType(resourceClass, filename) + const solidType = new SolidType(resourceClass, storageUrl + filename) parser.turtleToTypeIndexDoc(turtle) .then(function(doc) { doc.addType(solidType); @@ -306,7 +306,7 @@ window.addEventListener("simply-content-loaded", function() { const { TypeIndexParser, SolidType } = SolidTypeIndexParser; var typeIndexUrl = api.url + typeIndex; const parser = new TypeIndexParser({ typeIndexUrl }); - const solidType = new SolidType(resourceClass, undefined, container) + const solidType = new SolidType(resourceClass, undefined, storageUrl + container) parser.turtleToTypeIndexDoc(turtle) .then(function(doc) { doc.addType(solidType); diff --git a/solid/js/vendor/solid/solid-auth-fetcher.bundle.js b/solid/js/vendor/solid/solid-auth-fetcher.bundle.js index ac45a803..fd1208c8 100644 --- a/solid/js/vendor/solid/solid-auth-fetcher.bundle.js +++ b/solid/js/vendor/solid/solid-auth-fetcher.bundle.js @@ -1,13 +1,13 @@ -var solidAuthFetcher=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=199)}([function(t,e,r){"use strict";(function(t){ +var solidAuthFetcher=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=200)}([function(t,e,r){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var i=r(247),n=r(248),a=r(115);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(i)return U(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:g(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,i,n){var a,o=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,r/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var f=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){for(var c=!0,l=0;ln&&(i=n):i=n;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o>8,n=r%256,a.push(n),a.push(i);return a}(e,t.length-r),t,r,i)}function C(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(a=t[n+1]))&&(u=(31&h)<<6|63&a)>127&&(f=u);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(u=(15&h)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&h)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),s=Math.min(a,o),h=this.slice(i,n),f=t.slice(e,r),c=0;cn)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return M(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,i,n,a){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function x(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,a=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function O(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,a=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function N(t,e,r,i,n,a){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,i,a){return a||N(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function L(t,e,r,i,a){return a||N(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var i=this[t],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var i=e,n=1,a=this[t+--i];i>0&&(n*=256);)a+=this[t+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+n]=t/a&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function K(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(7))},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){ +var i=r(248),n=r(249),a=r(115);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(i)return U(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var a,o=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,r/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var f=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){for(var c=!0,l=0;ln&&(i=n):i=n;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o>8,n=r%256,a.push(n),a.push(i);return a}(e,t.length-r),t,r,i)}function C(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(a=t[n+1]))&&(u=(31&h)<<6|63&a)>127&&(f=u);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(u=(15&h)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&h)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),s=Math.min(a,o),h=this.slice(i,n),f=t.slice(e,r),c=0;cn)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return M(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,i,n,a){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function x(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,a=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function O(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,a=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function N(t,e,r,i,n,a){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,i,a){return a||N(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function F(t,e,r,i,a){return a||N(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var i=this[t],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var i=e,n=1,a=this[t+--i];i>0&&(n*=256);)a+=this[t+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+n]=t/a&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function K(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(7))},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var i=r(0),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e){t.exports={options:{usePureJavaScript:!1}}},function(t,e){var r,i,n=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var u,h=[],f=!1,c=-1;function l(){f&&u&&(f=!1,u.length?h=u.concat(h):c=-1,h.length&&d())}function d(){if(!f){var t=s(l);f=!0;for(var e=h.length;e;){for(u=h,h=[];++c1)for(var r=1;r1)for(var r=1;r=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function u(){for(var t=[],e=0;e0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},t}(),w=function(){this.scopedResolutions=new Map};function _(t,e,r){var i,n,a=s(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1],o=function(t,e){return null===t?"at position #"+e:'"'+t.split(",")[e].trim()+'" at position #'+e}(void 0===a?null:a,e);return i="Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',void 0===n&&(n=" "),u([i],r.message.split("\n").map((function(t){return n+t}))).join("\n")}var E=new Map,M=new(function(){function t(t){this.parent=t,this._registry=new b}return t.prototype.register=function(t,e,r){var i;if(void 0===r&&(r={lifecycle:n.Transient}),i=function(t){return c(t)||g(t)||y(t)||l(t)}(e)?e:{useClass:e},(r.lifecycle===n.Singleton||r.lifecycle==n.ContainerScoped||r.lifecycle==n.ResolutionScoped)&&(g(i)||l(i)))throw new Error('Cannot use lifecycle "'+n[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:i,options:r}),this},t.prototype.registerType=function(t,e){return m(e)?this.register(t,{useToken:e}):this.register(t,{useClass:e})},t.prototype.registerInstance=function(t,e){return this.register(t,{useValue:e})},t.prototype.registerSingleton=function(t,e){if(m(t)){if(m(e))return this.register(t,{useToken:e},{lifecycle:n.Singleton});if(e)return this.register(t,{useClass:e},{lifecycle:n.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=t;return e&&!m(e)&&(r=e),this.register(t,{useClass:r},{lifecycle:n.Singleton})},t.prototype.resolve=function(t,e){void 0===e&&(e=new w);var r=this.getRegistration(t);if(!r&&m(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');if(r)return this.resolveRegistration(r,e);if(function(t){return"function"==typeof t||t instanceof d}(t))return this.construct(t,e);throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.resolveRegistration=function(t,e){if(t.options.lifecycle===n.ResolutionScoped&&e.scopedResolutions.has(t))return e.scopedResolutions.get(t);var r,i=t.options.lifecycle===n.Singleton,a=t.options.lifecycle===n.ContainerScoped,o=i||a;return r=g(t.provider)?t.provider.useValue:y(t.provider)?o?t.instance||(t.instance=this.resolve(t.provider.useToken,e)):this.resolve(t.provider.useToken,e):c(t.provider)?o?t.instance||(t.instance=this.construct(t.provider.useClass,e)):this.construct(t.provider.useClass,e):l(t.provider)?t.provider.useFactory(this):this.construct(t.provider,e),t.options.lifecycle===n.ResolutionScoped&&e.scopedResolutions.set(t,r),r},t.prototype.resolveAll=function(t,e){var r=this;void 0===e&&(e=new w);var i=this.getAllRegistrations(t);if(!i&&m(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');return i?i.map((function(t){return r.resolveRegistration(t,e)})):[this.construct(t,e)]},t.prototype.isRegistered=function(t,e){return void 0===e&&(e=!1),this._registry.has(t)||e&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},t.prototype.reset=function(){this._registry.clear()},t.prototype.clearInstances=function(){var t,e;try{for(var r=o(this._registry.entries()),i=r.next();!i.done;i=r.next()){var n=s(i.value,2),a=n[0],u=n[1];this._registry.setAll(a,u.filter((function(t){return!g(t.provider)})).map((function(t){return t.instance=void 0,t})))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.createChildContainer=function(){var e,r,i=new t(this);try{for(var a=o(this._registry.entries()),u=a.next();!u.done;u=a.next()){var h=s(u.value,2),f=h[0],c=h[1];c.some((function(t){return t.options.lifecycle===n.ContainerScoped}))&&i._registry.setAll(f,c.map((function(t){return t.options.lifecycle===n.ContainerScoped?{provider:t.provider,options:t.options}:t})))}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},t.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},t.prototype.construct=function(t,e){var r=this;if(t instanceof d)return t.createProxy((function(t){return r.resolve(t,e)}));if(0===t.length)return new t;var i=E.get(t);if(!i||0===i.length)throw new Error('TypeInfo not known for "'+t.name+'"');var n=i.map(this.resolveParams(e,t));return new(t.bind.apply(t,u([void 0],n)))},t.prototype.resolveParams=function(t,e){var r=this;return function(i,n){try{return v(i)?i.multiple?r.resolveAll(i.token):r.resolve(i.token,t):r.resolve(i,t)}catch(t){throw new Error(_(e,n,t))}}},t}());var S=function(){return function(t){var e=h(t);return function(r){function i(){for(var i=[],n=0;n15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&o.setAttribute("a",a=!a))}}u.nextTick=u.setImmediate}(),u.isNodejs=void 0!==e&&e.versions&&e.versions.node,u.globalScope=u.isNodejs?n:"undefined"==typeof self?window:self,u.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},u.isArrayBufferView=function(t){return t&&u.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},u.ByteBuffer=f,u.ByteStringBuffer=f;u.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},u.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},u.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},u.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},u.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},u.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},u.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(u.encodeUtf8(t))},u.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},u.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},u.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},u.ByteStringBuffer.prototype.putInt=function(t,e){h(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},u.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e},u.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},u.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},u.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},u.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},u.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},u.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},u.ByteStringBuffer.prototype.copy=function(){var t=u.createBuffer(this.data);return t.read=this.read,t},u.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},u.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},u.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},u.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+e);return i.set(r),this.data=new DataView(i.buffer),this},u.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},u.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},u.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},u.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},u.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},u.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},u.DataBuffer.prototype.putInt=function(t,e){h(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},u.DataBuffer.prototype.putSignedInt=function(t,e){return h(e),this.accommodate(e/8),t<0&&(t+=2<0);return e},u.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},u.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},u.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},u.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},u.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},u.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},u.DataBuffer.prototype.copy=function(){return new u.DataBuffer(this)},u.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},u.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},u.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},u.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},u.xorBytes=function(t,e,r){for(var i="",n="",a="",o=0,s=0;r>0;--r,++o)n=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(i+=a,a="",s=0),a+=String.fromCharCode(n),++s;return i+=a},u.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";u.encode64=function(t,e){for(var r,i,n,a="",o="",s=0;s>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},u.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,i,n,a="",o=0;o>4),64!==i&&(a+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(a+=String.fromCharCode((3&i)<<6|n)));return a},u.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},u.decodeUtf8=function(t){return decodeURIComponent(escape(t))},u.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.decode}},u.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},u.binary.raw.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},u.binary.base64.decode=function(t,e,r){var i,n,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,h=r=r||0;u>4,64!==a&&(s[h++]=(15&n)<<4|a>>2,64!==o&&(s[h++]=(3&a)<<6|o));return e?h-r:s.subarray(0,h)},u.binary.base58.encode=function(t,e){return u.binary.baseN.encode(t,d,e)},u.binary.base58.decode=function(t,e){return u.binary.baseN.decode(t,d,e)},u.text={utf8:{},utf16:{}},u.text.utf8.encode=function(t,e,r){t=u.encodeUtf8(t);var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a0?(n=r[i].substring(0,o),a=r[i].substring(o+1)):(n=r[i],a=null),n in e||(e[n]=[]),n in Object.prototype||null===a||e[n].push(unescape(a))}return e};return void 0===t?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),e=_):e=r(t),e},u.parseFragment=function(t){var e=t,r="",i=t.indexOf("?");i>0&&(e=t.substring(0,i),r=t.substring(i+1));var n=e.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:e,queryString:r,path:n,query:""===r?{}:u.getQueryVariables(r)}},u.makeRequest=function(t){var e=u.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(t){return void 0===t?e.path:e.path[t]},getQuery:function(t,r){var i;return void 0===t?i=e.query:(i=e.query[t])&&void 0!==r&&(i=i[r]),i},getQueryLast:function(t,e){var i=r.getQuery(t);return i?i[i.length-1]:e}};return r},u.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var i=jQuery.param(e||{});return r=r||"",t+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")},u.setPath=function(t,e,r){if("object"==typeof t&&null!==t)for(var i=0,n=e.length;i0&&a.push(r),o=i.lastIndex;var s=e[0][1];switch(s){case"s":case"o":n");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},u.formatNumber=function(t,e,r,i){var n=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===i?".":i,u=n<0?"-":"",h=parseInt(n=Math.abs(+n||0).toFixed(a),10)+"",f=h.length>3?h.length%3:0;return u+(f?h.substr(0,f)+s:"")+h.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(n-h).toFixed(a).slice(2):"")},u.formatSize=function(t){return t=t>=1073741824?u.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?u.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?u.formatNumber(t/1024,0)+" KiB":u.formatNumber(t,0)+" bytes"},u.bytesFromIP=function(t){return-1!==t.indexOf(".")?u.bytesFromIPv4(t):-1!==t.indexOf(":")?u.bytesFromIPv6(t):null},u.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=u.createBuffer(),r=0;rr[i].end-r[i].start&&(i=r.length-1)):r.push({start:s,end:s})}e.push(a)}if(r.length>0){var h=r[i];h.end-h.start>0&&(e.splice(h.start,h.end-h.start+1,""),0===h.start&&e.unshift(""),7===h.end&&e.push(""))}return e.join(":")},u.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in u&&!t.update)return e(null,u.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return u.cores=navigator.hardwareConcurrency,e(null,u.cores);if("undefined"==typeof Worker)return u.cores=1,e(null,u.cores);if("undefined"==typeof Blob)return u.cores=2,e(null,u.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(t){for(var e=Date.now(),r=e+4;Date.now()s.st&&n.stn.st&&s.st=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function u(){for(var t=[],e=0;e0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},t}(),w=function(){this.scopedResolutions=new Map};function _(t,e,r){var i,n,a=s(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1],o=function(t,e){return null===t?"at position #"+e:'"'+t.split(",")[e].trim()+'" at position #'+e}(void 0===a?null:a,e);return i="Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',void 0===n&&(n=" "),u([i],r.message.split("\n").map((function(t){return n+t}))).join("\n")}var E=new Map,M=new(function(){function t(t){this.parent=t,this._registry=new b}return t.prototype.register=function(t,e,r){var i;if(void 0===r&&(r={lifecycle:n.Transient}),i=function(t){return c(t)||y(t)||g(t)||l(t)}(e)?e:{useClass:e},(r.lifecycle===n.Singleton||r.lifecycle==n.ContainerScoped||r.lifecycle==n.ResolutionScoped)&&(y(i)||l(i)))throw new Error('Cannot use lifecycle "'+n[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:i,options:r}),this},t.prototype.registerType=function(t,e){return m(e)?this.register(t,{useToken:e}):this.register(t,{useClass:e})},t.prototype.registerInstance=function(t,e){return this.register(t,{useValue:e})},t.prototype.registerSingleton=function(t,e){if(m(t)){if(m(e))return this.register(t,{useToken:e},{lifecycle:n.Singleton});if(e)return this.register(t,{useClass:e},{lifecycle:n.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=t;return e&&!m(e)&&(r=e),this.register(t,{useClass:r},{lifecycle:n.Singleton})},t.prototype.resolve=function(t,e){void 0===e&&(e=new w);var r=this.getRegistration(t);if(!r&&m(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');if(r)return this.resolveRegistration(r,e);if(function(t){return"function"==typeof t||t instanceof d}(t))return this.construct(t,e);throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.resolveRegistration=function(t,e){if(t.options.lifecycle===n.ResolutionScoped&&e.scopedResolutions.has(t))return e.scopedResolutions.get(t);var r,i=t.options.lifecycle===n.Singleton,a=t.options.lifecycle===n.ContainerScoped,o=i||a;return r=y(t.provider)?t.provider.useValue:g(t.provider)?o?t.instance||(t.instance=this.resolve(t.provider.useToken,e)):this.resolve(t.provider.useToken,e):c(t.provider)?o?t.instance||(t.instance=this.construct(t.provider.useClass,e)):this.construct(t.provider.useClass,e):l(t.provider)?t.provider.useFactory(this):this.construct(t.provider,e),t.options.lifecycle===n.ResolutionScoped&&e.scopedResolutions.set(t,r),r},t.prototype.resolveAll=function(t,e){var r=this;void 0===e&&(e=new w);var i=this.getAllRegistrations(t);if(!i&&m(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');return i?i.map((function(t){return r.resolveRegistration(t,e)})):[this.construct(t,e)]},t.prototype.isRegistered=function(t,e){return void 0===e&&(e=!1),this._registry.has(t)||e&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},t.prototype.reset=function(){this._registry.clear()},t.prototype.clearInstances=function(){var t,e;try{for(var r=o(this._registry.entries()),i=r.next();!i.done;i=r.next()){var n=s(i.value,2),a=n[0],u=n[1];this._registry.setAll(a,u.filter((function(t){return!y(t.provider)})).map((function(t){return t.instance=void 0,t})))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.createChildContainer=function(){var e,r,i=new t(this);try{for(var a=o(this._registry.entries()),u=a.next();!u.done;u=a.next()){var h=s(u.value,2),f=h[0],c=h[1];c.some((function(t){return t.options.lifecycle===n.ContainerScoped}))&&i._registry.setAll(f,c.map((function(t){return t.options.lifecycle===n.ContainerScoped?{provider:t.provider,options:t.options}:t})))}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},t.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},t.prototype.construct=function(t,e){var r=this;if(t instanceof d)return t.createProxy((function(t){return r.resolve(t,e)}));if(0===t.length)return new t;var i=E.get(t);if(!i||0===i.length)throw new Error('TypeInfo not known for "'+t.name+'"');var n=i.map(this.resolveParams(e,t));return new(t.bind.apply(t,u([void 0],n)))},t.prototype.resolveParams=function(t,e){var r=this;return function(i,n){try{return v(i)?i.multiple?r.resolveAll(i.token):r.resolve(i.token,t):r.resolve(i,t)}catch(t){throw new Error(_(e,n,t))}}},t}());var S=function(){return function(t){var e=h(t);return function(r){function i(){for(var i=[],n=0;n15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&o.setAttribute("a",a=!a))}}u.nextTick=u.setImmediate}(),u.isNodejs=void 0!==e&&e.versions&&e.versions.node,u.globalScope=u.isNodejs?n:"undefined"==typeof self?window:self,u.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},u.isArrayBufferView=function(t){return t&&u.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},u.ByteBuffer=f,u.ByteStringBuffer=f;u.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},u.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},u.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},u.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},u.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},u.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},u.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(u.encodeUtf8(t))},u.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},u.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},u.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},u.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},u.ByteStringBuffer.prototype.putInt=function(t,e){h(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},u.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e},u.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},u.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},u.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},u.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},u.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},u.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},u.ByteStringBuffer.prototype.copy=function(){var t=u.createBuffer(this.data);return t.read=this.read,t},u.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},u.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},u.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},u.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+e);return i.set(r),this.data=new DataView(i.buffer),this},u.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},u.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},u.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},u.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},u.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},u.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},u.DataBuffer.prototype.putInt=function(t,e){h(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},u.DataBuffer.prototype.putSignedInt=function(t,e){return h(e),this.accommodate(e/8),t<0&&(t+=2<0);return e},u.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},u.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},u.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},u.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},u.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},u.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},u.DataBuffer.prototype.copy=function(){return new u.DataBuffer(this)},u.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},u.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},u.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},u.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},u.xorBytes=function(t,e,r){for(var i="",n="",a="",o=0,s=0;r>0;--r,++o)n=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(i+=a,a="",s=0),a+=String.fromCharCode(n),++s;return i+=a},u.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";u.encode64=function(t,e){for(var r,i,n,a="",o="",s=0;s>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},u.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,i,n,a="",o=0;o>4),64!==i&&(a+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(a+=String.fromCharCode((3&i)<<6|n)));return a},u.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},u.decodeUtf8=function(t){return decodeURIComponent(escape(t))},u.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.decode}},u.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},u.binary.raw.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},u.binary.base64.decode=function(t,e,r){var i,n,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,h=r=r||0;u>4,64!==a&&(s[h++]=(15&n)<<4|a>>2,64!==o&&(s[h++]=(3&a)<<6|o));return e?h-r:s.subarray(0,h)},u.binary.base58.encode=function(t,e){return u.binary.baseN.encode(t,d,e)},u.binary.base58.decode=function(t,e){return u.binary.baseN.decode(t,d,e)},u.text={utf8:{},utf16:{}},u.text.utf8.encode=function(t,e,r){t=u.encodeUtf8(t);var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a0?(n=r[i].substring(0,o),a=r[i].substring(o+1)):(n=r[i],a=null),n in e||(e[n]=[]),n in Object.prototype||null===a||e[n].push(unescape(a))}return e};return void 0===t?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),e=_):e=r(t),e},u.parseFragment=function(t){var e=t,r="",i=t.indexOf("?");i>0&&(e=t.substring(0,i),r=t.substring(i+1));var n=e.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:e,queryString:r,path:n,query:""===r?{}:u.getQueryVariables(r)}},u.makeRequest=function(t){var e=u.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(t){return void 0===t?e.path:e.path[t]},getQuery:function(t,r){var i;return void 0===t?i=e.query:(i=e.query[t])&&void 0!==r&&(i=i[r]),i},getQueryLast:function(t,e){var i=r.getQuery(t);return i?i[i.length-1]:e}};return r},u.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var i=jQuery.param(e||{});return r=r||"",t+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")},u.setPath=function(t,e,r){if("object"==typeof t&&null!==t)for(var i=0,n=e.length;i0&&a.push(r),o=i.lastIndex;var s=e[0][1];switch(s){case"s":case"o":n");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},u.formatNumber=function(t,e,r,i){var n=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===i?".":i,u=n<0?"-":"",h=parseInt(n=Math.abs(+n||0).toFixed(a),10)+"",f=h.length>3?h.length%3:0;return u+(f?h.substr(0,f)+s:"")+h.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(n-h).toFixed(a).slice(2):"")},u.formatSize=function(t){return t=t>=1073741824?u.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?u.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?u.formatNumber(t/1024,0)+" KiB":u.formatNumber(t,0)+" bytes"},u.bytesFromIP=function(t){return-1!==t.indexOf(".")?u.bytesFromIPv4(t):-1!==t.indexOf(":")?u.bytesFromIPv6(t):null},u.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=u.createBuffer(),r=0;rr[i].end-r[i].start&&(i=r.length-1)):r.push({start:s,end:s})}e.push(a)}if(r.length>0){var h=r[i];h.end-h.start>0&&(e.splice(h.start,h.end-h.start+1,""),0===h.start&&e.unshift(""),7===h.end&&e.push(""))}return e.join(":")},u.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in u&&!t.update)return e(null,u.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return u.cores=navigator.hardwareConcurrency,e(null,u.cores);if("undefined"==typeof Worker)return u.cores=1,e(null,u.cores);if("undefined"==typeof Blob)return u.cores=2,e(null,u.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(t){for(var e=Date.now(),r=e+4;Date.now()s.st&&n.stn.st&&s.st0))return!0;var i;for(i=0;i0))return!0;var i;for(i=0;i0))return!0;var i;for(i=0;i0))return!0;var i;for(i=0;i(n>>1)-1?(n>>1)-u:u,a.isubn(s)):s=0,i[o]=s,a.iushrn(1)}return i},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0;t.cmpn(-i)>0||e.cmpn(-n)>0;){var a,o,s,u=t.andln(3)+i&3,h=e.andln(3)+n&3;if(3===u&&(u=-1),3===h&&(h=-1),0==(1&u))a=0;else a=3!==(s=t.andln(7)+i&7)&&5!==s||2!==h?u:-u;if(r[0].push(a),0==(1&h))o=0;else o=3!==(s=e.andln(7)+n&7)&&5!==s||2!==u?h:-h;r[1].push(o),2*i===a+1&&(i=1-i),2*n===o+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},function(t,e,r){(function(t,i){var n; +var i,n=r(8);i={base64url:r(52),utf8:r(262),asBuffer:function(t,r){return e.isBuffer(t)?t:"string"==typeof t?"base64url"===(r=r||"binary")?i.base64url.decode(t):e.from(t,r):(n.util.isArrayBufferView(t)?t=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteOffset+t.byteLength):n.util.isArrayBuffer(t)&&(t=new Uint8Array(t)),e.from(t))},randomBytes:function(t){return e.from(n.random.getBytes(t),"binary")}},t.exports=i}).call(this,r(0).Buffer)},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var i=e,n=r(18),a=r(10),o=r(180);i.assert=a,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-u:u,a.isubn(s)):s=0,i[o]=s,a.iushrn(1)}return i},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0;t.cmpn(-i)>0||e.cmpn(-n)>0;){var a,o,s,u=t.andln(3)+i&3,h=e.andln(3)+n&3;if(3===u&&(u=-1),3===h&&(h=-1),0==(1&u))a=0;else a=3!==(s=t.andln(7)+i&7)&&5!==s||2!==h?u:-u;if(r[0].push(a),0==(1&h))o=0;else o=3!==(s=e.andln(7)+n&7)&&5!==s||2!==u?h:-h;r[1].push(o),2*i===a+1&&(i=1-i),2*n===o+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},function(t,e,r){(function(t,i){var n; /** * @license * Lodash @@ -40,30 +40,30 @@ var i,n=r(8);i={base64url:r(52),utf8:r(261),asBuffer:function(t,r){return e.isBu * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var a="Expected a function",o="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],u="[object Arguments]",h="[object Array]",f="[object Boolean]",c="[object Date]",l="[object Error]",d="[object Function]",p="[object GeneratorFunction]",m="[object Map]",v="[object Number]",y="[object Object]",g="[object RegExp]",b="[object Set]",w="[object String]",_="[object Symbol]",E="[object WeakMap]",M="[object ArrayBuffer]",S="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",k="[object Int8Array]",T="[object Int16Array]",I="[object Int32Array]",R="[object Uint8Array]",P="[object Uint16Array]",B="[object Uint32Array]",x=/\b__p \+= '';/g,O=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,F=RegExp(j.source),D=RegExp(L.source),U=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,H=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(Z.source),W=/^\s+|\s+$/g,$=/^\s+/,Q=/\s+$/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,tt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,et=/\\(\\)?/g,rt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,nt=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,ot=/^\[object .+?Constructor\]$/,st=/^0o[0-7]+$/i,ut=/^(?:0|[1-9]\d*)$/,ht=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,ct=/['\n\r\u2028\u2029\\]/g,lt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pt="[\\ud800-\\udfff]",mt="["+dt+"]",vt="["+lt+"]",yt="\\d+",gt="[\\u2700-\\u27bf]",bt="[a-z\\xdf-\\xf6\\xf8-\\xff]",wt="[^\\ud800-\\udfff"+dt+yt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",_t="\\ud83c[\\udffb-\\udfff]",Et="[^\\ud800-\\udfff]",Mt="(?:\\ud83c[\\udde6-\\uddff]){2}",St="[\\ud800-\\udbff][\\udc00-\\udfff]",Ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",At="(?:"+bt+"|"+wt+")",kt="(?:"+Ct+"|"+wt+")",Tt="(?:"+vt+"|"+_t+")"+"?",It="[\\ufe0e\\ufe0f]?"+Tt+("(?:\\u200d(?:"+[Et,Mt,St].join("|")+")[\\ufe0e\\ufe0f]?"+Tt+")*"),Rt="(?:"+[gt,Mt,St].join("|")+")"+It,Pt="(?:"+[Et+vt+"?",vt,Mt,St,pt].join("|")+")",Bt=RegExp("['’]","g"),xt=RegExp(vt,"g"),Ot=RegExp(_t+"(?="+_t+")|"+Pt+It,"g"),Nt=RegExp([Ct+"?"+bt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[mt,Ct,"$"].join("|")+")",kt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[mt,Ct+At,"$"].join("|")+")",Ct+"?"+At+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ct+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",yt,Rt].join("|"),"g"),jt=RegExp("[\\u200d\\ud800-\\udfff"+lt+"\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ft=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Dt=-1,Ut={};Ut[C]=Ut[A]=Ut[k]=Ut[T]=Ut[I]=Ut[R]=Ut["[object Uint8ClampedArray]"]=Ut[P]=Ut[B]=!0,Ut[u]=Ut[h]=Ut[M]=Ut[f]=Ut[S]=Ut[c]=Ut[l]=Ut[d]=Ut[m]=Ut[v]=Ut[y]=Ut[g]=Ut[b]=Ut[w]=Ut[E]=!1;var Kt={};Kt[u]=Kt[h]=Kt[M]=Kt[S]=Kt[f]=Kt[c]=Kt[C]=Kt[A]=Kt[k]=Kt[T]=Kt[I]=Kt[m]=Kt[v]=Kt[y]=Kt[g]=Kt[b]=Kt[w]=Kt[_]=Kt[R]=Kt["[object Uint8ClampedArray]"]=Kt[P]=Kt[B]=!0,Kt[l]=Kt[d]=Kt[E]=!1;var qt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=parseFloat,Vt=parseInt,Ht="object"==typeof t&&t&&t.Object===Object&&t,Zt="object"==typeof self&&self&&self.Object===Object&&self,Gt=Ht||Zt||Function("return this")(),Wt=e&&!e.nodeType&&e,$t=Wt&&"object"==typeof i&&i&&!i.nodeType&&i,Qt=$t&&$t.exports===Wt,Yt=Qt&&Ht.process,Jt=function(){try{var t=$t&&$t.require&&$t.require("util").types;return t||Yt&&Yt.binding&&Yt.binding("util")}catch(t){}}(),Xt=Jt&&Jt.isArrayBuffer,te=Jt&&Jt.isDate,ee=Jt&&Jt.isMap,re=Jt&&Jt.isRegExp,ie=Jt&&Jt.isSet,ne=Jt&&Jt.isTypedArray;function ae(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function oe(t,e,r,i){for(var n=-1,a=null==t?0:t.length;++n-1}function le(t,e,r){for(var i=-1,n=null==t?0:t.length;++i-1;);return r}function Oe(t,e){for(var r=t.length;r--&&_e(e,t[r],0)>-1;);return r}function Ne(t,e){for(var r=t.length,i=0;r--;)t[r]===e&&++i;return i}var je=Ae({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Le=Ae({"&":"&","<":"<",">":">",'"':""","'":"'"});function Fe(t){return"\\"+qt[t]}function De(t){return jt.test(t)}function Ue(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function Ke(t,e){return function(r){return t(e(r))}}function qe(t,e){for(var r=-1,i=t.length,n=0,a=[];++r",""":'"',"'":"'"});var We=function t(e){var r,i=(e=null==e?Gt:We.defaults(Gt.Object(),e,We.pick(Gt,Ft))).Array,n=e.Date,lt=e.Error,dt=e.Function,pt=e.Math,mt=e.Object,vt=e.RegExp,yt=e.String,gt=e.TypeError,bt=i.prototype,wt=dt.prototype,_t=mt.prototype,Et=e["__core-js_shared__"],Mt=wt.toString,St=_t.hasOwnProperty,Ct=0,At=(r=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",kt=_t.toString,Tt=Mt.call(mt),It=Gt._,Rt=vt("^"+Mt.call(St).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pt=Qt?e.Buffer:void 0,Ot=e.Symbol,jt=e.Uint8Array,qt=Pt?Pt.allocUnsafe:void 0,Ht=Ke(mt.getPrototypeOf,mt),Zt=mt.create,Wt=_t.propertyIsEnumerable,$t=bt.splice,Yt=Ot?Ot.isConcatSpreadable:void 0,Jt=Ot?Ot.iterator:void 0,ge=Ot?Ot.toStringTag:void 0,Ae=function(){try{var t=Xn(mt,"defineProperty");return t({},"",{}),t}catch(t){}}(),$e=e.clearTimeout!==Gt.clearTimeout&&e.clearTimeout,Qe=n&&n.now!==Gt.Date.now&&n.now,Ye=e.setTimeout!==Gt.setTimeout&&e.setTimeout,Je=pt.ceil,Xe=pt.floor,tr=mt.getOwnPropertySymbols,er=Pt?Pt.isBuffer:void 0,rr=e.isFinite,ir=bt.join,nr=Ke(mt.keys,mt),ar=pt.max,or=pt.min,sr=n.now,ur=e.parseInt,hr=pt.random,fr=bt.reverse,cr=Xn(e,"DataView"),lr=Xn(e,"Map"),dr=Xn(e,"Promise"),pr=Xn(e,"Set"),mr=Xn(e,"WeakMap"),vr=Xn(mt,"create"),yr=mr&&new mr,gr={},br=Aa(cr),wr=Aa(lr),_r=Aa(dr),Er=Aa(pr),Mr=Aa(mr),Sr=Ot?Ot.prototype:void 0,Cr=Sr?Sr.valueOf:void 0,Ar=Sr?Sr.toString:void 0;function kr(t){if(Vo(t)&&!xo(t)&&!(t instanceof Pr)){if(t instanceof Rr)return t;if(St.call(t,"__wrapped__"))return ka(t)}return new Rr(t)}var Tr=function(){function t(){}return function(e){if(!zo(e))return{};if(Zt)return Zt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Ir(){}function Rr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Pr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Br(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function $r(t,e,r,i,n,a){var o,s=1&e,h=2&e,l=4&e;if(r&&(o=n?r(t,i,n,a):r(t)),void 0!==o)return o;if(!zo(t))return t;var E=xo(t);if(E){if(o=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&St.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!s)return yn(t,o)}else{var x=ra(t),O=x==d||x==p;if(Lo(t))return cn(t,s);if(x==y||x==u||O&&!n){if(o=h||O?{}:na(t),!s)return h?function(t,e){return gn(t,ea(t),e)}(t,function(t,e){return t&&gn(e,_s(e),t)}(o,t)):function(t,e){return gn(t,ta(t),e)}(t,Hr(o,t))}else{if(!Kt[x])return n?t:{};o=function(t,e,r){var i=t.constructor;switch(e){case M:return ln(t);case f:case c:return new i(+t);case S:return function(t,e){var r=e?ln(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case C:case A:case k:case T:case I:case R:case"[object Uint8ClampedArray]":case P:case B:return dn(t,r);case m:return new i;case v:case w:return new i(t);case g:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return new i;case _:return n=t,Cr?mt(Cr.call(n)):{}}var n}(t,x,s)}}a||(a=new jr);var N=a.get(t);if(N)return N;a.set(t,o),$o(t)?t.forEach((function(i){o.add($r(i,e,r,i,t,a))})):Ho(t)&&t.forEach((function(i,n){o.set(n,$r(i,e,r,n,t,a))}));var j=E?void 0:(l?h?Zn:Hn:h?_s:ws)(t);return se(j||t,(function(i,n){j&&(i=t[n=i]),qr(o,n,$r(i,e,r,n,t,a))})),o}function Qr(t,e,r){var i=r.length;if(null==t)return!i;for(t=mt(t);i--;){var n=r[i],a=e[n],o=t[n];if(void 0===o&&!(n in t)||!a(o))return!1}return!0}function Yr(t,e,r){if("function"!=typeof t)throw new gt(a);return ba((function(){t.apply(void 0,r)}),e)}function Jr(t,e,r,i){var n=-1,a=ce,o=!0,s=t.length,u=[],h=e.length;if(!s)return u;r&&(e=de(e,Re(r))),i?(a=le,o=!1):e.length>=200&&(a=Be,o=!1,e=new Nr(e));t:for(;++n-1},xr.prototype.set=function(t,e){var r=this.__data__,i=zr(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},Or.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(lr||xr),string:new Br}},Or.prototype.delete=function(t){var e=Yn(this,t).delete(t);return this.size-=e?1:0,e},Or.prototype.get=function(t){return Yn(this,t).get(t)},Or.prototype.has=function(t){return Yn(this,t).has(t)},Or.prototype.set=function(t,e){var r=Yn(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Nr.prototype.add=Nr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.clear=function(){this.__data__=new xr,this.size=0},jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},jr.prototype.get=function(t){return this.__data__.get(t)},jr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof xr){var i=r.__data__;if(!lr||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Or(i)}return r.set(t,e),this.size=r.size,this};var Xr=_n(si),ti=_n(ui,!0);function ei(t,e){var r=!0;return Xr(t,(function(t,i,n){return r=!!e(t,i,n)})),r}function ri(t,e,r){for(var i=-1,n=t.length;++i0&&r(s)?e>1?ni(s,e-1,r,i,n):pe(n,s):i||(n[n.length]=s)}return n}var ai=En(),oi=En(!0);function si(t,e){return t&&ai(t,e,ws)}function ui(t,e){return t&&oi(t,e,ws)}function hi(t,e){return fe(e,(function(e){return Uo(t[e])}))}function fi(t,e){for(var r=0,i=(e=sn(e,t)).length;null!=t&&re}function pi(t,e){return null!=t&&St.call(t,e)}function mi(t,e){return null!=t&&e in mt(t)}function vi(t,e,r){for(var n=r?le:ce,a=t[0].length,o=t.length,s=o,u=i(o),h=1/0,f=[];s--;){var c=t[s];s&&e&&(c=de(c,Re(e))),h=or(c.length,h),u[s]=!r&&(e||a>=120&&c.length>=120)?new Nr(s&&c):void 0}c=t[0];var l=-1,d=u[0];t:for(;++l=s)return u;var h=r[i];return u*("desc"==h?-1:1)}}return t.index-e.index}(t,e,r)}))}function Bi(t,e,r){for(var i=-1,n=e.length,a={};++i-1;)s!==t&&$t.call(s,u,1),$t.call(t,u,1);return t}function Oi(t,e){for(var r=t?e.length:0,i=r-1;r--;){var n=e[r];if(r==i||n!==a){var a=n;oa(n)?$t.call(t,n,1):Ji(t,n)}}return t}function Ni(t,e){return t+Xe(hr()*(e-t+1))}function ji(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Xe(e/2))&&(t+=t)}while(e);return r}function Li(t,e){return wa(pa(t,e,Zs),t+"")}function Fi(t){return Fr(Is(t))}function Di(t,e){var r=Is(t);return Ma(r,Wr(e,0,r.length))}function Ui(t,e,r,i){if(!zo(t))return t;for(var n=-1,a=(e=sn(e,t)).length,o=a-1,s=t;null!=s&&++na?0:a+e),(r=r>a?a:r)<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var o=i(a);++n>>1,o=t[a];null!==o&&!Yo(o)&&(r?o<=e:o=200){var h=e?null:Ln(t);if(h)return ze(h);o=!1,n=Be,u=new Nr}else u=e?[]:s;t:for(;++i=i?t:Vi(t,e,r)}var fn=$e||function(t){return Gt.clearTimeout(t)};function cn(t,e){if(e)return t.slice();var r=t.length,i=qt?qt(r):new t.constructor(r);return t.copy(i),i}function ln(t){var e=new t.constructor(t.byteLength);return new jt(e).set(new jt(t)),e}function dn(t,e){var r=e?ln(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function pn(t,e){if(t!==e){var r=void 0!==t,i=null===t,n=t==t,a=Yo(t),o=void 0!==e,s=null===e,u=e==e,h=Yo(e);if(!s&&!h&&!a&&t>e||a&&o&&u&&!s&&!h||i&&o&&u||!r&&u||!n)return 1;if(!i&&!a&&!h&&t1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(n--,a):void 0,o&&sa(r[0],r[1],o)&&(a=n<3?void 0:a,n=1),e=mt(e);++i-1?n[a?e[o]:o]:void 0}}function kn(t){return Vn((function(e){var r=e.length,i=r,n=Rr.prototype.thru;for(t&&e.reverse();i--;){var o=e[i];if("function"!=typeof o)throw new gt(a);if(n&&!s&&"wrapper"==Wn(o))var s=new Rr([],!0)}for(i=s?i:r;++i1&&b.reverse(),c&&hs))return!1;var h=a.get(t),f=a.get(e);if(h&&f)return h==e&&f==t;var c=-1,l=!0,d=2&r?new Nr:void 0;for(a.set(t,e),a.set(e,t);++c-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(Y,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return se(s,(function(r){var i="_."+r[0];e&r[1]&&!ce(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(X):[]}(i),r)))}function Ea(t){var e=0,r=0;return function(){var i=sr(),n=16-(i-r);if(r=i,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ma(t,e){var r=-1,i=t.length,n=i-1;for(e=void 0===e?i:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Ga(t,r)}));function to(t){var e=kr(t);return e.__chain__=!0,e}function eo(t,e){return e(t)}var ro=Vn((function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,n=function(e){return Gr(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Pr&&oa(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:eo,args:[n],thisArg:void 0}),new Rr(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(n)}));var io=bn((function(t,e,r){St.call(t,r)?++t[r]:Zr(t,r,1)}));var no=An(Pa),ao=An(Ba);function oo(t,e){return(xo(t)?se:Xr)(t,Qn(e,3))}function so(t,e){return(xo(t)?ue:ti)(t,Qn(e,3))}var uo=bn((function(t,e,r){St.call(t,r)?t[r].push(e):Zr(t,r,[e])}));var ho=Li((function(t,e,r){var n=-1,a="function"==typeof e,o=No(t)?i(t.length):[];return Xr(t,(function(t){o[++n]=a?ae(e,t,r):yi(t,e,r)})),o})),fo=bn((function(t,e,r){Zr(t,r,e)}));function co(t,e){return(xo(t)?de:Ai)(t,Qn(e,3))}var lo=bn((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]}));var po=Li((function(t,e){if(null==t)return[];var r=e.length;return r>1&&sa(t,e[0],e[1])?e=[]:r>2&&sa(e[0],e[1],e[2])&&(e=[e[0]]),Pi(t,ni(e,1),[])})),mo=Qe||function(){return Gt.Date.now()};function vo(t,e,r){return e=r?void 0:e,Dn(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function yo(t,e){var r;if("function"!=typeof e)throw new gt(a);return t=is(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=void 0),r}}var go=Li((function(t,e,r){var i=1;if(r.length){var n=qe(r,$n(go));i|=32}return Dn(t,i,e,r,n)})),bo=Li((function(t,e,r){var i=3;if(r.length){var n=qe(r,$n(bo));i|=32}return Dn(e,i,t,r,n)}));function wo(t,e,r){var i,n,o,s,u,h,f=0,c=!1,l=!1,d=!0;if("function"!=typeof t)throw new gt(a);function p(e){var r=i,a=n;return i=n=void 0,f=e,s=t.apply(a,r)}function m(t){return f=t,u=ba(y,e),c?p(t):s}function v(t){var r=t-h;return void 0===h||r>=e||r<0||l&&t-f>=o}function y(){var t=mo();if(v(t))return g(t);u=ba(y,function(t){var r=e-(t-h);return l?or(r,o-(t-f)):r}(t))}function g(t){return u=void 0,d&&i?p(t):(i=n=void 0,s)}function b(){var t=mo(),r=v(t);if(i=arguments,n=this,h=t,r){if(void 0===u)return m(h);if(l)return fn(u),u=ba(y,e),p(h)}return void 0===u&&(u=ba(y,e)),s}return e=as(e)||0,zo(r)&&(c=!!r.leading,o=(l="maxWait"in r)?ar(as(r.maxWait)||0,e):o,d="trailing"in r?!!r.trailing:d),b.cancel=function(){void 0!==u&&fn(u),f=0,i=h=n=u=void 0},b.flush=function(){return void 0===u?s:g(mo())},b}var _o=Li((function(t,e){return Yr(t,1,e)})),Eo=Li((function(t,e,r){return Yr(t,as(e)||0,r)}));function Mo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new gt(a);var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],a=r.cache;if(a.has(n))return a.get(n);var o=t.apply(this,i);return r.cache=a.set(n,o)||a,o};return r.cache=new(Mo.Cache||Or),r}function So(t){if("function"!=typeof t)throw new gt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Mo.Cache=Or;var Co=un((function(t,e){var r=(e=1==e.length&&xo(e[0])?de(e[0],Re(Qn())):de(ni(e,1),Re(Qn()))).length;return Li((function(i){for(var n=-1,a=or(i.length,r);++n=e})),Bo=gi(function(){return arguments}())?gi:function(t){return Vo(t)&&St.call(t,"callee")&&!Wt.call(t,"callee")},xo=i.isArray,Oo=Xt?Re(Xt):function(t){return Vo(t)&&li(t)==M};function No(t){return null!=t&&qo(t.length)&&!Uo(t)}function jo(t){return Vo(t)&&No(t)}var Lo=er||au,Fo=te?Re(te):function(t){return Vo(t)&&li(t)==c};function Do(t){if(!Vo(t))return!1;var e=li(t);return e==l||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Go(t)}function Uo(t){if(!zo(t))return!1;var e=li(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ko(t){return"number"==typeof t&&t==is(t)}function qo(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function zo(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Vo(t){return null!=t&&"object"==typeof t}var Ho=ee?Re(ee):function(t){return Vo(t)&&ra(t)==m};function Zo(t){return"number"==typeof t||Vo(t)&&li(t)==v}function Go(t){if(!Vo(t)||li(t)!=y)return!1;var e=Ht(t);if(null===e)return!0;var r=St.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Mt.call(r)==Tt}var Wo=re?Re(re):function(t){return Vo(t)&&li(t)==g};var $o=ie?Re(ie):function(t){return Vo(t)&&ra(t)==b};function Qo(t){return"string"==typeof t||!xo(t)&&Vo(t)&&li(t)==w}function Yo(t){return"symbol"==typeof t||Vo(t)&&li(t)==_}var Jo=ne?Re(ne):function(t){return Vo(t)&&qo(t.length)&&!!Ut[li(t)]};var Xo=On(Ci),ts=On((function(t,e){return t<=e}));function es(t){if(!t)return[];if(No(t))return Qo(t)?Ze(t):yn(t);if(Jt&&t[Jt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Jt]());var e=ra(t);return(e==m?Ue:e==b?ze:Is)(t)}function rs(t){return t?(t=as(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function is(t){var e=rs(t),r=e%1;return e==e?r?e-r:e:0}function ns(t){return t?Wr(is(t),0,4294967295):0}function as(t){if("number"==typeof t)return t;if(Yo(t))return NaN;if(zo(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=zo(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(W,"");var r=at.test(t);return r||st.test(t)?Vt(t.slice(2),r?2:8):nt.test(t)?NaN:+t}function os(t){return gn(t,_s(t))}function ss(t){return null==t?"":Qi(t)}var us=wn((function(t,e){if(ca(e)||No(e))gn(e,ws(e),t);else for(var r in e)St.call(e,r)&&qr(t,r,e[r])})),hs=wn((function(t,e){gn(e,_s(e),t)})),fs=wn((function(t,e,r,i){gn(e,_s(e),t,i)})),cs=wn((function(t,e,r,i){gn(e,ws(e),t,i)})),ls=Vn(Gr);var ds=Li((function(t,e){t=mt(t);var r=-1,i=e.length,n=i>2?e[2]:void 0;for(n&&sa(e[0],e[1],n)&&(i=1);++r1),e})),gn(t,Zn(t),r),i&&(r=$r(r,7,qn));for(var n=e.length;n--;)Ji(r,e[n]);return r}));var Cs=Vn((function(t,e){return null==t?{}:function(t,e){return Bi(t,e,(function(e,r){return vs(t,r)}))}(t,e)}));function As(t,e){if(null==t)return{};var r=de(Zn(t),(function(t){return[t]}));return e=Qn(e),Bi(t,r,(function(t,r){return e(t,r[0])}))}var ks=Fn(ws),Ts=Fn(_s);function Is(t){return null==t?[]:Pe(t,ws(t))}var Rs=Sn((function(t,e,r){return e=e.toLowerCase(),t+(r?Ps(e):e)}));function Ps(t){return Ds(ss(t).toLowerCase())}function Bs(t){return(t=ss(t))&&t.replace(ht,je).replace(xt,"")}var xs=Sn((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Os=Sn((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Ns=Mn("toLowerCase");var js=Sn((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}));var Ls=Sn((function(t,e,r){return t+(r?" ":"")+Ds(e)}));var Fs=Sn((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Ds=Mn("toUpperCase");function Us(t,e,r){return t=ss(t),void 0===(e=r?void 0:e)?function(t){return Lt.test(t)}(t)?function(t){return t.match(Nt)||[]}(t):function(t){return t.match(tt)||[]}(t):t.match(e)||[]}var Ks=Li((function(t,e){try{return ae(t,void 0,e)}catch(t){return Do(t)?t:new lt(t)}})),qs=Vn((function(t,e){return se(e,(function(e){e=Ca(e),Zr(t,e,go(t[e],t))})),t}));function zs(t){return function(){return t}}var Vs=kn(),Hs=kn(!0);function Zs(t){return t}function Gs(t){return Ei("function"==typeof t?t:$r(t,1))}var Ws=Li((function(t,e){return function(r){return yi(r,t,e)}})),$s=Li((function(t,e){return function(r){return yi(t,r,e)}}));function Qs(t,e,r){var i=ws(e),n=hi(e,i);null!=r||zo(e)&&(n.length||!i.length)||(r=e,e=t,t=this,n=hi(e,ws(e)));var a=!(zo(r)&&"chain"in r&&!r.chain),o=Uo(t);return se(n,(function(r){var i=e[r];t[r]=i,o&&(t.prototype[r]=function(){var e=this.__chain__;if(a||e){var r=t(this.__wrapped__),n=r.__actions__=yn(this.__actions__);return n.push({func:i,args:arguments,thisArg:t}),r.__chain__=e,r}return i.apply(t,pe([this.value()],arguments))})})),t}function Ys(){}var Js=Pn(de),Xs=Pn(he),tu=Pn(ye);function eu(t){return ua(t)?Ce(Ca(t)):function(t){return function(e){return fi(e,t)}}(t)}var ru=xn(),iu=xn(!0);function nu(){return[]}function au(){return!1}var ou=Rn((function(t,e){return t+e}),0),su=jn("ceil"),uu=Rn((function(t,e){return t/e}),1),hu=jn("floor");var fu,cu=Rn((function(t,e){return t*e}),1),lu=jn("round"),du=Rn((function(t,e){return t-e}),0);return kr.after=function(t,e){if("function"!=typeof e)throw new gt(a);return t=is(t),function(){if(--t<1)return e.apply(this,arguments)}},kr.ary=vo,kr.assign=us,kr.assignIn=hs,kr.assignInWith=fs,kr.assignWith=cs,kr.at=ls,kr.before=yo,kr.bind=go,kr.bindAll=qs,kr.bindKey=bo,kr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},kr.chain=to,kr.chunk=function(t,e,r){e=(r?sa(t,e,r):void 0===e)?1:ar(is(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var a=0,o=0,s=i(Je(n/e));an?0:n+r),(i=void 0===i||i>n?n:is(i))<0&&(i+=n),i=r>i?0:ns(i);r>>0)?(t=ss(t))&&("string"==typeof e||null!=e&&!Wo(e))&&!(e=Qi(e))&&De(t)?hn(Ze(t),0,r):t.split(e,r):[]},kr.spread=function(t,e){if("function"!=typeof t)throw new gt(a);return e=null==e?0:ar(is(e),0),Li((function(r){var i=r[e],n=hn(r,0,e);return i&&pe(n,i),ae(t,this,n)}))},kr.tail=function(t){var e=null==t?0:t.length;return e?Vi(t,1,e):[]},kr.take=function(t,e,r){return t&&t.length?Vi(t,0,(e=r||void 0===e?1:is(e))<0?0:e):[]},kr.takeRight=function(t,e,r){var i=null==t?0:t.length;return i?Vi(t,(e=i-(e=r||void 0===e?1:is(e)))<0?0:e,i):[]},kr.takeRightWhile=function(t,e){return t&&t.length?tn(t,Qn(e,3),!1,!0):[]},kr.takeWhile=function(t,e){return t&&t.length?tn(t,Qn(e,3)):[]},kr.tap=function(t,e){return e(t),t},kr.throttle=function(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new gt(a);return zo(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),wo(t,e,{leading:i,maxWait:e,trailing:n})},kr.thru=eo,kr.toArray=es,kr.toPairs=ks,kr.toPairsIn=Ts,kr.toPath=function(t){return xo(t)?de(t,Ca):Yo(t)?[t]:yn(Sa(ss(t)))},kr.toPlainObject=os,kr.transform=function(t,e,r){var i=xo(t),n=i||Lo(t)||Jo(t);if(e=Qn(e,4),null==r){var a=t&&t.constructor;r=n?i?new a:[]:zo(t)&&Uo(a)?Tr(Ht(t)):{}}return(n?se:si)(t,(function(t,i,n){return e(r,t,i,n)})),r},kr.unary=function(t){return vo(t,1)},kr.union=za,kr.unionBy=Va,kr.unionWith=Ha,kr.uniq=function(t){return t&&t.length?Yi(t):[]},kr.uniqBy=function(t,e){return t&&t.length?Yi(t,Qn(e,2)):[]},kr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Yi(t,void 0,e):[]},kr.unset=function(t,e){return null==t||Ji(t,e)},kr.unzip=Za,kr.unzipWith=Ga,kr.update=function(t,e,r){return null==t?t:Xi(t,e,on(r))},kr.updateWith=function(t,e,r,i){return i="function"==typeof i?i:void 0,null==t?t:Xi(t,e,on(r),i)},kr.values=Is,kr.valuesIn=function(t){return null==t?[]:Pe(t,_s(t))},kr.without=Wa,kr.words=Us,kr.wrap=function(t,e){return Ao(on(e),t)},kr.xor=$a,kr.xorBy=Qa,kr.xorWith=Ya,kr.zip=Ja,kr.zipObject=function(t,e){return nn(t||[],e||[],qr)},kr.zipObjectDeep=function(t,e){return nn(t||[],e||[],Ui)},kr.zipWith=Xa,kr.entries=ks,kr.entriesIn=Ts,kr.extend=hs,kr.extendWith=fs,Qs(kr,kr),kr.add=ou,kr.attempt=Ks,kr.camelCase=Rs,kr.capitalize=Ps,kr.ceil=su,kr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=as(r))==r?r:0),void 0!==e&&(e=(e=as(e))==e?e:0),Wr(as(t),e,r)},kr.clone=function(t){return $r(t,4)},kr.cloneDeep=function(t){return $r(t,5)},kr.cloneDeepWith=function(t,e){return $r(t,5,e="function"==typeof e?e:void 0)},kr.cloneWith=function(t,e){return $r(t,4,e="function"==typeof e?e:void 0)},kr.conformsTo=function(t,e){return null==e||Qr(t,e,ws(e))},kr.deburr=Bs,kr.defaultTo=function(t,e){return null==t||t!=t?e:t},kr.divide=uu,kr.endsWith=function(t,e,r){t=ss(t),e=Qi(e);var i=t.length,n=r=void 0===r?i:Wr(is(r),0,i);return(r-=e.length)>=0&&t.slice(r,n)==e},kr.eq=Io,kr.escape=function(t){return(t=ss(t))&&D.test(t)?t.replace(L,Le):t},kr.escapeRegExp=function(t){return(t=ss(t))&&G.test(t)?t.replace(Z,"\\$&"):t},kr.every=function(t,e,r){var i=xo(t)?he:ei;return r&&sa(t,e,r)&&(e=void 0),i(t,Qn(e,3))},kr.find=no,kr.findIndex=Pa,kr.findKey=function(t,e){return be(t,Qn(e,3),si)},kr.findLast=ao,kr.findLastIndex=Ba,kr.findLastKey=function(t,e){return be(t,Qn(e,3),ui)},kr.floor=hu,kr.forEach=oo,kr.forEachRight=so,kr.forIn=function(t,e){return null==t?t:ai(t,Qn(e,3),_s)},kr.forInRight=function(t,e){return null==t?t:oi(t,Qn(e,3),_s)},kr.forOwn=function(t,e){return t&&si(t,Qn(e,3))},kr.forOwnRight=function(t,e){return t&&ui(t,Qn(e,3))},kr.get=ms,kr.gt=Ro,kr.gte=Po,kr.has=function(t,e){return null!=t&&ia(t,e,pi)},kr.hasIn=vs,kr.head=Oa,kr.identity=Zs,kr.includes=function(t,e,r,i){t=No(t)?t:Is(t),r=r&&!i?is(r):0;var n=t.length;return r<0&&(r=ar(n+r,0)),Qo(t)?r<=n&&t.indexOf(e,r)>-1:!!n&&_e(t,e,r)>-1},kr.indexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=null==r?0:is(r);return n<0&&(n=ar(i+n,0)),_e(t,e,n)},kr.inRange=function(t,e,r){return e=rs(e),void 0===r?(r=e,e=0):r=rs(r),function(t,e,r){return t>=or(e,r)&&t=-9007199254740991&&t<=9007199254740991},kr.isSet=$o,kr.isString=Qo,kr.isSymbol=Yo,kr.isTypedArray=Jo,kr.isUndefined=function(t){return void 0===t},kr.isWeakMap=function(t){return Vo(t)&&ra(t)==E},kr.isWeakSet=function(t){return Vo(t)&&"[object WeakSet]"==li(t)},kr.join=function(t,e){return null==t?"":ir.call(t,e)},kr.kebabCase=xs,kr.last=Fa,kr.lastIndexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=i;return void 0!==r&&(n=(n=is(r))<0?ar(i+n,0):or(n,i-1)),e==e?function(t,e,r){for(var i=r+1;i--;)if(t[i]===e)return i;return i}(t,e,n):we(t,Me,n,!0)},kr.lowerCase=Os,kr.lowerFirst=Ns,kr.lt=Xo,kr.lte=ts,kr.max=function(t){return t&&t.length?ri(t,Zs,di):void 0},kr.maxBy=function(t,e){return t&&t.length?ri(t,Qn(e,2),di):void 0},kr.mean=function(t){return Se(t,Zs)},kr.meanBy=function(t,e){return Se(t,Qn(e,2))},kr.min=function(t){return t&&t.length?ri(t,Zs,Ci):void 0},kr.minBy=function(t,e){return t&&t.length?ri(t,Qn(e,2),Ci):void 0},kr.stubArray=nu,kr.stubFalse=au,kr.stubObject=function(){return{}},kr.stubString=function(){return""},kr.stubTrue=function(){return!0},kr.multiply=cu,kr.nth=function(t,e){return t&&t.length?Ri(t,is(e)):void 0},kr.noConflict=function(){return Gt._===this&&(Gt._=It),this},kr.noop=Ys,kr.now=mo,kr.pad=function(t,e,r){t=ss(t);var i=(e=is(e))?He(t):0;if(!e||i>=e)return t;var n=(e-i)/2;return Bn(Xe(n),r)+t+Bn(Je(n),r)},kr.padEnd=function(t,e,r){t=ss(t);var i=(e=is(e))?He(t):0;return e&&ie){var i=t;t=e,e=i}if(r||t%1||e%1){var n=hr();return or(t+n*(e-t+zt("1e-"+((n+"").length-1))),e)}return Ni(t,e)},kr.reduce=function(t,e,r){var i=xo(t)?me:ke,n=arguments.length<3;return i(t,Qn(e,4),r,n,Xr)},kr.reduceRight=function(t,e,r){var i=xo(t)?ve:ke,n=arguments.length<3;return i(t,Qn(e,4),r,n,ti)},kr.repeat=function(t,e,r){return e=(r?sa(t,e,r):void 0===e)?1:is(e),ji(ss(t),e)},kr.replace=function(){var t=arguments,e=ss(t[0]);return t.length<3?e:e.replace(t[1],t[2])},kr.result=function(t,e,r){var i=-1,n=(e=sn(e,t)).length;for(n||(n=1,t=void 0);++i9007199254740991)return[];var r=4294967295,i=or(t,4294967295);t-=4294967295;for(var n=Ie(i,e=Qn(e));++r=a)return t;var s=r-He(i);if(s<1)return i;var u=o?hn(o,0,s).join(""):t.slice(0,s);if(void 0===n)return u+i;if(o&&(s+=u.length-s),Wo(n)){if(t.slice(s).search(n)){var h,f=u;for(n.global||(n=vt(n.source,ss(it.exec(n))+"g")),n.lastIndex=0;h=n.exec(f);)var c=h.index;u=u.slice(0,void 0===c?s:c)}}else if(t.indexOf(Qi(n),s)!=s){var l=u.lastIndexOf(n);l>-1&&(u=u.slice(0,l))}return u+i},kr.unescape=function(t){return(t=ss(t))&&F.test(t)?t.replace(j,Ge):t},kr.uniqueId=function(t){var e=++Ct;return ss(t)+e},kr.upperCase=Fs,kr.upperFirst=Ds,kr.each=oo,kr.eachRight=so,kr.first=Oa,Qs(kr,(fu={},si(kr,(function(t,e){St.call(kr.prototype,e)||(fu[e]=t)})),fu),{chain:!1}),kr.VERSION="4.17.19",se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){kr[t].placeholder=kr})),se(["drop","take"],(function(t,e){Pr.prototype[t]=function(r){r=void 0===r?1:ar(is(r),0);var i=this.__filtered__&&!e?new Pr(this):this.clone();return i.__filtered__?i.__takeCount__=or(r,i.__takeCount__):i.__views__.push({size:or(r,4294967295),type:t+(i.__dir__<0?"Right":"")}),i},Pr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),se(["filter","map","takeWhile"],(function(t,e){var r=e+1,i=1==r||3==r;Pr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Qn(t,3),type:r}),e.__filtered__=e.__filtered__||i,e}})),se(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Pr.prototype[t]=function(){return this[r](1).value()[0]}})),se(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Pr.prototype[t]=function(){return this.__filtered__?new Pr(this):this[r](1)}})),Pr.prototype.compact=function(){return this.filter(Zs)},Pr.prototype.find=function(t){return this.filter(t).head()},Pr.prototype.findLast=function(t){return this.reverse().find(t)},Pr.prototype.invokeMap=Li((function(t,e){return"function"==typeof t?new Pr(this):this.map((function(r){return yi(r,t,e)}))})),Pr.prototype.reject=function(t){return this.filter(So(Qn(t)))},Pr.prototype.slice=function(t,e){t=is(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Pr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=is(e))<0?r.dropRight(-e):r.take(e-t)),r)},Pr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pr.prototype.toArray=function(){return this.take(4294967295)},si(Pr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),n=kr[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);n&&(kr.prototype[e]=function(){var e=this.__wrapped__,o=i?[1]:arguments,s=e instanceof Pr,u=o[0],h=s||xo(e),f=function(t){var e=n.apply(kr,pe([t],o));return i&&c?e[0]:e};h&&r&&"function"==typeof u&&1!=u.length&&(s=h=!1);var c=this.__chain__,l=!!this.__actions__.length,d=a&&!c,p=s&&!l;if(!a&&h){e=p?e:new Pr(this);var m=t.apply(e,o);return m.__actions__.push({func:eo,args:[f],thisArg:void 0}),new Rr(m,c)}return d&&p?t.apply(this,o):(m=this.thru(f),d?i?m.value()[0]:m.value():m)})})),se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=bt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);kr.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(xo(n)?n:[],t)}return this[r]((function(r){return e.apply(xo(r)?r:[],t)}))}})),si(Pr.prototype,(function(t,e){var r=kr[e];if(r){var i=r.name+"";St.call(gr,i)||(gr[i]=[]),gr[i].push({name:e,func:r})}})),gr[Tn(void 0,2).name]=[{name:"wrapper",func:void 0}],Pr.prototype.clone=function(){var t=new Pr(this.__wrapped__);return t.__actions__=yn(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yn(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yn(this.__views__),t},Pr.prototype.reverse=function(){if(this.__filtered__){var t=new Pr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=xo(t),i=e<0,n=r?t.length:0,a=function(t,e,r){var i=-1,n=r.length;for(;++i=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},kr.prototype.plant=function(t){for(var e,r=this;r instanceof Ir;){var i=ka(r);i.__index__=0,i.__values__=void 0,e?n.__wrapped__=i:e=i;var n=i;r=r.__wrapped__}return n.__wrapped__=t,e},kr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Pr){var e=t;return this.__actions__.length&&(e=new Pr(this)),(e=e.reverse()).__actions__.push({func:eo,args:[qa],thisArg:void 0}),new Rr(e,this.__chain__)}return this.thru(qa)},kr.prototype.toJSON=kr.prototype.valueOf=kr.prototype.value=function(){return en(this.__wrapped__,this.__actions__)},kr.prototype.first=kr.prototype.head,Jt&&(kr.prototype[Jt]=function(){return this}),kr}();Gt._=We,void 0===(n=function(){return We}.call(e,r,e,i))||(i.exports=n)}).call(this)}).call(this,r(7),r(15)(t))},function(t,e,r){"use strict";(function(t){ + */(function(){var a="Expected a function",o="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],u="[object Arguments]",h="[object Array]",f="[object Boolean]",c="[object Date]",l="[object Error]",d="[object Function]",p="[object GeneratorFunction]",m="[object Map]",v="[object Number]",g="[object Object]",y="[object RegExp]",b="[object Set]",w="[object String]",_="[object Symbol]",E="[object WeakMap]",M="[object ArrayBuffer]",S="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",k="[object Int8Array]",T="[object Int16Array]",I="[object Int32Array]",R="[object Uint8Array]",P="[object Uint16Array]",B="[object Uint32Array]",x=/\b__p \+= '';/g,O=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,L=RegExp(j.source),D=RegExp(F.source),U=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,H=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(Z.source),W=/^\s+|\s+$/g,$=/^\s+/,Q=/\s+$/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,tt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,et=/\\(\\)?/g,rt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,nt=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,ot=/^\[object .+?Constructor\]$/,st=/^0o[0-7]+$/i,ut=/^(?:0|[1-9]\d*)$/,ht=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,ct=/['\n\r\u2028\u2029\\]/g,lt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pt="[\\ud800-\\udfff]",mt="["+dt+"]",vt="["+lt+"]",gt="\\d+",yt="[\\u2700-\\u27bf]",bt="[a-z\\xdf-\\xf6\\xf8-\\xff]",wt="[^\\ud800-\\udfff"+dt+gt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",_t="\\ud83c[\\udffb-\\udfff]",Et="[^\\ud800-\\udfff]",Mt="(?:\\ud83c[\\udde6-\\uddff]){2}",St="[\\ud800-\\udbff][\\udc00-\\udfff]",Ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",At="(?:"+bt+"|"+wt+")",kt="(?:"+Ct+"|"+wt+")",Tt="(?:"+vt+"|"+_t+")"+"?",It="[\\ufe0e\\ufe0f]?"+Tt+("(?:\\u200d(?:"+[Et,Mt,St].join("|")+")[\\ufe0e\\ufe0f]?"+Tt+")*"),Rt="(?:"+[yt,Mt,St].join("|")+")"+It,Pt="(?:"+[Et+vt+"?",vt,Mt,St,pt].join("|")+")",Bt=RegExp("['’]","g"),xt=RegExp(vt,"g"),Ot=RegExp(_t+"(?="+_t+")|"+Pt+It,"g"),Nt=RegExp([Ct+"?"+bt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[mt,Ct,"$"].join("|")+")",kt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[mt,Ct+At,"$"].join("|")+")",Ct+"?"+At+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ct+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gt,Rt].join("|"),"g"),jt=RegExp("[\\u200d\\ud800-\\udfff"+lt+"\\ufe0e\\ufe0f]"),Ft=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Dt=-1,Ut={};Ut[C]=Ut[A]=Ut[k]=Ut[T]=Ut[I]=Ut[R]=Ut["[object Uint8ClampedArray]"]=Ut[P]=Ut[B]=!0,Ut[u]=Ut[h]=Ut[M]=Ut[f]=Ut[S]=Ut[c]=Ut[l]=Ut[d]=Ut[m]=Ut[v]=Ut[g]=Ut[y]=Ut[b]=Ut[w]=Ut[E]=!1;var Kt={};Kt[u]=Kt[h]=Kt[M]=Kt[S]=Kt[f]=Kt[c]=Kt[C]=Kt[A]=Kt[k]=Kt[T]=Kt[I]=Kt[m]=Kt[v]=Kt[g]=Kt[y]=Kt[b]=Kt[w]=Kt[_]=Kt[R]=Kt["[object Uint8ClampedArray]"]=Kt[P]=Kt[B]=!0,Kt[l]=Kt[d]=Kt[E]=!1;var qt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=parseFloat,Vt=parseInt,Ht="object"==typeof t&&t&&t.Object===Object&&t,Zt="object"==typeof self&&self&&self.Object===Object&&self,Gt=Ht||Zt||Function("return this")(),Wt=e&&!e.nodeType&&e,$t=Wt&&"object"==typeof i&&i&&!i.nodeType&&i,Qt=$t&&$t.exports===Wt,Yt=Qt&&Ht.process,Jt=function(){try{var t=$t&&$t.require&&$t.require("util").types;return t||Yt&&Yt.binding&&Yt.binding("util")}catch(t){}}(),Xt=Jt&&Jt.isArrayBuffer,te=Jt&&Jt.isDate,ee=Jt&&Jt.isMap,re=Jt&&Jt.isRegExp,ie=Jt&&Jt.isSet,ne=Jt&&Jt.isTypedArray;function ae(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function oe(t,e,r,i){for(var n=-1,a=null==t?0:t.length;++n-1}function le(t,e,r){for(var i=-1,n=null==t?0:t.length;++i-1;);return r}function Oe(t,e){for(var r=t.length;r--&&_e(e,t[r],0)>-1;);return r}function Ne(t,e){for(var r=t.length,i=0;r--;)t[r]===e&&++i;return i}var je=Ae({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Fe=Ae({"&":"&","<":"<",">":">",'"':""","'":"'"});function Le(t){return"\\"+qt[t]}function De(t){return jt.test(t)}function Ue(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function Ke(t,e){return function(r){return t(e(r))}}function qe(t,e){for(var r=-1,i=t.length,n=0,a=[];++r",""":'"',"'":"'"});var We=function t(e){var r,i=(e=null==e?Gt:We.defaults(Gt.Object(),e,We.pick(Gt,Lt))).Array,n=e.Date,lt=e.Error,dt=e.Function,pt=e.Math,mt=e.Object,vt=e.RegExp,gt=e.String,yt=e.TypeError,bt=i.prototype,wt=dt.prototype,_t=mt.prototype,Et=e["__core-js_shared__"],Mt=wt.toString,St=_t.hasOwnProperty,Ct=0,At=(r=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",kt=_t.toString,Tt=Mt.call(mt),It=Gt._,Rt=vt("^"+Mt.call(St).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pt=Qt?e.Buffer:void 0,Ot=e.Symbol,jt=e.Uint8Array,qt=Pt?Pt.allocUnsafe:void 0,Ht=Ke(mt.getPrototypeOf,mt),Zt=mt.create,Wt=_t.propertyIsEnumerable,$t=bt.splice,Yt=Ot?Ot.isConcatSpreadable:void 0,Jt=Ot?Ot.iterator:void 0,ye=Ot?Ot.toStringTag:void 0,Ae=function(){try{var t=Xn(mt,"defineProperty");return t({},"",{}),t}catch(t){}}(),$e=e.clearTimeout!==Gt.clearTimeout&&e.clearTimeout,Qe=n&&n.now!==Gt.Date.now&&n.now,Ye=e.setTimeout!==Gt.setTimeout&&e.setTimeout,Je=pt.ceil,Xe=pt.floor,tr=mt.getOwnPropertySymbols,er=Pt?Pt.isBuffer:void 0,rr=e.isFinite,ir=bt.join,nr=Ke(mt.keys,mt),ar=pt.max,or=pt.min,sr=n.now,ur=e.parseInt,hr=pt.random,fr=bt.reverse,cr=Xn(e,"DataView"),lr=Xn(e,"Map"),dr=Xn(e,"Promise"),pr=Xn(e,"Set"),mr=Xn(e,"WeakMap"),vr=Xn(mt,"create"),gr=mr&&new mr,yr={},br=Aa(cr),wr=Aa(lr),_r=Aa(dr),Er=Aa(pr),Mr=Aa(mr),Sr=Ot?Ot.prototype:void 0,Cr=Sr?Sr.valueOf:void 0,Ar=Sr?Sr.toString:void 0;function kr(t){if(Vo(t)&&!xo(t)&&!(t instanceof Pr)){if(t instanceof Rr)return t;if(St.call(t,"__wrapped__"))return ka(t)}return new Rr(t)}var Tr=function(){function t(){}return function(e){if(!zo(e))return{};if(Zt)return Zt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Ir(){}function Rr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Pr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Br(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function $r(t,e,r,i,n,a){var o,s=1&e,h=2&e,l=4&e;if(r&&(o=n?r(t,i,n,a):r(t)),void 0!==o)return o;if(!zo(t))return t;var E=xo(t);if(E){if(o=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&St.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!s)return gn(t,o)}else{var x=ra(t),O=x==d||x==p;if(Fo(t))return cn(t,s);if(x==g||x==u||O&&!n){if(o=h||O?{}:na(t),!s)return h?function(t,e){return yn(t,ea(t),e)}(t,function(t,e){return t&&yn(e,_s(e),t)}(o,t)):function(t,e){return yn(t,ta(t),e)}(t,Hr(o,t))}else{if(!Kt[x])return n?t:{};o=function(t,e,r){var i=t.constructor;switch(e){case M:return ln(t);case f:case c:return new i(+t);case S:return function(t,e){var r=e?ln(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case C:case A:case k:case T:case I:case R:case"[object Uint8ClampedArray]":case P:case B:return dn(t,r);case m:return new i;case v:case w:return new i(t);case y:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return new i;case _:return n=t,Cr?mt(Cr.call(n)):{}}var n}(t,x,s)}}a||(a=new jr);var N=a.get(t);if(N)return N;a.set(t,o),$o(t)?t.forEach((function(i){o.add($r(i,e,r,i,t,a))})):Ho(t)&&t.forEach((function(i,n){o.set(n,$r(i,e,r,n,t,a))}));var j=E?void 0:(l?h?Zn:Hn:h?_s:ws)(t);return se(j||t,(function(i,n){j&&(i=t[n=i]),qr(o,n,$r(i,e,r,n,t,a))})),o}function Qr(t,e,r){var i=r.length;if(null==t)return!i;for(t=mt(t);i--;){var n=r[i],a=e[n],o=t[n];if(void 0===o&&!(n in t)||!a(o))return!1}return!0}function Yr(t,e,r){if("function"!=typeof t)throw new yt(a);return ba((function(){t.apply(void 0,r)}),e)}function Jr(t,e,r,i){var n=-1,a=ce,o=!0,s=t.length,u=[],h=e.length;if(!s)return u;r&&(e=de(e,Re(r))),i?(a=le,o=!1):e.length>=200&&(a=Be,o=!1,e=new Nr(e));t:for(;++n-1},xr.prototype.set=function(t,e){var r=this.__data__,i=zr(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},Or.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(lr||xr),string:new Br}},Or.prototype.delete=function(t){var e=Yn(this,t).delete(t);return this.size-=e?1:0,e},Or.prototype.get=function(t){return Yn(this,t).get(t)},Or.prototype.has=function(t){return Yn(this,t).has(t)},Or.prototype.set=function(t,e){var r=Yn(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Nr.prototype.add=Nr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.clear=function(){this.__data__=new xr,this.size=0},jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},jr.prototype.get=function(t){return this.__data__.get(t)},jr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof xr){var i=r.__data__;if(!lr||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Or(i)}return r.set(t,e),this.size=r.size,this};var Xr=_n(si),ti=_n(ui,!0);function ei(t,e){var r=!0;return Xr(t,(function(t,i,n){return r=!!e(t,i,n)})),r}function ri(t,e,r){for(var i=-1,n=t.length;++i0&&r(s)?e>1?ni(s,e-1,r,i,n):pe(n,s):i||(n[n.length]=s)}return n}var ai=En(),oi=En(!0);function si(t,e){return t&&ai(t,e,ws)}function ui(t,e){return t&&oi(t,e,ws)}function hi(t,e){return fe(e,(function(e){return Uo(t[e])}))}function fi(t,e){for(var r=0,i=(e=sn(e,t)).length;null!=t&&re}function pi(t,e){return null!=t&&St.call(t,e)}function mi(t,e){return null!=t&&e in mt(t)}function vi(t,e,r){for(var n=r?le:ce,a=t[0].length,o=t.length,s=o,u=i(o),h=1/0,f=[];s--;){var c=t[s];s&&e&&(c=de(c,Re(e))),h=or(c.length,h),u[s]=!r&&(e||a>=120&&c.length>=120)?new Nr(s&&c):void 0}c=t[0];var l=-1,d=u[0];t:for(;++l=s)return u;var h=r[i];return u*("desc"==h?-1:1)}}return t.index-e.index}(t,e,r)}))}function Bi(t,e,r){for(var i=-1,n=e.length,a={};++i-1;)s!==t&&$t.call(s,u,1),$t.call(t,u,1);return t}function Oi(t,e){for(var r=t?e.length:0,i=r-1;r--;){var n=e[r];if(r==i||n!==a){var a=n;oa(n)?$t.call(t,n,1):Ji(t,n)}}return t}function Ni(t,e){return t+Xe(hr()*(e-t+1))}function ji(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Xe(e/2))&&(t+=t)}while(e);return r}function Fi(t,e){return wa(pa(t,e,Zs),t+"")}function Li(t){return Lr(Is(t))}function Di(t,e){var r=Is(t);return Ma(r,Wr(e,0,r.length))}function Ui(t,e,r,i){if(!zo(t))return t;for(var n=-1,a=(e=sn(e,t)).length,o=a-1,s=t;null!=s&&++na?0:a+e),(r=r>a?a:r)<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var o=i(a);++n>>1,o=t[a];null!==o&&!Yo(o)&&(r?o<=e:o=200){var h=e?null:Fn(t);if(h)return ze(h);o=!1,n=Be,u=new Nr}else u=e?[]:s;t:for(;++i=i?t:Vi(t,e,r)}var fn=$e||function(t){return Gt.clearTimeout(t)};function cn(t,e){if(e)return t.slice();var r=t.length,i=qt?qt(r):new t.constructor(r);return t.copy(i),i}function ln(t){var e=new t.constructor(t.byteLength);return new jt(e).set(new jt(t)),e}function dn(t,e){var r=e?ln(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function pn(t,e){if(t!==e){var r=void 0!==t,i=null===t,n=t==t,a=Yo(t),o=void 0!==e,s=null===e,u=e==e,h=Yo(e);if(!s&&!h&&!a&&t>e||a&&o&&u&&!s&&!h||i&&o&&u||!r&&u||!n)return 1;if(!i&&!a&&!h&&t1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(n--,a):void 0,o&&sa(r[0],r[1],o)&&(a=n<3?void 0:a,n=1),e=mt(e);++i-1?n[a?e[o]:o]:void 0}}function kn(t){return Vn((function(e){var r=e.length,i=r,n=Rr.prototype.thru;for(t&&e.reverse();i--;){var o=e[i];if("function"!=typeof o)throw new yt(a);if(n&&!s&&"wrapper"==Wn(o))var s=new Rr([],!0)}for(i=s?i:r;++i1&&b.reverse(),c&&hs))return!1;var h=a.get(t),f=a.get(e);if(h&&f)return h==e&&f==t;var c=-1,l=!0,d=2&r?new Nr:void 0;for(a.set(t,e),a.set(e,t);++c-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(Y,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return se(s,(function(r){var i="_."+r[0];e&r[1]&&!ce(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(X):[]}(i),r)))}function Ea(t){var e=0,r=0;return function(){var i=sr(),n=16-(i-r);if(r=i,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ma(t,e){var r=-1,i=t.length,n=i-1;for(e=void 0===e?i:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Ga(t,r)}));function to(t){var e=kr(t);return e.__chain__=!0,e}function eo(t,e){return e(t)}var ro=Vn((function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,n=function(e){return Gr(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Pr&&oa(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:eo,args:[n],thisArg:void 0}),new Rr(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(n)}));var io=bn((function(t,e,r){St.call(t,r)?++t[r]:Zr(t,r,1)}));var no=An(Pa),ao=An(Ba);function oo(t,e){return(xo(t)?se:Xr)(t,Qn(e,3))}function so(t,e){return(xo(t)?ue:ti)(t,Qn(e,3))}var uo=bn((function(t,e,r){St.call(t,r)?t[r].push(e):Zr(t,r,[e])}));var ho=Fi((function(t,e,r){var n=-1,a="function"==typeof e,o=No(t)?i(t.length):[];return Xr(t,(function(t){o[++n]=a?ae(e,t,r):gi(t,e,r)})),o})),fo=bn((function(t,e,r){Zr(t,r,e)}));function co(t,e){return(xo(t)?de:Ai)(t,Qn(e,3))}var lo=bn((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]}));var po=Fi((function(t,e){if(null==t)return[];var r=e.length;return r>1&&sa(t,e[0],e[1])?e=[]:r>2&&sa(e[0],e[1],e[2])&&(e=[e[0]]),Pi(t,ni(e,1),[])})),mo=Qe||function(){return Gt.Date.now()};function vo(t,e,r){return e=r?void 0:e,Dn(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function go(t,e){var r;if("function"!=typeof e)throw new yt(a);return t=is(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=void 0),r}}var yo=Fi((function(t,e,r){var i=1;if(r.length){var n=qe(r,$n(yo));i|=32}return Dn(t,i,e,r,n)})),bo=Fi((function(t,e,r){var i=3;if(r.length){var n=qe(r,$n(bo));i|=32}return Dn(e,i,t,r,n)}));function wo(t,e,r){var i,n,o,s,u,h,f=0,c=!1,l=!1,d=!0;if("function"!=typeof t)throw new yt(a);function p(e){var r=i,a=n;return i=n=void 0,f=e,s=t.apply(a,r)}function m(t){return f=t,u=ba(g,e),c?p(t):s}function v(t){var r=t-h;return void 0===h||r>=e||r<0||l&&t-f>=o}function g(){var t=mo();if(v(t))return y(t);u=ba(g,function(t){var r=e-(t-h);return l?or(r,o-(t-f)):r}(t))}function y(t){return u=void 0,d&&i?p(t):(i=n=void 0,s)}function b(){var t=mo(),r=v(t);if(i=arguments,n=this,h=t,r){if(void 0===u)return m(h);if(l)return fn(u),u=ba(g,e),p(h)}return void 0===u&&(u=ba(g,e)),s}return e=as(e)||0,zo(r)&&(c=!!r.leading,o=(l="maxWait"in r)?ar(as(r.maxWait)||0,e):o,d="trailing"in r?!!r.trailing:d),b.cancel=function(){void 0!==u&&fn(u),f=0,i=h=n=u=void 0},b.flush=function(){return void 0===u?s:y(mo())},b}var _o=Fi((function(t,e){return Yr(t,1,e)})),Eo=Fi((function(t,e,r){return Yr(t,as(e)||0,r)}));function Mo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new yt(a);var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],a=r.cache;if(a.has(n))return a.get(n);var o=t.apply(this,i);return r.cache=a.set(n,o)||a,o};return r.cache=new(Mo.Cache||Or),r}function So(t){if("function"!=typeof t)throw new yt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Mo.Cache=Or;var Co=un((function(t,e){var r=(e=1==e.length&&xo(e[0])?de(e[0],Re(Qn())):de(ni(e,1),Re(Qn()))).length;return Fi((function(i){for(var n=-1,a=or(i.length,r);++n=e})),Bo=yi(function(){return arguments}())?yi:function(t){return Vo(t)&&St.call(t,"callee")&&!Wt.call(t,"callee")},xo=i.isArray,Oo=Xt?Re(Xt):function(t){return Vo(t)&&li(t)==M};function No(t){return null!=t&&qo(t.length)&&!Uo(t)}function jo(t){return Vo(t)&&No(t)}var Fo=er||au,Lo=te?Re(te):function(t){return Vo(t)&&li(t)==c};function Do(t){if(!Vo(t))return!1;var e=li(t);return e==l||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Go(t)}function Uo(t){if(!zo(t))return!1;var e=li(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ko(t){return"number"==typeof t&&t==is(t)}function qo(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function zo(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Vo(t){return null!=t&&"object"==typeof t}var Ho=ee?Re(ee):function(t){return Vo(t)&&ra(t)==m};function Zo(t){return"number"==typeof t||Vo(t)&&li(t)==v}function Go(t){if(!Vo(t)||li(t)!=g)return!1;var e=Ht(t);if(null===e)return!0;var r=St.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Mt.call(r)==Tt}var Wo=re?Re(re):function(t){return Vo(t)&&li(t)==y};var $o=ie?Re(ie):function(t){return Vo(t)&&ra(t)==b};function Qo(t){return"string"==typeof t||!xo(t)&&Vo(t)&&li(t)==w}function Yo(t){return"symbol"==typeof t||Vo(t)&&li(t)==_}var Jo=ne?Re(ne):function(t){return Vo(t)&&qo(t.length)&&!!Ut[li(t)]};var Xo=On(Ci),ts=On((function(t,e){return t<=e}));function es(t){if(!t)return[];if(No(t))return Qo(t)?Ze(t):gn(t);if(Jt&&t[Jt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Jt]());var e=ra(t);return(e==m?Ue:e==b?ze:Is)(t)}function rs(t){return t?(t=as(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function is(t){var e=rs(t),r=e%1;return e==e?r?e-r:e:0}function ns(t){return t?Wr(is(t),0,4294967295):0}function as(t){if("number"==typeof t)return t;if(Yo(t))return NaN;if(zo(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=zo(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(W,"");var r=at.test(t);return r||st.test(t)?Vt(t.slice(2),r?2:8):nt.test(t)?NaN:+t}function os(t){return yn(t,_s(t))}function ss(t){return null==t?"":Qi(t)}var us=wn((function(t,e){if(ca(e)||No(e))yn(e,ws(e),t);else for(var r in e)St.call(e,r)&&qr(t,r,e[r])})),hs=wn((function(t,e){yn(e,_s(e),t)})),fs=wn((function(t,e,r,i){yn(e,_s(e),t,i)})),cs=wn((function(t,e,r,i){yn(e,ws(e),t,i)})),ls=Vn(Gr);var ds=Fi((function(t,e){t=mt(t);var r=-1,i=e.length,n=i>2?e[2]:void 0;for(n&&sa(e[0],e[1],n)&&(i=1);++r1),e})),yn(t,Zn(t),r),i&&(r=$r(r,7,qn));for(var n=e.length;n--;)Ji(r,e[n]);return r}));var Cs=Vn((function(t,e){return null==t?{}:function(t,e){return Bi(t,e,(function(e,r){return vs(t,r)}))}(t,e)}));function As(t,e){if(null==t)return{};var r=de(Zn(t),(function(t){return[t]}));return e=Qn(e),Bi(t,r,(function(t,r){return e(t,r[0])}))}var ks=Ln(ws),Ts=Ln(_s);function Is(t){return null==t?[]:Pe(t,ws(t))}var Rs=Sn((function(t,e,r){return e=e.toLowerCase(),t+(r?Ps(e):e)}));function Ps(t){return Ds(ss(t).toLowerCase())}function Bs(t){return(t=ss(t))&&t.replace(ht,je).replace(xt,"")}var xs=Sn((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Os=Sn((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Ns=Mn("toLowerCase");var js=Sn((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}));var Fs=Sn((function(t,e,r){return t+(r?" ":"")+Ds(e)}));var Ls=Sn((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Ds=Mn("toUpperCase");function Us(t,e,r){return t=ss(t),void 0===(e=r?void 0:e)?function(t){return Ft.test(t)}(t)?function(t){return t.match(Nt)||[]}(t):function(t){return t.match(tt)||[]}(t):t.match(e)||[]}var Ks=Fi((function(t,e){try{return ae(t,void 0,e)}catch(t){return Do(t)?t:new lt(t)}})),qs=Vn((function(t,e){return se(e,(function(e){e=Ca(e),Zr(t,e,yo(t[e],t))})),t}));function zs(t){return function(){return t}}var Vs=kn(),Hs=kn(!0);function Zs(t){return t}function Gs(t){return Ei("function"==typeof t?t:$r(t,1))}var Ws=Fi((function(t,e){return function(r){return gi(r,t,e)}})),$s=Fi((function(t,e){return function(r){return gi(t,r,e)}}));function Qs(t,e,r){var i=ws(e),n=hi(e,i);null!=r||zo(e)&&(n.length||!i.length)||(r=e,e=t,t=this,n=hi(e,ws(e)));var a=!(zo(r)&&"chain"in r&&!r.chain),o=Uo(t);return se(n,(function(r){var i=e[r];t[r]=i,o&&(t.prototype[r]=function(){var e=this.__chain__;if(a||e){var r=t(this.__wrapped__),n=r.__actions__=gn(this.__actions__);return n.push({func:i,args:arguments,thisArg:t}),r.__chain__=e,r}return i.apply(t,pe([this.value()],arguments))})})),t}function Ys(){}var Js=Pn(de),Xs=Pn(he),tu=Pn(ge);function eu(t){return ua(t)?Ce(Ca(t)):function(t){return function(e){return fi(e,t)}}(t)}var ru=xn(),iu=xn(!0);function nu(){return[]}function au(){return!1}var ou=Rn((function(t,e){return t+e}),0),su=jn("ceil"),uu=Rn((function(t,e){return t/e}),1),hu=jn("floor");var fu,cu=Rn((function(t,e){return t*e}),1),lu=jn("round"),du=Rn((function(t,e){return t-e}),0);return kr.after=function(t,e){if("function"!=typeof e)throw new yt(a);return t=is(t),function(){if(--t<1)return e.apply(this,arguments)}},kr.ary=vo,kr.assign=us,kr.assignIn=hs,kr.assignInWith=fs,kr.assignWith=cs,kr.at=ls,kr.before=go,kr.bind=yo,kr.bindAll=qs,kr.bindKey=bo,kr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},kr.chain=to,kr.chunk=function(t,e,r){e=(r?sa(t,e,r):void 0===e)?1:ar(is(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var a=0,o=0,s=i(Je(n/e));an?0:n+r),(i=void 0===i||i>n?n:is(i))<0&&(i+=n),i=r>i?0:ns(i);r>>0)?(t=ss(t))&&("string"==typeof e||null!=e&&!Wo(e))&&!(e=Qi(e))&&De(t)?hn(Ze(t),0,r):t.split(e,r):[]},kr.spread=function(t,e){if("function"!=typeof t)throw new yt(a);return e=null==e?0:ar(is(e),0),Fi((function(r){var i=r[e],n=hn(r,0,e);return i&&pe(n,i),ae(t,this,n)}))},kr.tail=function(t){var e=null==t?0:t.length;return e?Vi(t,1,e):[]},kr.take=function(t,e,r){return t&&t.length?Vi(t,0,(e=r||void 0===e?1:is(e))<0?0:e):[]},kr.takeRight=function(t,e,r){var i=null==t?0:t.length;return i?Vi(t,(e=i-(e=r||void 0===e?1:is(e)))<0?0:e,i):[]},kr.takeRightWhile=function(t,e){return t&&t.length?tn(t,Qn(e,3),!1,!0):[]},kr.takeWhile=function(t,e){return t&&t.length?tn(t,Qn(e,3)):[]},kr.tap=function(t,e){return e(t),t},kr.throttle=function(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new yt(a);return zo(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),wo(t,e,{leading:i,maxWait:e,trailing:n})},kr.thru=eo,kr.toArray=es,kr.toPairs=ks,kr.toPairsIn=Ts,kr.toPath=function(t){return xo(t)?de(t,Ca):Yo(t)?[t]:gn(Sa(ss(t)))},kr.toPlainObject=os,kr.transform=function(t,e,r){var i=xo(t),n=i||Fo(t)||Jo(t);if(e=Qn(e,4),null==r){var a=t&&t.constructor;r=n?i?new a:[]:zo(t)&&Uo(a)?Tr(Ht(t)):{}}return(n?se:si)(t,(function(t,i,n){return e(r,t,i,n)})),r},kr.unary=function(t){return vo(t,1)},kr.union=za,kr.unionBy=Va,kr.unionWith=Ha,kr.uniq=function(t){return t&&t.length?Yi(t):[]},kr.uniqBy=function(t,e){return t&&t.length?Yi(t,Qn(e,2)):[]},kr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Yi(t,void 0,e):[]},kr.unset=function(t,e){return null==t||Ji(t,e)},kr.unzip=Za,kr.unzipWith=Ga,kr.update=function(t,e,r){return null==t?t:Xi(t,e,on(r))},kr.updateWith=function(t,e,r,i){return i="function"==typeof i?i:void 0,null==t?t:Xi(t,e,on(r),i)},kr.values=Is,kr.valuesIn=function(t){return null==t?[]:Pe(t,_s(t))},kr.without=Wa,kr.words=Us,kr.wrap=function(t,e){return Ao(on(e),t)},kr.xor=$a,kr.xorBy=Qa,kr.xorWith=Ya,kr.zip=Ja,kr.zipObject=function(t,e){return nn(t||[],e||[],qr)},kr.zipObjectDeep=function(t,e){return nn(t||[],e||[],Ui)},kr.zipWith=Xa,kr.entries=ks,kr.entriesIn=Ts,kr.extend=hs,kr.extendWith=fs,Qs(kr,kr),kr.add=ou,kr.attempt=Ks,kr.camelCase=Rs,kr.capitalize=Ps,kr.ceil=su,kr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=as(r))==r?r:0),void 0!==e&&(e=(e=as(e))==e?e:0),Wr(as(t),e,r)},kr.clone=function(t){return $r(t,4)},kr.cloneDeep=function(t){return $r(t,5)},kr.cloneDeepWith=function(t,e){return $r(t,5,e="function"==typeof e?e:void 0)},kr.cloneWith=function(t,e){return $r(t,4,e="function"==typeof e?e:void 0)},kr.conformsTo=function(t,e){return null==e||Qr(t,e,ws(e))},kr.deburr=Bs,kr.defaultTo=function(t,e){return null==t||t!=t?e:t},kr.divide=uu,kr.endsWith=function(t,e,r){t=ss(t),e=Qi(e);var i=t.length,n=r=void 0===r?i:Wr(is(r),0,i);return(r-=e.length)>=0&&t.slice(r,n)==e},kr.eq=Io,kr.escape=function(t){return(t=ss(t))&&D.test(t)?t.replace(F,Fe):t},kr.escapeRegExp=function(t){return(t=ss(t))&&G.test(t)?t.replace(Z,"\\$&"):t},kr.every=function(t,e,r){var i=xo(t)?he:ei;return r&&sa(t,e,r)&&(e=void 0),i(t,Qn(e,3))},kr.find=no,kr.findIndex=Pa,kr.findKey=function(t,e){return be(t,Qn(e,3),si)},kr.findLast=ao,kr.findLastIndex=Ba,kr.findLastKey=function(t,e){return be(t,Qn(e,3),ui)},kr.floor=hu,kr.forEach=oo,kr.forEachRight=so,kr.forIn=function(t,e){return null==t?t:ai(t,Qn(e,3),_s)},kr.forInRight=function(t,e){return null==t?t:oi(t,Qn(e,3),_s)},kr.forOwn=function(t,e){return t&&si(t,Qn(e,3))},kr.forOwnRight=function(t,e){return t&&ui(t,Qn(e,3))},kr.get=ms,kr.gt=Ro,kr.gte=Po,kr.has=function(t,e){return null!=t&&ia(t,e,pi)},kr.hasIn=vs,kr.head=Oa,kr.identity=Zs,kr.includes=function(t,e,r,i){t=No(t)?t:Is(t),r=r&&!i?is(r):0;var n=t.length;return r<0&&(r=ar(n+r,0)),Qo(t)?r<=n&&t.indexOf(e,r)>-1:!!n&&_e(t,e,r)>-1},kr.indexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=null==r?0:is(r);return n<0&&(n=ar(i+n,0)),_e(t,e,n)},kr.inRange=function(t,e,r){return e=rs(e),void 0===r?(r=e,e=0):r=rs(r),function(t,e,r){return t>=or(e,r)&&t=-9007199254740991&&t<=9007199254740991},kr.isSet=$o,kr.isString=Qo,kr.isSymbol=Yo,kr.isTypedArray=Jo,kr.isUndefined=function(t){return void 0===t},kr.isWeakMap=function(t){return Vo(t)&&ra(t)==E},kr.isWeakSet=function(t){return Vo(t)&&"[object WeakSet]"==li(t)},kr.join=function(t,e){return null==t?"":ir.call(t,e)},kr.kebabCase=xs,kr.last=La,kr.lastIndexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=i;return void 0!==r&&(n=(n=is(r))<0?ar(i+n,0):or(n,i-1)),e==e?function(t,e,r){for(var i=r+1;i--;)if(t[i]===e)return i;return i}(t,e,n):we(t,Me,n,!0)},kr.lowerCase=Os,kr.lowerFirst=Ns,kr.lt=Xo,kr.lte=ts,kr.max=function(t){return t&&t.length?ri(t,Zs,di):void 0},kr.maxBy=function(t,e){return t&&t.length?ri(t,Qn(e,2),di):void 0},kr.mean=function(t){return Se(t,Zs)},kr.meanBy=function(t,e){return Se(t,Qn(e,2))},kr.min=function(t){return t&&t.length?ri(t,Zs,Ci):void 0},kr.minBy=function(t,e){return t&&t.length?ri(t,Qn(e,2),Ci):void 0},kr.stubArray=nu,kr.stubFalse=au,kr.stubObject=function(){return{}},kr.stubString=function(){return""},kr.stubTrue=function(){return!0},kr.multiply=cu,kr.nth=function(t,e){return t&&t.length?Ri(t,is(e)):void 0},kr.noConflict=function(){return Gt._===this&&(Gt._=It),this},kr.noop=Ys,kr.now=mo,kr.pad=function(t,e,r){t=ss(t);var i=(e=is(e))?He(t):0;if(!e||i>=e)return t;var n=(e-i)/2;return Bn(Xe(n),r)+t+Bn(Je(n),r)},kr.padEnd=function(t,e,r){t=ss(t);var i=(e=is(e))?He(t):0;return e&&ie){var i=t;t=e,e=i}if(r||t%1||e%1){var n=hr();return or(t+n*(e-t+zt("1e-"+((n+"").length-1))),e)}return Ni(t,e)},kr.reduce=function(t,e,r){var i=xo(t)?me:ke,n=arguments.length<3;return i(t,Qn(e,4),r,n,Xr)},kr.reduceRight=function(t,e,r){var i=xo(t)?ve:ke,n=arguments.length<3;return i(t,Qn(e,4),r,n,ti)},kr.repeat=function(t,e,r){return e=(r?sa(t,e,r):void 0===e)?1:is(e),ji(ss(t),e)},kr.replace=function(){var t=arguments,e=ss(t[0]);return t.length<3?e:e.replace(t[1],t[2])},kr.result=function(t,e,r){var i=-1,n=(e=sn(e,t)).length;for(n||(n=1,t=void 0);++i9007199254740991)return[];var r=4294967295,i=or(t,4294967295);t-=4294967295;for(var n=Ie(i,e=Qn(e));++r=a)return t;var s=r-He(i);if(s<1)return i;var u=o?hn(o,0,s).join(""):t.slice(0,s);if(void 0===n)return u+i;if(o&&(s+=u.length-s),Wo(n)){if(t.slice(s).search(n)){var h,f=u;for(n.global||(n=vt(n.source,ss(it.exec(n))+"g")),n.lastIndex=0;h=n.exec(f);)var c=h.index;u=u.slice(0,void 0===c?s:c)}}else if(t.indexOf(Qi(n),s)!=s){var l=u.lastIndexOf(n);l>-1&&(u=u.slice(0,l))}return u+i},kr.unescape=function(t){return(t=ss(t))&&L.test(t)?t.replace(j,Ge):t},kr.uniqueId=function(t){var e=++Ct;return ss(t)+e},kr.upperCase=Ls,kr.upperFirst=Ds,kr.each=oo,kr.eachRight=so,kr.first=Oa,Qs(kr,(fu={},si(kr,(function(t,e){St.call(kr.prototype,e)||(fu[e]=t)})),fu),{chain:!1}),kr.VERSION="4.17.19",se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){kr[t].placeholder=kr})),se(["drop","take"],(function(t,e){Pr.prototype[t]=function(r){r=void 0===r?1:ar(is(r),0);var i=this.__filtered__&&!e?new Pr(this):this.clone();return i.__filtered__?i.__takeCount__=or(r,i.__takeCount__):i.__views__.push({size:or(r,4294967295),type:t+(i.__dir__<0?"Right":"")}),i},Pr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),se(["filter","map","takeWhile"],(function(t,e){var r=e+1,i=1==r||3==r;Pr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Qn(t,3),type:r}),e.__filtered__=e.__filtered__||i,e}})),se(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Pr.prototype[t]=function(){return this[r](1).value()[0]}})),se(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Pr.prototype[t]=function(){return this.__filtered__?new Pr(this):this[r](1)}})),Pr.prototype.compact=function(){return this.filter(Zs)},Pr.prototype.find=function(t){return this.filter(t).head()},Pr.prototype.findLast=function(t){return this.reverse().find(t)},Pr.prototype.invokeMap=Fi((function(t,e){return"function"==typeof t?new Pr(this):this.map((function(r){return gi(r,t,e)}))})),Pr.prototype.reject=function(t){return this.filter(So(Qn(t)))},Pr.prototype.slice=function(t,e){t=is(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Pr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=is(e))<0?r.dropRight(-e):r.take(e-t)),r)},Pr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pr.prototype.toArray=function(){return this.take(4294967295)},si(Pr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),n=kr[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);n&&(kr.prototype[e]=function(){var e=this.__wrapped__,o=i?[1]:arguments,s=e instanceof Pr,u=o[0],h=s||xo(e),f=function(t){var e=n.apply(kr,pe([t],o));return i&&c?e[0]:e};h&&r&&"function"==typeof u&&1!=u.length&&(s=h=!1);var c=this.__chain__,l=!!this.__actions__.length,d=a&&!c,p=s&&!l;if(!a&&h){e=p?e:new Pr(this);var m=t.apply(e,o);return m.__actions__.push({func:eo,args:[f],thisArg:void 0}),new Rr(m,c)}return d&&p?t.apply(this,o):(m=this.thru(f),d?i?m.value()[0]:m.value():m)})})),se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=bt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);kr.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(xo(n)?n:[],t)}return this[r]((function(r){return e.apply(xo(r)?r:[],t)}))}})),si(Pr.prototype,(function(t,e){var r=kr[e];if(r){var i=r.name+"";St.call(yr,i)||(yr[i]=[]),yr[i].push({name:e,func:r})}})),yr[Tn(void 0,2).name]=[{name:"wrapper",func:void 0}],Pr.prototype.clone=function(){var t=new Pr(this.__wrapped__);return t.__actions__=gn(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=gn(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=gn(this.__views__),t},Pr.prototype.reverse=function(){if(this.__filtered__){var t=new Pr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=xo(t),i=e<0,n=r?t.length:0,a=function(t,e,r){var i=-1,n=r.length;for(;++i=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},kr.prototype.plant=function(t){for(var e,r=this;r instanceof Ir;){var i=ka(r);i.__index__=0,i.__values__=void 0,e?n.__wrapped__=i:e=i;var n=i;r=r.__wrapped__}return n.__wrapped__=t,e},kr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Pr){var e=t;return this.__actions__.length&&(e=new Pr(this)),(e=e.reverse()).__actions__.push({func:eo,args:[qa],thisArg:void 0}),new Rr(e,this.__chain__)}return this.thru(qa)},kr.prototype.toJSON=kr.prototype.valueOf=kr.prototype.value=function(){return en(this.__wrapped__,this.__actions__)},kr.prototype.first=kr.prototype.head,Jt&&(kr.prototype[Jt]=function(){return this}),kr}();Gt._=We,void 0===(n=function(){return We}.call(e,r,e,i))||(i.exports=n)}).call(this)}).call(this,r(7),r(15)(t))},function(t,e,r){"use strict";(function(t){ /*! * algorithms/helpers.js - Internal functions and fields used in Cryptographic * Algorithms * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -"undefined"==typeof Promise&&r(116).polyfill(),e.int32ToBuffer=function(e,r){return(r=r||t.alloc(4))[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r};var i=Math.pow(2,32);e.int64ToBuffer=function(r,n){n=n||t.alloc(8);var a=Math.floor(r/i),o=r%i;return a=e.int32ToBuffer(a),o=e.int32ToBuffer(o),n=t.concat([a,o])};var n={};Object.defineProperty(e,"subtleCrypto",{get:function(){return"subtleCrypto"in n?n.subtleCrypto:n.subtleCrypto=function(){if("undefined"!=typeof crypto&&void 0!==crypto.subtle)return crypto.subtle}()},enumerable:!0}),Object.defineProperty(e,"nodeCrypto",{get:function(){return"nodeCrypto"in n?n.nodeCrypto:n.nodeCrypto=function(){var t;try{t=r(266)}catch(t){return}if(Object.keys(t).length)return t}()},enumerable:!0}),e.setupFallback=function(t,r,i){return t&&e.nodeCrypto?function(){var e,r=arguments;function n(t){return 0===t.message.indexOf("unsupported algorithm:")?i.apply(null,r):Promise.reject(t)}try{e=Promise.resolve(t.apply(null,r))}catch(t){e=n(t)}return e}:r&&e.subtleCrypto?function(){var t,e=arguments;function n(t){return t.code!==DOMException.NOT_SUPPORTED_ERR&&"Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData"!==t.message&&t instanceof Error?Promise.reject(t):i.apply(null,e)}try{t=(t=r.apply(null,e)).catch(n)}catch(e){t=n(e)}return t}:i}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(237),n=r(238),a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function u(t){return(t||"").toString().replace(s,"")}var h=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function c(t){var r,i=("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(t=t||i);if("blob:"===t.protocol)n=new d(unescape(t.pathname),{});else if("string"===o)for(r in n=new d(t,{}),f)delete n[r];else if("object"===o){for(r in t)r in f||(n[r]=t[r]);void 0===n.slashes&&(n.slashes=a.test(t.href))}return n}function l(t){t=u(t);var e=o.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function d(t,e,r){if(t=u(t),!(this instanceof d))return new d(t,e,r);var a,o,s,f,p,m,v=h.slice(),y=typeof e,g=this,b=0;for("object"!==y&&"string"!==y&&(r=e,e=null),r&&"function"!=typeof r&&(r=n.parse),e=c(e),a=!(o=l(t||"")).protocol&&!o.slashes,g.slashes=o.slashes||a&&e.slashes,g.protocol=o.protocol||e.protocol||"",t=o.rest,o.slashes||(v[3]=[/(.*)/,"pathname"]);b=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):a(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],a=i+t[e+1]>>>0,o=(a>>0,t[e+1]=a},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,a,o,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,a,o,s){return e+i+a+s>>>0},e.sum64_5_hi=function(t,e,r,i,n,a,o,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,a,o,s,u,h){return e+i+a+s+h>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict"; +"undefined"==typeof Promise&&r(116).polyfill(),e.int32ToBuffer=function(e,r){return(r=r||t.alloc(4))[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r};var i=Math.pow(2,32);e.int64ToBuffer=function(r,n){n=n||t.alloc(8);var a=Math.floor(r/i),o=r%i;return a=e.int32ToBuffer(a),o=e.int32ToBuffer(o),n=t.concat([a,o])};var n={};Object.defineProperty(e,"subtleCrypto",{get:function(){return"subtleCrypto"in n?n.subtleCrypto:n.subtleCrypto=function(){if("undefined"!=typeof crypto&&void 0!==crypto.subtle)return crypto.subtle}()},enumerable:!0}),Object.defineProperty(e,"nodeCrypto",{get:function(){return"nodeCrypto"in n?n.nodeCrypto:n.nodeCrypto=function(){var t;try{t=r(267)}catch(t){return}if(Object.keys(t).length)return t}()},enumerable:!0}),e.setupFallback=function(t,r,i){return t&&e.nodeCrypto?function(){var e,r=arguments;function n(t){return 0===t.message.indexOf("unsupported algorithm:")?i.apply(null,r):Promise.reject(t)}try{e=Promise.resolve(t.apply(null,r))}catch(t){e=n(t)}return e}:r&&e.subtleCrypto?function(){var t,e=arguments;function n(t){return t.code!==DOMException.NOT_SUPPORTED_ERR&&"Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData"!==t.message&&t instanceof Error?Promise.reject(t):i.apply(null,e)}try{t=(t=r.apply(null,e)).catch(n)}catch(e){t=n(e)}return t}:i}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(238),n=r(239),a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function u(t){return(t||"").toString().replace(s,"")}var h=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function c(t){var r,i=("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(t=t||i);if("blob:"===t.protocol)n=new d(unescape(t.pathname),{});else if("string"===o)for(r in n=new d(t,{}),f)delete n[r];else if("object"===o){for(r in t)r in f||(n[r]=t[r]);void 0===n.slashes&&(n.slashes=a.test(t.href))}return n}function l(t){t=u(t);var e=o.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function d(t,e,r){if(t=u(t),!(this instanceof d))return new d(t,e,r);var a,o,s,f,p,m,v=h.slice(),g=typeof e,y=this,b=0;for("object"!==g&&"string"!==g&&(r=e,e=null),r&&"function"!=typeof r&&(r=n.parse),e=c(e),a=!(o=l(t||"")).protocol&&!o.slashes,y.slashes=o.slashes||a&&e.slashes,y.protocol=o.protocol||e.protocol||"",t=o.rest,o.slashes||(v[3]=[/(.*)/,"pathname"]);b=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):a(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],a=i+t[e+1]>>>0,o=(a>>0,t[e+1]=a},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,a,o,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,a,o,s){return e+i+a+s>>>0},e.sum64_5_hi=function(t,e,r,i,n,a,o,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,a,o,s,u,h){return e+i+a+s+h>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict"; /*! * algorithms/constants.js - Constants used in Cryptographic Algorithms * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. - */t.exports={CHUNK_SIZE:1024,HASHLENGTH:{"SHA-1":160,"SHA-256":256,"SHA-384":384,"SHA-512":512},ENCLENGTH:{"AES-128-CBC":128,"AES-192-CBC":192,"AES-256-CBC":256,"AES-128-KW":128,"AES-192-KW":192,"AES-256-KW":256},KEYLENGTH:{"A128CBC-HS256":256,"A192CBC-HS384":384,"A256CBC-HS512":512,"A128CBC+HS256":256,"A192CBC+HS384":384,"A256CBC+HS512":512,A128GCM:128,A192GCM:192,A256GCM:256,A128KW:128,A192KW:192,A256KW:256,"ECDH-ES+A128KW":128,"ECDH-ES+A192KW":192,"ECDH-ES+A256KW":256},NONCELENGTH:{"A128CBC-HS256":128,"A192CBC-HS384":128,"A256CBC-HS512":128,"A128CBC+HS256":128,"A192CBC+HS384":128,"A256CBC+HS512":128,A128GCM:96,A192GCM:96,A256GCM:96}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(364).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function h(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function c(t,e,r,i){var n,a,o,s;if(h(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=f(t))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=n[t];if(void 0===u)return!1;if("function"==typeof u)a(u,this,e);else{var h=u.length,f=v(u,h);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";(function(e){ + */t.exports={CHUNK_SIZE:1024,HASHLENGTH:{"SHA-1":160,"SHA-256":256,"SHA-384":384,"SHA-512":512},ENCLENGTH:{"AES-128-CBC":128,"AES-192-CBC":192,"AES-256-CBC":256,"AES-128-KW":128,"AES-192-KW":192,"AES-256-KW":256},KEYLENGTH:{"A128CBC-HS256":256,"A192CBC-HS384":384,"A256CBC-HS512":512,"A128CBC+HS256":256,"A192CBC+HS384":384,"A256CBC+HS512":512,A128GCM:128,A192GCM:192,A256GCM:256,A128KW:128,A192KW:192,A256KW:256,"ECDH-ES+A128KW":128,"ECDH-ES+A192KW":192,"ECDH-ES+A256KW":256},NONCELENGTH:{"A128CBC-HS256":128,"A192CBC-HS384":128,"A256CBC-HS512":128,"A128CBC+HS256":128,"A192CBC+HS384":128,"A256CBC+HS512":128,A128GCM:96,A192GCM:96,A256GCM:96}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(365).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function h(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function c(t,e,r,i){var n,a,o,s;if(h(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=f(t))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=n[t];if(void 0===u)return!1;if("function"==typeof u)a(u,this,e);else{var h=u.length,f=v(u,h);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";(function(e){ /*! * util/utf8.js - Implementation of UTF-8 Encoder/Decoder * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i,n=r(12),a=n.partialRight,o=n.merge,s=(i=[],"undefined"!=typeof Uint8ClampedArray&&i.push(Uint8ClampedArray),"undefined"!=typeof Uint8Array&&i.push(Uint8Array),"undefined"!=typeof Uint16Array&&i.push(Uint16Array),"undefined"!=typeof Uint32Array&&i.push(Uint32Array),"undefined"!=typeof Float32Array&&i.push(Float32Array),"undefined"!=typeof Float64Array&&i.push(Float64Array),i);t.exports=a(o,(function(t,r){if(e.isBuffer(r))r=e.from(r);else{var i=function(t){for(var e,r=0;!e&&s.length>r;r++)t instanceof s[r]&&(e=s[r]);return e}(r);r=i?new i(r,r.byteOffset,r.byteLength):void 0}return r,r}))}).call(this,r(0).Buffer)},function(t,e,r){var i=r(3);r(6),r(24);var n=t.exports=i.asn1=i.asn1||{};function a(t,e,r){if(r>e){var i=new Error("Too few bytes to parse DER.");throw i.available=t.length(),i.remaining=e,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(t,e,r,a,o){if(i.util.isArray(a)){for(var s=[],u=0;ur){if(o.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=r,p.requested=d,p}d=r}var m=32==(32&u);if(m)if(c=[],void 0===d)for(;;){if(a(e,r,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),r-=2;break}s=e.length(),c.push(t(e,r,i+1,o)),r-=s-e.length()}else for(;d>0;)s=e.length(),c.push(t(e,d,i+1,o)),r-=s-e.length(),d-=s-e.length();void 0===c&&h===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&(l=e.bytes(d));if(void 0===c&&o.decodeBitStrings&&h===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&d>1){var v=e.read,y=r,g=0;if(f===n.Type.BITSTRING&&(a(e,r,1),g=e.getByte(),r--),0===g)try{s=e.length();var b={verbose:o.verbose,strict:!0,decodeBitStrings:!0},w=t(e,r,i+1,b),_=s-e.length();r-=_,f==n.Type.BITSTRING&&_++;var E=w.tagClass;_!==d||E!==n.Class.UNIVERSAL&&E!==n.Class.CONTEXT_SPECIFIC||(c=[w])}catch(t){}void 0===c&&(e.read=v,r=y)}if(void 0===c){if(void 0===d){if(o.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=r}if(f===n.Type.BMPSTRING)for(c="";d>0;d-=2)a(e,r,2),c+=String.fromCharCode(e.getInt16()),r-=2;else c=e.getBytes(d)}var M=void 0===l?null:{bitStringContents:l};return n.create(h,f,m,c,M)}(t,t.length(),0,e)},n.toDer=function(t){var e=i.util.createBuffer(),r=t.tagClass|t.type,a=i.util.createBuffer(),o=!1;if("bitStringContents"in t&&(o=!0,t.original&&(o=n.equals(t,t.original))),o)a.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:a.putByte(0);for(var s=0;s1&&(0===t.value.charCodeAt(0)&&0==(128&t.value.charCodeAt(1))||255===t.value.charCodeAt(0)&&128==(128&t.value.charCodeAt(1)))?a.putBytes(t.value.substr(1)):a.putBytes(t.value);if(e.putByte(r),a.length()<=127)e.putByte(127&a.length());else{var u=a.length(),h="";do{h+=String.fromCharCode(255&u),u>>>=8}while(u>0);e.putByte(128|h.length);for(s=h.length-1;s>=0;--s)e.putByte(h.charCodeAt(s))}return e.putBuffer(a),e},n.oidToDer=function(t){var e,r,n,a,o=t.split("."),s=i.util.createBuffer();s.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var u=2;u>>=7,e||(a|=128),r.push(a),e=!1}while(n>0);for(var h=r.length-1;h>=0;--h)s.putByte(r[h])}return s},n.derToOid=function(t){var e;"string"==typeof t&&(t=i.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)n<<=7,128&(r=t.getByte())?n+=127&r:(e+="."+(n+r),n=0);return e},n.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(t.substr(2,2),10)-1,n=parseInt(t.substr(4,2),10),a=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),s=0;if(t.length>11){var u=t.charAt(10),h=10;"+"!==u&&"-"!==u&&(s=parseInt(t.substr(10,2),10),h+=2)}if(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,0),h&&("+"===(u=t.charAt(h))||"-"===u)){var f=60*parseInt(t.substr(h+1,2),10)+parseInt(t.substr(h+4,2),10);f*=6e4,"+"===u?e.setTime(+e-f):e.setTime(+e+f)}return e},n.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),i=parseInt(t.substr(4,2),10)-1,n=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=parseInt(t.substr(10,2),10),s=parseInt(t.substr(12,2),10),u=0,h=0,f=!1;"Z"===t.charAt(t.length-1)&&(f=!0);var c=t.length-5,l=t.charAt(c);"+"!==l&&"-"!==l||(h=60*parseInt(t.substr(c+1,2),10)+parseInt(t.substr(c+4,2),10),h*=6e4,"+"===l&&(h*=-1),f=!0);return"."===t.charAt(14)&&(u=1e3*parseFloat(t.substr(14),10)),f?(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,u),e.setTime(+e+h)):(e.setFullYear(r,i,n),e.setHours(a,o,s,u)),e},n.dateToUtcTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r},n.derToInteger=function(t){"string"==typeof t&&(t=i.util.createBuffer(t));var e=8*t.length();if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)},n.validate=function(t,e,r,a){var o=!1;if(t.tagClass!==e.tagClass&&void 0!==e.tagClass||t.type!==e.type&&void 0!==e.type)a&&(t.tagClass!==e.tagClass&&a.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&a.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));else if(t.constructed===e.constructed||void 0===e.constructed){if(o=!0,e.value&&i.util.isArray(e.value))for(var s=0,u=0;o&&u0&&(a+="\n");for(var s="",u=0;u1?a+="0x"+i.util.bytesToHex(t.value.slice(1)):a+="(none)",t.value.length>0){var l=t.value.charCodeAt(0);1==l?a+=" (1 unused bit shown)":l>1&&(a+=" ("+l+" unused bits shown)")}}else t.type===n.Type.OCTETSTRING?(o.test(t.value)||(a+="("+t.value+") "),a+="0x"+i.util.bytesToHex(t.value)):t.type===n.Type.UTF8?a+=i.util.decodeUtf8(t.value):t.type===n.Type.PRINTABLESTRING||t.type===n.Type.IA5String?a+=t.value:o.test(t.value)?a+="0x"+i.util.bytesToHex(t.value):0===t.value.length?a+="[null]":a+=t.value}return a}},function(t,e,r){var i=r(3);r(40),r(121),r(122),r(6),i.random&&i.random.getBytes?t.exports=i.random:function(e){var r={},n=new Array(4),a=i.util.createBuffer();function o(){var t=i.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),i.aes._expandKey(t,!1)},r.formatSeed=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),t},r.cipher=function(t,e){return i.aes._updateBlock(t,e,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(t){return++t[3],t},r.md=i.md.sha256;var s=o(),u=null,h=i.util.globalScope,f=h.crypto||h.msCrypto;if(f&&f.getRandomValues&&(u=function(t){return f.getRandomValues(t)}),i.options.usePureJavaScript||!i.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var l in navigator)try{"string"==typeof navigator[l]&&(c+=navigator[l])}catch(t){}s.collect(c),c=null}e&&(e().mousemove((function(t){s.collectInt(t.clientX,16),s.collectInt(t.clientY,16)})),e().keypress((function(t){s.collectInt(t.charCode,8)})))}if(i.random)for(var l in s)i.random[l]=s[l];else i.random=s;i.random.createInstance=o,t.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},function(t,e,r){var i=r(2).Buffer,n=r(44).Transform,a=r(27).StringDecoder;function o(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1)(o,n),o.prototype.update=function(t,e,r){"string"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},o.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},o.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},o.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new a(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=o},function(t,e,r){var i=r(3);i.pki=i.pki||{};var n=t.exports=i.pki.oids=i.oids=i.oids||{};function a(t,e){n[t]=e,n[e]=t}function o(t,e){n[t]=e}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.5","serialName"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.13","description"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping")},function(t,e,r){var i=r(3);t.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},function(t,e,r){"use strict";var i=r(57),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var a=Object.create(r(45));a.inherits=r(1);var o=r(138),s=r(85);a.inherits(c,o);for(var u=n(s.prototype),h=0;h>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),g(i.showHidden)&&(i.showHidden=!1),g(i.depth)&&(i.depth=2),g(i.colors)&&(i.colors=!1),g(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),f(i,t,i.depth)}function u(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function h(t,e){return t}function f(t,r,i){if(t.customInspect&&r&&M(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return y(n)||(n=f(t,n,i)),n}var a=function(t,e){if(g(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(v(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(a)return a;var o=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),E(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(r);if(0===o.length){if(M(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return c(r)}var h,w="",S=!1,C=["{","}"];(d(r)&&(S=!0,C=["[","]"]),M(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),E(r)&&(w=" "+c(r)),0!==o.length||S&&0!=r.length?i<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=S?function(t,e,r,i,n){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,w,C)):C[0]+w+C[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,r,i,n,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),T(i,n)||(o="["+n+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?f(t,u.value,null):f(t,u.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),g(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return"number"==typeof t}function y(t){return"string"==typeof t}function g(t){return void 0===t}function b(t){return w(t)&&"[object RegExp]"===S(t)}function w(t){return"object"==typeof t&&null!==t}function _(t){return w(t)&&"[object Date]"===S(t)}function E(t){return w(t)&&("[object Error]"===S(t)||t instanceof Error)}function M(t){return"function"==typeof t}function S(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(g(a)&&(a=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(a)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=v,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=g,e.isRegExp=b,e.isObject=w,e.isDate=_,e.isError=E,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(296);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(297),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var I="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(I&&t[I]){var e;if("function"!=typeof(e=t[I]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,I,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],a=0;a=e)throw new Error("Cannot access property/index "+i+" levels up, current level is "+e);return r[e-i]}if(i>e)throw new Error("Cannot access data "+i+" levels up, current level is "+e);if(a="data"+(e-i||""),!n)return a}for(var s=a,h=n.split("/"),f=0;fr;r++)t instanceof s[r]&&(e=s[r]);return e}(r);r=i?new i(r,r.byteOffset,r.byteLength):void 0}return r,r}))}).call(this,r(0).Buffer)},function(t,e,r){var i=r(4);r(6),r(24);var n=t.exports=i.asn1=i.asn1||{};function a(t,e,r){if(r>e){var i=new Error("Too few bytes to parse DER.");throw i.available=t.length(),i.remaining=e,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(t,e,r,a,o){if(i.util.isArray(a)){for(var s=[],u=0;ur){if(o.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=r,p.requested=d,p}d=r}var m=32==(32&u);if(m)if(c=[],void 0===d)for(;;){if(a(e,r,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),r-=2;break}s=e.length(),c.push(t(e,r,i+1,o)),r-=s-e.length()}else for(;d>0;)s=e.length(),c.push(t(e,d,i+1,o)),r-=s-e.length(),d-=s-e.length();void 0===c&&h===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&(l=e.bytes(d));if(void 0===c&&o.decodeBitStrings&&h===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&d>1){var v=e.read,g=r,y=0;if(f===n.Type.BITSTRING&&(a(e,r,1),y=e.getByte(),r--),0===y)try{s=e.length();var b={verbose:o.verbose,strict:!0,decodeBitStrings:!0},w=t(e,r,i+1,b),_=s-e.length();r-=_,f==n.Type.BITSTRING&&_++;var E=w.tagClass;_!==d||E!==n.Class.UNIVERSAL&&E!==n.Class.CONTEXT_SPECIFIC||(c=[w])}catch(t){}void 0===c&&(e.read=v,r=g)}if(void 0===c){if(void 0===d){if(o.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=r}if(f===n.Type.BMPSTRING)for(c="";d>0;d-=2)a(e,r,2),c+=String.fromCharCode(e.getInt16()),r-=2;else c=e.getBytes(d)}var M=void 0===l?null:{bitStringContents:l};return n.create(h,f,m,c,M)}(t,t.length(),0,e)},n.toDer=function(t){var e=i.util.createBuffer(),r=t.tagClass|t.type,a=i.util.createBuffer(),o=!1;if("bitStringContents"in t&&(o=!0,t.original&&(o=n.equals(t,t.original))),o)a.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:a.putByte(0);for(var s=0;s1&&(0===t.value.charCodeAt(0)&&0==(128&t.value.charCodeAt(1))||255===t.value.charCodeAt(0)&&128==(128&t.value.charCodeAt(1)))?a.putBytes(t.value.substr(1)):a.putBytes(t.value);if(e.putByte(r),a.length()<=127)e.putByte(127&a.length());else{var u=a.length(),h="";do{h+=String.fromCharCode(255&u),u>>>=8}while(u>0);e.putByte(128|h.length);for(s=h.length-1;s>=0;--s)e.putByte(h.charCodeAt(s))}return e.putBuffer(a),e},n.oidToDer=function(t){var e,r,n,a,o=t.split("."),s=i.util.createBuffer();s.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var u=2;u>>=7,e||(a|=128),r.push(a),e=!1}while(n>0);for(var h=r.length-1;h>=0;--h)s.putByte(r[h])}return s},n.derToOid=function(t){var e;"string"==typeof t&&(t=i.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)n<<=7,128&(r=t.getByte())?n+=127&r:(e+="."+(n+r),n=0);return e},n.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(t.substr(2,2),10)-1,n=parseInt(t.substr(4,2),10),a=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),s=0;if(t.length>11){var u=t.charAt(10),h=10;"+"!==u&&"-"!==u&&(s=parseInt(t.substr(10,2),10),h+=2)}if(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,0),h&&("+"===(u=t.charAt(h))||"-"===u)){var f=60*parseInt(t.substr(h+1,2),10)+parseInt(t.substr(h+4,2),10);f*=6e4,"+"===u?e.setTime(+e-f):e.setTime(+e+f)}return e},n.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),i=parseInt(t.substr(4,2),10)-1,n=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=parseInt(t.substr(10,2),10),s=parseInt(t.substr(12,2),10),u=0,h=0,f=!1;"Z"===t.charAt(t.length-1)&&(f=!0);var c=t.length-5,l=t.charAt(c);"+"!==l&&"-"!==l||(h=60*parseInt(t.substr(c+1,2),10)+parseInt(t.substr(c+4,2),10),h*=6e4,"+"===l&&(h*=-1),f=!0);return"."===t.charAt(14)&&(u=1e3*parseFloat(t.substr(14),10)),f?(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,u),e.setTime(+e+h)):(e.setFullYear(r,i,n),e.setHours(a,o,s,u)),e},n.dateToUtcTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r},n.derToInteger=function(t){"string"==typeof t&&(t=i.util.createBuffer(t));var e=8*t.length();if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)},n.validate=function(t,e,r,a){var o=!1;if(t.tagClass!==e.tagClass&&void 0!==e.tagClass||t.type!==e.type&&void 0!==e.type)a&&(t.tagClass!==e.tagClass&&a.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&a.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));else if(t.constructed===e.constructed||void 0===e.constructed){if(o=!0,e.value&&i.util.isArray(e.value))for(var s=0,u=0;o&&u0&&(a+="\n");for(var s="",u=0;u1?a+="0x"+i.util.bytesToHex(t.value.slice(1)):a+="(none)",t.value.length>0){var l=t.value.charCodeAt(0);1==l?a+=" (1 unused bit shown)":l>1&&(a+=" ("+l+" unused bits shown)")}}else t.type===n.Type.OCTETSTRING?(o.test(t.value)||(a+="("+t.value+") "),a+="0x"+i.util.bytesToHex(t.value)):t.type===n.Type.UTF8?a+=i.util.decodeUtf8(t.value):t.type===n.Type.PRINTABLESTRING||t.type===n.Type.IA5String?a+=t.value:o.test(t.value)?a+="0x"+i.util.bytesToHex(t.value):0===t.value.length?a+="[null]":a+=t.value}return a}},function(t,e,r){var i=r(4);r(40),r(121),r(122),r(6),i.random&&i.random.getBytes?t.exports=i.random:function(e){var r={},n=new Array(4),a=i.util.createBuffer();function o(){var t=i.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),i.aes._expandKey(t,!1)},r.formatSeed=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),t},r.cipher=function(t,e){return i.aes._updateBlock(t,e,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(t){return++t[3],t},r.md=i.md.sha256;var s=o(),u=null,h=i.util.globalScope,f=h.crypto||h.msCrypto;if(f&&f.getRandomValues&&(u=function(t){return f.getRandomValues(t)}),i.options.usePureJavaScript||!i.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var l in navigator)try{"string"==typeof navigator[l]&&(c+=navigator[l])}catch(t){}s.collect(c),c=null}e&&(e().mousemove((function(t){s.collectInt(t.clientX,16),s.collectInt(t.clientY,16)})),e().keypress((function(t){s.collectInt(t.charCode,8)})))}if(i.random)for(var l in s)i.random[l]=s[l];else i.random=s;i.random.createInstance=o,t.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},function(t,e,r){var i=r(2).Buffer,n=r(44).Transform,a=r(27).StringDecoder;function o(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1)(o,n),o.prototype.update=function(t,e,r){"string"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},o.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},o.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},o.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new a(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=o},function(t,e,r){var i=r(4);i.pki=i.pki||{};var n=t.exports=i.pki.oids=i.oids=i.oids||{};function a(t,e){n[t]=e,n[e]=t}function o(t,e){n[t]=e}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.5","serialName"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.13","description"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping")},function(t,e,r){var i=r(4);t.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},function(t,e,r){"use strict";var i=r(57),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var a=Object.create(r(45));a.inherits=r(1);var o=r(138),s=r(85);a.inherits(c,o);for(var u=n(s.prototype),h=0;h>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),f(i,t,i.depth)}function u(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function h(t,e){return t}function f(t,r,i){if(t.customInspect&&r&&M(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=f(t,n,i)),n}var a=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(v(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(a)return a;var o=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),E(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(r);if(0===o.length){if(M(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return c(r)}var h,w="",S=!1,C=["{","}"];(d(r)&&(S=!0,C=["[","]"]),M(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),E(r)&&(w=" "+c(r)),0!==o.length||S&&0!=r.length?i<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=S?function(t,e,r,i,n){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,w,C)):C[0]+w+C[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,r,i,n,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),T(i,n)||(o="["+n+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?f(t,u.value,null):f(t,u.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return w(t)&&"[object RegExp]"===S(t)}function w(t){return"object"==typeof t&&null!==t}function _(t){return w(t)&&"[object Date]"===S(t)}function E(t){return w(t)&&("[object Error]"===S(t)||t instanceof Error)}function M(t){return"function"==typeof t}function S(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(a)&&(a=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(a)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=v,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=b,e.isObject=w,e.isDate=_,e.isError=E,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(297);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(298),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var I="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(I&&t[I]){var e;if("function"!=typeof(e=t[I]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,I,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],a=0;a=e)throw new Error("Cannot access property/index "+i+" levels up, current level is "+e);return r[e-i]}if(i>e)throw new Error("Cannot access data "+i+" levels up, current level is "+e);if(a="data"+(e-i||""),!n)return a}for(var s=a,h=n.split("/"),f=0;f4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(149),a=r(153);r(1)(h,n);for(var o=i(a.prototype),s=0;s=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},function(t,e,r){"use strict";var i={};function n(t,e,r){r||(r=Error);var n=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function a(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(174),a=r(178);r(1)(h,n);for(var o=i(a.prototype),s=0;s>>=2;for(n=0;n>8^255&c^99,a[m]=c,o[c]=m,d=(l=t[c])<<24^c<<16^c<<8^c^l,p=((r=t[m])^(i=t[r])^(n=t[i]))<<24^(m^n)<<16^(m^i^n)<<8^m^r^n;for(var y=0;y<4;++y)u[y][m]=d,h[y][c]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===m?m=v=1:(m=r^t[t[t[r^n]]],v^=t[t[v]])}}function l(t,e){for(var r,i=t.slice(0),n=1,o=i.length,u=4*(o+6+1),f=o;f>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^s[n]<<24,n++):o>6&&f%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),i[f]=i[f-o]^r;if(e){for(var c,l=h[0],d=h[1],p=h[2],m=h[3],v=i.slice(0),y=(f=0,(u=i.length)-4);f>>24]]^d[a[c>>>16&255]]^p[a[c>>>8&255]]^m[a[255&c]];i=v}return i}function d(t,e,r,i){var n,s,f,c,l,d,p,m,v,y,g,b,w=t.length/4-1;i?(n=h[0],s=h[1],f=h[2],c=h[3],l=o):(n=u[0],s=u[1],f=u[2],c=u[3],l=a),d=e[0]^t[0],p=e[i?3:1]^t[1],m=e[2]^t[2],v=e[i?1:3]^t[3];for(var _=3,E=1;E>>24]^s[p>>>16&255]^f[m>>>8&255]^c[255&v]^t[++_],g=n[p>>>24]^s[m>>>16&255]^f[v>>>8&255]^c[255&d]^t[++_],b=n[m>>>24]^s[v>>>16&255]^f[d>>>8&255]^c[255&p]^t[++_],v=n[v>>>24]^s[d>>>16&255]^f[p>>>8&255]^c[255&m]^t[++_],d=y,p=g,m=b;r[0]=l[d>>>24]<<24^l[p>>>16&255]<<16^l[m>>>8&255]<<8^l[255&v]^t[++_],r[i?3:1]=l[p>>>24]<<24^l[m>>>16&255]<<16^l[v>>>8&255]<<8^l[255&d]^t[++_],r[2]=l[m>>>24]<<24^l[v>>>16&255]<<16^l[d>>>8&255]<<8^l[255&p]^t[++_],r[i?1:3]=l[v>>>24]<<24^l[d>>>16&255]<<16^l[p>>>8&255]<<8^l[255&m]^t[++_]}function p(t){var e,r="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(3);r(6);var n=t.exports=i.pem=i.pem||{};function a(t){for(var e=t.name+": ",r=[],i=function(t,e){return" "+e},n=0;n65&&-1!==o){var s=e[o];","===s?(++o,e=e.substr(0,o)+"\r\n "+e.substr(o)):e=e.substr(0,o)+"\r\n"+s+e.substr(o+1),a=n-o-1,o=-1,++n}else" "!==e[n]&&"\t"!==e[n]&&","!==e[n]||(o=n);return e}function o(t){return t.replace(/^\s+/,"")}n.encode=function(t,e){e=e||{};var r,n="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(n+=a(r={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(n+=a(r={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(r={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&r.values.push(t.dekInfo.parameters),n+=a(r)),t.headers)for(var o=0;o4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(149),a=r(153);r(1)(h,n);for(var o=i(a.prototype),s=0;s=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},function(t,e,r){"use strict";var i={};function n(t,e,r){r||(r=Error);var n=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function a(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(174),a=r(178);r(1)(h,n);for(var o=i(a.prototype),s=0;s>>=2;for(n=0;n>8^255&c^99,a[m]=c,o[c]=m,d=(l=t[c])<<24^c<<16^c<<8^c^l,p=((r=t[m])^(i=t[r])^(n=t[i]))<<24^(m^n)<<16^(m^i^n)<<8^m^r^n;for(var g=0;g<4;++g)u[g][m]=d,h[g][c]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===m?m=v=1:(m=r^t[t[t[r^n]]],v^=t[t[v]])}}function l(t,e){for(var r,i=t.slice(0),n=1,o=i.length,u=4*(o+6+1),f=o;f>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^s[n]<<24,n++):o>6&&f%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),i[f]=i[f-o]^r;if(e){for(var c,l=h[0],d=h[1],p=h[2],m=h[3],v=i.slice(0),g=(f=0,(u=i.length)-4);f>>24]]^d[a[c>>>16&255]]^p[a[c>>>8&255]]^m[a[255&c]];i=v}return i}function d(t,e,r,i){var n,s,f,c,l,d,p,m,v,g,y,b,w=t.length/4-1;i?(n=h[0],s=h[1],f=h[2],c=h[3],l=o):(n=u[0],s=u[1],f=u[2],c=u[3],l=a),d=e[0]^t[0],p=e[i?3:1]^t[1],m=e[2]^t[2],v=e[i?1:3]^t[3];for(var _=3,E=1;E>>24]^s[p>>>16&255]^f[m>>>8&255]^c[255&v]^t[++_],y=n[p>>>24]^s[m>>>16&255]^f[v>>>8&255]^c[255&d]^t[++_],b=n[m>>>24]^s[v>>>16&255]^f[d>>>8&255]^c[255&p]^t[++_],v=n[v>>>24]^s[d>>>16&255]^f[p>>>8&255]^c[255&m]^t[++_],d=g,p=y,m=b;r[0]=l[d>>>24]<<24^l[p>>>16&255]<<16^l[m>>>8&255]<<8^l[255&v]^t[++_],r[i?3:1]=l[p>>>24]<<24^l[m>>>16&255]<<16^l[v>>>8&255]<<8^l[255&d]^t[++_],r[2]=l[m>>>24]<<24^l[v>>>16&255]<<16^l[d>>>8&255]<<8^l[255&p]^t[++_],r[i?1:3]=l[v>>>24]<<24^l[d>>>16&255]<<16^l[p>>>8&255]<<8^l[255&m]^t[++_]}function p(t){var e,r="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(4);r(6);var n=t.exports=i.pem=i.pem||{};function a(t){for(var e=t.name+": ",r=[],i=function(t,e){return" "+e},n=0;n65&&-1!==o){var s=e[o];","===s?(++o,e=e.substr(0,o)+"\r\n "+e.substr(o)):e=e.substr(0,o)+"\r\n"+s+e.substr(o+1),a=n-o-1,o=-1,++n}else" "!==e[n]&&"\t"!==e[n]&&","!==e[n]||(o=n);return e}function o(t){return t.replace(/^\s+/,"")}n.encode=function(t,e){e=e||{};var r,n="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(n+=a(r={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(n+=a(r={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(r={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&r.values.push(t.dekInfo.parameters),n+=a(r)),t.headers)for(var o=0;o=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a=0||!a.gcd(e.n).equals(n.ONE));for(var o=(t=t.multiply(a.modPow(e.e,e.n)).mod(e.n)).mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);o.compareTo(s)<0;)o=o.add(e.p);var u=o.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return u=u.multiply(a.modInverse(e.n)).mod(e.n)};function v(t,e,r){var n=i.util.createBuffer(),a=Math.ceil(e.n.bitLength()/8);if(t.length>a-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=a-11,o}n.putByte(0),n.putByte(r);var s,u=a-3-t.length;if(0===r||1===r){s=0===r?0:255;for(var h=0;h0;){var f=0,c=i.random.getBytes(u);for(h=0;h1;){if(255!==o.getByte()){--o.read;break}++h}else if(2===u)for(h=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++h}if(0!==o.getByte()||h!==a-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function g(t,e,r){"function"==typeof e&&(r=e,e={});var a={algorithm:{name:(e=e||{}).algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};function o(){s(t.pBits,(function(e,i){return e?r(e):(t.p=i,null!==t.q?h(e,t.q):void s(t.qBits,h))}))}function s(t,e){i.prime.generateProbablePrime(t,a,e)}function h(e,i){if(e)return r(e);if(t.q=i,t.p.compareTo(t.q)<0){var a=t.p;t.p=t.q,t.q=a}if(0!==t.p.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.p=null,void o();if(0!==t.q.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.q=null,void s(t.qBits,h);if(t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),0!==t.phi.gcd(t.e).compareTo(n.ONE))return t.p=t.q=null,void o();if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits)return t.q=null,void s(t.qBits,h);var f=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}"prng"in e&&(a.prng=e.prng),o()}function b(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=i.util.hexToBytes(e);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function _(t){return i.util.isNodejs&&"function"==typeof a[t]}function E(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.crypto&&"object"==typeof s.globalScope.crypto.subtle&&"function"==typeof s.globalScope.crypto.subtle[t]}function M(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.msCrypto&&"object"==typeof s.globalScope.msCrypto.subtle&&"function"==typeof s.globalScope.msCrypto.subtle[t]}function S(t){for(var e=i.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n0;)f.putByte(0),--c;return f.putBytes(i.util.hexToBytes(h)),f.getBytes()},u.rsa.decrypt=function(t,e,r,a){var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=o,s}var u=new n(i.util.createBuffer(t).toHex(),16);if(u.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var h=m(u,e,r).toString(16),f=i.util.createBuffer(),c=o-Math.ceil(h.length/2);c>0;)f.putByte(0),--c;return f.putBytes(i.util.hexToBytes(h)),!1!==a?y(f.getBytes(),e,r):f.getBytes()},u.rsa.createKeyPairGenerationState=function(t,e,r){"string"==typeof t&&(t=parseInt(t,10)),t=t||2048;var a,o=(r=r||{}).prng||i.random,s={nextBytes:function(t){for(var e=o.getBytesSync(t.length),r=0;r>1,pBits:t-(t>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},u.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var i,a=0,o=function(t,e){return t|e},s=+new Date,f=0;null===t.keys&&(e<=0||fc?t.pqState=0:t.num.isProbablePrime(w(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(h[a++%8],0):2===t.pqState?t.pqState=0===t.num.subtract(n.ONE).gcd(t.e).compareTo(n.ONE)?3:0:3===t.pqState&&(t.pqState=0,null===t.p?t.p=t.num:t.q=t.num,null!==t.p&&null!==t.q&&++t.state,t.num=null)}else if(1===t.state)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(2===t.state)t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(3===t.state)0===t.phi.gcd(t.e).compareTo(n.ONE)?++t.state:(t.p=null,t.q=null,t.state=0);else if(4===t.state)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(5===t.state){var d=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,d,t.p,t.q,d.mod(t.p1),d.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)}}f+=(i=+new Date)-s,s=i}return null!==t.keys},u.rsa.generateKeyPair=function(t,e,r,n){if(1===arguments.length?"object"==typeof t?(r=t,t=void 0):"function"==typeof t&&(n=t,t=void 0):2===arguments.length?"number"==typeof t?"function"==typeof e?(n=e,e=void 0):"number"!=typeof e&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):3===arguments.length&&("number"==typeof e?"function"==typeof r&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},void 0===t&&(t=r.bits||2048),void 0===e&&(e=r.e||65537),!i.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(65537===e||3===e))if(n){if(_("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(t,e,r){if(t)return n(t);n(null,{privateKey:u.privateKeyFromPem(r),publicKey:u.publicKeyFromPem(e)})}));if(E("generateKey")&&E("exportKey"))return s.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(t){return s.globalScope.crypto.subtle.exportKey("pkcs8",t.privateKey)})).then(void 0,(function(t){n(t)})).then((function(t){if(t){var e=u.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(t)));n(null,{privateKey:e,publicKey:u.setRsaPublicKey(e.n,e.e)})}}));if(M("generateKey")&&M("exportKey")){var h=s.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);return h.oncomplete=function(t){var e=t.target.result,r=s.globalScope.msCrypto.subtle.exportKey("pkcs8",e.privateKey);r.oncomplete=function(t){var e=t.target.result,r=u.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(e)));n(null,{privateKey:r,publicKey:u.setRsaPublicKey(r.n,r.e)})},r.onerror=function(t){n(t)}},void(h.onerror=function(t){n(t)})}}else if(_("generateKeyPairSync")){var f=a.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:u.privateKeyFromPem(f.privateKey),publicKey:u.publicKeyFromPem(f.publicKey)}}var c=u.rsa.createKeyPairGenerationState(t,e,r);if(!n)return u.rsa.stepKeyPairGenerationState(c,0),c.keys;g(c,r,n)},u.setRsaPublicKey=u.rsa.setPublicKey=function(t,e){var r={n:t,e:e,encrypt:function(t,e,n){if("string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===e)e={encode:function(t,e,r){return v(t,e,2).getBytes()}};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={encode:function(t,e){return i.pkcs1.encode_rsa_oaep(e,t,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(e))e={encode:function(t){return t}};else if("string"==typeof e)throw new Error('Unsupported encryption scheme: "'+e+'".');var a=e.encode(t,r,!0);return u.rsa.encrypt(a,r,!0)},verify:function(t,e,i){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,e){return e=y(e,r,!0),t===o.fromDer(e).value[1].value}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(t,e){return t===(e=y(e,r,!0))}});var n=u.rsa.decrypt(e,r,!0,!1);return i.verify(t,n,r.n.bitLength())}};return r},u.setRsaPrivateKey=u.rsa.setPrivateKey=function(t,e,r,n,a,o,s,h){var f={n:t,e:e,d:r,p:n,q:a,dP:o,dQ:s,qInv:h,decrypt:function(t,e,r){"string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5");var n=u.rsa.decrypt(t,f,!1,!1);if("RSAES-PKCS1-V1_5"===e)e={decode:y};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={decode:function(t,e){return i.pkcs1.decode_rsa_oaep(e,t,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(e))throw new Error('Unsupported encryption scheme: "'+e+'".');e={decode:function(t){return t}}}return e.decode(n,f,!1)},sign:function(t,e){var r=!1;"string"==typeof e&&(e=e.toUpperCase()),void 0===e||"RSASSA-PKCS1-V1_5"===e?(e={encode:p},r=1):"NONE"!==e&&"NULL"!==e&&null!==e||(e={encode:function(){return t}},r=1);var i=e.encode(t,f.n.bitLength());return u.rsa.encrypt(i,f,r)}};return f},u.wrapRsaPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(u.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(t).getBytes())])},u.privateKeyFromAsn1=function(t){var e,r,a,s,h,l,d,p,m={},v=[];if(o.validate(t,f,m,v)&&(t=o.fromDer(i.util.createBuffer(m.privateKey))),m={},v=[],!o.validate(t,c,m,v)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=v,y}return e=i.util.createBuffer(m.privateKeyModulus).toHex(),r=i.util.createBuffer(m.privateKeyPublicExponent).toHex(),a=i.util.createBuffer(m.privateKeyPrivateExponent).toHex(),s=i.util.createBuffer(m.privateKeyPrime1).toHex(),h=i.util.createBuffer(m.privateKeyPrime2).toHex(),l=i.util.createBuffer(m.privateKeyExponent1).toHex(),d=i.util.createBuffer(m.privateKeyExponent2).toHex(),p=i.util.createBuffer(m.privateKeyCoefficient).toHex(),u.setRsaPrivateKey(new n(e,16),new n(r,16),new n(a,16),new n(s,16),new n(h,16),new n(l,16),new n(d,16),new n(p,16))},u.privateKeyToAsn1=u.privateKeyToRSAPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.qInv))])},u.publicKeyFromAsn1=function(t){var e={},r=[];if(o.validate(t,d,e,r)){var a,s=o.derToOid(e.publicKeyOid);if(s!==u.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=s,a;t=e.rsaPublicKey}if(r=[],!o.validate(t,l,e,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var h=i.util.createBuffer(e.publicKeyModulus).toHex(),f=i.util.createBuffer(e.publicKeyExponent).toHex();return u.setRsaPublicKey(new n(h,16),new n(f,16))},u.publicKeyToAsn1=u.publicKeyToSubjectPublicKeyInfo=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(u.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[u.publicKeyToRSAPublicKey(t)])])},u.publicKeyToRSAPublicKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.e))])}},function(t,e,r){"use strict";(function(e){ +var i=r(12).clone,n=r(9),a=r(8),o=r(76),s={name:"PrivateKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,constructed:!1,capture:"keyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"keyOid"},{name:"AlgorithmIdentifier.parameters",captureAsn1:"keyParams"}]},{name:"PrivateKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OCTETSTRING,constructed:!1,capture:"keyValue"}]},u={name:"SubjectPublicKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"keyOid"},{name:"AlgorithmIdentifier.parameters",captureAsn1:"keyParams"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"keyValue"}]},h={name:"Certificate",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:a.asn1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:a.asn1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},f={THUMBPRINT_KEY:"internal\0thumbprint",THUMBPRINT_HASH:"SHA-256"};t.exports={validators:{privateKey:s,publicKey:u,certificate:h},thumbprint:function(t,r,i){if("function"!=typeof t.thumbprint)return Promise.reject(new Error("thumbprint not supported"));i=(i||f.THUMBPRINT_HASH).toUpperCase();var a=t.thumbprint(r),s=Object.keys(a).sort().map((function(t){var r=a[t];return e.isBuffer(r)&&(r=n.base64url.encode(r)),JSON.stringify(t)+":"+JSON.stringify(r)}));s="{"+s.join(",")+"}";try{return o.digest(i,e.from(s,"utf8"))}catch(t){return Promise.reject(t)}},unpackProps:function(t,r){var a;r.forEach((function(r){if(r.name in t){a=a||{};var o=t[r.name];switch(r.type){case"binary":e.isBuffer(o)?t[r.name]=n.base64url.encode(o):o=n.base64url.decode(o);break;case"string":case"number":case"boolean":break;case"array":o=[].concat(o);break;case"object":o=i(o)}a[r.name]=o}}));var o=a||{};return Object.keys(t).forEach((function(e){e in o||delete t[e]})),a},COMMON_PROPS:[{name:"kty",type:"string"},{name:"kid",type:"string"},{name:"use",type:"string"},{name:"alg",type:"string"},{name:"x5c",type:"array"},{name:"x5t",type:"binary"},{name:"x5u",type:"string"},{name:"key_ops",type:"array"}],INTERNALS:f}}).call(this,r(0).Buffer)},function(t,e,r){t.exports=n;var i=r(19).EventEmitter;function n(){i.call(this)}r(1)(n,i),n.Readable=r(83),n.Writable=r(291),n.Duplex=r(292),n.Transform=r(293),n.PassThrough=r(294),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",a),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",u));var o=!1;function s(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(f(),0===i.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",n),t.removeListener("drain",a),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",h),t.on("error",h),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(1),n=r(89),a=r(91),o=r(92),s=r(23);function u(t){s.call(this,"digest"),this._hash=t}i(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new n:"rmd160"===t||"ripemd160"===t?new a:new u(o(t))}},function(t,e,r){(function(e){t.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new e(i),a=0;a=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a=0||!a.gcd(e.n).equals(n.ONE));for(var o=(t=t.multiply(a.modPow(e.e,e.n)).mod(e.n)).mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);o.compareTo(s)<0;)o=o.add(e.p);var u=o.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return u=u.multiply(a.modInverse(e.n)).mod(e.n)};function v(t,e,r){var n=i.util.createBuffer(),a=Math.ceil(e.n.bitLength()/8);if(t.length>a-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=a-11,o}n.putByte(0),n.putByte(r);var s,u=a-3-t.length;if(0===r||1===r){s=0===r?0:255;for(var h=0;h0;){var f=0,c=i.random.getBytes(u);for(h=0;h1;){if(255!==o.getByte()){--o.read;break}++h}else if(2===u)for(h=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++h}if(0!==o.getByte()||h!==a-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function y(t,e,r){"function"==typeof e&&(r=e,e={});var a={algorithm:{name:(e=e||{}).algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};function o(){s(t.pBits,(function(e,i){return e?r(e):(t.p=i,null!==t.q?h(e,t.q):void s(t.qBits,h))}))}function s(t,e){i.prime.generateProbablePrime(t,a,e)}function h(e,i){if(e)return r(e);if(t.q=i,t.p.compareTo(t.q)<0){var a=t.p;t.p=t.q,t.q=a}if(0!==t.p.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.p=null,void o();if(0!==t.q.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.q=null,void s(t.qBits,h);if(t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),0!==t.phi.gcd(t.e).compareTo(n.ONE))return t.p=t.q=null,void o();if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits)return t.q=null,void s(t.qBits,h);var f=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}"prng"in e&&(a.prng=e.prng),o()}function b(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=i.util.hexToBytes(e);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function _(t){return i.util.isNodejs&&"function"==typeof a[t]}function E(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.crypto&&"object"==typeof s.globalScope.crypto.subtle&&"function"==typeof s.globalScope.crypto.subtle[t]}function M(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.msCrypto&&"object"==typeof s.globalScope.msCrypto.subtle&&"function"==typeof s.globalScope.msCrypto.subtle[t]}function S(t){for(var e=i.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n0;)f.putByte(0),--c;return f.putBytes(i.util.hexToBytes(h)),f.getBytes()},u.rsa.decrypt=function(t,e,r,a){var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=o,s}var u=new n(i.util.createBuffer(t).toHex(),16);if(u.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var h=m(u,e,r).toString(16),f=i.util.createBuffer(),c=o-Math.ceil(h.length/2);c>0;)f.putByte(0),--c;return f.putBytes(i.util.hexToBytes(h)),!1!==a?g(f.getBytes(),e,r):f.getBytes()},u.rsa.createKeyPairGenerationState=function(t,e,r){"string"==typeof t&&(t=parseInt(t,10)),t=t||2048;var a,o=(r=r||{}).prng||i.random,s={nextBytes:function(t){for(var e=o.getBytesSync(t.length),r=0;r>1,pBits:t-(t>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},u.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var i,a=0,o=function(t,e){return t|e},s=+new Date,f=0;null===t.keys&&(e<=0||fc?t.pqState=0:t.num.isProbablePrime(w(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(h[a++%8],0):2===t.pqState?t.pqState=0===t.num.subtract(n.ONE).gcd(t.e).compareTo(n.ONE)?3:0:3===t.pqState&&(t.pqState=0,null===t.p?t.p=t.num:t.q=t.num,null!==t.p&&null!==t.q&&++t.state,t.num=null)}else if(1===t.state)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(2===t.state)t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(3===t.state)0===t.phi.gcd(t.e).compareTo(n.ONE)?++t.state:(t.p=null,t.q=null,t.state=0);else if(4===t.state)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(5===t.state){var d=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,d,t.p,t.q,d.mod(t.p1),d.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)}}f+=(i=+new Date)-s,s=i}return null!==t.keys},u.rsa.generateKeyPair=function(t,e,r,n){if(1===arguments.length?"object"==typeof t?(r=t,t=void 0):"function"==typeof t&&(n=t,t=void 0):2===arguments.length?"number"==typeof t?"function"==typeof e?(n=e,e=void 0):"number"!=typeof e&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):3===arguments.length&&("number"==typeof e?"function"==typeof r&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},void 0===t&&(t=r.bits||2048),void 0===e&&(e=r.e||65537),!i.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(65537===e||3===e))if(n){if(_("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(t,e,r){if(t)return n(t);n(null,{privateKey:u.privateKeyFromPem(r),publicKey:u.publicKeyFromPem(e)})}));if(E("generateKey")&&E("exportKey"))return s.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(t){return s.globalScope.crypto.subtle.exportKey("pkcs8",t.privateKey)})).then(void 0,(function(t){n(t)})).then((function(t){if(t){var e=u.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(t)));n(null,{privateKey:e,publicKey:u.setRsaPublicKey(e.n,e.e)})}}));if(M("generateKey")&&M("exportKey")){var h=s.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);return h.oncomplete=function(t){var e=t.target.result,r=s.globalScope.msCrypto.subtle.exportKey("pkcs8",e.privateKey);r.oncomplete=function(t){var e=t.target.result,r=u.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(e)));n(null,{privateKey:r,publicKey:u.setRsaPublicKey(r.n,r.e)})},r.onerror=function(t){n(t)}},void(h.onerror=function(t){n(t)})}}else if(_("generateKeyPairSync")){var f=a.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:u.privateKeyFromPem(f.privateKey),publicKey:u.publicKeyFromPem(f.publicKey)}}var c=u.rsa.createKeyPairGenerationState(t,e,r);if(!n)return u.rsa.stepKeyPairGenerationState(c,0),c.keys;y(c,r,n)},u.setRsaPublicKey=u.rsa.setPublicKey=function(t,e){var r={n:t,e:e,encrypt:function(t,e,n){if("string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===e)e={encode:function(t,e,r){return v(t,e,2).getBytes()}};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={encode:function(t,e){return i.pkcs1.encode_rsa_oaep(e,t,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(e))e={encode:function(t){return t}};else if("string"==typeof e)throw new Error('Unsupported encryption scheme: "'+e+'".');var a=e.encode(t,r,!0);return u.rsa.encrypt(a,r,!0)},verify:function(t,e,i){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,e){return e=g(e,r,!0),t===o.fromDer(e).value[1].value}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(t,e){return t===(e=g(e,r,!0))}});var n=u.rsa.decrypt(e,r,!0,!1);return i.verify(t,n,r.n.bitLength())}};return r},u.setRsaPrivateKey=u.rsa.setPrivateKey=function(t,e,r,n,a,o,s,h){var f={n:t,e:e,d:r,p:n,q:a,dP:o,dQ:s,qInv:h,decrypt:function(t,e,r){"string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5");var n=u.rsa.decrypt(t,f,!1,!1);if("RSAES-PKCS1-V1_5"===e)e={decode:g};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={decode:function(t,e){return i.pkcs1.decode_rsa_oaep(e,t,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(e))throw new Error('Unsupported encryption scheme: "'+e+'".');e={decode:function(t){return t}}}return e.decode(n,f,!1)},sign:function(t,e){var r=!1;"string"==typeof e&&(e=e.toUpperCase()),void 0===e||"RSASSA-PKCS1-V1_5"===e?(e={encode:p},r=1):"NONE"!==e&&"NULL"!==e&&null!==e||(e={encode:function(){return t}},r=1);var i=e.encode(t,f.n.bitLength());return u.rsa.encrypt(i,f,r)}};return f},u.wrapRsaPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(u.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(t).getBytes())])},u.privateKeyFromAsn1=function(t){var e,r,a,s,h,l,d,p,m={},v=[];if(o.validate(t,f,m,v)&&(t=o.fromDer(i.util.createBuffer(m.privateKey))),m={},v=[],!o.validate(t,c,m,v)){var g=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw g.errors=v,g}return e=i.util.createBuffer(m.privateKeyModulus).toHex(),r=i.util.createBuffer(m.privateKeyPublicExponent).toHex(),a=i.util.createBuffer(m.privateKeyPrivateExponent).toHex(),s=i.util.createBuffer(m.privateKeyPrime1).toHex(),h=i.util.createBuffer(m.privateKeyPrime2).toHex(),l=i.util.createBuffer(m.privateKeyExponent1).toHex(),d=i.util.createBuffer(m.privateKeyExponent2).toHex(),p=i.util.createBuffer(m.privateKeyCoefficient).toHex(),u.setRsaPrivateKey(new n(e,16),new n(r,16),new n(a,16),new n(s,16),new n(h,16),new n(l,16),new n(d,16),new n(p,16))},u.privateKeyToAsn1=u.privateKeyToRSAPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.qInv))])},u.publicKeyFromAsn1=function(t){var e={},r=[];if(o.validate(t,d,e,r)){var a,s=o.derToOid(e.publicKeyOid);if(s!==u.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=s,a;t=e.rsaPublicKey}if(r=[],!o.validate(t,l,e,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var h=i.util.createBuffer(e.publicKeyModulus).toHex(),f=i.util.createBuffer(e.publicKeyExponent).toHex();return u.setRsaPublicKey(new n(h,16),new n(f,16))},u.publicKeyToAsn1=u.publicKeyToSubjectPublicKeyInfo=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(u.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[u.publicKeyToRSAPublicKey(t)])])},u.publicKeyToRSAPublicKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(t.e))])}},function(t,e,r){"use strict";(function(e){ /*! * util/base64url.js - Implementation of web-safe Base64 Encoder/Decoder * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(258),n={encode:function(t,r){return t instanceof ArrayBuffer&&(t=new Uint8Array(t)),e.isBuffer(t)||(t=e.from(t,r)),i.encode(t)},decode:i.toBuffer};t.exports=n}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ +var i=r(259),n={encode:function(t,r){return t instanceof ArrayBuffer&&(t=new Uint8Array(t)),e.isBuffer(t)||(t=e.from(t,r)),i.encode(t)},decode:i.toBuffer};t.exports=n}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ /*! * jwk/keystore.js - JWK KeyStore Implementation * @@ -93,7 +93,7 @@ var i=r(12).clone,n=r(20),a=r(8),o=r(9),s={BaseKey:r(54),helpers:r(43)},u=functi * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(12),n=r(20),a=r(262),o=i.assign,s=i.clone,u=i.flatten,h=i.intersection,f=i.omit,c=i.pick,l=i.uniq,d=r(76),p=r(134),m=r(43),v=r(9);t.exports=function(t,r,i,y){if(!t)throw new Error("kty cannot be null");if(!r)throw new Error("keystore cannot be null");if(!i)throw new Error("props cannot be null");if("string"==typeof i&&(i=JSON.parse(i)),!y)throw new Error("cfg cannot be null");var g,b,w=[],_={},E={};i=s(i),g=o({},i[m.INTERNALS.THUMBPRINT_KEY]||{}),delete i[m.INTERNALS.THUMBPRINT_KEY],Object.keys(g).forEach((function(t){var r=g[t];b||(b=r,e.isBuffer(b)&&(b=v.base64url.encode(b))),e.isBuffer(r)||(r=v.base64url.decode(r),g[t]=r)})),i.kty=t,i.kid=i.kid||b||a();var M,S=Object.keys(m.COMMON_PROPS).map((function(t){return m.COMMON_PROPS[t].name}));E.base=c(i,S),w=w.concat(Object.keys(E.base)),E.public=s(i),_.public=y.publicKey(E.public),_.public&&(w=w.concat(Object.keys(E.public))),E.private=s(i),_.private=y.privateKey(E.private),_.private&&(w=w.concat(Object.keys(E.private))),E.extra=f(i,w),M=_.public&&"length"in _.public?_.public.length:_.private&&"length"in _.private?_.private.length:NaN,Object.defineProperty(this,"keystore",{value:r,enumerable:!0}),Object.defineProperty(this,"length",{value:M,enumerable:!0}),Object.defineProperty(this,"kty",{value:t,enumerable:!0}),Object.defineProperty(this,"kid",{value:E.base.kid,enumerable:!0}),Object.defineProperty(this,"use",{value:E.base.use||"",enumerable:!0}),Object.defineProperty(this,"alg",{value:E.base.alg||"",enumerable:!0}),Object.defineProperty(this,"thumbprint",{value:function(t){if(t=(t||m.INTERNALS.THUMBPRINT_HASH).toUpperCase(),g[t])return Promise.resolve(g[t]);var e=m.thumbprint(y,E,t);return e=e.then((function(e){return e&&(g[t]=e),e}))}}),Object.defineProperty(this,"algorithms",{value:function(e){var r=[];this.use&&"sig"!==this.use||(e&&p.MODE_SIGN!==e||r.push(p.MODE_SIGN),e&&p.MODE_VERIFY!==e||r.push(p.MODE_VERIFY)),this.use&&"enc"!==this.use||(e&&p.MODE_ENCRYPT!==e||r.push(p.MODE_ENCRYPT),e&&p.MODE_DECRYPT!==e||r.push(p.MODE_DECRYPT),e&&p.MODE_WRAP!==e||r.push(p.MODE_WRAP),e&&p.MODE_UNWRAP!==e||r.push(p.MODE_UNWRAP));var i,n=this,a=r.map((function(t){return y.algorithms.call(n,_,t)}));(a=u(a),a=l(a),this.alg)&&(i="oct"===t?[this.alg,"dir"]:[this.alg],a=h(a,i));return a}}),Object.defineProperty(this,"supports",{value:function(t,e){return-1!==this.algorithms(e).indexOf(t)}}),Object.defineProperty(this,"has",{value:function(t,e){var r=!1;return r=(r=(r=(r=r||!(!E.base||!(t in E.base)))||!(!_.public||!(t in _.public)))||!(!E.extra||!(t in E.extra)))||!!(e&&_.private&&t in _.private)}}),Object.defineProperty(this,"get",{value:function(t,e){var r;return E.base&&t in E.base?r=E.base:_.public&&t in _.public?r=_.public:E.extra&&t in E.extra?r=E.extra:e&&_.private&&t in _.private&&(r=_.private),r&&r[t]||null}}),Object.defineProperty(this,"toJSON",{value:function(t,e){Array.isArray(t)&&(e=t,t=!1);var r={};return r=n(r,E.base,E.public,"boolean"==typeof t&&t?E.private:{},E.extra),r=f(r,e||[])}}),Object.defineProperty(this,"toPEM",{value:function(t){if(null===t&&(t=!1),!y.convertToPEM)throw new Error("Unsupported key type for PEM encoding");var e=t?_.private:_.public;if(!e)throw new Error("Invalid key");return y.convertToPEM.call(this,e,t)}}),Object.defineProperty(this,"toObject",{value:function(t,e){Array.isArray(t)&&(e=t,t=!1);var r={};return r=n(r,E.base,_.public,"boolean"==typeof t&&t?_.private:{},E.extra),r=f(r,(e||[]).concat("length"))}}),Object.defineProperty(this,"sign",{value:function(t,e,r){if(-1===this.algorithms("sign").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=y.signKey.call(this,t,_);return i?(r=r?s(r):{},y.signProps&&(r=n(r,y.signProps.call(this,t,r))),d.sign(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"verify",{value:function(t,e,r,i){if(-1===this.algorithms("verify").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var a=y.verifyKey.call(this,t,_);return a?(i=i?s(i):{},y.verifyProps&&(i=n(i,y.verifyProps.call(this,t,i))),d.verify(t,a,e,r,i)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"encrypt",{value:function(t,e,r){if(-1===this.algorithms("encrypt").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=y.encryptKey.call(this,t,_);return i?(r=r?s(r):{},y.encryptProps&&(r=n(r,y.encryptProps.call(this,t,r))),d.encrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"decrypt",{value:function(t,e,r){if(-1===this.algorithms("decrypt").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=y.decryptKey.call(this,t,_);return i?(r=r?s(r):{},y.decryptProps&&(r=n(r,y.decryptProps.call(this,t,r))),d.decrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"wrap",{value:function(t,e,r){if(-1===this.algorithms("wrap").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=y.wrapKey.call(this,t,_);return i?(r=r?s(r):{},y.wrapProps&&(r=n(r,y.wrapProps.call(this,t,r))),d.encrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"unwrap",{value:function(t,e,r){if(-1===this.algorithms("unwrap").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=y.unwrapKey.call(this,t,_);return i?(r=r?s(r):{},y.unwrapProps&&(r=n(r,y.unwrapProps.call(this,t,r))),d.decrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}})}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ +var i=r(12),n=r(20),a=r(263),o=i.assign,s=i.clone,u=i.flatten,h=i.intersection,f=i.omit,c=i.pick,l=i.uniq,d=r(76),p=r(134),m=r(43),v=r(9);t.exports=function(t,r,i,g){if(!t)throw new Error("kty cannot be null");if(!r)throw new Error("keystore cannot be null");if(!i)throw new Error("props cannot be null");if("string"==typeof i&&(i=JSON.parse(i)),!g)throw new Error("cfg cannot be null");var y,b,w=[],_={},E={};i=s(i),y=o({},i[m.INTERNALS.THUMBPRINT_KEY]||{}),delete i[m.INTERNALS.THUMBPRINT_KEY],Object.keys(y).forEach((function(t){var r=y[t];b||(b=r,e.isBuffer(b)&&(b=v.base64url.encode(b))),e.isBuffer(r)||(r=v.base64url.decode(r),y[t]=r)})),i.kty=t,i.kid=i.kid||b||a();var M,S=Object.keys(m.COMMON_PROPS).map((function(t){return m.COMMON_PROPS[t].name}));E.base=c(i,S),w=w.concat(Object.keys(E.base)),E.public=s(i),_.public=g.publicKey(E.public),_.public&&(w=w.concat(Object.keys(E.public))),E.private=s(i),_.private=g.privateKey(E.private),_.private&&(w=w.concat(Object.keys(E.private))),E.extra=f(i,w),M=_.public&&"length"in _.public?_.public.length:_.private&&"length"in _.private?_.private.length:NaN,Object.defineProperty(this,"keystore",{value:r,enumerable:!0}),Object.defineProperty(this,"length",{value:M,enumerable:!0}),Object.defineProperty(this,"kty",{value:t,enumerable:!0}),Object.defineProperty(this,"kid",{value:E.base.kid,enumerable:!0}),Object.defineProperty(this,"use",{value:E.base.use||"",enumerable:!0}),Object.defineProperty(this,"alg",{value:E.base.alg||"",enumerable:!0}),Object.defineProperty(this,"thumbprint",{value:function(t){if(t=(t||m.INTERNALS.THUMBPRINT_HASH).toUpperCase(),y[t])return Promise.resolve(y[t]);var e=m.thumbprint(g,E,t);return e=e.then((function(e){return e&&(y[t]=e),e}))}}),Object.defineProperty(this,"algorithms",{value:function(e){var r=[];this.use&&"sig"!==this.use||(e&&p.MODE_SIGN!==e||r.push(p.MODE_SIGN),e&&p.MODE_VERIFY!==e||r.push(p.MODE_VERIFY)),this.use&&"enc"!==this.use||(e&&p.MODE_ENCRYPT!==e||r.push(p.MODE_ENCRYPT),e&&p.MODE_DECRYPT!==e||r.push(p.MODE_DECRYPT),e&&p.MODE_WRAP!==e||r.push(p.MODE_WRAP),e&&p.MODE_UNWRAP!==e||r.push(p.MODE_UNWRAP));var i,n=this,a=r.map((function(t){return g.algorithms.call(n,_,t)}));(a=u(a),a=l(a),this.alg)&&(i="oct"===t?[this.alg,"dir"]:[this.alg],a=h(a,i));return a}}),Object.defineProperty(this,"supports",{value:function(t,e){return-1!==this.algorithms(e).indexOf(t)}}),Object.defineProperty(this,"has",{value:function(t,e){var r=!1;return r=(r=(r=(r=r||!(!E.base||!(t in E.base)))||!(!_.public||!(t in _.public)))||!(!E.extra||!(t in E.extra)))||!!(e&&_.private&&t in _.private)}}),Object.defineProperty(this,"get",{value:function(t,e){var r;return E.base&&t in E.base?r=E.base:_.public&&t in _.public?r=_.public:E.extra&&t in E.extra?r=E.extra:e&&_.private&&t in _.private&&(r=_.private),r&&r[t]||null}}),Object.defineProperty(this,"toJSON",{value:function(t,e){Array.isArray(t)&&(e=t,t=!1);var r={};return r=n(r,E.base,E.public,"boolean"==typeof t&&t?E.private:{},E.extra),r=f(r,e||[])}}),Object.defineProperty(this,"toPEM",{value:function(t){if(null===t&&(t=!1),!g.convertToPEM)throw new Error("Unsupported key type for PEM encoding");var e=t?_.private:_.public;if(!e)throw new Error("Invalid key");return g.convertToPEM.call(this,e,t)}}),Object.defineProperty(this,"toObject",{value:function(t,e){Array.isArray(t)&&(e=t,t=!1);var r={};return r=n(r,E.base,_.public,"boolean"==typeof t&&t?_.private:{},E.extra),r=f(r,(e||[]).concat("length"))}}),Object.defineProperty(this,"sign",{value:function(t,e,r){if(-1===this.algorithms("sign").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=g.signKey.call(this,t,_);return i?(r=r?s(r):{},g.signProps&&(r=n(r,g.signProps.call(this,t,r))),d.sign(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"verify",{value:function(t,e,r,i){if(-1===this.algorithms("verify").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var a=g.verifyKey.call(this,t,_);return a?(i=i?s(i):{},g.verifyProps&&(i=n(i,g.verifyProps.call(this,t,i))),d.verify(t,a,e,r,i)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"encrypt",{value:function(t,e,r){if(-1===this.algorithms("encrypt").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=g.encryptKey.call(this,t,_);return i?(r=r?s(r):{},g.encryptProps&&(r=n(r,g.encryptProps.call(this,t,r))),d.encrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"decrypt",{value:function(t,e,r){if(-1===this.algorithms("decrypt").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=g.decryptKey.call(this,t,_);return i?(r=r?s(r):{},g.decryptProps&&(r=n(r,g.decryptProps.call(this,t,r))),d.decrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"wrap",{value:function(t,e,r){if(-1===this.algorithms("wrap").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=g.wrapKey.call(this,t,_);return i?(r=r?s(r):{},g.wrapProps&&(r=n(r,g.wrapProps.call(this,t,r))),d.encrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"unwrap",{value:function(t,e,r){if(-1===this.algorithms("unwrap").indexOf(t))return Promise.reject(new Error("unsupported algorithm"));var i=g.unwrapKey.call(this,t,_);return i?(r=r?s(r):{},g.unwrapProps&&(r=n(r,g.unwrapProps.call(this,t,r))),d.decrypt(t,i,e,r)):Promise.reject(new Error("improper key"))}})}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ /*! * algorithms/sha.js - Cryptographic Secure Hash Algorithms, versions 1 and 2 * @@ -105,29 +105,29 @@ var i=r(8),n=r(13);var a={};["SHA-1","SHA-256","SHA-384","SHA-512"].forEach((fun * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(78),n=t.exports={intToBigEndian:function(t,r,i){if("number"==typeof t)switch(arguments.length){case 1:r=e.alloc(4),n.intToBigEndian(t,r,0);break;case 3:r[i]=255&t>>>24,r[++i]=255&t>>>16,r[++i]=255&t>>>8,r[++i]=255&t;break;default:throw new TypeError("Expected 1 or 3 arguments.")}else switch(arguments.length){case 1:r=e.alloc(4*t.length),n.intToBigEndian(t,r,0);break;case 3:for(var a=0;a>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&v]^e[y++],o=h[p>>>24]^f[m>>>16&255]^c[v>>>8&255]^l[255&d]^e[y++],s=h[m>>>24]^f[v>>>16&255]^c[d>>>8&255]^l[255&p]^e[y++],u=h[v>>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[y++],d=a,p=o,m=s,v=u;return a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&v])^e[y++],o=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[v>>>8&255]<<8|i[255&d])^e[y++],s=(i[m>>>24]<<24|i[v>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[y++],u=(i[v>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[y++],[a>>>=0,o>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[o]=h,i[h]=o;var f=t[o],c=t[f],l=t[c],d=257*t[h]^16843008*h;n[0][o]=d<<24|d>>>8,n[1][o]=d<<16|d>>>16,n[2][o]=d<<8|d>>>24,n[3][o]=d,d=16843009*l^65537*c^257*f^16843008*o,a[0][h]=d<<24|d>>>8,a[1][h]=d<<16|d>>>16,a[2][h]=d<<8|d>>>24,a[3][h]=d,0===o?o=s=1:(o=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function h(t){this._key=n(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],a=0;a>>24,o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o],o^=s[a/e|0]<<24):e>6&&a%e==4&&(o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o]),n[a]=n[a-e]^o}for(var h=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return o(t=n(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=o(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},h.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=h},function(t,e,r){var i=r(2).Buffer,n=r(89);t.exports=function(t,e,r,a){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,s=i.alloc(o),u=i.alloc(a||0),h=i.alloc(0);o>0||a>0;){var f=new n;f.update(h),f.update(t),e&&f.update(e),h=f.digest();var c=0;if(o>0){var l=s.length-o;c=Math.min(o,h.length),h.copy(s,l,0,c),o-=c}if(c0){var d=u.length-a,p=Math.min(a,h.length-c);h.copy(u,d,c,c+p),a-=p}}return h.fill(0),{key:s,iv:u}}},function(t,e,r){"use strict";var i=r(18),n=r(11),a=n.getNAF,o=n.getJSF,s=n.assert;function u(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,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(t,e){s(t.precomputed);var r=t._getDoubles(),i=a(e,1,this._bitLength),n=(1<=u;e--)h=(h<<1)+i[e];o.push(h)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=n;l>0;l--){for(u=0;u=0;h--){for(e=0;h>=0&&0===o[h];h--)e++;if(h>=0&&e++,u=u.dblp(e),h<0)break;var f=o[h];s(0!==f),u="affine"===t.type?f>0?u.mixedAdd(n[f-1>>1]):u.mixedAdd(n[-f-1>>1].neg()):f>0?u.add(n[f-1>>1]):u.add(n[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,i,n){for(var s=this._wnafT1,u=this._wnafT2,h=this._wnafT3,f=0,c=0;c=1;c-=2){var d=c-1,p=c;if(1===s[d]&&1===s[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=o(r[d],r[p]);f=Math.max(y[0].length,f),h[d]=new Array(f),h[p]=new Array(f);for(var g=0;g=0;c--){for(var M=0;c>=0;){var S=!0;for(g=0;g=0&&M++,_=_.dblp(M),c<0)break;for(g=0;g0?C=u[g][A-1>>1]:A<0&&(C=u[g][-A-1>>1].neg()),_="affine"===C.type?_.mixedAdd(C):_.add(C))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n>>24,r[++i]=255&t>>>16,r[++i]=255&t>>>8,r[++i]=255&t;break;default:throw new TypeError("Expected 1 or 3 arguments.")}else switch(arguments.length){case 1:r=e.alloc(4*t.length),n.intToBigEndian(t,r,0);break;case 3:for(var a=0;a>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&v]^e[g++],o=h[p>>>24]^f[m>>>16&255]^c[v>>>8&255]^l[255&d]^e[g++],s=h[m>>>24]^f[v>>>16&255]^c[d>>>8&255]^l[255&p]^e[g++],u=h[v>>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[g++],d=a,p=o,m=s,v=u;return a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&v])^e[g++],o=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[v>>>8&255]<<8|i[255&d])^e[g++],s=(i[m>>>24]<<24|i[v>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[g++],u=(i[v>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[g++],[a>>>=0,o>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[o]=h,i[h]=o;var f=t[o],c=t[f],l=t[c],d=257*t[h]^16843008*h;n[0][o]=d<<24|d>>>8,n[1][o]=d<<16|d>>>16,n[2][o]=d<<8|d>>>24,n[3][o]=d,d=16843009*l^65537*c^257*f^16843008*o,a[0][h]=d<<24|d>>>8,a[1][h]=d<<16|d>>>16,a[2][h]=d<<8|d>>>24,a[3][h]=d,0===o?o=s=1:(o=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function h(t){this._key=n(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],a=0;a>>24,o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o],o^=s[a/e|0]<<24):e>6&&a%e==4&&(o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o]),n[a]=n[a-e]^o}for(var h=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return o(t=n(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=o(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},h.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=h},function(t,e,r){var i=r(2).Buffer,n=r(89);t.exports=function(t,e,r,a){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,s=i.alloc(o),u=i.alloc(a||0),h=i.alloc(0);o>0||a>0;){var f=new n;f.update(h),f.update(t),e&&f.update(e),h=f.digest();var c=0;if(o>0){var l=s.length-o;c=Math.min(o,h.length),h.copy(s,l,0,c),o-=c}if(c0){var d=u.length-a,p=Math.min(a,h.length-c);h.copy(u,d,c,c+p),a-=p}}return h.fill(0),{key:s,iv:u}}},function(t,e,r){"use strict";var i=r(18),n=r(11),a=n.getNAF,o=n.getJSF,s=n.assert;function u(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,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(t,e){s(t.precomputed);var r=t._getDoubles(),i=a(e,1,this._bitLength),n=(1<=u;e--)h=(h<<1)+i[e];o.push(h)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=n;l>0;l--){for(u=0;u=0;h--){for(e=0;h>=0&&0===o[h];h--)e++;if(h>=0&&e++,u=u.dblp(e),h<0)break;var f=o[h];s(0!==f),u="affine"===t.type?f>0?u.mixedAdd(n[f-1>>1]):u.mixedAdd(n[-f-1>>1].neg()):f>0?u.add(n[f-1>>1]):u.add(n[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,i,n){for(var s=this._wnafT1,u=this._wnafT2,h=this._wnafT3,f=0,c=0;c=1;c-=2){var d=c-1,p=c;if(1===s[d]&&1===s[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=o(r[d],r[p]);f=Math.max(g[0].length,f),h[d]=new Array(f),h[p]=new Array(f);for(var y=0;y=0;c--){for(var M=0;c>=0;){var S=!0;for(y=0;y=0&&M++,_=_.dblp(M),c<0)break;for(y=0;y0?C=u[y][A-1>>1]:A<0&&(C=u[y][-A-1>>1].neg()),_="affine"===C.type?_.mixedAdd(C):_.add(C))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;ne.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=i.util.createBuffer(),n=i.util.createBuffer(),h=o.length();for(u=0;u4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),t=e.from(t,"binary"),r=e.from(r,"binary"),u?4===n.pbkdf2Sync.length?n.pbkdf2(t,r,a,o,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):n.pbkdf2(t,r,a,o,s,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(t,r,a,o).toString("binary"):n.pbkdf2Sync(t,r,a,o,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in i.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=i.md[s].create()}var h=s.digestLength;if(o>4294967295*h){var f=new Error("Derived key is too long.");if(u)return u(f);throw f}var c=Math.ceil(o/h),l=o-(c-1)*h,d=i.hmac.create();d.start(s,t);var p,m,v,y="";if(!u){for(var g=1;g<=c;++g){d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(g)),p=v=d.digest().getBytes();for(var b=2;b<=a;++b)d.start(null,null),d.update(v),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,h),v=m;y+=gc)return u(null,y);d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(g)),p=v=d.digest().getBytes(),b=2,_()}function _(){if(b<=a)return d.start(null,null),d.update(v),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,h),v=m,++b,i.util.setImmediate(_);y+=g>>0,u>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=u[1],u[1]=u[0]+(n.fullMessageLength[h]/4294967296>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,u[0]=u[1]/4294967296>>>0;return e.putBytes(a),s(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var u,h=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-h));for(var f=8*n.fullMessageLength[0],c=0;c>>0,o.putInt32(f>>>0),f=u>>>0;o.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};s(l,r,o);var d=i.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d},n};var a=null,o=!1;function s(t,e,r){for(var i,n,a,o,s,u,h,f=r.length();f>=64;){for(n=t.h0,a=t.h1,o=t.h2,s=t.h3,u=t.h4,h=0;h<16;++h)i=r.getInt32(),e[h]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+u+1518500249+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<20;++h)i=(i=e[h-3]^e[h-8]^e[h-14]^e[h-16])<<1|i>>>31,e[h]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+u+1518500249+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<32;++h)i=(i=e[h-3]^e[h-8]^e[h-14]^e[h-16])<<1|i>>>31,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+1859775393+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<40;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+1859775393+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<60;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a&o|s&(a^o))+u+2400959708+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<80;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+3395469782+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;t.h0=t.h0+n|0,t.h1=t.h1+a|0,t.h2=t.h2+o|0,t.h3=t.h3+s|0,t.h4=t.h4+u|0,f-=64}}},function(t,e,r){var i=r(3);function n(t,e){i.cipher.registerAlgorithm(t,(function(){return new i.des.Algorithm(t,e)}))}r(68),r(118),r(6),t.exports=i.des=i.des||{},i.des.startEncrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!1,mode:i||(null===e?"ECB":"CBC")});return n.start(e),n},i.des.createEncryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!1,mode:e})},i.des.startDecrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!0,mode:i||(null===e?"ECB":"CBC")});return n.start(e),n},i.des.createDecryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!0,mode:e})},i.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(t,e){return d(r._keys,t,e,!1)},decrypt:function(t,e){return d(r._keys,t,e,!0)}}}),r._init=!1},i.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=i.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==e.length())throw new Error("Invalid Triple-DES key size: "+8*e.length());this._keys=function(t){for(var e,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[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],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[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],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],h=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],c=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],v=t.length()>8?3:1,y=[],g=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^E))<<4,_^=e=65535&((E^=e)>>>-16^_),_^=(e=858993459&(_>>>2^(E^=e<<-16)))<<2,_^=e=65535&((E^=e)>>>-16^_),_^=(e=1431655765&(_>>>1^(E^=e<<-16)))<<1,_^=e=16711935&((E^=e)>>>8^_),e=(_^=(e=1431655765&(_>>>1^(E^=e<<8)))<<1)<<8|(E^=e)>>>20&240,_=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=e;for(var M=0;M>>26,E=E<<2|E>>>26):(_=_<<1|_>>>27,E=E<<1|E>>>27);var S=r[(_&=-15)>>>28]|i[_>>>24&15]|n[_>>>20&15]|a[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|u[_>>>4&15],C=h[(E&=-15)>>>28]|f[E>>>24&15]|c[E>>>20&15]|l[E>>>16&15]|d[E>>>12&15]|p[E>>>8&15]|m[E>>>4&15];e=65535&(C>>>16^S),y[b++]=S^e,y[b++]=C^e<<16}}return y}(e),this._init=!0}},n("DES-ECB",i.cipher.modes.ecb),n("DES-CBC",i.cipher.modes.cbc),n("DES-CFB",i.cipher.modes.cfb),n("DES-OFB",i.cipher.modes.ofb),n("DES-CTR",i.cipher.modes.ctr),n("3DES-ECB",i.cipher.modes.ecb),n("3DES-CBC",i.cipher.modes.cbc),n("3DES-CFB",i.cipher.modes.cfb),n("3DES-OFB",i.cipher.modes.ofb),n("3DES-CTR",i.cipher.modes.ctr);var a=[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],s=[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],u=[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],h=[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],f=[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],c=[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],l=[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];function d(t,e,r,i){var n,d,p=32===t.length?3:9;n=3===p?i?[30,-2,-2]:[0,32,2]:i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=e[0],v=e[1];m^=(d=252645135&(m>>>4^v))<<4,m^=(d=65535&(m>>>16^(v^=d)))<<16,m^=d=858993459&((v^=d)>>>2^m),m^=d=16711935&((v^=d<<2)>>>8^m),m=(m^=(d=1431655765&(m>>>1^(v^=d<<8)))<<1)<<1|m>>>31,v=(v^=d)<<1|v>>>31;for(var y=0;y>>4|v<<28)^t[w+1];d=m,m=v,v=d^(o[_>>>24&63]|u[_>>>16&63]|f[_>>>8&63]|l[63&_]|a[E>>>24&63]|s[E>>>16&63]|h[E>>>8&63]|c[63&E])}d=m,m=v,v=d}v=v>>>1|v<<31,v^=d=1431655765&((m=m>>>1|m<<31)>>>1^v),v^=(d=16711935&(v>>>8^(m^=d<<1)))<<8,v^=(d=858993459&(v>>>2^(m^=d)))<<2,v^=d=65535&((m^=d)>>>16^v),v^=d=252645135&((m^=d<<16)>>>4^v),m^=d<<4,r[0]=m,r[1]=v}function p(t){var e,r="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(3);r(40),r(21),r(73),r(25),r(253),r(24),r(41),r(75),r(51),r(6);var n=i.asn1,a=t.exports=i.pki=i.pki||{},o=a.oids,s={};s.CN=o.commonName,s.commonName="CN",s.C=o.countryName,s.countryName="C",s.L=o.localityName,s.localityName="L",s.ST=o.stateOrProvinceName,s.stateOrProvinceName="ST",s.O=o.organizationName,s.organizationName="O",s.OU=o.organizationalUnitName,s.organizationalUnitName="OU",s.E=o.emailAddress,s.emailAddress="E";var u=i.pki.rsa.publicKeyValidator,h={name:"Certificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(t,e){"string"==typeof e&&(e={shortName:e});for(var r,i=null,n=0;null===i&&n128)throw new Error('Invalid "nsComment" content.');t.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,t.comment)}else if("subjectKeyIdentifier"===t.name&&e.cert){var d=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=d.toHex(),t.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===t.name&&e.cert){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;if(t.keyIdentifier){var p=!0===t.keyIdentifier?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;f.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,p))}if(t.authorityCertIssuer){var v=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===t.authorityCertIssuer?e.cert.issuer:t.authorityCertIssuer)])];f.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,v))}if(t.serialNumber){var y=i.util.hexToBytes(!0===t.serialNumber?e.cert.serialNumber:t.serialNumber);f.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if("cRLDistributionPoints"===t.name){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;var g,b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),w=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(l=0;l2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=c[0],u.validity.notAfter=c[1],u.tbsCertificate=r.tbsCertificate,e){var l;if(u.md=null,u.signatureOid in o)switch(o[u.signatureOid]){case"sha1WithRSAEncryption":u.md=i.md.sha1.create();break;case"md5WithRSAEncryption":u.md=i.md.md5.create();break;case"sha256WithRSAEncryption":u.md=i.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=i.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=i.md.sha512.create();break;case"RSASSA-PSS":u.md=i.md.sha256.create()}if(null===u.md)throw(l=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=u.signatureOid,l;var m=n.toDer(u.tbsCertificate);u.md.update(m.getBytes())}var y=i.md.sha1.create();u.issuer.getField=function(t){return d(u.issuer,t)},u.issuer.addField=function(t){v([t]),u.issuer.attributes.push(t)},u.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=y.digest().toHex();var g=i.md.sha1.create();return u.subject.getField=function(t){return d(u.subject,t)},u.subject.addField=function(t){v([t]),u.subject.attributes.push(t)},u.subject.attributes=a.RDNAttributesAsArray(r.certSubject,g),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=g.digest().toHex(),r.certExtensions?u.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},a.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(r=u.value.charCodeAt(1),a=u.value.length>2?u.value.charCodeAt(2):0),e.digitalSignature=128==(128&r),e.nonRepudiation=64==(64&r),e.keyEncipherment=32==(32&r),e.dataEncipherment=16==(16&r),e.keyAgreement=8==(8&r),e.keyCertSign=4==(4&r),e.cRLSign=2==(2&r),e.encipherOnly=1==(1&r),e.decipherOnly=128==(128&a)}else if("basicConstraints"===e.name){(u=n.fromDer(e.value)).value.length>0&&u.value[0].type===n.Type.BOOLEAN?e.cA=0!==u.value[0].value.charCodeAt(0):e.cA=!1;var s=null;u.value.length>0&&u.value[0].type===n.Type.INTEGER?s=u.value[0].value:u.value.length>1&&(s=u.value[1].value),null!==s&&(e.pathLenConstraint=n.derToInteger(s))}else if("extKeyUsage"===e.name)for(var u=n.fromDer(e.value),h=0;h1&&(r=u.value.charCodeAt(1)),e.client=128==(128&r),e.server=64==(64&r),e.email=32==(32&r),e.objsign=16==(16&r),e.reserved=8==(8&r),e.sslCA=4==(4&r),e.emailCA=2==(2&r),e.objCA=1==(1&r)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){var c;e.altNames=[];u=n.fromDer(e.value);for(var l=0;l=w&&t<_?n.create(n.Class.UNIVERSAL,n.Type.UTCTIME,!1,n.dateToUtcTime(t)):n.create(n.Class.UNIVERSAL,n.Type.GENERALIZEDTIME,!1,n.dateToGeneralizedTime(t))}a.getTBSCertificate=function(t){var e=E(t.validity.notBefore),r=E(t.validity.notAfter),o=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,i.util.hexToBytes(t.serialNumber)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.siginfo.algorithmOid).getBytes()),g(t.siginfo.algorithmOid,t.siginfo.parameters)]),m(t.issuer),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[e,r]),m(t.subject),a.publicKeyToAsn1(t.publicKey)]);return t.issuer.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.issuer.uniqueId)])),t.subject.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.subject.uniqueId)])),t.extensions.length>0&&o.value.push(a.certificateExtensionsToAsn1(t.extensions)),o},a.getCertificationRequestInfo=function(t){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes()),m(t.subject),a.publicKeyToAsn1(t.publicKey),b(t)])},a.distinguishedNameToAsn1=function(t){return m(t)},a.certificateToAsn1=function(t){var e=t.tbsCertificate||a.getTBSCertificate(t);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[e,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.signatureOid).getBytes()),g(t.signatureOid,t.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])},a.certificateExtensionsToAsn1=function(t){var e=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);e.value.push(r);for(var i=0;if.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:o}),null===u){if(null===(c=e[0]||t.getIssuer(f))&&f.isIssuer(f)&&(l=!0,c=f),c){var d=c;i.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){c=d.shift();try{p=c.verify(f)}catch(t){}}p||(u={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==u||c&&!l||t.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===u&&c&&!f.isIssuer(c)&&(u={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===u)for(var m={keyUsage:!0,basicConstraints:!0},v=0;null===u&&vg.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var w=null===u||u.error,_=r.verify?r.verify(w,h,n):w;if(!0!==_)throw!0===w&&(u={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(_||0===_)&&("object"!=typeof _||i.util.isArray(_)?"string"==typeof _&&(u.error=_):(_.message&&(u.message=_.message),_.error&&(u.error=_.error))),u;u=null,s=!1,++h}while(e.length>0);return!0}},function(t,e,r){var i=r(3);r(22),r(6),(t.exports=i.pss=i.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e,r=t.md,n=t.mgf,a=r.digestLength,o=t.salt||null;if("string"==typeof o&&(o=i.util.createBuffer(o)),"saltLength"in t)e=t.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");e=o.length()}if(null!==o&&o.length()!==e)throw new Error("Given salt length does not match length of given salt.");var s=t.prng||i.random,u={encode:function(t,u){var h,f,c=u-1,l=Math.ceil(c/8),d=t.digest().getBytes();if(l>8*l-c&255;return(w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1))+m+String.fromCharCode(188)},verify:function(t,o,s){var u,h=s-1,f=Math.ceil(h/8);if(o=o.substr(-f),f>8*f-h&255;if(0!=(l.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(d,c),v="";for(u=0;ue.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=i.util.createBuffer(),n=i.util.createBuffer(),h=o.length();for(u=0;u4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),t=e.from(t,"binary"),r=e.from(r,"binary"),u?4===n.pbkdf2Sync.length?n.pbkdf2(t,r,a,o,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):n.pbkdf2(t,r,a,o,s,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(t,r,a,o).toString("binary"):n.pbkdf2Sync(t,r,a,o,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in i.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=i.md[s].create()}var h=s.digestLength;if(o>4294967295*h){var f=new Error("Derived key is too long.");if(u)return u(f);throw f}var c=Math.ceil(o/h),l=o-(c-1)*h,d=i.hmac.create();d.start(s,t);var p,m,v,g="";if(!u){for(var y=1;y<=c;++y){d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(y)),p=v=d.digest().getBytes();for(var b=2;b<=a;++b)d.start(null,null),d.update(v),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,h),v=m;g+=yc)return u(null,g);d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(y)),p=v=d.digest().getBytes(),b=2,_()}function _(){if(b<=a)return d.start(null,null),d.update(v),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,h),v=m,++b,i.util.setImmediate(_);g+=y>>0,u>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=u[1],u[1]=u[0]+(n.fullMessageLength[h]/4294967296>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,u[0]=u[1]/4294967296>>>0;return e.putBytes(a),s(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var u,h=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-h));for(var f=8*n.fullMessageLength[0],c=0;c>>0,o.putInt32(f>>>0),f=u>>>0;o.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};s(l,r,o);var d=i.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d},n};var a=null,o=!1;function s(t,e,r){for(var i,n,a,o,s,u,h,f=r.length();f>=64;){for(n=t.h0,a=t.h1,o=t.h2,s=t.h3,u=t.h4,h=0;h<16;++h)i=r.getInt32(),e[h]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+u+1518500249+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<20;++h)i=(i=e[h-3]^e[h-8]^e[h-14]^e[h-16])<<1|i>>>31,e[h]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+u+1518500249+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<32;++h)i=(i=e[h-3]^e[h-8]^e[h-14]^e[h-16])<<1|i>>>31,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+1859775393+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<40;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+1859775393+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<60;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a&o|s&(a^o))+u+2400959708+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;h<80;++h)i=(i=e[h-6]^e[h-16]^e[h-28]^e[h-32])<<2|i>>>30,e[h]=i,i=(n<<5|n>>>27)+(a^o^s)+u+3395469782+i,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;t.h0=t.h0+n|0,t.h1=t.h1+a|0,t.h2=t.h2+o|0,t.h3=t.h3+s|0,t.h4=t.h4+u|0,f-=64}}},function(t,e,r){var i=r(4);function n(t,e){i.cipher.registerAlgorithm(t,(function(){return new i.des.Algorithm(t,e)}))}r(68),r(118),r(6),t.exports=i.des=i.des||{},i.des.startEncrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!1,mode:i||(null===e?"ECB":"CBC")});return n.start(e),n},i.des.createEncryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!1,mode:e})},i.des.startDecrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!0,mode:i||(null===e?"ECB":"CBC")});return n.start(e),n},i.des.createDecryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!0,mode:e})},i.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(t,e){return d(r._keys,t,e,!1)},decrypt:function(t,e){return d(r._keys,t,e,!0)}}}),r._init=!1},i.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=i.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==e.length())throw new Error("Invalid Triple-DES key size: "+8*e.length());this._keys=function(t){for(var e,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[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],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[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],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],h=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],c=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],v=t.length()>8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^E))<<4,_^=e=65535&((E^=e)>>>-16^_),_^=(e=858993459&(_>>>2^(E^=e<<-16)))<<2,_^=e=65535&((E^=e)>>>-16^_),_^=(e=1431655765&(_>>>1^(E^=e<<-16)))<<1,_^=e=16711935&((E^=e)>>>8^_),e=(_^=(e=1431655765&(_>>>1^(E^=e<<8)))<<1)<<8|(E^=e)>>>20&240,_=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=e;for(var M=0;M>>26,E=E<<2|E>>>26):(_=_<<1|_>>>27,E=E<<1|E>>>27);var S=r[(_&=-15)>>>28]|i[_>>>24&15]|n[_>>>20&15]|a[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|u[_>>>4&15],C=h[(E&=-15)>>>28]|f[E>>>24&15]|c[E>>>20&15]|l[E>>>16&15]|d[E>>>12&15]|p[E>>>8&15]|m[E>>>4&15];e=65535&(C>>>16^S),g[b++]=S^e,g[b++]=C^e<<16}}return g}(e),this._init=!0}},n("DES-ECB",i.cipher.modes.ecb),n("DES-CBC",i.cipher.modes.cbc),n("DES-CFB",i.cipher.modes.cfb),n("DES-OFB",i.cipher.modes.ofb),n("DES-CTR",i.cipher.modes.ctr),n("3DES-ECB",i.cipher.modes.ecb),n("3DES-CBC",i.cipher.modes.cbc),n("3DES-CFB",i.cipher.modes.cfb),n("3DES-OFB",i.cipher.modes.ofb),n("3DES-CTR",i.cipher.modes.ctr);var a=[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],s=[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],u=[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],h=[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],f=[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],c=[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],l=[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];function d(t,e,r,i){var n,d,p=32===t.length?3:9;n=3===p?i?[30,-2,-2]:[0,32,2]:i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=e[0],v=e[1];m^=(d=252645135&(m>>>4^v))<<4,m^=(d=65535&(m>>>16^(v^=d)))<<16,m^=d=858993459&((v^=d)>>>2^m),m^=d=16711935&((v^=d<<2)>>>8^m),m=(m^=(d=1431655765&(m>>>1^(v^=d<<8)))<<1)<<1|m>>>31,v=(v^=d)<<1|v>>>31;for(var g=0;g>>4|v<<28)^t[w+1];d=m,m=v,v=d^(o[_>>>24&63]|u[_>>>16&63]|f[_>>>8&63]|l[63&_]|a[E>>>24&63]|s[E>>>16&63]|h[E>>>8&63]|c[63&E])}d=m,m=v,v=d}v=v>>>1|v<<31,v^=d=1431655765&((m=m>>>1|m<<31)>>>1^v),v^=(d=16711935&(v>>>8^(m^=d<<1)))<<8,v^=(d=858993459&(v>>>2^(m^=d)))<<2,v^=d=65535&((m^=d)>>>16^v),v^=d=252645135&((m^=d<<16)>>>4^v),m^=d<<4,r[0]=m,r[1]=v}function p(t){var e,r="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(4);r(40),r(21),r(73),r(25),r(254),r(24),r(41),r(75),r(51),r(6);var n=i.asn1,a=t.exports=i.pki=i.pki||{},o=a.oids,s={};s.CN=o.commonName,s.commonName="CN",s.C=o.countryName,s.countryName="C",s.L=o.localityName,s.localityName="L",s.ST=o.stateOrProvinceName,s.stateOrProvinceName="ST",s.O=o.organizationName,s.organizationName="O",s.OU=o.organizationalUnitName,s.organizationalUnitName="OU",s.E=o.emailAddress,s.emailAddress="E";var u=i.pki.rsa.publicKeyValidator,h={name:"Certificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(t,e){"string"==typeof e&&(e={shortName:e});for(var r,i=null,n=0;null===i&&n128)throw new Error('Invalid "nsComment" content.');t.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,t.comment)}else if("subjectKeyIdentifier"===t.name&&e.cert){var d=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=d.toHex(),t.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===t.name&&e.cert){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;if(t.keyIdentifier){var p=!0===t.keyIdentifier?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;f.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,p))}if(t.authorityCertIssuer){var v=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===t.authorityCertIssuer?e.cert.issuer:t.authorityCertIssuer)])];f.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,v))}if(t.serialNumber){var g=i.util.hexToBytes(!0===t.serialNumber?e.cert.serialNumber:t.serialNumber);f.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===t.name){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;var y,b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),w=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(l=0;l2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=c[0],u.validity.notAfter=c[1],u.tbsCertificate=r.tbsCertificate,e){var l;if(u.md=null,u.signatureOid in o)switch(o[u.signatureOid]){case"sha1WithRSAEncryption":u.md=i.md.sha1.create();break;case"md5WithRSAEncryption":u.md=i.md.md5.create();break;case"sha256WithRSAEncryption":u.md=i.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=i.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=i.md.sha512.create();break;case"RSASSA-PSS":u.md=i.md.sha256.create()}if(null===u.md)throw(l=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=u.signatureOid,l;var m=n.toDer(u.tbsCertificate);u.md.update(m.getBytes())}var g=i.md.sha1.create();u.issuer.getField=function(t){return d(u.issuer,t)},u.issuer.addField=function(t){v([t]),u.issuer.attributes.push(t)},u.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer,g),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=g.digest().toHex();var y=i.md.sha1.create();return u.subject.getField=function(t){return d(u.subject,t)},u.subject.addField=function(t){v([t]),u.subject.attributes.push(t)},u.subject.attributes=a.RDNAttributesAsArray(r.certSubject,y),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=y.digest().toHex(),r.certExtensions?u.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},a.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(r=u.value.charCodeAt(1),a=u.value.length>2?u.value.charCodeAt(2):0),e.digitalSignature=128==(128&r),e.nonRepudiation=64==(64&r),e.keyEncipherment=32==(32&r),e.dataEncipherment=16==(16&r),e.keyAgreement=8==(8&r),e.keyCertSign=4==(4&r),e.cRLSign=2==(2&r),e.encipherOnly=1==(1&r),e.decipherOnly=128==(128&a)}else if("basicConstraints"===e.name){(u=n.fromDer(e.value)).value.length>0&&u.value[0].type===n.Type.BOOLEAN?e.cA=0!==u.value[0].value.charCodeAt(0):e.cA=!1;var s=null;u.value.length>0&&u.value[0].type===n.Type.INTEGER?s=u.value[0].value:u.value.length>1&&(s=u.value[1].value),null!==s&&(e.pathLenConstraint=n.derToInteger(s))}else if("extKeyUsage"===e.name)for(var u=n.fromDer(e.value),h=0;h1&&(r=u.value.charCodeAt(1)),e.client=128==(128&r),e.server=64==(64&r),e.email=32==(32&r),e.objsign=16==(16&r),e.reserved=8==(8&r),e.sslCA=4==(4&r),e.emailCA=2==(2&r),e.objCA=1==(1&r)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){var c;e.altNames=[];u=n.fromDer(e.value);for(var l=0;l=w&&t<_?n.create(n.Class.UNIVERSAL,n.Type.UTCTIME,!1,n.dateToUtcTime(t)):n.create(n.Class.UNIVERSAL,n.Type.GENERALIZEDTIME,!1,n.dateToGeneralizedTime(t))}a.getTBSCertificate=function(t){var e=E(t.validity.notBefore),r=E(t.validity.notAfter),o=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,i.util.hexToBytes(t.serialNumber)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.siginfo.algorithmOid).getBytes()),y(t.siginfo.algorithmOid,t.siginfo.parameters)]),m(t.issuer),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[e,r]),m(t.subject),a.publicKeyToAsn1(t.publicKey)]);return t.issuer.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.issuer.uniqueId)])),t.subject.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.subject.uniqueId)])),t.extensions.length>0&&o.value.push(a.certificateExtensionsToAsn1(t.extensions)),o},a.getCertificationRequestInfo=function(t){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes()),m(t.subject),a.publicKeyToAsn1(t.publicKey),b(t)])},a.distinguishedNameToAsn1=function(t){return m(t)},a.certificateToAsn1=function(t){var e=t.tbsCertificate||a.getTBSCertificate(t);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[e,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.signatureOid).getBytes()),y(t.signatureOid,t.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])},a.certificateExtensionsToAsn1=function(t){var e=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);e.value.push(r);for(var i=0;if.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:o}),null===u){if(null===(c=e[0]||t.getIssuer(f))&&f.isIssuer(f)&&(l=!0,c=f),c){var d=c;i.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){c=d.shift();try{p=c.verify(f)}catch(t){}}p||(u={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==u||c&&!l||t.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===u&&c&&!f.isIssuer(c)&&(u={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===u)for(var m={keyUsage:!0,basicConstraints:!0},v=0;null===u&&vy.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var w=null===u||u.error,_=r.verify?r.verify(w,h,n):w;if(!0!==_)throw!0===w&&(u={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(_||0===_)&&("object"!=typeof _||i.util.isArray(_)?"string"==typeof _&&(u.error=_):(_.message&&(u.message=_.message),_.error&&(u.error=_.error))),u;u=null,s=!1,++h}while(e.length>0);return!0}},function(t,e,r){var i=r(4);r(22),r(6),(t.exports=i.pss=i.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e,r=t.md,n=t.mgf,a=r.digestLength,o=t.salt||null;if("string"==typeof o&&(o=i.util.createBuffer(o)),"saltLength"in t)e=t.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");e=o.length()}if(null!==o&&o.length()!==e)throw new Error("Given salt length does not match length of given salt.");var s=t.prng||i.random,u={encode:function(t,u){var h,f,c=u-1,l=Math.ceil(c/8),d=t.digest().getBytes();if(l>8*l-c&255;return(w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1))+m+String.fromCharCode(188)},verify:function(t,o,s){var u,h=s-1,f=Math.ceil(h/8);if(o=o.substr(-f),f>8*f-h&255;if(0!=(l.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(d,c),v="";for(u=0;ue.length?Promise.reject(new Error("invalid key length")):Promise.resolve(e)}return o.setupFallback((function(t,e,i){return s((i=i||{}).length,t).then((function(){var i=o.nodeCrypto.createHmac(r,t);i.update(e);var n=i.digest();return{data:e,mac:n}}))}),(function(t,r,i){var n={name:"HMAC",hash:{name:a}};return s((i=i||{}).length,t).then((function(){return o.subtleCrypto.importKey("raw",t,n,!0,["sign"])})).then((function(t){return o.subtleCrypto.sign(n,t,r)})).then((function(t){var i=e.from(t);return{data:r,mac:i}}))}),(function(t,i,a){return s((a=a||{}).length,t).then((function(){var a=n.hmac.create();return a.start(r,t.toString("binary")),a.update(i.toString("binary")),a=e.from(a.digest().bytes(),"binary"),{data:i,mac:a}}))}))}function u(t){var r=t.replace("HS","SHA").toLowerCase(),s=t.replace("HS","SHA-");function u(t,e,r){t=(t||i.HASHLENGTH[s])/8;for(var n=!0,a=0;t>a;a++)n=n&&e[a]===r[a];return n}return o.setupFallback((function(t,e,i,n){n=n||{};var a=o.nodeCrypto.createHmac(r,t);a.update(e);var s=a.digest();if(!u(n.length,i,s))throw new Error("verification failed");return{data:e,mac:s,valid:!0}}),(function(t,r,i,n){var a={name:"HMAC",hash:{name:s}};return((n=n||{}).length?o.subtleCrypto.importKey("raw",t,a,!0,["sign"]).then((function(t){return o.subtleCrypto.sign(a,t,r)})).then((function(t){var r=e.from(t);return u(n.length,i,r)})):o.subtleCrypto.importKey("raw",t,a,!0,["verify"]).then((function(t){return o.subtleCrypto.verify(a,t,i,r)}))).then((function(t){return t?{data:r,mac:i,valid:!0}:Promise.reject(new Error("verifaction failed"))}))}),(function(t,i,o,s){s=s||{};var h=n.hmac.create();return h.start(r,new a(t)),h.update(i.toString("binary")),h=e.from(h.digest().bytes(),"binary"),u(s.length,o,h)?Promise.resolve({data:i,mac:o,valid:!0}):Promise.reject(new Error("verification failed"))}))}var h={};["HS1","HS256","HS384","HS512"].forEach((function(t){h[t]={sign:s(t),verify:u(t)}})),t.exports=h}).call(this,r(0).Buffer)},function(t,e){t.exports=i;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function i(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function n(t){return!0===(t&&t.__isLong__)}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var a={},o={};function s(t,e){var r,i,n;return e?(n=0<=(t>>>=0)&&t<256)&&(i=o[t])?i:(r=h(t,(0|t)<0?-1:0,!0),n&&(o[t]=r),r):(n=-128<=(t|=0)&&t<128)&&(i=a[t])?i:(r=h(t,t<0?-1:0,!1),n&&(a[t]=r),r)}function u(t,e){if(isNaN(t))return e?g:y;if(e){if(t<0)return g;if(t>=p)return M}else{if(t<=-m)return S;if(t+1>=m)return E}return t<0?u(-t,e).neg():h(t%d|0,t/d|0,e)}function h(t,e,r){return new i(t,e,r)}i.fromInt=s,i.fromNumber=u,i.fromBits=h;var f=Math.pow;function c(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return y;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||360)throw Error("interior hyphen");if(0===i)return c(t.substring(1),e,r).neg();for(var n=u(f(r,8)),a=y,o=0;o>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},C.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((a=s).isZero())return h+o;for(;h.length<6;)h="0"+h;o=""+h+o}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(t){return n(t)||(t=l(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},C.eq=C.equals,C.notEquals=function(t){return!this.eq(t)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(t){return this.comp(t)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(t){return this.comp(t)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(t){return this.comp(t)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(t){return this.comp(t)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(t){if(n(t)||(t=l(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(b)},C.neg=C.negate,C.add=function(t){n(t)||(t=l(t));var e=this.high>>>16,r=65535&this.high,i=this.low>>>16,a=65535&this.low,o=t.high>>>16,s=65535&t.high,u=t.low>>>16,f=0,c=0,d=0,p=0;return d+=(p+=a+(65535&t.low))>>>16,c+=(d+=i+u)>>>16,f+=(c+=r+s)>>>16,f+=e+o,h((d&=65535)<<16|(p&=65535),(f&=65535)<<16|(c&=65535),this.unsigned)},C.subtract=function(t){return n(t)||(t=l(t)),this.add(t.neg())},C.sub=C.subtract,C.multiply=function(t){if(this.isZero())return y;if(n(t)||(t=l(t)),r)return h(r.mul(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned);if(t.isZero())return y;if(this.eq(S))return t.isOdd()?S:y;if(t.eq(S))return this.isOdd()?S:y;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(v)&&t.lt(v))return u(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,i=65535&this.high,a=this.low>>>16,o=65535&this.low,s=t.high>>>16,f=65535&t.high,c=t.low>>>16,d=65535&t.low,p=0,m=0,g=0,b=0;return g+=(b+=o*d)>>>16,m+=(g+=a*d)>>>16,g&=65535,m+=(g+=o*c)>>>16,p+=(m+=i*d)>>>16,m&=65535,p+=(m+=a*c)>>>16,m&=65535,p+=(m+=o*f)>>>16,p+=e*d+i*c+a*f+o*s,h((g&=65535)<<16|(b&=65535),(p&=65535)<<16|(m&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(t){if(n(t)||(t=l(t)),t.isZero())throw Error("division by zero");var e,i,a;if(r)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?h((this.unsigned?r.div_u:r.div_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?g:y;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return g;if(t.gt(this.shru(1)))return w;a=g}else{if(this.eq(S))return t.eq(b)||t.eq(_)?S:t.eq(S)?b:(e=this.shr(1).div(t).shl(1)).eq(y)?t.isNegative()?b:_:(i=this.sub(t.mul(e)),a=e.add(i.div(t)));if(t.eq(S))return this.unsigned?g:y;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=y}for(i=this;i.gte(t);){e=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(e)/Math.LN2),s=o<=48?1:f(2,o-48),c=u(e),d=c.mul(t);d.isNegative()||d.gt(i);)d=(c=u(e-=s,this.unsigned)).mul(t);c.isZero()&&(c=b),a=a.add(c),i=i.sub(d)}return a},C.div=C.divide,C.modulo=function(t){return n(t)||(t=l(t)),r?h((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return h(~this.low,~this.high,this.unsigned)},C.and=function(t){return n(t)||(t=l(t)),h(this.low&t.low,this.high&t.high,this.unsigned)},C.or=function(t){return n(t)||(t=l(t)),h(this.low|t.low,this.high|t.high,this.unsigned)},C.xor=function(t){return n(t)||(t=l(t)),h(this.low^t.low,this.high^t.high,this.unsigned)},C.shiftLeft=function(t){return n(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?h(this.low<>>32-t,this.unsigned):h(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):h(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(t){if(n(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?h(this.low>>>t|e<<32-t,e>>>t,this.unsigned):h(32===t?e:e>>>t-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},C.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},C.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},i.fromBytes=function(t,e,r){return r?i.fromBytesLE(t,e):i.fromBytesBE(t,e)},i.fromBytesLE=function(t,e){return new i(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},i.fromBytesBE=function(t,e){return new i(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},function(t,e,r){"use strict";(function(e){ +var i=r(17),n=r(8),a=r(42),o=r(13);function s(t){var r=t.replace("HS","SHA").toLowerCase(),a=t.replace("HS","SHA-");function s(t,e){return(t=(t||i.HASHLENGTH[a])/8)>e.length?Promise.reject(new Error("invalid key length")):Promise.resolve(e)}return o.setupFallback((function(t,e,i){return s((i=i||{}).length,t).then((function(){var i=o.nodeCrypto.createHmac(r,t);i.update(e);var n=i.digest();return{data:e,mac:n}}))}),(function(t,r,i){var n={name:"HMAC",hash:{name:a}};return s((i=i||{}).length,t).then((function(){return o.subtleCrypto.importKey("raw",t,n,!0,["sign"])})).then((function(t){return o.subtleCrypto.sign(n,t,r)})).then((function(t){var i=e.from(t);return{data:r,mac:i}}))}),(function(t,i,a){return s((a=a||{}).length,t).then((function(){var a=n.hmac.create();return a.start(r,t.toString("binary")),a.update(i.toString("binary")),a=e.from(a.digest().bytes(),"binary"),{data:i,mac:a}}))}))}function u(t){var r=t.replace("HS","SHA").toLowerCase(),s=t.replace("HS","SHA-");function u(t,e,r){t=(t||i.HASHLENGTH[s])/8;for(var n=!0,a=0;t>a;a++)n=n&&e[a]===r[a];return n}return o.setupFallback((function(t,e,i,n){n=n||{};var a=o.nodeCrypto.createHmac(r,t);a.update(e);var s=a.digest();if(!u(n.length,i,s))throw new Error("verification failed");return{data:e,mac:s,valid:!0}}),(function(t,r,i,n){var a={name:"HMAC",hash:{name:s}};return((n=n||{}).length?o.subtleCrypto.importKey("raw",t,a,!0,["sign"]).then((function(t){return o.subtleCrypto.sign(a,t,r)})).then((function(t){var r=e.from(t);return u(n.length,i,r)})):o.subtleCrypto.importKey("raw",t,a,!0,["verify"]).then((function(t){return o.subtleCrypto.verify(a,t,i,r)}))).then((function(t){return t?{data:r,mac:i,valid:!0}:Promise.reject(new Error("verifaction failed"))}))}),(function(t,i,o,s){s=s||{};var h=n.hmac.create();return h.start(r,new a(t)),h.update(i.toString("binary")),h=e.from(h.digest().bytes(),"binary"),u(s.length,o,h)?Promise.resolve({data:i,mac:o,valid:!0}):Promise.reject(new Error("verification failed"))}))}var h={};["HS1","HS256","HS384","HS512"].forEach((function(t){h[t]={sign:s(t),verify:u(t)}})),t.exports=h}).call(this,r(0).Buffer)},function(t,e){t.exports=i;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function i(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function n(t){return!0===(t&&t.__isLong__)}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var a={},o={};function s(t,e){var r,i,n;return e?(n=0<=(t>>>=0)&&t<256)&&(i=o[t])?i:(r=h(t,(0|t)<0?-1:0,!0),n&&(o[t]=r),r):(n=-128<=(t|=0)&&t<128)&&(i=a[t])?i:(r=h(t,t<0?-1:0,!1),n&&(a[t]=r),r)}function u(t,e){if(isNaN(t))return e?y:g;if(e){if(t<0)return y;if(t>=p)return M}else{if(t<=-m)return S;if(t+1>=m)return E}return t<0?u(-t,e).neg():h(t%d|0,t/d|0,e)}function h(t,e,r){return new i(t,e,r)}i.fromInt=s,i.fromNumber=u,i.fromBits=h;var f=Math.pow;function c(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return g;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||360)throw Error("interior hyphen");if(0===i)return c(t.substring(1),e,r).neg();for(var n=u(f(r,8)),a=g,o=0;o>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},C.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((a=s).isZero())return h+o;for(;h.length<6;)h="0"+h;o=""+h+o}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(t){return n(t)||(t=l(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},C.eq=C.equals,C.notEquals=function(t){return!this.eq(t)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(t){return this.comp(t)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(t){return this.comp(t)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(t){return this.comp(t)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(t){return this.comp(t)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(t){if(n(t)||(t=l(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(b)},C.neg=C.negate,C.add=function(t){n(t)||(t=l(t));var e=this.high>>>16,r=65535&this.high,i=this.low>>>16,a=65535&this.low,o=t.high>>>16,s=65535&t.high,u=t.low>>>16,f=0,c=0,d=0,p=0;return d+=(p+=a+(65535&t.low))>>>16,c+=(d+=i+u)>>>16,f+=(c+=r+s)>>>16,f+=e+o,h((d&=65535)<<16|(p&=65535),(f&=65535)<<16|(c&=65535),this.unsigned)},C.subtract=function(t){return n(t)||(t=l(t)),this.add(t.neg())},C.sub=C.subtract,C.multiply=function(t){if(this.isZero())return g;if(n(t)||(t=l(t)),r)return h(r.mul(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned);if(t.isZero())return g;if(this.eq(S))return t.isOdd()?S:g;if(t.eq(S))return this.isOdd()?S:g;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(v)&&t.lt(v))return u(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,i=65535&this.high,a=this.low>>>16,o=65535&this.low,s=t.high>>>16,f=65535&t.high,c=t.low>>>16,d=65535&t.low,p=0,m=0,y=0,b=0;return y+=(b+=o*d)>>>16,m+=(y+=a*d)>>>16,y&=65535,m+=(y+=o*c)>>>16,p+=(m+=i*d)>>>16,m&=65535,p+=(m+=a*c)>>>16,m&=65535,p+=(m+=o*f)>>>16,p+=e*d+i*c+a*f+o*s,h((y&=65535)<<16|(b&=65535),(p&=65535)<<16|(m&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(t){if(n(t)||(t=l(t)),t.isZero())throw Error("division by zero");var e,i,a;if(r)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?h((this.unsigned?r.div_u:r.div_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?y:g;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return y;if(t.gt(this.shru(1)))return w;a=y}else{if(this.eq(S))return t.eq(b)||t.eq(_)?S:t.eq(S)?b:(e=this.shr(1).div(t).shl(1)).eq(g)?t.isNegative()?b:_:(i=this.sub(t.mul(e)),a=e.add(i.div(t)));if(t.eq(S))return this.unsigned?y:g;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=g}for(i=this;i.gte(t);){e=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(e)/Math.LN2),s=o<=48?1:f(2,o-48),c=u(e),d=c.mul(t);d.isNegative()||d.gt(i);)d=(c=u(e-=s,this.unsigned)).mul(t);c.isZero()&&(c=b),a=a.add(c),i=i.sub(d)}return a},C.div=C.divide,C.modulo=function(t){return n(t)||(t=l(t)),r?h((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return h(~this.low,~this.high,this.unsigned)},C.and=function(t){return n(t)||(t=l(t)),h(this.low&t.low,this.high&t.high,this.unsigned)},C.or=function(t){return n(t)||(t=l(t)),h(this.low|t.low,this.high|t.high,this.unsigned)},C.xor=function(t){return n(t)||(t=l(t)),h(this.low^t.low,this.high^t.high,this.unsigned)},C.shiftLeft=function(t){return n(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?h(this.low<>>32-t,this.unsigned):h(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):h(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(t){if(n(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?h(this.low>>>t|e<<32-t,e>>>t,this.unsigned):h(32===t?e:e>>>t-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},C.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},C.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},i.fromBytes=function(t,e,r){return r?i.fromBytesLE(t,e):i.fromBytesBE(t,e)},i.fromBytesLE=function(t,e){return new i(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},i.fromBytesBE=function(t,e){return new i(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},function(t,e,r){"use strict";(function(e){ /*! * algorithms/aes-kw.js - AES-KW Key-Wrapping * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(13),n=r(8),a=r(42),o=e.from("a6a6a6a6a6a6a6a6","hex");function s(t,r){for(var i=Math.max(t.length,r.length),n=e.alloc(i),a=0;i>a;a++)n[a]=(t[a]||0)^(r[a]||0);return n}function u(t,e){for(var r=[],i=0;t.length>i;i+=e)r.push(t.slice(i,i+e));return r}function h(t){var r=Math.floor(t/4294967296),i=t%4294967296,n=e.alloc(8);return n[0]=255&r>>>24,n[1]=255&r>>>16,n[2]=255&r>>>8,n[3]=255&r>>>0,n[4]=255&i>>>24,n[5]=255&i>>>16,n[6]=255&i>>>8,n[7]=255&i>>>0,n}function f(t){function r(e,r){if(t!==e.length<<3)throw new Error("invalid key size");if(0m;m++)for(var v=0;d.length>v;v++){l=d.length*m+v+1,c=e.concat([f,d[v]]),f=s((c=i.nodeCrypto.createCipheriv("AES"+t,n,p).update(c)).slice(0,8),h(l)),d[v]=c.slice(8,16)}d=[f].concat(d);var y=e.concat(d);return Promise.resolve({data:y})}),(function(t,n){try{r(t,n)}catch(t){return Promise.reject(t)}var a={name:"AES-KW"},o=[i.subtleCrypto.importKey("raw",n,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),i.subtleCrypto.importKey("raw",t,a,!0,["wrapKey"])];return o=(o=(o=Promise.all(o)).then((function(t){return i.subtleCrypto.wrapKey("raw",t[0],t[1],a)}))).then((function(t){return{data:t=e.from(t)}}))}),(function(t,i){try{r(t,i)}catch(t){return Promise.reject(t)}var f,c,l,d=n.cipher.createCipher("AES",new a(t)),p=u(i,8);f=o;for(var m=0;6>m;m++)for(var v=0;p.length>v;v++)l=p.length*m+v+1,c=e.concat([f,p[v]]),d.start(),d.update(new a(c)),d.finish(),f=s((c=e.from(d.output.bytes(),"binary")).slice(0,8),h(l)),p[v]=c.slice(8,16);p=[f].concat(p);var y=e.concat(p);return Promise.resolve({data:y})}))}function c(t){function r(e,r){if(t!==e.length<<3)throw new Error("invalid key size");if(0a;a++)n[a]=(t[a]||0)^(r[a]||0);return n}function u(t,e){for(var r=[],i=0;t.length>i;i+=e)r.push(t.slice(i,i+e));return r}function h(t){var r=Math.floor(t/4294967296),i=t%4294967296,n=e.alloc(8);return n[0]=255&r>>>24,n[1]=255&r>>>16,n[2]=255&r>>>8,n[3]=255&r>>>0,n[4]=255&i>>>24,n[5]=255&i>>>16,n[6]=255&i>>>8,n[7]=255&i>>>0,n}function f(t){function r(e,r){if(t!==e.length<<3)throw new Error("invalid key size");if(0m;m++)for(var v=0;d.length>v;v++){l=d.length*m+v+1,c=e.concat([f,d[v]]),f=s((c=i.nodeCrypto.createCipheriv("AES"+t,n,p).update(c)).slice(0,8),h(l)),d[v]=c.slice(8,16)}d=[f].concat(d);var g=e.concat(d);return Promise.resolve({data:g})}),(function(t,n){try{r(t,n)}catch(t){return Promise.reject(t)}var a={name:"AES-KW"},o=[i.subtleCrypto.importKey("raw",n,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),i.subtleCrypto.importKey("raw",t,a,!0,["wrapKey"])];return o=(o=(o=Promise.all(o)).then((function(t){return i.subtleCrypto.wrapKey("raw",t[0],t[1],a)}))).then((function(t){return{data:t=e.from(t)}}))}),(function(t,i){try{r(t,i)}catch(t){return Promise.reject(t)}var f,c,l,d=n.cipher.createCipher("AES",new a(t)),p=u(i,8);f=o;for(var m=0;6>m;m++)for(var v=0;p.length>v;v++)l=p.length*m+v+1,c=e.concat([f,p[v]]),d.start(),d.update(new a(c)),d.finish(),f=s((c=e.from(d.output.bytes(),"binary")).slice(0,8),h(l)),p[v]=c.slice(8,16);p=[f].concat(p);var g=e.concat(p);return Promise.resolve({data:g})}))}function c(t){function r(e,r){if(t!==e.length<<3)throw new Error("invalid key size");if(0-1?i:a.nextTick;g.WritableState=y;var h=Object.create(r(45));h.inherits=r(1);var f={deprecate:r(86)},c=r(139),l=r(84).Buffer,d=n.Uint8Array||function(){};var p,m=r(140);function v(){}function y(t,e){s=s||r(26),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(a.nextTick(n,i),a.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,r,i,e,n);else{var o=E(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),i?u(w,t,r,o,n):w(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function g(t){if(s=s||r(26),!(p.call(g,this)||this instanceof s))return new g(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function b(t,e,r,i,n,a,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function w(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)n[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;n.allBuffers=u,b(t,e,!0,e.length,n,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(b(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(M,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(g,c),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===g&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,s=!n.objectMode&&(i=t,l.isBuffer(i)||i instanceof d);return s&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),a.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,a){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=e.objectMode?1:i.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,S(t,e),r&&(e.finished?a.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=m.destroy,g.prototype._undestroy=m.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(4),r(117).setImmediate,r(7))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,r(7))},function(t,e,r){var i=r(312),n=r(409);e.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],e.sign=i.sign,e.verify=n.verify,e.decode=n.decode,e.isValid=n.isValid,e.createSign=function(t){return new i(t)},e.createVerify=function(t){return new n(t)}},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(31),e.createHash=e.Hash=r(46),e.createHmac=e.Hmac=r(157);var i=r(327),n=Object.keys(i),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);e.getHashes=function(){return a};var o=r(160);e.pbkdf2=o.pbkdf2,e.pbkdf2Sync=o.pbkdf2Sync;var s=r(329);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=r(344);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var h=r(351);e.createSign=h.createSign,e.Sign=h.Sign,e.createVerify=h.createVerify,e.Verify=h.Verify,e.createECDH=r(399);var f=r(402);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var c=r(406);e.randomFill=c.randomFill,e.randomFillSync=c.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){"use strict";var i=r(1),n=r(148),a=r(2).Buffer,o=new Array(16);function s(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function h(t,e,r,i,n,a,o){return u(t+(e&r|~e&i)+n+a|0,o)+e|0}function f(t,e,r,i,n,a,o){return u(t+(e&i|r&~i)+n+a|0,o)+e|0}function c(t,e,r,i,n,a,o){return u(t+(e^r^i)+n+a|0,o)+e|0}function l(t,e,r,i,n,a,o){return u(t+(r^(e|~i))+n+a|0,o)+e|0}i(s,n),s.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,a=this._d;r=h(r,i,n,a,t[0],3614090360,7),a=h(a,r,i,n,t[1],3905402710,12),n=h(n,a,r,i,t[2],606105819,17),i=h(i,n,a,r,t[3],3250441966,22),r=h(r,i,n,a,t[4],4118548399,7),a=h(a,r,i,n,t[5],1200080426,12),n=h(n,a,r,i,t[6],2821735955,17),i=h(i,n,a,r,t[7],4249261313,22),r=h(r,i,n,a,t[8],1770035416,7),a=h(a,r,i,n,t[9],2336552879,12),n=h(n,a,r,i,t[10],4294925233,17),i=h(i,n,a,r,t[11],2304563134,22),r=h(r,i,n,a,t[12],1804603682,7),a=h(a,r,i,n,t[13],4254626195,12),n=h(n,a,r,i,t[14],2792965006,17),r=f(r,i=h(i,n,a,r,t[15],1236535329,22),n,a,t[1],4129170786,5),a=f(a,r,i,n,t[6],3225465664,9),n=f(n,a,r,i,t[11],643717713,14),i=f(i,n,a,r,t[0],3921069994,20),r=f(r,i,n,a,t[5],3593408605,5),a=f(a,r,i,n,t[10],38016083,9),n=f(n,a,r,i,t[15],3634488961,14),i=f(i,n,a,r,t[4],3889429448,20),r=f(r,i,n,a,t[9],568446438,5),a=f(a,r,i,n,t[14],3275163606,9),n=f(n,a,r,i,t[3],4107603335,14),i=f(i,n,a,r,t[8],1163531501,20),r=f(r,i,n,a,t[13],2850285829,5),a=f(a,r,i,n,t[2],4243563512,9),n=f(n,a,r,i,t[7],1735328473,14),r=c(r,i=f(i,n,a,r,t[12],2368359562,20),n,a,t[5],4294588738,4),a=c(a,r,i,n,t[8],2272392833,11),n=c(n,a,r,i,t[11],1839030562,16),i=c(i,n,a,r,t[14],4259657740,23),r=c(r,i,n,a,t[1],2763975236,4),a=c(a,r,i,n,t[4],1272893353,11),n=c(n,a,r,i,t[7],4139469664,16),i=c(i,n,a,r,t[10],3200236656,23),r=c(r,i,n,a,t[13],681279174,4),a=c(a,r,i,n,t[0],3936430074,11),n=c(n,a,r,i,t[3],3572445317,16),i=c(i,n,a,r,t[6],76029189,23),r=c(r,i,n,a,t[9],3654602809,4),a=c(a,r,i,n,t[12],3873151461,11),n=c(n,a,r,i,t[15],530742520,16),r=l(r,i=c(i,n,a,r,t[2],3299628645,23),n,a,t[0],4096336452,6),a=l(a,r,i,n,t[7],1126891415,10),n=l(n,a,r,i,t[14],2878612391,15),i=l(i,n,a,r,t[5],4237533241,21),r=l(r,i,n,a,t[12],1700485571,6),a=l(a,r,i,n,t[3],2399980690,10),n=l(n,a,r,i,t[10],4293915773,15),i=l(i,n,a,r,t[1],2240044497,21),r=l(r,i,n,a,t[8],1873313359,6),a=l(a,r,i,n,t[15],4264355552,10),n=l(n,a,r,i,t[6],2734768916,15),i=l(i,n,a,r,t[13],1309151649,21),r=l(r,i,n,a,t[4],4149444226,6),a=l(a,r,i,n,t[11],3174756917,10),n=l(n,a,r,i,t[2],718787259,15),i=l(i,n,a,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+a|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=a.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,r){"use strict";var i=r(32).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,a){if("function"==typeof r)return t(e,null,r);r||(r={}),a=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n>>32-e}function m(t,e,r,i,n,a,o,s){return p(t+(e^r^i)+a+o|0,s)+n|0}function v(t,e,r,i,n,a,o,s){return p(t+(e&r|~e&i)+a+o|0,s)+n|0}function y(t,e,r,i,n,a,o,s){return p(t+((e|~r)^i)+a+o|0,s)+n|0}function g(t,e,r,i,n,a,o,s){return p(t+(e&i|r&~i)+a+o|0,s)+n|0}function b(t,e,r,i,n,a,o,s){return p(t+(e^(r|~i))+a+o|0,s)+n|0}n(d,a),d.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,E=0|this._c,M=0|this._d,S=0|this._e,C=0;C<80;C+=1){var A,k;C<16?(A=m(r,i,n,a,d,t[s[C]],c[0],h[C]),k=b(w,_,E,M,S,t[u[C]],l[0],f[C])):C<32?(A=v(r,i,n,a,d,t[s[C]],c[1],h[C]),k=g(w,_,E,M,S,t[u[C]],l[1],f[C])):C<48?(A=y(r,i,n,a,d,t[s[C]],c[2],h[C]),k=y(w,_,E,M,S,t[u[C]],l[2],f[C])):C<64?(A=g(r,i,n,a,d,t[s[C]],c[3],h[C]),k=v(w,_,E,M,S,t[u[C]],l[3],f[C])):(A=b(r,i,n,a,d,t[s[C]],c[4],h[C]),k=m(w,_,E,M,S,t[u[C]],l[4],f[C])),r=d,d=a,a=p(n,10),n=i,i=A,w=S,S=M,M=p(E,10),E=_,_=k}var T=this._b+n+M|0;this._b=this._c+a+S|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+i+E|0,this._a=T},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(322),e.sha1=r(323),e.sha224=r(324),e.sha256=r(155),e.sha384=r(325),e.sha512=r(156)},function(t,e,r){"use strict";var i=r(10);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new i(n(e));return r}t.exports=a,a.getr=o}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=e;i.version=r(363).version,i.utils=r(11),i.rand=r(96),i.curve=r(181),i.curves=r(100),i.ec=r(375),i.eddsa=r(379)},function(t,e,r){"use strict";var i,n=e,a=r(101),o=r(181),s=r(11).assert;function u(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),h("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:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(374)}catch(t){i=void 0}h("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",i]})},function(t,e,r){var i=e;i.utils=r(16),i.common=r(48),i.sha=r(368),i.ripemd=r(372),i.hmac=r(373),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(404).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.handleRedirect=e.onRequest=e.onLogout=e.onSession=e.uniqueLogin=e.getSession=e.logout=e.fetch=e.login=e.customAuthFetcher=void 0;const n=i(r(200));var a=r(460);let o;Object.defineProperty(e,"getNodeSolidServerCookie",{enumerable:!0,get:function(){return a.getNodeSolidServerCookie}}),Object.defineProperty(e,"getPhpSolidServerCookie",{enumerable:!0,get:function(){return a.getPhpSolidServerCookie}}),Object.defineProperty(e,"getAuthFetcher",{enumerable:!0,get:function(){return a.getAuthFetcher}}),Object.defineProperty(e,"getAuthHeaders",{enumerable:!0,get:function(){return a.getAuthHeaders}});let s,u=!1;async function h(t){const e=n.default({storage:null==t?void 0:t.storage});return(null==t?void 0:t.doNotAutoHandleRedirect)||(o?u||await o:(o=e.automaticallyHandleRedirect(),await o,u=!0)),e}async function f(t){return s||(s=await h(t),s)}e.customAuthFetcher=h,e.login=async function(t){return(await f()).login(t)},e.fetch=async function(t,e){return(await f()).fetch(t,e)},e.logout=async function(){return(await f()).logout()},e.getSession=async function(){return(await f()).getSession()},e.uniqueLogin=async function(t){return(await f()).uniqueLogin(t)},e.onSession=async function(t){return(await f()).onSession(t)},e.onLogout=async function(t){return(await f()).onLogout(t)},e.onRequest=async function(t){return(await f()).onRequest(t)},e.handleRedirect=async function(t){return(await f()).handleRedirect(t)}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(202),u=r(5),h=o(r(105)),f=r(19);let c=class extends f.EventEmitter{constructor(t,e,r,i,n,a){super(),this.loginHandler=t,this.redirectHandler=e,this.logoutHandler=r,this.sessionCreator=i,this.authenticatedFetcher=n,this.environmentDetector=a,this.globalUserName="global"}async loginHelper(t,e){const r=h.default(s.loginInputOptionsSchema,t);return e&&(r.localUserId=e),this.loginHandler.handle(r)}async login(t){return this.loginHelper(t,this.globalUserName)}async fetch(t,e){return this.emit("request",t,e),this.authenticatedFetcher.handle({localUserId:this.globalUserName,type:"dpop"},t,e)}async logout(){await this.logoutHandler.handle(this.globalUserName)}async getSession(){return this.sessionCreator.getSession(this.globalUserName)}async uniqueLogin(t){return this.loginHelper(t)}async onSession(t){const e=await this.getSession();e&&t(e),this.on("session",t)}async onLogout(t){throw new Error("Not Implemented")}async onRequest(t){this.on("request",t)}async handleRedirect(t){const e=await this.redirectHandler.handle(t);return this.emit("session",e),e}async automaticallyHandleRedirect(){"browser"===this.environmentDetector.detect()&&await this.handleRedirect(window.location.href)}customAuthFetcher(t){throw new Error("Not Implemented")}};c=i([u.injectable(),a(0,u.inject("loginHandler")),a(1,u.inject("redirectHandler")),a(2,u.inject("logoutHandler")),a(3,u.inject("sessionCreator")),a(4,u.inject("authenticatedFetcher")),a(5,u.inject("environmentDetector")),n("design:paramtypes",[Object,Object,Object,Object,Object,Object])],c),e.default=c},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.traverseObject=e.compileJoinedStringOf=e.compileTypeof=void 0;const n=i(r(203)),a=i(r(14)),o=i(r(239));function s(t){return e=>typeof e===t}function u(t){return e=>!e.split(" ").some(e=>-1===t.indexOf(e))}function h(t,e,r,i){"object"===e.type?Object.keys(t).forEach(r=>{e.properties&&e.properties[r]&&h(t[r],e.properties[r],t,r)}):"array"===e.type?t.forEach((r,i)=>{e.items&&h(r,e.items,t,i)}):e.shouldConvertToUrl&&r&&i&&(r[i]=new a.default(t))}e.compileTypeof=s,e.compileJoinedStringOf=u,e.traverseObject=h,e.default=function(t,e){const r=o.default(e),i=new n.default;if(i.addKeyword("typeof",{compile:s}),i.addKeyword("joinedStringOf",{compile:u}),!i.validate(t,r)){let e=(t.title?t.title:"schema")+" is invalid";throw i.errors&&(e+=":",e+=i.errors.map(t=>`\n${t.dataPath} ${t.message}`).toString()),new Error(e)}return h(r,t),r}},function(t,e,r){"use strict";var i=r(29);t.exports=function(t){i.copy(t,this)}},function(t,e,r){"use strict";t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var r,i="boolean"==typeof e.cycles&&e.cycles,n=e.cmp&&(r=e.cmp,function(t){return function(e,i){var n={key:e,value:t[e]},a={key:i,value:t[i]};return r(n,a)}}),a=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var r,o;if(Array.isArray(e)){for(o="[",r=0;r",g=d?">":"<",b=void 0;if(!l&&"number"!=typeof s&&void 0!==s)throw new Error(e+" must be number");if(!v&&void 0!==m&&"number"!=typeof m&&"boolean"!=typeof m)throw new Error(p+" must be number or boolean");if(v){var w=t.util.getData(m.$data,o,t.dataPathArr),_="exclusive"+a,E="exclType"+a,M="exclIsNumber"+a,S="' + "+(k="op"+a)+" + '";n+=" var schemaExcl"+a+" = "+w+"; ",n+=" var "+_+"; var "+E+" = typeof "+(w="schemaExcl"+a)+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var C;b=p;(C=C||[]).push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(b||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: {} ",!1!==t.opts.messages&&(n+=" , message: '"+p+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var A=n;n=C.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+E+" == 'number' ? ( ("+_+" = "+i+" === undefined || "+w+" "+y+"= "+i+") ? "+c+" "+g+"= "+w+" : "+c+" "+g+" "+i+" ) : ( ("+_+" = "+w+" === true) ? "+c+" "+g+"= "+i+" : "+c+" "+g+" "+i+" ) || "+c+" !== "+c+") { var op"+a+" = "+_+" ? '"+y+"' : '"+y+"='; ",void 0===s&&(b=p,h=t.errSchemaPath+"/"+p,i=w,l=v)}else{S=y;if((M="number"==typeof m)&&l){var k="'"+S+"'";n+=" if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" ( "+i+" === undefined || "+m+" "+y+"= "+i+" ? "+c+" "+g+"= "+m+" : "+c+" "+g+" "+i+" ) || "+c+" !== "+c+") { "}else{M&&void 0===s?(_=!0,b=p,h=t.errSchemaPath+"/"+p,i=m,g+="="):(M&&(i=Math[d?"min":"max"](m,s)),m===(!M||i)?(_=!0,b=p,h=t.errSchemaPath+"/"+p,g+="="):(_=!1,S+="="));k="'"+S+"'";n+=" if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+c+" "+g+" "+i+" || "+c+" !== "+c+") { "}}b=b||e,(C=C||[]).push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(b||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { comparison: "+k+", limit: "+i+", exclusive: "+_+" } ",!1!==t.opts.messages&&(n+=" , message: 'should be "+S+" ",n+=l?"' + "+i:i+"'"),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";A=n;return n=C.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+c+".length "+("maxItems"==e?">":"<")+" "+i+") { ";var d=e,p=p||[];p.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have ",n+="maxItems"==e?"more":"fewer",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var m=n;return n=p.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+m+"]); ":n+=" validate.errors = ["+m+"]; return false; ":n+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");var d="maxLength"==e?">":"<";n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),!1===t.opts.unicode?n+=" "+c+".length ":n+=" ucs2length("+c+") ",n+=" "+d+" "+i+") { ";var p=e,m=m||[];m.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT be ",n+="maxLength"==e?"longer":"shorter",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var v=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" Object.keys("+c+").length "+("maxProperties"==e?">":"<")+" "+i+") { ";var d=e,p=p||[];p.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have ",n+="maxProperties"==e?"more":"fewer",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var m=n;return n=p.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+m+"]); ":n+=" validate.errors = ["+m+"]; return false; ":n+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.flattenHeaders=void 0,e.flattenHeaders=function(t){if(void 0===t)return{};const e={};return"function"!=typeof t.forEach?t:(t.forEach((t,r)=>{e[r]=t}),e)}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(e,r){ + */var i={createEncrypt:r(285).createEncrypt,createDecrypt:r(308).createDecrypt};t.exports=i},function(t,e,r){(e=t.exports=r(138)).Stream=e,e.Readable=e,e.Writable=r(85),e.Duplex=r(26),e.Transform=r(141),e.PassThrough=r(290)},function(t,e,r){var i=r(0),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,i,n){var a=r(57);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var s,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:a.nextTick;y.WritableState=g;var h=Object.create(r(45));h.inherits=r(1);var f={deprecate:r(86)},c=r(139),l=r(84).Buffer,d=n.Uint8Array||function(){};var p,m=r(140);function v(){}function g(t,e){s=s||r(26),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(a.nextTick(n,i),a.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,r,i,e,n);else{var o=E(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),i?u(w,t,r,o,n):w(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(t){if(s=s||r(26),!(p.call(y,this)||this instanceof s))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function b(t,e,r,i,n,a,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function w(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)n[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;n.allBuffers=u,b(t,e,!0,e.length,n,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(b(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(M,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,c),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,s=!n.objectMode&&(i=t,l.isBuffer(i)||i instanceof d);return s&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),a.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,a){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=e.objectMode?1:i.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,S(t,e),r&&(e.finished?a.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(3),r(117).setImmediate,r(7))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,r(7))},function(t,e,r){var i=r(313),n=r(410);e.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],e.sign=i.sign,e.verify=n.verify,e.decode=n.decode,e.isValid=n.isValid,e.createSign=function(t){return new i(t)},e.createVerify=function(t){return new n(t)}},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(31),e.createHash=e.Hash=r(46),e.createHmac=e.Hmac=r(157);var i=r(328),n=Object.keys(i),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);e.getHashes=function(){return a};var o=r(160);e.pbkdf2=o.pbkdf2,e.pbkdf2Sync=o.pbkdf2Sync;var s=r(330);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=r(345);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var h=r(352);e.createSign=h.createSign,e.Sign=h.Sign,e.createVerify=h.createVerify,e.Verify=h.Verify,e.createECDH=r(400);var f=r(403);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var c=r(407);e.randomFill=c.randomFill,e.randomFillSync=c.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){"use strict";var i=r(1),n=r(148),a=r(2).Buffer,o=new Array(16);function s(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function h(t,e,r,i,n,a,o){return u(t+(e&r|~e&i)+n+a|0,o)+e|0}function f(t,e,r,i,n,a,o){return u(t+(e&i|r&~i)+n+a|0,o)+e|0}function c(t,e,r,i,n,a,o){return u(t+(e^r^i)+n+a|0,o)+e|0}function l(t,e,r,i,n,a,o){return u(t+(r^(e|~i))+n+a|0,o)+e|0}i(s,n),s.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,a=this._d;r=h(r,i,n,a,t[0],3614090360,7),a=h(a,r,i,n,t[1],3905402710,12),n=h(n,a,r,i,t[2],606105819,17),i=h(i,n,a,r,t[3],3250441966,22),r=h(r,i,n,a,t[4],4118548399,7),a=h(a,r,i,n,t[5],1200080426,12),n=h(n,a,r,i,t[6],2821735955,17),i=h(i,n,a,r,t[7],4249261313,22),r=h(r,i,n,a,t[8],1770035416,7),a=h(a,r,i,n,t[9],2336552879,12),n=h(n,a,r,i,t[10],4294925233,17),i=h(i,n,a,r,t[11],2304563134,22),r=h(r,i,n,a,t[12],1804603682,7),a=h(a,r,i,n,t[13],4254626195,12),n=h(n,a,r,i,t[14],2792965006,17),r=f(r,i=h(i,n,a,r,t[15],1236535329,22),n,a,t[1],4129170786,5),a=f(a,r,i,n,t[6],3225465664,9),n=f(n,a,r,i,t[11],643717713,14),i=f(i,n,a,r,t[0],3921069994,20),r=f(r,i,n,a,t[5],3593408605,5),a=f(a,r,i,n,t[10],38016083,9),n=f(n,a,r,i,t[15],3634488961,14),i=f(i,n,a,r,t[4],3889429448,20),r=f(r,i,n,a,t[9],568446438,5),a=f(a,r,i,n,t[14],3275163606,9),n=f(n,a,r,i,t[3],4107603335,14),i=f(i,n,a,r,t[8],1163531501,20),r=f(r,i,n,a,t[13],2850285829,5),a=f(a,r,i,n,t[2],4243563512,9),n=f(n,a,r,i,t[7],1735328473,14),r=c(r,i=f(i,n,a,r,t[12],2368359562,20),n,a,t[5],4294588738,4),a=c(a,r,i,n,t[8],2272392833,11),n=c(n,a,r,i,t[11],1839030562,16),i=c(i,n,a,r,t[14],4259657740,23),r=c(r,i,n,a,t[1],2763975236,4),a=c(a,r,i,n,t[4],1272893353,11),n=c(n,a,r,i,t[7],4139469664,16),i=c(i,n,a,r,t[10],3200236656,23),r=c(r,i,n,a,t[13],681279174,4),a=c(a,r,i,n,t[0],3936430074,11),n=c(n,a,r,i,t[3],3572445317,16),i=c(i,n,a,r,t[6],76029189,23),r=c(r,i,n,a,t[9],3654602809,4),a=c(a,r,i,n,t[12],3873151461,11),n=c(n,a,r,i,t[15],530742520,16),r=l(r,i=c(i,n,a,r,t[2],3299628645,23),n,a,t[0],4096336452,6),a=l(a,r,i,n,t[7],1126891415,10),n=l(n,a,r,i,t[14],2878612391,15),i=l(i,n,a,r,t[5],4237533241,21),r=l(r,i,n,a,t[12],1700485571,6),a=l(a,r,i,n,t[3],2399980690,10),n=l(n,a,r,i,t[10],4293915773,15),i=l(i,n,a,r,t[1],2240044497,21),r=l(r,i,n,a,t[8],1873313359,6),a=l(a,r,i,n,t[15],4264355552,10),n=l(n,a,r,i,t[6],2734768916,15),i=l(i,n,a,r,t[13],1309151649,21),r=l(r,i,n,a,t[4],4149444226,6),a=l(a,r,i,n,t[11],3174756917,10),n=l(n,a,r,i,t[2],718787259,15),i=l(i,n,a,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+a|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=a.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,r){"use strict";var i=r(32).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,a){if("function"==typeof r)return t(e,null,r);r||(r={}),a=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n>>32-e}function m(t,e,r,i,n,a,o,s){return p(t+(e^r^i)+a+o|0,s)+n|0}function v(t,e,r,i,n,a,o,s){return p(t+(e&r|~e&i)+a+o|0,s)+n|0}function g(t,e,r,i,n,a,o,s){return p(t+((e|~r)^i)+a+o|0,s)+n|0}function y(t,e,r,i,n,a,o,s){return p(t+(e&i|r&~i)+a+o|0,s)+n|0}function b(t,e,r,i,n,a,o,s){return p(t+(e^(r|~i))+a+o|0,s)+n|0}n(d,a),d.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,E=0|this._c,M=0|this._d,S=0|this._e,C=0;C<80;C+=1){var A,k;C<16?(A=m(r,i,n,a,d,t[s[C]],c[0],h[C]),k=b(w,_,E,M,S,t[u[C]],l[0],f[C])):C<32?(A=v(r,i,n,a,d,t[s[C]],c[1],h[C]),k=y(w,_,E,M,S,t[u[C]],l[1],f[C])):C<48?(A=g(r,i,n,a,d,t[s[C]],c[2],h[C]),k=g(w,_,E,M,S,t[u[C]],l[2],f[C])):C<64?(A=y(r,i,n,a,d,t[s[C]],c[3],h[C]),k=v(w,_,E,M,S,t[u[C]],l[3],f[C])):(A=b(r,i,n,a,d,t[s[C]],c[4],h[C]),k=m(w,_,E,M,S,t[u[C]],l[4],f[C])),r=d,d=a,a=p(n,10),n=i,i=A,w=S,S=M,M=p(E,10),E=_,_=k}var T=this._b+n+M|0;this._b=this._c+a+S|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+i+E|0,this._a=T},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(323),e.sha1=r(324),e.sha224=r(325),e.sha256=r(155),e.sha384=r(326),e.sha512=r(156)},function(t,e,r){"use strict";var i=r(10);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new i(n(e));return r}t.exports=a,a.getr=o}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=e;i.version=r(364).version,i.utils=r(11),i.rand=r(96),i.curve=r(181),i.curves=r(100),i.ec=r(376),i.eddsa=r(380)},function(t,e,r){"use strict";var i,n=e,a=r(101),o=r(181),s=r(11).assert;function u(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),h("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:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(375)}catch(t){i=void 0}h("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",i]})},function(t,e,r){var i=e;i.utils=r(16),i.common=r(48),i.sha=r(369),i.ripemd=r(373),i.hmac=r(374),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(405).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.handleRedirect=e.onRequest=e.onLogout=e.onSession=e.uniqueLogin=e.getSession=e.logout=e.fetch=e.login=e.customAuthFetcher=void 0;const n=i(r(201));var a=r(462);let o;Object.defineProperty(e,"getNodeSolidServerCookie",{enumerable:!0,get:function(){return a.getNodeSolidServerCookie}}),Object.defineProperty(e,"getPhpSolidServerCookie",{enumerable:!0,get:function(){return a.getPhpSolidServerCookie}}),Object.defineProperty(e,"getAuthFetcher",{enumerable:!0,get:function(){return a.getAuthFetcher}}),Object.defineProperty(e,"getAuthHeaders",{enumerable:!0,get:function(){return a.getAuthHeaders}});let s,u=!1;async function h(t){const e=n.default({storage:null==t?void 0:t.storage});return(null==t?void 0:t.doNotAutoHandleRedirect)||(o?u||await o:(o=e.automaticallyHandleRedirect(),await o,u=!0)),e}async function f(t){return s||(s=await h(t),s)}e.customAuthFetcher=h,e.login=async function(t){return(await f()).login(t)},e.fetch=async function(t,e){return(await f()).fetch(t,e)},e.logout=async function(){return(await f()).logout()},e.getSession=async function(){return(await f()).getSession()},e.uniqueLogin=async function(t){return(await f()).uniqueLogin(t)},e.onSession=async function(t){return(await f()).onSession(t)},e.onLogout=async function(t){return(await f()).onLogout(t)},e.onRequest=async function(t){return(await f()).onRequest(t)},e.handleRedirect=async function(t){return(await f()).handleRedirect(t)}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(203),u=r(5),h=o(r(105)),f=r(19);let c=class extends f.EventEmitter{constructor(t,e,r,i,n,a){super(),this.loginHandler=t,this.redirectHandler=e,this.logoutHandler=r,this.sessionCreator=i,this.authenticatedFetcher=n,this.environmentDetector=a,this.globalUserName="global"}async loginHelper(t,e){const r=h.default(s.loginInputOptionsSchema,t);return e&&(r.localUserId=e),this.loginHandler.handle(r)}async login(t){return this.loginHelper(t,this.globalUserName)}async fetch(t,e){return this.emit("request",t,e),this.authenticatedFetcher.handle({localUserId:this.globalUserName,type:"dpop"},t,e)}async logout(){await this.logoutHandler.handle(this.globalUserName)}async getSession(){return this.sessionCreator.getSession(this.globalUserName)}async uniqueLogin(t){return this.loginHelper(t)}async onSession(t){const e=await this.getSession();e&&t(e),this.on("session",t)}async onLogout(t){throw new Error("Not Implemented")}async onRequest(t){this.on("request",t)}async handleRedirect(t){const e=await this.redirectHandler.handle(t);return this.emit("session",e),e}async automaticallyHandleRedirect(){"browser"===this.environmentDetector.detect()&&await this.handleRedirect(window.location.href)}customAuthFetcher(t){throw new Error("Not Implemented")}};c=i([u.injectable(),a(0,u.inject("loginHandler")),a(1,u.inject("redirectHandler")),a(2,u.inject("logoutHandler")),a(3,u.inject("sessionCreator")),a(4,u.inject("authenticatedFetcher")),a(5,u.inject("environmentDetector")),n("design:paramtypes",[Object,Object,Object,Object,Object,Object])],c),e.default=c},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.traverseObject=e.compileJoinedStringOf=e.compileTypeof=void 0;const n=i(r(204)),a=i(r(14)),o=i(r(240));function s(t){return e=>typeof e===t}function u(t){return e=>!e.split(" ").some(e=>-1===t.indexOf(e))}function h(t,e,r,i){"object"===e.type?Object.keys(t).forEach(r=>{e.properties&&e.properties[r]&&h(t[r],e.properties[r],t,r)}):"array"===e.type?t.forEach((r,i)=>{e.items&&h(r,e.items,t,i)}):e.shouldConvertToUrl&&r&&i&&(r[i]=new a.default(t))}e.compileTypeof=s,e.compileJoinedStringOf=u,e.traverseObject=h,e.default=function(t,e){const r=o.default(e),i=new n.default;if(i.addKeyword("typeof",{compile:s}),i.addKeyword("joinedStringOf",{compile:u}),!i.validate(t,r)){let e=(t.title?t.title:"schema")+" is invalid";throw i.errors&&(e+=":",e+=i.errors.map(t=>`\n${t.dataPath} ${t.message}`).toString()),new Error(e)}return h(r,t),r}},function(t,e,r){"use strict";var i=r(29);t.exports=function(t){i.copy(t,this)}},function(t,e,r){"use strict";t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var r,i="boolean"==typeof e.cycles&&e.cycles,n=e.cmp&&(r=e.cmp,function(t){return function(e,i){var n={key:e,value:t[e]},a={key:i,value:t[i]};return r(n,a)}}),a=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var r,o;if(Array.isArray(e)){for(o="[",r=0;r",y=d?">":"<",b=void 0;if(!l&&"number"!=typeof s&&void 0!==s)throw new Error(e+" must be number");if(!v&&void 0!==m&&"number"!=typeof m&&"boolean"!=typeof m)throw new Error(p+" must be number or boolean");if(v){var w=t.util.getData(m.$data,o,t.dataPathArr),_="exclusive"+a,E="exclType"+a,M="exclIsNumber"+a,S="' + "+(k="op"+a)+" + '";n+=" var schemaExcl"+a+" = "+w+"; ",n+=" var "+_+"; var "+E+" = typeof "+(w="schemaExcl"+a)+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var C;b=p;(C=C||[]).push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(b||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: {} ",!1!==t.opts.messages&&(n+=" , message: '"+p+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var A=n;n=C.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+E+" == 'number' ? ( ("+_+" = "+i+" === undefined || "+w+" "+g+"= "+i+") ? "+c+" "+y+"= "+w+" : "+c+" "+y+" "+i+" ) : ( ("+_+" = "+w+" === true) ? "+c+" "+y+"= "+i+" : "+c+" "+y+" "+i+" ) || "+c+" !== "+c+") { var op"+a+" = "+_+" ? '"+g+"' : '"+g+"='; ",void 0===s&&(b=p,h=t.errSchemaPath+"/"+p,i=w,l=v)}else{S=g;if((M="number"==typeof m)&&l){var k="'"+S+"'";n+=" if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" ( "+i+" === undefined || "+m+" "+g+"= "+i+" ? "+c+" "+y+"= "+m+" : "+c+" "+y+" "+i+" ) || "+c+" !== "+c+") { "}else{M&&void 0===s?(_=!0,b=p,h=t.errSchemaPath+"/"+p,i=m,y+="="):(M&&(i=Math[d?"min":"max"](m,s)),m===(!M||i)?(_=!0,b=p,h=t.errSchemaPath+"/"+p,y+="="):(_=!1,S+="="));k="'"+S+"'";n+=" if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+c+" "+y+" "+i+" || "+c+" !== "+c+") { "}}b=b||e,(C=C||[]).push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(b||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { comparison: "+k+", limit: "+i+", exclusive: "+_+" } ",!1!==t.opts.messages&&(n+=" , message: 'should be "+S+" ",n+=l?"' + "+i:i+"'"),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";A=n;return n=C.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+c+".length "+("maxItems"==e?">":"<")+" "+i+") { ";var d=e,p=p||[];p.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have ",n+="maxItems"==e?"more":"fewer",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var m=n;return n=p.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+m+"]); ":n+=" validate.errors = ["+m+"]; return false; ":n+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");var d="maxLength"==e?">":"<";n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),!1===t.opts.unicode?n+=" "+c+".length ":n+=" ucs2length("+c+") ",n+=" "+d+" "+i+") { ";var p=e,m=m||[];m.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT be ",n+="maxLength"==e?"longer":"shorter",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var v=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" Object.keys("+c+").length "+("maxProperties"==e?">":"<")+" "+i+") { ";var d=e,p=p||[];p.push(n),n="",!1!==t.createErrors?(n+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { limit: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have ",n+="maxProperties"==e?"more":"fewer",n+=" than ",n+=l?"' + "+i+" + '":""+s,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var m=n;return n=p.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+m+"]); ":n+=" validate.errors = ["+m+"]; return false; ":n+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.flattenHeaders=void 0,e.flattenHeaders=function(t){if(void 0===t)return{};const e={};return"function"!=typeof t.forEach?t:(t.forEach((t,r)=>{e[r]=t}),e)}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(e,r){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 - */var i;i=function(){"use strict";function t(t){return"function"==typeof t}var i=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,a=void 0,o=void 0,s=function(t,e){p[n]=t,p[n+1]=e,2===(n+=2)&&(o?o(m):w())},u="undefined"!=typeof window?window:void 0,h=u||{},f=h.MutationObserver||h.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var p=new Array(1e3);function m(){for(var t=0;t=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(250),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(7))},function(t,e,r){var i=r(3);r(6),i.cipher=i.cipher||{};var n=t.exports=i.cipher.modes=i.cipher.modes||{};function a(t){if("string"==typeof t&&(t=i.util.createBuffer(t)),i.util.isArray(t)&&t.length>4){var e=t;t=i.util.createBuffer();for(var r=0;r0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e,r=i.util.createBuffer(t.iv);if(this._cipherLength=0,e="additionalData"in t?i.util.createBuffer(t.additionalData):i.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=i.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(s(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,e=i.util.createBuffer(e),this._aDataLength=s(8*e.length());var a=e.length()%this.blockSize;for(a&&e.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];e.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])},n.gcm.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},n.gcm.prototype.decrypt=function(t,e,r){var i=t.length();if(i0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--i)e[i]=t[i]>>>1|(1&t[i-1])<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)},n.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var i=t[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][i];e[0]^=n[0],e[1]^=n[1],e[2]^=n[2],e[3]^=n[3]}return e},n.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)},n.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,i=4*r,n=16*r,a=new Array(n),o=0;o>>1,n=new Array(r);n[i]=t.slice(0);for(var a=i>>>1;a>0;)this.pow(n[2*a],n[a]=[]),a>>=1;for(a=2;a>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}n.encode_rsa_oaep=function(t,e,r){var n,o,s,u;"string"==typeof r?(n=r,o=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,o=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=i.md.sha1.create(),u||(u=s);var h=Math.ceil(t.n.bitLength()/8),f=h-2*s.digestLength-2;if(e.length>f)throw(v=new Error("RSAES-OAEP input message length is too long.")).length=e.length,v.maxLength=f,v;n||(n=""),s.update(n,"raw");for(var c=s.digest(),l="",d=f-e.length,p=0;p>>0,s>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=s[1],s[1]=s[0]+(n.fullMessageLength[h]/4294967296>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(a),u(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var s,h=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-h));for(var f=8*n.fullMessageLength[0],c=0;c>>0,o.putInt32(f>>>0),f=s>>>0;o.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(l,r,o);var d=i.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d.putInt32(l.h5),d.putInt32(l.h6),d.putInt32(l.h7),d},n};var a=null,o=!1,s=null;function u(t,e,r){for(var i,n,a,o,u,h,f,c,l,d,p,m,v,y=r.length();y>=64;){for(u=0;u<16;++u)e[u]=r.getInt32();for(;u<64;++u)i=((i=e[u-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=((n=e[u-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e[u]=i+e[u-7]+n+e[u-16]|0;for(h=t.h0,f=t.h1,c=t.h2,l=t.h3,d=t.h4,p=t.h5,m=t.h6,v=t.h7,u=0;u<64;++u)a=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),o=h&f|c&(h^f),i=v+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(m^d&(p^m))+s[u]+e[u],v=m,m=p,p=d,d=l+i>>>0,l=c,c=f,f=h,h=i+(n=a+o)>>>0;t.h0=t.h0+h|0,t.h1=t.h1+f|0,t.h2=t.h2+c|0,t.h3=t.h3+l|0,t.h4=t.h4+d|0,t.h5=t.h5+p|0,t.h6=t.h6+m|0,t.h7=t.h7+v|0,y-=64}}},function(t,e,r){(function(e){var i=r(3);r(6);var n=null;!i.util.isNodejs||i.options.usePureJavaScript||e.versions["node-webkit"]||(n=r(71)),(t.exports=i.prng=i.prng||{}).create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,a=new Array(32),o=0;o<32;++o)a[o]=r.create();function s(){if(e.pools[0].messageLength>=32)return u();var t=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(t)),u()}function u(){e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;var t=e.plugin.md.create();t.update(e.keyBytes);for(var r=1,i=0;i<32;++i)e.reseeds%r==0&&(t.update(e.pools[i].digest().getBytes()),e.pools[i].start()),r<<=1;e.keyBytes=t.digest().getBytes(),t.start(),t.update(e.keyBytes);var n=t.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(n),e.generated=0}function h(t){var e=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(e=function(t){return n.getRandomValues(t)});var a=i.util.createBuffer();if(e)for(;a.length()>16)))<<16,l=4294967295&(f=(2147483647&(f+=h>>15))+(f>>31));for(u=0;u<3;++u)c=l>>>(u<<3),c^=Math.floor(256*Math.random()),a.putByte(String.fromCharCode(255&c))}return a.getBytes(t)}return e.pools=a,e.pool=0,e.generate=function(t,r){if(!r)return e.generateSync(t);var n=e.plugin.cipher,a=e.plugin.increment,o=e.plugin.formatKey,s=e.plugin.formatSeed,h=i.util.createBuffer();e.key=null,function f(c){if(c)return r(c);if(h.length()>=t)return r(null,h.getBytes(t));e.generated>1048575&&(e.key=null);if(null===e.key)return i.util.nextTick((function(){!function(t){if(e.pools[0].messageLength>=32)return u(),t();var r=32-e.pools[0].messageLength<<5;e.seedFile(r,(function(r,i){if(r)return t(r);e.collect(i),u(),t()}))}(f)}));var l=n(e.key,e.seed);e.generated+=l.length,h.putBytes(l),e.key=o(n(e.key,a(e.seed))),e.seed=s(n(e.key,e.seed)),i.util.setImmediate(f)}()},e.generateSync=function(t){var r=e.plugin.cipher,n=e.plugin.increment,a=e.plugin.formatKey,o=e.plugin.formatSeed;e.key=null;for(var u=i.util.createBuffer();u.length()1048575&&(e.key=null),null===e.key&&s();var h=r(e.key,e.seed);e.generated+=h.length,u.putBytes(h),e.key=a(r(e.key,n(e.seed))),e.seed=o(r(e.key,e.seed))}return u.getBytes(t)},n?(e.seedFile=function(t,e){n.randomBytes(t,(function(t,r){if(t)return e(t);e(null,r.toString())}))},e.seedFileSync=function(t){return n.randomBytes(t).toString()}):(e.seedFile=function(t,e){try{e(null,h(t))}catch(t){e(t)}},e.seedFileSync=h),e.collect=function(t){for(var r=t.length,i=0;i>n&255);e.collect(i)},e.registerWorker=function(t){if(t===self)e.seedFile=function(t,e){self.addEventListener("message",(function t(r){var i=r.data;i.forge&&i.forge.prng&&(self.removeEventListener("message",t),e(i.forge.prng.err,i.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:t}}})};else{t.addEventListener("message",(function(r){var i=r.data;i.forge&&i.forge.prng&&e.seedFile(i.forge.prng.needed,(function(e,r){t.postMessage({forge:{prng:{err:e,bytes:r}}})}))}))}},e}}).call(this,r(4))},function(t,e,r){var i=r(3);r(21),r(6);var n=i.asn1,a=t.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=a;var o={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=o;var s={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},a.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(t,e,r){var i,n=r(3);t.exports=n.jsbn=n.jsbn||{};function a(t,e,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function o(){return new a(null)}function s(t,e,r,i,n,a){for(var o=16383&e,s=e>>14;--a>=0;){var u=16383&this.data[t],h=this.data[t++]>>14,f=s*u+h*o;n=((u=o*u+((16383&f)<<14)+r.data[i]+n)>>28)+(f>>14)+s*h,r.data[i++]=268435455&u}return n}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=s,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(var o=32767&e,s=e>>15;--a>=0;){var u=32767&this.data[t],h=this.data[t++]>>15,f=s*u+h*o;n=((u=o*u+((32767&f)<<15)+r.data[i]+(1073741823&n))>>>30)+(f>>>15)+s*h+(n>>>30),r.data[i++]=1073741823&u}return n},i=30):"Netscape"!=navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(;--a>=0;){var o=e*this.data[t++]+r.data[i]+n;n=Math.floor(o/67108864),r.data[i++]=67108863&o}return n},i=26):(a.prototype.am=s,i=28),a.prototype.DB=i,a.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function m(t){this.m=t}function v(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function E(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function M(){}function S(t){return t}function C(t){this.r2=o(),this.q3=o(),a.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}m.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},m.prototype.revert=function(t){return t},m.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},m.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},m.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},v.prototype.convert=function(t){var e=o();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(a.ZERO)>0&&this.m.subTo(e,e),e},v.prototype.revert=function(t){var e=o();return t.copyTo(e),this.reduce(e),e},v.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,i,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},v.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},v.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},a.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s},a.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},a.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=8==r?255&t[i]:l(t,i);s<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},a.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s},a.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e.data[r+o+1]=this.data[r]>>n|s,s=(this.data[r]&a)<=0;--r)e.data[r]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},a.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,a=(1<>i;for(var o=r+1;o>i;i>0&&(e.data[this.t-r-1]|=(this.s&a)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e.data[r++]=this.DV+i:i>0&&(e.data[r++]=i),e.t=r,e.clamp()},a.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e.data[n]=0;for(n=0;n=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()},a.prototype.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(f,s),n.lShiftTo(f,r)):(i.copyTo(s),n.copyTo(r));var c=s.t,l=s.data[c-1];if(0!=l){var d=l*(1<1?s.data[c-2]>>this.F2:0),m=this.FV/d,v=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),a.ONE.dlShiftTo(c,w),w.subTo(s,s);s.t=0;){var _=r.data[--g]==l?this.DM:Math.floor(r.data[g]*m+(r.data[g-1]+y)*v);if((r.data[g]+=s.am(0,_,r,b,0,c))<_)for(s.dlShiftTo(b,w),r.subTo(w,r);r.data[g]<--_;)r.subTo(w,r)}null!=e&&(r.drShiftTo(c,e),u!=h&&a.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(t,e){if(t>4294967295||t<1)return a.ONE;var r=o(),i=o(),n=e.convert(this),s=p(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var u=r;r=i,i=u}return e.revert(r)},a.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,a=c(r));o>=0;)s>(s+=this.DB-e)):(r=this.data[o]>>(s-=e)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=c(r));return n?a:"0"},a.prototype.negate=function(){var t=o();return a.ZERO.subTo(this,t),t},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this.data[r]-t.data[r]))return e;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(t){var e=o();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(a.ZERO)>0&&t.subTo(e,e),e},a.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new m(e):new v(e),this.exp(t,r)},a.ZERO=d(0),a.ONE=d(1),M.prototype.convert=S,M.prototype.revert=S,M.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},M.prototype.sqrTo=function(t,e){t.squareTo(e)},C.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=o();return t.copyTo(e),this.reduce(e),e},C.prototype.revert=function(t){return t},C.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},C.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},C.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var A=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],k=(1<<26)/A[A.length-1];a.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},a.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=d(r),n=o(),a=o(),s="";for(this.divRemTo(i,n,a);n.signum()>0;)s=(r+a.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,a);return a.intValue().toString(t)+s},a.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,u=0;u=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(a.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(a.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e.data[r++]=i:i<-1&&(e.data[r++]=this.DV+i),e.t=r,e.clamp()},a.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}},a.prototype.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n=0;)r.data[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this.data[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this.data[i])%t;return r},a.prototype.millerRabin=function(t){var e=this.subtract(a.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var i,n=e.shiftRight(r),o={nextBytes:function(t){for(var e=0;e=0);var u=i.modPow(n,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(e)){for(var h=1;h++>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this.data[t]&(1<>(i+=this.DB-8)):(r=this.data[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},a.prototype.equals=function(t){return 0==this.compareTo(t)},a.prototype.min=function(t){return this.compareTo(t)<0?this:t},a.prototype.max=function(t){return this.compareTo(t)>0?this:t},a.prototype.and=function(t){var e=o();return this.bitwiseTo(t,y,e),e},a.prototype.or=function(t){var e=o();return this.bitwiseTo(t,g,e),e},a.prototype.xor=function(t){var e=o();return this.bitwiseTo(t,b,e),e},a.prototype.andNot=function(t){var e=o();return this.bitwiseTo(t,w,e),e},a.prototype.not=function(){for(var t=o(),e=0;e=this.t?0!=this.s:0!=(this.data[e]&1<1){var c=o();for(i.sqrTo(s[1],c);u<=f;)s[u]=o(),i.mulTo(c,s[u-2],s[u]),u+=2}var l,y,g=t.t-1,b=!0,w=o();for(n=p(t.data[g])-1;g>=0;){for(n>=h?l=t.data[g]>>n-h&f:(l=(t.data[g]&(1<0&&(l|=t.data[g-1]>>this.DB+n-h)),u=r;0==(1&l);)l>>=1,--u;if((n-=u)<0&&(n+=this.DB,--g),b)s[l].copyTo(a),b=!1;else{for(;u>1;)i.sqrTo(a,w),i.sqrTo(w,a),u-=2;u>0?i.sqrTo(a,w):(y=a,a=w,w=y),i.mulTo(w,s[l],a)}for(;g>=0&&0==(t.data[g]&1<=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(u,o)):(i.subTo(r,i),e&&s.subTo(n,s),u.subTo(o,u))}return 0!=i.compareTo(a.ONE)?a.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},a.prototype.pow=function(t){return this.exp(t,new M)},a.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return e;for(n0&&(e.rShiftTo(a,e),r.rShiftTo(a,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(e=0;et&&(o=u(t,e));var d=o.toString(16);n.target.postMessage({hex:d,workLoad:f}),o.dAddOffset(c,0)}}}d()}(t,e,n,a);return s(t,e,n,a)}(t,h,a.options,n);throw new Error("Invalid prime generation algorithm: "+a.name)}}function s(t,e,r,a){var o=u(t,e),s=function(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var h=10;"maxBlockTime"in r&&(h=r.maxBlockTime),function t(e,r,a,o,s,h,f){var c=+new Date;do{if(e.bitLength()>r&&(e=u(r,a)),e.isProbablePrime(s))return f(null,e);e.dAddOffset(n[o++%8],0)}while(h<0||+new Date-c=0;u--)I>>=8,I+=C.at(u)+T.at(u),T.setAt(u,255&I);k.putBuffer(T)}w=k,c.putBuffer(M)}return c.truncate(c.length()-a),c},o.pbe.getCipher=function(t,e,r){switch(t){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(t,e,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(t,e,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=t,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}},o.pbe.getCipherForPBES2=function(t,e,r){var n,s={},u=[];if(!a.validate(e,h,s,u))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,n;if((t=a.derToOid(s.kdfOid))!==o.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,n.supportedOids=["pkcs5PBKDF2"],n;if((t=a.derToOid(s.encOid))!==o.oids["aes128-CBC"]&&t!==o.oids["aes192-CBC"]&&t!==o.oids["aes256-CBC"]&&t!==o.oids["des-EDE3-CBC"]&&t!==o.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var f,c,d=s.kdfSalt,p=i.util.createBuffer(s.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[t]){case"aes128-CBC":f=16,c=i.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,c=i.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,c=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,c=i.des.createDecryptionCipher;break;case"desCBC":f=8,c=i.des.createDecryptionCipher}var m=l(s.prfOid),v=i.pkcs5.pbkdf2(r,d,p,f,m),y=s.encIv,g=c(v);return g.start(y),g},o.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},s=[];if(!a.validate(e,f,n,s))throw(m=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,m;var u,h,c,d=i.util.createBuffer(n.salt),p=i.util.createBuffer(n.iterations);switch(p=p.getInt(p.length()<<3),t){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,h=8,c=i.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,h=8,c=function(t,e){var r=i.rc2.createDecryptionCipher(t,40);return r.start(e,null),r};break;default:var m;throw(m=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,m}var v=l(n.prfOid),y=o.pbe.generatePkcs12Key(r,d,1,p,u,v);return v.start(),c(y,o.pbe.generatePkcs12Key(r,d,2,p,h,v))},o.pbe.opensslDeriveBytes=function(t,e,r,n){if(null==n){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');n=i.md.md5.create()}null===e&&(e="");for(var a=[c(n,t+e)],o=16,s=1;o>>((3&e)<<3)&255;return n}}},function(t,e){for(var r=[],i=0;i<256;++i)r[i]=(i+256).toString(16).substr(1);t.exports=function(t,e){var i=e||0,n=r;return[n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]]].join("")}},function(t,e,r){"use strict";(function(e){ + */var i;i=function(){"use strict";function t(t){return"function"==typeof t}var i=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,a=void 0,o=void 0,s=function(t,e){p[n]=t,p[n+1]=e,2===(n+=2)&&(o?o(m):w())},u="undefined"!=typeof window?window:void 0,h=u||{},f=h.MutationObserver||h.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var p=new Array(1e3);function m(){for(var t=0;t=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(251),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(7))},function(t,e,r){var i=r(4);r(6),i.cipher=i.cipher||{};var n=t.exports=i.cipher.modes=i.cipher.modes||{};function a(t){if("string"==typeof t&&(t=i.util.createBuffer(t)),i.util.isArray(t)&&t.length>4){var e=t;t=i.util.createBuffer();for(var r=0;r0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e,r=i.util.createBuffer(t.iv);if(this._cipherLength=0,e="additionalData"in t?i.util.createBuffer(t.additionalData):i.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=i.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(s(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,e=i.util.createBuffer(e),this._aDataLength=s(8*e.length());var a=e.length()%this.blockSize;for(a&&e.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];e.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])},n.gcm.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},n.gcm.prototype.decrypt=function(t,e,r){var i=t.length();if(i0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--i)e[i]=t[i]>>>1|(1&t[i-1])<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)},n.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var i=t[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][i];e[0]^=n[0],e[1]^=n[1],e[2]^=n[2],e[3]^=n[3]}return e},n.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)},n.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,i=4*r,n=16*r,a=new Array(n),o=0;o>>1,n=new Array(r);n[i]=t.slice(0);for(var a=i>>>1;a>0;)this.pow(n[2*a],n[a]=[]),a>>=1;for(a=2;a>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}n.encode_rsa_oaep=function(t,e,r){var n,o,s,u;"string"==typeof r?(n=r,o=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,o=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=i.md.sha1.create(),u||(u=s);var h=Math.ceil(t.n.bitLength()/8),f=h-2*s.digestLength-2;if(e.length>f)throw(v=new Error("RSAES-OAEP input message length is too long.")).length=e.length,v.maxLength=f,v;n||(n=""),s.update(n,"raw");for(var c=s.digest(),l="",d=f-e.length,p=0;p>>0,s>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=s[1],s[1]=s[0]+(n.fullMessageLength[h]/4294967296>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(a),u(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var s,h=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-h));for(var f=8*n.fullMessageLength[0],c=0;c>>0,o.putInt32(f>>>0),f=s>>>0;o.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(l,r,o);var d=i.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d.putInt32(l.h5),d.putInt32(l.h6),d.putInt32(l.h7),d},n};var a=null,o=!1,s=null;function u(t,e,r){for(var i,n,a,o,u,h,f,c,l,d,p,m,v,g=r.length();g>=64;){for(u=0;u<16;++u)e[u]=r.getInt32();for(;u<64;++u)i=((i=e[u-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=((n=e[u-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e[u]=i+e[u-7]+n+e[u-16]|0;for(h=t.h0,f=t.h1,c=t.h2,l=t.h3,d=t.h4,p=t.h5,m=t.h6,v=t.h7,u=0;u<64;++u)a=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),o=h&f|c&(h^f),i=v+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(m^d&(p^m))+s[u]+e[u],v=m,m=p,p=d,d=l+i>>>0,l=c,c=f,f=h,h=i+(n=a+o)>>>0;t.h0=t.h0+h|0,t.h1=t.h1+f|0,t.h2=t.h2+c|0,t.h3=t.h3+l|0,t.h4=t.h4+d|0,t.h5=t.h5+p|0,t.h6=t.h6+m|0,t.h7=t.h7+v|0,g-=64}}},function(t,e,r){(function(e){var i=r(4);r(6);var n=null;!i.util.isNodejs||i.options.usePureJavaScript||e.versions["node-webkit"]||(n=r(71)),(t.exports=i.prng=i.prng||{}).create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,a=new Array(32),o=0;o<32;++o)a[o]=r.create();function s(){if(e.pools[0].messageLength>=32)return u();var t=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(t)),u()}function u(){e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;var t=e.plugin.md.create();t.update(e.keyBytes);for(var r=1,i=0;i<32;++i)e.reseeds%r==0&&(t.update(e.pools[i].digest().getBytes()),e.pools[i].start()),r<<=1;e.keyBytes=t.digest().getBytes(),t.start(),t.update(e.keyBytes);var n=t.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(n),e.generated=0}function h(t){var e=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(e=function(t){return n.getRandomValues(t)});var a=i.util.createBuffer();if(e)for(;a.length()>16)))<<16,l=4294967295&(f=(2147483647&(f+=h>>15))+(f>>31));for(u=0;u<3;++u)c=l>>>(u<<3),c^=Math.floor(256*Math.random()),a.putByte(String.fromCharCode(255&c))}return a.getBytes(t)}return e.pools=a,e.pool=0,e.generate=function(t,r){if(!r)return e.generateSync(t);var n=e.plugin.cipher,a=e.plugin.increment,o=e.plugin.formatKey,s=e.plugin.formatSeed,h=i.util.createBuffer();e.key=null,function f(c){if(c)return r(c);if(h.length()>=t)return r(null,h.getBytes(t));e.generated>1048575&&(e.key=null);if(null===e.key)return i.util.nextTick((function(){!function(t){if(e.pools[0].messageLength>=32)return u(),t();var r=32-e.pools[0].messageLength<<5;e.seedFile(r,(function(r,i){if(r)return t(r);e.collect(i),u(),t()}))}(f)}));var l=n(e.key,e.seed);e.generated+=l.length,h.putBytes(l),e.key=o(n(e.key,a(e.seed))),e.seed=s(n(e.key,e.seed)),i.util.setImmediate(f)}()},e.generateSync=function(t){var r=e.plugin.cipher,n=e.plugin.increment,a=e.plugin.formatKey,o=e.plugin.formatSeed;e.key=null;for(var u=i.util.createBuffer();u.length()1048575&&(e.key=null),null===e.key&&s();var h=r(e.key,e.seed);e.generated+=h.length,u.putBytes(h),e.key=a(r(e.key,n(e.seed))),e.seed=o(r(e.key,e.seed))}return u.getBytes(t)},n?(e.seedFile=function(t,e){n.randomBytes(t,(function(t,r){if(t)return e(t);e(null,r.toString())}))},e.seedFileSync=function(t){return n.randomBytes(t).toString()}):(e.seedFile=function(t,e){try{e(null,h(t))}catch(t){e(t)}},e.seedFileSync=h),e.collect=function(t){for(var r=t.length,i=0;i>n&255);e.collect(i)},e.registerWorker=function(t){if(t===self)e.seedFile=function(t,e){self.addEventListener("message",(function t(r){var i=r.data;i.forge&&i.forge.prng&&(self.removeEventListener("message",t),e(i.forge.prng.err,i.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:t}}})};else{t.addEventListener("message",(function(r){var i=r.data;i.forge&&i.forge.prng&&e.seedFile(i.forge.prng.needed,(function(e,r){t.postMessage({forge:{prng:{err:e,bytes:r}}})}))}))}},e}}).call(this,r(3))},function(t,e,r){var i=r(4);r(21),r(6);var n=i.asn1,a=t.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=a;var o={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=o;var s={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},a.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(t,e,r){var i,n=r(4);t.exports=n.jsbn=n.jsbn||{};function a(t,e,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function o(){return new a(null)}function s(t,e,r,i,n,a){for(var o=16383&e,s=e>>14;--a>=0;){var u=16383&this.data[t],h=this.data[t++]>>14,f=s*u+h*o;n=((u=o*u+((16383&f)<<14)+r.data[i]+n)>>28)+(f>>14)+s*h,r.data[i++]=268435455&u}return n}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=s,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(var o=32767&e,s=e>>15;--a>=0;){var u=32767&this.data[t],h=this.data[t++]>>15,f=s*u+h*o;n=((u=o*u+((32767&f)<<15)+r.data[i]+(1073741823&n))>>>30)+(f>>>15)+s*h+(n>>>30),r.data[i++]=1073741823&u}return n},i=30):"Netscape"!=navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(;--a>=0;){var o=e*this.data[t++]+r.data[i]+n;n=Math.floor(o/67108864),r.data[i++]=67108863&o}return n},i=26):(a.prototype.am=s,i=28),a.prototype.DB=i,a.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function m(t){this.m=t}function v(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function E(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function M(){}function S(t){return t}function C(t){this.r2=o(),this.q3=o(),a.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}m.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},m.prototype.revert=function(t){return t},m.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},m.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},m.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},v.prototype.convert=function(t){var e=o();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(a.ZERO)>0&&this.m.subTo(e,e),e},v.prototype.revert=function(t){var e=o();return t.copyTo(e),this.reduce(e),e},v.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,i,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},v.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},v.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},a.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s},a.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},a.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=8==r?255&t[i]:l(t,i);s<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},a.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s},a.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e.data[r+o+1]=this.data[r]>>n|s,s=(this.data[r]&a)<=0;--r)e.data[r]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},a.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,a=(1<>i;for(var o=r+1;o>i;i>0&&(e.data[this.t-r-1]|=(this.s&a)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e.data[r++]=this.DV+i:i>0&&(e.data[r++]=i),e.t=r,e.clamp()},a.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e.data[n]=0;for(n=0;n=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()},a.prototype.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(f,s),n.lShiftTo(f,r)):(i.copyTo(s),n.copyTo(r));var c=s.t,l=s.data[c-1];if(0!=l){var d=l*(1<1?s.data[c-2]>>this.F2:0),m=this.FV/d,v=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),a.ONE.dlShiftTo(c,w),w.subTo(s,s);s.t=0;){var _=r.data[--y]==l?this.DM:Math.floor(r.data[y]*m+(r.data[y-1]+g)*v);if((r.data[y]+=s.am(0,_,r,b,0,c))<_)for(s.dlShiftTo(b,w),r.subTo(w,r);r.data[y]<--_;)r.subTo(w,r)}null!=e&&(r.drShiftTo(c,e),u!=h&&a.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(t,e){if(t>4294967295||t<1)return a.ONE;var r=o(),i=o(),n=e.convert(this),s=p(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var u=r;r=i,i=u}return e.revert(r)},a.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,a=c(r));o>=0;)s>(s+=this.DB-e)):(r=this.data[o]>>(s-=e)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=c(r));return n?a:"0"},a.prototype.negate=function(){var t=o();return a.ZERO.subTo(this,t),t},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this.data[r]-t.data[r]))return e;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(t){var e=o();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(a.ZERO)>0&&t.subTo(e,e),e},a.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new m(e):new v(e),this.exp(t,r)},a.ZERO=d(0),a.ONE=d(1),M.prototype.convert=S,M.prototype.revert=S,M.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},M.prototype.sqrTo=function(t,e){t.squareTo(e)},C.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=o();return t.copyTo(e),this.reduce(e),e},C.prototype.revert=function(t){return t},C.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},C.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},C.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var A=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],k=(1<<26)/A[A.length-1];a.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},a.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=d(r),n=o(),a=o(),s="";for(this.divRemTo(i,n,a);n.signum()>0;)s=(r+a.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,a);return a.intValue().toString(t)+s},a.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,u=0;u=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(a.ONE.shiftLeft(t-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(a.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e.data[r++]=i:i<-1&&(e.data[r++]=this.DV+i),e.t=r,e.clamp()},a.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}},a.prototype.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n=0;)r.data[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this.data[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this.data[i])%t;return r},a.prototype.millerRabin=function(t){var e=this.subtract(a.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var i,n=e.shiftRight(r),o={nextBytes:function(t){for(var e=0;e=0);var u=i.modPow(n,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(e)){for(var h=1;h++>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this.data[t]&(1<>(i+=this.DB-8)):(r=this.data[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},a.prototype.equals=function(t){return 0==this.compareTo(t)},a.prototype.min=function(t){return this.compareTo(t)<0?this:t},a.prototype.max=function(t){return this.compareTo(t)>0?this:t},a.prototype.and=function(t){var e=o();return this.bitwiseTo(t,g,e),e},a.prototype.or=function(t){var e=o();return this.bitwiseTo(t,y,e),e},a.prototype.xor=function(t){var e=o();return this.bitwiseTo(t,b,e),e},a.prototype.andNot=function(t){var e=o();return this.bitwiseTo(t,w,e),e},a.prototype.not=function(){for(var t=o(),e=0;e=this.t?0!=this.s:0!=(this.data[e]&1<1){var c=o();for(i.sqrTo(s[1],c);u<=f;)s[u]=o(),i.mulTo(c,s[u-2],s[u]),u+=2}var l,g,y=t.t-1,b=!0,w=o();for(n=p(t.data[y])-1;y>=0;){for(n>=h?l=t.data[y]>>n-h&f:(l=(t.data[y]&(1<0&&(l|=t.data[y-1]>>this.DB+n-h)),u=r;0==(1&l);)l>>=1,--u;if((n-=u)<0&&(n+=this.DB,--y),b)s[l].copyTo(a),b=!1;else{for(;u>1;)i.sqrTo(a,w),i.sqrTo(w,a),u-=2;u>0?i.sqrTo(a,w):(g=a,a=w,w=g),i.mulTo(w,s[l],a)}for(;y>=0&&0==(t.data[y]&1<=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(u,o)):(i.subTo(r,i),e&&s.subTo(n,s),u.subTo(o,u))}return 0!=i.compareTo(a.ONE)?a.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},a.prototype.pow=function(t){return this.exp(t,new M)},a.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return e;for(n0&&(e.rShiftTo(a,e),r.rShiftTo(a,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(e=0;et&&(o=u(t,e));var d=o.toString(16);n.target.postMessage({hex:d,workLoad:f}),o.dAddOffset(c,0)}}}d()}(t,e,n,a);return s(t,e,n,a)}(t,h,a.options,n);throw new Error("Invalid prime generation algorithm: "+a.name)}}function s(t,e,r,a){var o=u(t,e),s=function(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var h=10;"maxBlockTime"in r&&(h=r.maxBlockTime),function t(e,r,a,o,s,h,f){var c=+new Date;do{if(e.bitLength()>r&&(e=u(r,a)),e.isProbablePrime(s))return f(null,e);e.dAddOffset(n[o++%8],0)}while(h<0||+new Date-c=0;u--)I>>=8,I+=C.at(u)+T.at(u),T.setAt(u,255&I);k.putBuffer(T)}w=k,c.putBuffer(M)}return c.truncate(c.length()-a),c},o.pbe.getCipher=function(t,e,r){switch(t){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(t,e,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(t,e,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=t,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}},o.pbe.getCipherForPBES2=function(t,e,r){var n,s={},u=[];if(!a.validate(e,h,s,u))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,n;if((t=a.derToOid(s.kdfOid))!==o.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,n.supportedOids=["pkcs5PBKDF2"],n;if((t=a.derToOid(s.encOid))!==o.oids["aes128-CBC"]&&t!==o.oids["aes192-CBC"]&&t!==o.oids["aes256-CBC"]&&t!==o.oids["des-EDE3-CBC"]&&t!==o.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var f,c,d=s.kdfSalt,p=i.util.createBuffer(s.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[t]){case"aes128-CBC":f=16,c=i.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,c=i.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,c=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,c=i.des.createDecryptionCipher;break;case"desCBC":f=8,c=i.des.createDecryptionCipher}var m=l(s.prfOid),v=i.pkcs5.pbkdf2(r,d,p,f,m),g=s.encIv,y=c(v);return y.start(g),y},o.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},s=[];if(!a.validate(e,f,n,s))throw(m=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,m;var u,h,c,d=i.util.createBuffer(n.salt),p=i.util.createBuffer(n.iterations);switch(p=p.getInt(p.length()<<3),t){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,h=8,c=i.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,h=8,c=function(t,e){var r=i.rc2.createDecryptionCipher(t,40);return r.start(e,null),r};break;default:var m;throw(m=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,m}var v=l(n.prfOid),g=o.pbe.generatePkcs12Key(r,d,1,p,u,v);return v.start(),c(g,o.pbe.generatePkcs12Key(r,d,2,p,h,v))},o.pbe.opensslDeriveBytes=function(t,e,r,n){if(null==n){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');n=i.md.md5.create()}null===e&&(e="");for(var a=[c(n,t+e)],o=16,s=1;o>>((3&e)<<3)&255;return n}}},function(t,e){for(var r=[],i=0;i<256;++i)r[i]=(i+256).toString(16).substr(1);t.exports=function(t,e){var i=e||0,n=r;return[n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],"-",n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]],n[t[i++]]].join("")}},function(t,e,r){"use strict";(function(e){ /*! * deps/ciphermodes/gcm/helpers.js - AES-GCM Helper Functions * @@ -162,7 +162,7 @@ var i=r(78),n=r(12).fill,a=r(56),o=3774873600,s=new i(o>>8);var u=t.exports={E1: * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(17),n=r(55);function a(t){t=t.replace("CONCAT-","");return function(r,a){var o=(a=a||{}).length,s=i.HASHLENGTH[t];if(!o)return Promise.reject(new Error("invalid key length"));if(!a.otherInfo)return Promise.reject(new Error("invalid otherInfo"));var u=a.otherInfo,h=n[t].digest,f=Math.ceil(o/s),c=0,l=[];return function t(){if(f===c++)return e.concat(l).slice(0,o);var i=e.alloc(4+r.length+u.length);return i.writeUInt32BE(c,0),r.copy(i,4),u.copy(i,4+r.length),h(i).then((function(e){return l.push(e),t()}))}()}}var o={};["CONCAT-SHA-1","CONCAT-SHA-256","CONCAT-SHA-384","CONCAT-SHA-512"].forEach((function(t){o[t]={derive:a(t)}})),t.exports=o}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(t){var i=r(8),n=i.jsbn.BigInteger,a=r(132),o=r(273);function s(t){return new n(t,16)}function u(e,r){r||(r=Math.ceil(e.bitLength()/8)),r*=2;var i=e.toString(16);for(i=i.substring(Math.max(i.length-r,0));r>i.length;)i="0"+i;return t.from(i,"hex")}function h(e){return"string"==typeof e&&(e=t.from(e,"binary")),s(e.toString("hex"))}function f(t){return Math.ceil(t.getN().bitLength()/8)}function c(t){var e=o[t];if(!e)throw new TypeError("unsupported named curve: "+t);return e}function l(t,e){var r=t.getN().bitLength(),i=8*e.length,n=h(e);return r=0)return!1;if(o.compareTo(n.ONE)<0||a.compareTo(r)>=0)return!1;var s=l(this.params,t),u=o.modInverse(r),f=s.multiply(u).mod(r),c=a.multiply(u).mod(r),d=i.multiplyTwo(f,this.point,c).getX().toBigInteger();return(d=d.mod(r)).equals(a)},p.prototype.toPublicKey=function(){var t=h(this.d),e=this.params.getG().multiply(t);return new d(this.curve,e.getX().toBigInteger(),e.getY().toBigInteger())},p.prototype.sign=function(t){var e,r,a,o,s=f(this.params),c=this.params.getN(),d=this.params.getG(),p=l(this.params,t),m=h(this.d);do{do{do{a=h(i.random.getBytes(s))}while(a.equals(n.ZERO)||a.compareTo(c)>=0);e=d.multiply(a).getX().toBigInteger().mod(c)}while(e.equals(n.ZERO));o=m.multiply(e),o=p.add(o),r=a.modInverse(c).multiply(o).mod(c)}while(r.equals(n.ONE));var v=f(this.params);return{r:e=u(e,v),s:r=u(r,v)}},p.prototype.isValid=function(){var t=h(this.d),e=this.params.getN().subtract(n.ONE);return t.compareTo(n.ONE)>=0&&t.compareTo(e)<0},p.prototype.computeSecret=function(t){var e=h(this.d),r=t.point.multiply(e).getX().toBigInteger();return r=u(r,f(this.params))},e.generateKeyPair=function(t){var e=c(t),r=e.getN(),a=i.random.getBytes(f(e));a=h(a);var o=r.subtract(n.ONE),s=new p(t,a.mod(o).add(n.ONE)),u=s.toPublicKey();return{private:s,public:u}},e.asPublicKey=function(e,r,i){return"string"==typeof r?r=s(r):t.isBuffer(r)&&(r=h(r)),"string"==typeof i?i=s(i):t.isBuffer(i)&&(i=h(i)),new d(e,r,i)},e.asPrivateKey=function(e,r){return"string"==typeof r?r=s(r):t.isBuffer(r)&&(r=h(r)),new p(e,r)}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(8).jsbn.BigInteger;function n(){return new i(null)}function a(t){this.r2=n(),this.q3=n(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function o(t,e){this.x=e,this.p=t}function s(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=n||i.ONE,this.zinv=null}function u(t,e,r){this.p=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new s(this,null,null),this.reducer=new a(this.p)}a.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=n();return t.copyTo(e),this.reduce(e),e},a.prototype.revert=function(t){return t},a.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},a.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},a.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},o.prototype.equals=function(t){return t===this||this.p.equals(t.p)&&this.x.equals(t.x)},o.prototype.toBigInteger=function(){return this.x},o.prototype.negate=function(){return new o(this.p,this.x.negate().mod(this.p))},o.prototype.add=function(t){return new o(this.p,this.x.add(t.toBigInteger()).mod(this.p))},o.prototype.subtract=function(t){return new o(this.p,this.x.subtract(t.toBigInteger()).mod(this.p))},o.prototype.multiply=function(t){return new o(this.p,this.x.multiply(t.toBigInteger()).mod(this.p))},o.prototype.square=function(){return new o(this.p,this.x.pow(2).mod(this.p))},o.prototype.divide=function(t){return new o(this.p,this.x.multiply(t.toBigInteger().modInverse(this.p)).mod(this.p))},s.prototype.getX=function(){this.zinv||(this.zinv=this.z.modInverse(this.curve.p));var t=this.x.toBigInteger().multiply(this.zinv);return this.curve.reduce(t),this.curve.fromBigInteger(t)},s.prototype.getY=function(){this.zinv||(this.zinv=this.z.modInverse(this.curve.p));var t=this.y.toBigInteger().multiply(this.zinv);return this.curve.reduce(t),this.curve.fromBigInteger(t)},s.prototype.equals=function(t){return t===this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.p).equals(i.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.p).equals(i.ZERO))},s.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(i.ZERO)&&!this.y.toBigInteger().equals(i.ZERO)},s.prototype.negate=function(){return new s(this.curve,this.x,this.y.negate(),this.z)},s.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.p),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.p);if(i.ZERO.equals(r))return i.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new i("3"),a=this.x.toBigInteger(),o=this.y.toBigInteger(),u=r.pow(2),h=u.multiply(r),f=a.multiply(u),c=e.pow(2).multiply(this.z),l=c.subtract(f.shiftLeft(1)).multiply(t.z).subtract(h).multiply(r).mod(this.curve.p),d=f.multiply(n).multiply(e).subtract(o.multiply(h)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(h)).mod(this.curve.p),p=h.multiply(this.z).multiply(t.z).mod(this.curve.p);return new s(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(d),p)},s.prototype.twice=function(){if(this.isInfinity())return this;if(0===this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new i("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),a=n.multiply(r).mod(this.curve.p),o=this.curve.a.toBigInteger(),u=e.pow(2).multiply(t);i.ZERO.equals(o)||(u=u.add(this.z.pow(2).multiply(o)));var h=(u=u.mod(this.curve.p)).pow(2).subtract(e.shiftLeft(3).multiply(a)).shiftLeft(1).multiply(n).mod(this.curve.p),f=u.multiply(t).multiply(e).subtract(a.shiftLeft(1)).shiftLeft(2).multiply(a).subtract(u.pow(2).multiply(u)).mod(this.curve.p),c=n.pow(2).multiply(n).shiftLeft(3).mod(this.curve.p);return new s(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(f),c)},s.prototype.multiply=function(t){if(this.isInfinity())return this;if(0===t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new i("3")),a=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!==r.testBit(e)&&(o=o.add(s?this:a))}return o},s.prototype.multiplyTwo=function(t,e,r){var i;i=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var n=this.curve.getInfinity(),a=this.add(e);i>=0;)n=n.twice(),t.testBit(i)?n=r.testBit(i)?n.add(a):n.add(this):r.testBit(i)&&(n=n.add(e)),--i;return n},u.prototype.getP=function(){return this.p},u.prototype.getA=function(){return this.a},u.prototype.getB=function(){return this.b},u.prototype.equals=function(t){return t===this||this.p.equals(t.p)&&this.a.equals(t.a)&&this.b.equals(t.b)},u.prototype.contains=function(t){var e=t.getX().toBigInteger(),r=t.getY().toBigInteger(),i=this.a.toBigInteger(),n=this.b.toBigInteger(),a=this.p,o=r.pow(2).mod(a),s=e.pow(3).add(i.multiply(e)).add(n).mod(a);return o.equals(s)},u.prototype.getInfinity=function(){return this.infinity},u.prototype.fromBigInteger=function(t){return new o(this.p,t)},u.prototype.reduce=function(t){this.reducer.reduce(t)},u.prototype.decodePointHex=function(t){switch(parseInt(t.substring(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new s(this,this.fromBigInteger(new i(r,16)),this.fromBigInteger(new i(n,16)));default:return null}},u.prototype.encodePointHex=function(t){if(t.isInfinity())return"00";var e=t.getX().toBigInteger().toString(16),r=t.getY().toBigInteger().toString(16),i=this.getP().toString(16).length;for(i%2!=0&&i++;e.lengthi.length;)i="0"+i;return t.from(i,"hex")}function h(e){return"string"==typeof e&&(e=t.from(e,"binary")),s(e.toString("hex"))}function f(t){return Math.ceil(t.getN().bitLength()/8)}function c(t){var e=o[t];if(!e)throw new TypeError("unsupported named curve: "+t);return e}function l(t,e){var r=t.getN().bitLength(),i=8*e.length,n=h(e);return r=0)return!1;if(o.compareTo(n.ONE)<0||a.compareTo(r)>=0)return!1;var s=l(this.params,t),u=o.modInverse(r),f=s.multiply(u).mod(r),c=a.multiply(u).mod(r),d=i.multiplyTwo(f,this.point,c).getX().toBigInteger();return(d=d.mod(r)).equals(a)},p.prototype.toPublicKey=function(){var t=h(this.d),e=this.params.getG().multiply(t);return new d(this.curve,e.getX().toBigInteger(),e.getY().toBigInteger())},p.prototype.sign=function(t){var e,r,a,o,s=f(this.params),c=this.params.getN(),d=this.params.getG(),p=l(this.params,t),m=h(this.d);do{do{do{a=h(i.random.getBytes(s))}while(a.equals(n.ZERO)||a.compareTo(c)>=0);e=d.multiply(a).getX().toBigInteger().mod(c)}while(e.equals(n.ZERO));o=m.multiply(e),o=p.add(o),r=a.modInverse(c).multiply(o).mod(c)}while(r.equals(n.ONE));var v=f(this.params);return{r:e=u(e,v),s:r=u(r,v)}},p.prototype.isValid=function(){var t=h(this.d),e=this.params.getN().subtract(n.ONE);return t.compareTo(n.ONE)>=0&&t.compareTo(e)<0},p.prototype.computeSecret=function(t){var e=h(this.d),r=t.point.multiply(e).getX().toBigInteger();return r=u(r,f(this.params))},e.generateKeyPair=function(t){var e=c(t),r=e.getN(),a=i.random.getBytes(f(e));a=h(a);var o=r.subtract(n.ONE),s=new p(t,a.mod(o).add(n.ONE)),u=s.toPublicKey();return{private:s,public:u}},e.asPublicKey=function(e,r,i){return"string"==typeof r?r=s(r):t.isBuffer(r)&&(r=h(r)),"string"==typeof i?i=s(i):t.isBuffer(i)&&(i=h(i)),new d(e,r,i)},e.asPrivateKey=function(e,r){return"string"==typeof r?r=s(r):t.isBuffer(r)&&(r=h(r)),new p(e,r)}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(8).jsbn.BigInteger;function n(){return new i(null)}function a(t){this.r2=n(),this.q3=n(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function o(t,e){this.x=e,this.p=t}function s(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=n||i.ONE,this.zinv=null}function u(t,e,r){this.p=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new s(this,null,null),this.reducer=new a(this.p)}a.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=n();return t.copyTo(e),this.reduce(e),e},a.prototype.revert=function(t){return t},a.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},a.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},a.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},o.prototype.equals=function(t){return t===this||this.p.equals(t.p)&&this.x.equals(t.x)},o.prototype.toBigInteger=function(){return this.x},o.prototype.negate=function(){return new o(this.p,this.x.negate().mod(this.p))},o.prototype.add=function(t){return new o(this.p,this.x.add(t.toBigInteger()).mod(this.p))},o.prototype.subtract=function(t){return new o(this.p,this.x.subtract(t.toBigInteger()).mod(this.p))},o.prototype.multiply=function(t){return new o(this.p,this.x.multiply(t.toBigInteger()).mod(this.p))},o.prototype.square=function(){return new o(this.p,this.x.pow(2).mod(this.p))},o.prototype.divide=function(t){return new o(this.p,this.x.multiply(t.toBigInteger().modInverse(this.p)).mod(this.p))},s.prototype.getX=function(){this.zinv||(this.zinv=this.z.modInverse(this.curve.p));var t=this.x.toBigInteger().multiply(this.zinv);return this.curve.reduce(t),this.curve.fromBigInteger(t)},s.prototype.getY=function(){this.zinv||(this.zinv=this.z.modInverse(this.curve.p));var t=this.y.toBigInteger().multiply(this.zinv);return this.curve.reduce(t),this.curve.fromBigInteger(t)},s.prototype.equals=function(t){return t===this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.p).equals(i.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.p).equals(i.ZERO))},s.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(i.ZERO)&&!this.y.toBigInteger().equals(i.ZERO)},s.prototype.negate=function(){return new s(this.curve,this.x,this.y.negate(),this.z)},s.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.p),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.p);if(i.ZERO.equals(r))return i.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new i("3"),a=this.x.toBigInteger(),o=this.y.toBigInteger(),u=r.pow(2),h=u.multiply(r),f=a.multiply(u),c=e.pow(2).multiply(this.z),l=c.subtract(f.shiftLeft(1)).multiply(t.z).subtract(h).multiply(r).mod(this.curve.p),d=f.multiply(n).multiply(e).subtract(o.multiply(h)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(h)).mod(this.curve.p),p=h.multiply(this.z).multiply(t.z).mod(this.curve.p);return new s(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(d),p)},s.prototype.twice=function(){if(this.isInfinity())return this;if(0===this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new i("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),a=n.multiply(r).mod(this.curve.p),o=this.curve.a.toBigInteger(),u=e.pow(2).multiply(t);i.ZERO.equals(o)||(u=u.add(this.z.pow(2).multiply(o)));var h=(u=u.mod(this.curve.p)).pow(2).subtract(e.shiftLeft(3).multiply(a)).shiftLeft(1).multiply(n).mod(this.curve.p),f=u.multiply(t).multiply(e).subtract(a.shiftLeft(1)).shiftLeft(2).multiply(a).subtract(u.pow(2).multiply(u)).mod(this.curve.p),c=n.pow(2).multiply(n).shiftLeft(3).mod(this.curve.p);return new s(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(f),c)},s.prototype.multiply=function(t){if(this.isInfinity())return this;if(0===t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new i("3")),a=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!==r.testBit(e)&&(o=o.add(s?this:a))}return o},s.prototype.multiplyTwo=function(t,e,r){var i;i=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var n=this.curve.getInfinity(),a=this.add(e);i>=0;)n=n.twice(),t.testBit(i)?n=r.testBit(i)?n.add(a):n.add(this):r.testBit(i)&&(n=n.add(e)),--i;return n},u.prototype.getP=function(){return this.p},u.prototype.getA=function(){return this.a},u.prototype.getB=function(){return this.b},u.prototype.equals=function(t){return t===this||this.p.equals(t.p)&&this.a.equals(t.a)&&this.b.equals(t.b)},u.prototype.contains=function(t){var e=t.getX().toBigInteger(),r=t.getY().toBigInteger(),i=this.a.toBigInteger(),n=this.b.toBigInteger(),a=this.p,o=r.pow(2).mod(a),s=e.pow(3).add(i.multiply(e)).add(n).mod(a);return o.equals(s)},u.prototype.getInfinity=function(){return this.infinity},u.prototype.fromBigInteger=function(t){return new o(this.p,t)},u.prototype.reduce=function(t){this.reducer.reduce(t)},u.prototype.decodePointHex=function(t){switch(parseInt(t.substring(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new s(this,this.fromBigInteger(new i(r,16)),this.fromBigInteger(new i(n,16)));default:return null}},u.prototype.encodePointHex=function(t){if(t.isInfinity())return"00";var e=t.getX().toBigInteger().toString(16),r=t.getY().toBigInteger().toString(16),i=this.getP().toString(16).length;for(i%2!=0&&i++;e.length=u?o=new RangeError(h):e=i.concat(n,a),n=[],t.close(),r(o,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",o),r(e)})),t.on("end",s),t.end(e),o()}function g(t,e){if("string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function b(t){if(!(this instanceof b))return new b(t);k.call(this,t,a.DEFLATE)}function w(t){if(!(this instanceof w))return new w(t);k.call(this,t,a.INFLATE)}function _(t){if(!(this instanceof _))return new _(t);k.call(this,t,a.GZIP)}function E(t){if(!(this instanceof E))return new E(t);k.call(this,t,a.GUNZIP)}function M(t){if(!(this instanceof M))return new M(t);k.call(this,t,a.DEFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);k.call(this,t,a.INFLATERAW)}function C(t){if(!(this instanceof C))return new C(t);k.call(this,t,a.UNZIP)}function A(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function k(t,r){var o=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||e.Z_DEFAULT_CHUNK,n.call(this,t),t.flush&&!A(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!A(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSizee.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitse.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.levele.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevele.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=e.Z_FILTERED&&t.strategy!=e.Z_HUFFMAN_ONLY&&t.strategy!=e.Z_RLE&&t.strategy!=e.Z_FIXED&&t.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!i.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(t,r){T(s),s._hadError=!0;var i=new Error(t);i.errno=r,i.code=e.codes[r],s.emit("error",i)};var u=e.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var h=e.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(h=t.strategy),this._handle.init(t.windowBits||e.Z_DEFAULT_WINDOWBITS,u,t.memLevel||e.Z_DEFAULT_MEMLEVEL,h,t.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=h,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function T(e,r){r&&t.nextTick(r),e._handle&&(e._handle.close(),e._handle=null)}function I(t){t.emit("close")}Object.defineProperty(e,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),e.Deflate=b,e.Inflate=w,e.Gzip=_,e.Gunzip=E,e.DeflateRaw=M,e.InflateRaw=S,e.Unzip=C,e.createDeflate=function(t){return new b(t)},e.createInflate=function(t){return new w(t)},e.createDeflateRaw=function(t){return new M(t)},e.createInflateRaw=function(t){return new S(t)},e.createGzip=function(t){return new _(t)},e.createGunzip=function(t){return new E(t)},e.createUnzip=function(t){return new C(t)},e.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new b(e),t,r)},e.deflateSync=function(t,e){return g(new b(e),t)},e.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new _(e),t,r)},e.gzipSync=function(t,e){return g(new _(e),t)},e.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new M(e),t,r)},e.deflateRawSync=function(t,e){return g(new M(e),t)},e.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new C(e),t,r)},e.unzipSync=function(t,e){return g(new C(e),t)},e.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new w(e),t,r)},e.inflateSync=function(t,e){return g(new w(e),t)},e.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new E(e),t,r)},e.gunzipSync=function(t,e){return g(new E(e),t)},e.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new S(e),t,r)},e.inflateRawSync=function(t,e){return g(new S(e),t)},o.inherits(k,n),k.prototype.params=function(r,i,n){if(re.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(i!=e.Z_FILTERED&&i!=e.Z_HUFFMAN_ONLY&&i!=e.Z_RLE&&i!=e.Z_FIXED&&i!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==r||this._strategy!==i){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){s(o._handle,"zlib binding closed"),o._handle.params(r,i),o._hadError||(o._level=r,o._strategy=i,n&&n())}))}else t.nextTick(n)},k.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(t){this._transform(i.alloc(0),"",t)},k.prototype.flush=function(e,r){var n=this,o=this._writableState;("function"==typeof e||void 0===e&&!r)&&(r=e,e=a.Z_FULL_FLUSH),o.ended?r&&t.nextTick(r):o.ending?r&&this.once("end",r):o.needDrain?r&&this.once("drain",(function(){return n.flush(e,r)})):(this._flushFlag=e,this.write(i.alloc(0),"",r))},k.prototype.close=function(e){T(this,e),t.nextTick(I,this)},k.prototype._transform=function(t,e,r){var n,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||i.isBuffer(t)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(t,e,r){var n=t&&t.length,a=this._chunkSize-this._offset,o=0,f=this,c="function"==typeof r;if(!c){var l,d=[],p=0;this.on("error",(function(t){l=t})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(e,t,o,n,this._buffer,this._offset,a)}while(!this._hadError&&g(m[0],m[1]));if(this._hadError)throw l;if(p>=u)throw T(this),new RangeError(h);var v=i.concat(d,p);return T(this),v}s(this._handle,"zlib binding closed");var y=this._handle.write(e,t,o,n,this._buffer,this._offset,a);function g(u,h){if(this&&(this.buffer=null,this.callback=null),!f._hadError){var l=a-h;if(s(l>=0,"have should not go down"),l>0){var m=f._buffer.slice(f._offset,f._offset+l);f._offset+=l,c?f.push(m):(d.push(m),p+=m.length)}if((0===h||f._offset>=f._chunkSize)&&(a=f._chunkSize,f._offset=0,f._buffer=i.allocUnsafe(f._chunkSize)),0===h){if(o+=n-u,n=u,!c)return!0;var v=f._handle.write(e,t,o,n,f._buffer,f._offset,f._chunkSize);return v.callback=g,void(v.buffer=t)}if(!c)return!1;r()}}y.buffer=t,y.callback=g},o.inherits(b,k),o.inherits(w,k),o.inherits(_,k),o.inherits(E,k),o.inherits(M,k),o.inherits(S,k),o.inherits(C,k)}).call(this,r(4))},function(t,e,r){"use strict";(function(e,i){var n=r(57);t.exports=b;var a,o=r(115);b.ReadableState=g;r(19).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=r(139),h=r(84).Buffer,f=e.Uint8Array||function(){};var c=Object.create(r(45));c.inherits=r(1);var l=r(285),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=r(286),v=r(140);c.inherits(b,u);var y=["error","close","destroy","pause","resume"];function g(t,e){t=t||{};var i=e instanceof(a=a||r(26));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(27).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(a=a||r(26),!(this instanceof b))return new b(t);this._readableState=new g(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function w(t,e,r,i,n){var a,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,M(t)}(t,o)):(n||(a=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),a?t.emit("error",a):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?_(t,o,e,!1):C(t,o)):_(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function M(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(S,t):S(t))}function S(t){d("emit readable"),t.emit("readable"),I(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ta.length?a.length:t;if(o===a.length?n+=a:n+=a.slice(0,t),0===(t-=o)){o===a.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=a.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var a=i.data,o=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,o),0===(t-=o)){o===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function P(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function x(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?P(this):M(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&P(this),null;var i,n=e.needReadable;return d("need readable",n),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&P(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?f:b;function h(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",c),t.removeListener("error",v),t.removeListener("unpipe",h),r.removeListener("end",f),r.removeListener("end",b),r.removeListener("data",m),l=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function f(){d("onend"),t.end()}a.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var c=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",c);var l=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==x(a.pipes,t))&&!l&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function v(e){d("onerror",e),b(),t.removeListener("error",v),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),b()}function g(){d("onfinish"),t.removeListener("close",y),b()}function b(){d("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",v),t.once("close",y),t.once("finish",g),t.emit("pipe",r),a.flowing||(d("pipe resume"),r.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a=u?o=new RangeError(h):e=i.concat(n,a),n=[],t.close(),r(o,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",o),r(e)})),t.on("end",s),t.end(e),o()}function y(t,e){if("string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function b(t){if(!(this instanceof b))return new b(t);k.call(this,t,a.DEFLATE)}function w(t){if(!(this instanceof w))return new w(t);k.call(this,t,a.INFLATE)}function _(t){if(!(this instanceof _))return new _(t);k.call(this,t,a.GZIP)}function E(t){if(!(this instanceof E))return new E(t);k.call(this,t,a.GUNZIP)}function M(t){if(!(this instanceof M))return new M(t);k.call(this,t,a.DEFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);k.call(this,t,a.INFLATERAW)}function C(t){if(!(this instanceof C))return new C(t);k.call(this,t,a.UNZIP)}function A(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function k(t,r){var o=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||e.Z_DEFAULT_CHUNK,n.call(this,t),t.flush&&!A(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!A(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSizee.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitse.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.levele.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevele.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=e.Z_FILTERED&&t.strategy!=e.Z_HUFFMAN_ONLY&&t.strategy!=e.Z_RLE&&t.strategy!=e.Z_FIXED&&t.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!i.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(t,r){T(s),s._hadError=!0;var i=new Error(t);i.errno=r,i.code=e.codes[r],s.emit("error",i)};var u=e.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var h=e.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(h=t.strategy),this._handle.init(t.windowBits||e.Z_DEFAULT_WINDOWBITS,u,t.memLevel||e.Z_DEFAULT_MEMLEVEL,h,t.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=h,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function T(e,r){r&&t.nextTick(r),e._handle&&(e._handle.close(),e._handle=null)}function I(t){t.emit("close")}Object.defineProperty(e,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),e.Deflate=b,e.Inflate=w,e.Gzip=_,e.Gunzip=E,e.DeflateRaw=M,e.InflateRaw=S,e.Unzip=C,e.createDeflate=function(t){return new b(t)},e.createInflate=function(t){return new w(t)},e.createDeflateRaw=function(t){return new M(t)},e.createInflateRaw=function(t){return new S(t)},e.createGzip=function(t){return new _(t)},e.createGunzip=function(t){return new E(t)},e.createUnzip=function(t){return new C(t)},e.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new b(e),t,r)},e.deflateSync=function(t,e){return y(new b(e),t)},e.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new _(e),t,r)},e.gzipSync=function(t,e){return y(new _(e),t)},e.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new M(e),t,r)},e.deflateRawSync=function(t,e){return y(new M(e),t)},e.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new C(e),t,r)},e.unzipSync=function(t,e){return y(new C(e),t)},e.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new w(e),t,r)},e.inflateSync=function(t,e){return y(new w(e),t)},e.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new E(e),t,r)},e.gunzipSync=function(t,e){return y(new E(e),t)},e.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new S(e),t,r)},e.inflateRawSync=function(t,e){return y(new S(e),t)},o.inherits(k,n),k.prototype.params=function(r,i,n){if(re.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(i!=e.Z_FILTERED&&i!=e.Z_HUFFMAN_ONLY&&i!=e.Z_RLE&&i!=e.Z_FIXED&&i!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==r||this._strategy!==i){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){s(o._handle,"zlib binding closed"),o._handle.params(r,i),o._hadError||(o._level=r,o._strategy=i,n&&n())}))}else t.nextTick(n)},k.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(t){this._transform(i.alloc(0),"",t)},k.prototype.flush=function(e,r){var n=this,o=this._writableState;("function"==typeof e||void 0===e&&!r)&&(r=e,e=a.Z_FULL_FLUSH),o.ended?r&&t.nextTick(r):o.ending?r&&this.once("end",r):o.needDrain?r&&this.once("drain",(function(){return n.flush(e,r)})):(this._flushFlag=e,this.write(i.alloc(0),"",r))},k.prototype.close=function(e){T(this,e),t.nextTick(I,this)},k.prototype._transform=function(t,e,r){var n,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||i.isBuffer(t)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(t,e,r){var n=t&&t.length,a=this._chunkSize-this._offset,o=0,f=this,c="function"==typeof r;if(!c){var l,d=[],p=0;this.on("error",(function(t){l=t})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(e,t,o,n,this._buffer,this._offset,a)}while(!this._hadError&&y(m[0],m[1]));if(this._hadError)throw l;if(p>=u)throw T(this),new RangeError(h);var v=i.concat(d,p);return T(this),v}s(this._handle,"zlib binding closed");var g=this._handle.write(e,t,o,n,this._buffer,this._offset,a);function y(u,h){if(this&&(this.buffer=null,this.callback=null),!f._hadError){var l=a-h;if(s(l>=0,"have should not go down"),l>0){var m=f._buffer.slice(f._offset,f._offset+l);f._offset+=l,c?f.push(m):(d.push(m),p+=m.length)}if((0===h||f._offset>=f._chunkSize)&&(a=f._chunkSize,f._offset=0,f._buffer=i.allocUnsafe(f._chunkSize)),0===h){if(o+=n-u,n=u,!c)return!0;var v=f._handle.write(e,t,o,n,f._buffer,f._offset,f._chunkSize);return v.callback=y,void(v.buffer=t)}if(!c)return!1;r()}}g.buffer=t,g.callback=y},o.inherits(b,k),o.inherits(w,k),o.inherits(_,k),o.inherits(E,k),o.inherits(M,k),o.inherits(S,k),o.inherits(C,k)}).call(this,r(3))},function(t,e,r){"use strict";(function(e,i){var n=r(57);t.exports=b;var a,o=r(115);b.ReadableState=y;r(19).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=r(139),h=r(84).Buffer,f=e.Uint8Array||function(){};var c=Object.create(r(45));c.inherits=r(1);var l=r(286),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=r(287),v=r(140);c.inherits(b,u);var g=["error","close","destroy","pause","resume"];function y(t,e){t=t||{};var i=e instanceof(a=a||r(26));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(27).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(a=a||r(26),!(this instanceof b))return new b(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function w(t,e,r,i,n){var a,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,M(t)}(t,o)):(n||(a=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),a?t.emit("error",a):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?_(t,o,e,!1):C(t,o)):_(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function M(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(S,t):S(t))}function S(t){d("emit readable"),t.emit("readable"),I(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ta.length?a.length:t;if(o===a.length?n+=a:n+=a.slice(0,t),0===(t-=o)){o===a.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=a.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var a=i.data,o=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,o),0===(t-=o)){o===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function P(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function x(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?P(this):M(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&P(this),null;var i,n=e.needReadable;return d("need readable",n),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&P(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?f:b;function h(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",c),t.removeListener("error",v),t.removeListener("unpipe",h),r.removeListener("end",f),r.removeListener("end",b),r.removeListener("data",m),l=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function f(){d("onend"),t.end()}a.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var c=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",c);var l=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==x(a.pipes,t))&&!l&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function v(e){d("onerror",e),b(),t.removeListener("error",v),0===s(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),b()}function y(){d("onfinish"),t.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",v),t.once("close",g),t.once("finish",y),t.emit("pipe",r),a.flowing||(d("pipe resume"),r.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a * @license MIT - */function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,a=Math.min(r,i);n=0;h--)if(f[h]!==c[h])return!1;for(h=f.length-1;h>=0;h--)if(s=f[h],!b(t[s],e[s],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&y(n,r,"Missing expected exception"+i);var a="string"==typeof i,s=!t&&n&&!r;if((!t&&o.isError(n)&&a&&_(n,r)||s)&&y(n,r,"Got unwanted exception"+i),t&&n&&r&&!_(n,r)||!t&&n)throw n}l.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(v(t.actual),128)+" "+t.operator+" "+m(v(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=p(e),a=i.indexOf("\n"+n);if(a>=0){var o=i.indexOf("\n",a+1);i=i.substring(o+1)}this.stack=i}}},o.inherits(l.AssertionError,Error),l.fail=y,l.ok=g,l.equal=function(t,e,r){t!=e&&y(t,e,r,"==",l.equal)},l.notEqual=function(t,e,r){t==e&&y(t,e,r,"!=",l.notEqual)},l.deepEqual=function(t,e,r){b(t,e,!1)||y(t,e,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(t,e,r){b(t,e,!0)||y(t,e,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(t,e,r){b(t,e,!1)&&y(t,e,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function t(e,r,i){b(e,r,!0)&&y(e,r,i,"notDeepStrictEqual",t)},l.strictEqual=function(t,e,r){t!==e&&y(t,e,r,"===",l.strictEqual)},l.notStrictEqual=function(t,e,r){t===e&&y(t,e,r,"!==",l.notStrictEqual)},l.throws=function(t,e,r){E(!0,t,e,r)},l.doesNotThrow=function(t,e,r){E(!1,t,e,r)},l.ifError=function(t){if(t)throw t},l.strict=i((function t(e,r){e||y(e,!0,r,"==",t)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var M=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r(7))},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,a=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(n=n+e[i++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var a=i,o=n+r;t^=-1;for(var s=n;s>>8^a[255&(t^e[s])];return-1^t}},function(t,e,r){var i=r(87);t.exports=function(t,e){e=e||{};var r=i.decode(t,e);if(!r)return null;var n=r.payload;if("string"==typeof n)try{var a=JSON.parse(n);null!==a&&"object"==typeof a&&(n=a)}catch(t){}return!0===e.complete?{header:r.header,payload:n,signature:r.signature}:n}},function(t,e,r){(function(e){var i=r(2).Buffer,n=r(44);function a(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=i.alloc(0),this;if("function"==typeof t.pipe)return this.buffer=i.alloc(0),t.pipe(this),this;if(t.length||"object"==typeof t)return this.buffer=t,this.writable=!1,e.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof t+")")}r(28).inherits(a,n),a.prototype.write=function(t){this.buffer=i.concat([this.buffer,i.from(t)]),this.emit("data",t)},a.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=a}).call(this,r(4))},function(t,e,r){var i=r(313),n=r(2).Buffer,a=r(88),o=r(407),s=r(28),u="secret must be a string or buffer",h="key must be a string or a buffer",f="function"==typeof a.createPublicKey;function c(t){if(!n.isBuffer(t)&&"string"!=typeof t){if(!f)throw m(h);if("object"!=typeof t)throw m(h);if("string"!=typeof t.type)throw m(h);if("string"!=typeof t.asymmetricKeyType)throw m(h);if("function"!=typeof t.export)throw m(h)}}function l(t){if(!n.isBuffer(t)&&"string"!=typeof t&&"object"!=typeof t)throw m("key must be a string, a buffer or an object")}function d(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(t){var e=4-(t=t.toString()).length%4;if(4!==e)for(var r=0;r=this._blockSize;){for(var a=this._blockOffset;a0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},function(t,e,r){"use strict";(function(e,i){var n;t.exports=C,C.ReadableState=S;r(19).EventEmitter;var a=function(t,e){return t.listeners(e).length},o=r(150),s=r(0).Buffer,u=e.Uint8Array||function(){};var h,f=r(315);h=f&&f.debuglog?f.debuglog("stream"):function(){};var c,l,d,p=r(316),m=r(151),v=r(152).getHighWaterMark,y=r(32).codes,g=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(1)(C,o);var E=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function S(t,e,i){n=n||r(33),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=v(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(27).StringDecoder),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function C(t){if(n=n||r(33),!(this instanceof C))return new C(t);var e=this instanceof n;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function A(t,e,r,i,n){h("readableAddChunk",e);var a,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(h("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,o);else if(n||(a=function(t,e){var r;i=e,s.isBuffer(i)||i instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new g("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),a)E(t,a);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?E(t,new _):k(t,o,e,!0);else if(o.ended)E(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?k(t,o,e,!1):P(t,o)):k(t,o,e,!1)}else i||(o.reading=!1,P(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(R,t))}function R(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){h("readable nexttick read 0"),t.read(0)}function N(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function L(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function U(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):I(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&F(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?L(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){E(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:v;function s(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",v),r.removeListener("data",l),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var c=!1;function l(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==U(n.pipes,t))&&!c&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),v(),t.removeListener("error",d),0===a(t,"error")&&E(t,e)}function p(){t.removeListener("finish",m),v()}function m(){h("onfinish"),t.removeListener("close",p),v()}function v(){h("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(O,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(x,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(x,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=c.destroy,C.prototype._undestroy=c.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(7),r(4))},function(t,e,r){"use strict";t.exports=f;var i=r(32).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(33);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(u,n),u.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},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,v=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+d(r[y-15])+r[y-16];for(var g=0;g<64;++g){var b=v+l(u)+h(u,p,m)+o[g]+r[g]|0,w=c(i)+f(i,n,a)|0;v=m,m=p,p=u,u=s+b|0,s=a,a=n,n=i,i=b+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=v+this._h|0},u.prototype._hash=function(){var t=a.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[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],s=new Array(160);function u(){this.init(),this._w=s,n.call(this,128,112)}function h(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function v(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}i(u,n),u.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},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,s=0|this._eh,u=0|this._fh,g=0|this._gh,b=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,M=0|this._dl,S=0|this._el,C=0|this._fl,A=0|this._gl,k=0|this._hl,T=0;T<32;T+=2)e[T]=t.readInt32BE(4*T),e[T+1]=t.readInt32BE(4*T+4);for(;T<160;T+=2){var I=e[T-30],R=e[T-30+1],P=d(I,R),B=p(R,I),x=m(I=e[T-4],R=e[T-4+1]),O=v(R,I),N=e[T-14],j=e[T-14+1],L=e[T-32],F=e[T-32+1],D=B+j|0,U=P+N+y(D,B)|0;U=(U=U+x+y(D=D+O|0,O)|0)+L+y(D=D+F|0,F)|0,e[T]=U,e[T+1]=D}for(var K=0;K<160;K+=2){U=e[K],D=e[K+1];var q=f(r,i,n),z=f(w,_,E),V=c(r,w),H=c(w,r),Z=l(s,S),G=l(S,s),W=o[K],$=o[K+1],Q=h(s,u,g),Y=h(S,C,A),J=k+G|0,X=b+Z+y(J,k)|0;X=(X=(X=X+Q+y(J=J+Y|0,Y)|0)+W+y(J=J+$|0,$)|0)+U+y(J=J+D|0,D)|0;var tt=H+z|0,et=V+q+y(tt,H)|0;b=g,k=A,g=u,A=C,u=s,C=S,s=a+X+y(S=M+J|0,M)|0,a=n,M=E,n=i,E=_,i=r,_=w,r=X+et+y(w=J+tt|0,J)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+M|0,this._el=this._el+S|0,this._fl=this._fl+C|0,this._gl=this._gl+A|0,this._hl=this._hl+k|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+i+y(this._bl,_)|0,this._ch=this._ch+n+y(this._cl,E)|0,this._dh=this._dh+a+y(this._dl,M)|0,this._eh=this._eh+s+y(this._el,S)|0,this._fh=this._fh+u+y(this._fl,C)|0,this._gh=this._gh+g+y(this._gl,A)|0,this._hh=this._hh+b+y(this._hl,k)|0},u.prototype._hash=function(){var t=a.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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),t},t.exports=u},function(t,e,r){"use strict";var i=r(1),n=r(326),a=r(23),o=r(2).Buffer,s=r(158),u=r(91),h=r(92),f=o.alloc(128);function c(t,e){a.call(this,"digest"),"string"==typeof e&&(e=o.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:h(t)).update(e).digest():e.lengthr||a!=a)throw new TypeError("Bad key length")}}).call(this,r(0).Buffer)},function(t,e,r){(function(e){var r;e.browser?r="utf-8":r=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";t.exports=r}).call(this,r(4))},function(t,e,r){var i=r(158),n=r(91),a=r(92),o=r(161),s=r(162),u=r(2).Buffer,h=u.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var o=function(t){function e(e){return a(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new n).update(t).digest()}:"md5"===t?i:e}(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=o(e):e.length>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+o&1}for(o=6;o>=0;o-=2){for(s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1;for(s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},e.rip=function(t,e,r,i){for(var n=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+o&1,n<<=1,n|=t>>>s+o&1;for(o=4;o<8;o++)for(s=24;s>=0;s-=8)a<<=1,a|=e>>>s+o&1,a<<=1,a|=t>>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.pc1=function(t,e,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+o&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(o=1;o<=3;o++){for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1}for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.r28shl=function(t,e){return t<>>28-e};var i=[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];e.pc2=function(t,e,r,n){for(var a=0,o=0,s=i.length>>>1,u=0;u>>i[u]&1;for(u=s;u>>i[u]&1;r[n+0]=a>>>0,r[n+1]=o>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=t>>>a&63;for(a=11;a>=3;a-=4)n|=t>>>a&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var n=[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];e.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var a=[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];e.permute=function(t){for(var e=0,r=0;r>>a[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length>>1];r=a.r28shl(r,s),n=a.r28shl(n,s),a.pc2(r,n,t.keys,o)}},u.prototype._update=function(t,e,r,i){var n=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,s,n.tmp,0):this._decrypt(n,o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],a.writeUInt32BE(r,o,i),a.writeUInt32BE(r,s,i+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=l}a.rip(s,o,i,n)},u.prototype._decrypt=function(t,e,r,i,n){for(var o=r,s=e,u=t.keys.length-2;u>=0;u-=2){var h=t.keys[u],f=t.keys[u+1];a.expand(o,t.tmp,0),h^=t.tmp[0],f^=t.tmp[1];var c=a.substitute(h,f),l=o;o=(s^a.permute(c))>>>0,s=l}a.rip(o,s,i,n)}},function(t,e,r){var i=r(47),n=r(2).Buffer,a=r(167);function o(t){var e=t._cipher.encryptBlockRaw(t._prev);return a(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),a=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var s=0;st;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(h))for(;r.mod(f).cmp(c);)r.iadd(d)}else for(;r.mod(a).cmp(l);)r.iadd(d);if(v(p=r.shrn(1))&&v(r)&&y(p)&&y(r)&&o.test(p)&&o.test(r))return r}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(345).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){var i=r(346),n=r(96);function a(t){this.rand=t||new n.Rand}t.exports=a,a.create=function(t){return new a(t)},a.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},a.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},a.prototype.test=function(t,e,r){var n=t.bitLength(),a=i.mont(t),o=new i(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var h=t.shrn(u),f=s.toRed(a);e>0;e--){var c=this._randrange(new i(2),s);r&&r(c);var l=c.toRed(a).redPow(h);if(0!==l.cmp(o)&&0!==l.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),o),c=t.gcd(f);if(0!==c.cmpn(1))return c;var l=f.toRed(n).redPow(u);if(0!==l.cmp(a)&&0!==l.cmp(h)){for(var d=1;d0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?E(t,new _):k(t,o,e,!0);else if(o.ended)E(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?k(t,o,e,!1):P(t,o)):k(t,o,e,!1)}else i||(o.reading=!1,P(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(R,t))}function R(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){h("readable nexttick read 0"),t.read(0)}function N(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function L(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function U(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):I(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&F(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?L(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){E(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:v;function s(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",v),r.removeListener("data",l),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var c=!1;function l(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==U(n.pipes,t))&&!c&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),v(),t.removeListener("error",d),0===a(t,"error")&&E(t,e)}function p(){t.removeListener("finish",m),v()}function m(){h("onfinish"),t.removeListener("close",p),v()}function v(){h("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(O,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(x,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(x,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=c.destroy,C.prototype._undestroy=c.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(7),r(4))},function(t,e,r){"use strict";t.exports=f;var i=r(35).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(36);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>8,o=255&n;a?r.push(a,o):r.push(o)}return r},i.zero2=n,i.toHex=a,i.encode=function(t,e){return"hex"===e?a(t):t}},function(t,e,r){"use strict";var i=e;i.base=r(61),i.short=r(365),i.mont=r(366),i.edwards=r(367)},function(t,e,r){"use strict";var i=r(16).rotr32;function n(t,e,r){return t&e^~t&r}function a(t,e,r){return t&e^t&r^e&r}function o(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?o(e,r,i):2===t?a(e,r,i):void 0},e.ch32=n,e.maj32=a,e.p32=o,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,r){"use strict";var i=r(16),n=r(48),a=r(182),o=r(10),s=i.sum32,u=i.sum32_4,h=i.sum32_5,f=a.ch32,c=a.maj32,l=a.s0_256,d=a.s1_256,p=a.g0_256,m=a.g1_256,v=n.BlockHash,y=[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];function g(){if(!(this instanceof g))return new g;v.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}i.inherits(g,v),t.exports=g,g.blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i=49&&h<=54?h-49+10:h>=17&&h<=22?h-17+10:h,o|=u}return i(!(240&o),"Invalid character in "+t),n}function u(t,e,r,n){for(var a=0,o=0,s=Math.min(t.length,r),u=e;u=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&o"}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f:a.prototype.inspect=f;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"],l=[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];a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],f=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}a.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,a);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,a=0;n>8&255),r>16&255),6===a?(r>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===a?(r>=0&&(t[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(m=p),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?v(this,t,e):y(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,r+=a/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%t;return e?-n:n},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/t|0,r=a%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new C(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){C.call(this,t),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)}w.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(_,w),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new E;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},C.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},C.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},C.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},C.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},C.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},C.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},C.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},C.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},C.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},C.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},C.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},C.prototype.isqr=function(t){return this.imul(t,t.clone())},C.prototype.sqr=function(t){return this.mul(t,t)},C.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},C.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},C.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new A(t)},n(A,C),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){var i=r(1),n=r(50).Reporter,a=r(0).Buffer;function o(t,e){n.call(this,e),a.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=a.byteLength(t);else{if(!a.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}i(o,n),e.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},o.prototype.restore=function(t){var e=new o(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},o.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},o.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.prototype.join=function(t,e){return t||(t=new a(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):a.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},function(t,e,r){var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r(390)},function(t,e,r){var i=r(1),n=r(49),a=n.base,o=n.bignum,s=n.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){a.Node.call(this,"der",t)}function f(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function c(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var a=0;a=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6}(t,e,r,this.reporter);if(i.length<128)return(a=new n(2))[0]=o,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var u=1,h=i.length;h>=256;h>>=8)u++;(a=new n(2+u))[0]=o,a[1]=128|u;h=1+u;for(var f=i.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,i])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var a=0;for(i=0;i=128;o>>=7)a++}var s=new n(a),u=s.length-1;for(i=t.length-1;i>=0;i--){o=t[i];for(s[u--]=127&o;(o>>=7)>0;)s[u--]=128|127&o}return this._createEncoderBuffer(s)},h.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[f(i.getFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[f(i.getFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var a=new n(i);return t.copy(a),0===t.length&&(a[0]=0),this._createEncoderBuffer(a)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var o=t;o>=256;o>>=8)i++;for(o=(a=new Array(i)).length-1;o>=0;o--)a[o]=255&t,t>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new n(a))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var a=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i=8.0.0")}).call(this,r(4))},function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e};Object.defineProperty(e,"__esModule",{value:!0});const o=a(r(103));t.exports=o},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(201);const n=r(5),a=i(r(104)),o=i(r(240)),s=i(r(242)),u=i(r(243)),h=i(r(244)),f=i(r(245)),c=i(r(422)),l=i(r(423)),d=i(r(424)),p=i(r(425)),m=i(r(426)),v=i(r(427)),y=i(r(428)),g=i(r(429)),b=i(r(430)),w=i(r(431)),_=i(r(433)),E=i(r(435)),M=i(r(436)),S=i(r(437)),C=i(r(439)),A=i(r(440)),k=i(r(441)),T=i(r(442)),I=i(r(443)),R=i(r(444)),P=i(r(445)),B=i(r(446)),x=i(r(447)),O=i(r(448)),N=i(r(449)),j=i(r(450)),L=i(r(451)),F=i(r(452)),D=i(r(453)),U=i(r(454)),K=i(r(455)),q=i(r(456)),z=i(r(457)),V=i(r(458));n.container.register("fetcher",{useClass:w.default}),n.container.register("dpopHeaderCreator",{useClass:M.default}),n.container.register("dpopClientKeyManager",{useClass:S.default}),n.container.register("storageUtility",{useClass:C.default}),n.container.register("uuidGenerator",{useClass:A.default}),n.container.register("joseUtility",{useClass:f.default}),n.container.register("environmentDetector",{useClass:I.default}),n.container.register("urlRepresentationConverter",{useClass:P.default}),n.container.register("sessionCreator",{useClass:B.default}),n.container.register("authenticatedFetcher",{useClass:z.default}),n.container.register("aggregateAuthenticatedFetcher",{useClass:o.default}),n.container.register("authenticatedFetchers",{useClass:s.default}),n.container.register("authenticatedFetchers",{useClass:E.default}),n.container.register("authenticatedFetchers",{useClass:u.default}),n.container.register("loginHandler",{useClass:h.default}),n.container.register("loginHandlers",{useClass:D.default}),n.container.register("loginHandlers",{useClass:c.default}),n.container.register("postPopUpLoginHandler",{useClass:U.default}),n.container.register("postPopUpLoginHandlers",{useClass:c.default}),n.container.register("oidcHandler",{useClass:l.default}),n.container.register("oidcHandlers",{useClass:b.default}),n.container.register("oidcHandlers",{useClass:d.default}),n.container.register("oidcHandlers",{useClass:p.default}),n.container.register("oidcHandlers",{useClass:m.default}),n.container.register("oidcHandlers",{useClass:v.default}),n.container.register("oidcHandlers",{useClass:y.default}),n.container.register("oidcHandlers",{useClass:g.default}),n.container.register("redirector",{useClass:L.default}),n.container.register("clientRegistrar",{useClass:K.default}),n.container.register("tokenRequester",{useClass:V.default}),n.container.register("redirectHandler",{useClass:O.default}),n.container.register("redirectHandlers",{useClass:x.default}),n.container.register("redirectHandlers",{useClass:T.default}),n.container.register("redirectHandlers",{useClass:F.default}),n.container.register("tokenSaver",{useClass:j.default}),n.container.register("issuerConfigFetcher",{useClass:_.default}),n.container.register("tokenRefresher",{useClass:q.default}),n.container.register("logoutHandler",{useClass:R.default}),e.default=function(t){let e;e=t.storage?t.storage:"undefined"!=typeof document?new N.default:new k.default;const r=n.container.createChildContainer();return r.register("storage",{useValue:e}),r.resolve(a.default)}},function(t,e,r){(function(t,e){ + */function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,a=Math.min(r,i);n=0;h--)if(f[h]!==c[h])return!1;for(h=f.length-1;h>=0;h--)if(s=f[h],!b(t[s],e[s],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&g(n,r,"Missing expected exception"+i);var a="string"==typeof i,s=!t&&n&&!r;if((!t&&o.isError(n)&&a&&_(n,r)||s)&&g(n,r,"Got unwanted exception"+i),t&&n&&r&&!_(n,r)||!t&&n)throw n}l.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(v(t.actual),128)+" "+t.operator+" "+m(v(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=p(e),a=i.indexOf("\n"+n);if(a>=0){var o=i.indexOf("\n",a+1);i=i.substring(o+1)}this.stack=i}}},o.inherits(l.AssertionError,Error),l.fail=g,l.ok=y,l.equal=function(t,e,r){t!=e&&g(t,e,r,"==",l.equal)},l.notEqual=function(t,e,r){t==e&&g(t,e,r,"!=",l.notEqual)},l.deepEqual=function(t,e,r){b(t,e,!1)||g(t,e,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(t,e,r){b(t,e,!0)||g(t,e,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(t,e,r){b(t,e,!1)&&g(t,e,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function t(e,r,i){b(e,r,!0)&&g(e,r,i,"notDeepStrictEqual",t)},l.strictEqual=function(t,e,r){t!==e&&g(t,e,r,"===",l.strictEqual)},l.notStrictEqual=function(t,e,r){t===e&&g(t,e,r,"!==",l.notStrictEqual)},l.throws=function(t,e,r){E(!0,t,e,r)},l.doesNotThrow=function(t,e,r){E(!1,t,e,r)},l.ifError=function(t){if(t)throw t},l.strict=i((function t(e,r){e||g(e,!0,r,"==",t)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var M=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r(7))},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,a=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(n=n+e[i++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var a=i,o=n+r;t^=-1;for(var s=n;s>>8^a[255&(t^e[s])];return-1^t}},function(t,e,r){var i=r(87);t.exports=function(t,e){e=e||{};var r=i.decode(t,e);if(!r)return null;var n=r.payload;if("string"==typeof n)try{var a=JSON.parse(n);null!==a&&"object"==typeof a&&(n=a)}catch(t){}return!0===e.complete?{header:r.header,payload:n,signature:r.signature}:n}},function(t,e,r){(function(e){var i=r(2).Buffer,n=r(44);function a(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=i.alloc(0),this;if("function"==typeof t.pipe)return this.buffer=i.alloc(0),t.pipe(this),this;if(t.length||"object"==typeof t)return this.buffer=t,this.writable=!1,e.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof t+")")}r(28).inherits(a,n),a.prototype.write=function(t){this.buffer=i.concat([this.buffer,i.from(t)]),this.emit("data",t)},a.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=a}).call(this,r(3))},function(t,e,r){var i=r(314),n=r(2).Buffer,a=r(88),o=r(408),s=r(28),u="secret must be a string or buffer",h="key must be a string or a buffer",f="function"==typeof a.createPublicKey;function c(t){if(!n.isBuffer(t)&&"string"!=typeof t){if(!f)throw m(h);if("object"!=typeof t)throw m(h);if("string"!=typeof t.type)throw m(h);if("string"!=typeof t.asymmetricKeyType)throw m(h);if("function"!=typeof t.export)throw m(h)}}function l(t){if(!n.isBuffer(t)&&"string"!=typeof t&&"object"!=typeof t)throw m("key must be a string, a buffer or an object")}function d(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(t){var e=4-(t=t.toString()).length%4;if(4!==e)for(var r=0;r=this._blockSize;){for(var a=this._blockOffset;a0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},function(t,e,r){"use strict";(function(e,i){var n;t.exports=C,C.ReadableState=S;r(19).EventEmitter;var a=function(t,e){return t.listeners(e).length},o=r(150),s=r(0).Buffer,u=e.Uint8Array||function(){};var h,f=r(316);h=f&&f.debuglog?f.debuglog("stream"):function(){};var c,l,d,p=r(317),m=r(151),v=r(152).getHighWaterMark,g=r(32).codes,y=g.ERR_INVALID_ARG_TYPE,b=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(1)(C,o);var E=m.errorOrDestroy,M=["error","close","destroy","pause","resume"];function S(t,e,i){n=n||r(33),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=v(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(27).StringDecoder),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function C(t){if(n=n||r(33),!(this instanceof C))return new C(t);var e=this instanceof n;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function A(t,e,r,i,n){h("readableAddChunk",e);var a,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(h("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,o);else if(n||(a=function(t,e){var r;i=e,s.isBuffer(i)||i instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),a)E(t,a);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?E(t,new _):k(t,o,e,!0);else if(o.ended)E(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?k(t,o,e,!1):P(t,o)):k(t,o,e,!1)}else i||(o.reading=!1,P(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(R,t))}function R(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){h("readable nexttick read 0"),t.read(0)}function N(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function F(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function L(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function U(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):I(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&L(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?F(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&L(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){E(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:v;function s(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",v),r.removeListener("data",l),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var c=!1;function l(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==U(n.pipes,t))&&!c&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),v(),t.removeListener("error",d),0===a(t,"error")&&E(t,e)}function p(){t.removeListener("finish",m),v()}function m(){h("onfinish"),t.removeListener("close",p),v()}function v(){h("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(O,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(x,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(x,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=c.destroy,C.prototype._undestroy=c.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(7),r(3))},function(t,e,r){"use strict";t.exports=f;var i=r(32).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(33);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(u,n),u.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},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,v=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+d(r[g-15])+r[g-16];for(var y=0;y<64;++y){var b=v+l(u)+h(u,p,m)+o[y]+r[y]|0,w=c(i)+f(i,n,a)|0;v=m,m=p,p=u,u=s+b|0,s=a,a=n,n=i,i=b+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=v+this._h|0},u.prototype._hash=function(){var t=a.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[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],s=new Array(160);function u(){this.init(),this._w=s,n.call(this,128,112)}function h(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function v(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0>>0?1:0}i(u,n),u.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},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,s=0|this._eh,u=0|this._fh,y=0|this._gh,b=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,M=0|this._dl,S=0|this._el,C=0|this._fl,A=0|this._gl,k=0|this._hl,T=0;T<32;T+=2)e[T]=t.readInt32BE(4*T),e[T+1]=t.readInt32BE(4*T+4);for(;T<160;T+=2){var I=e[T-30],R=e[T-30+1],P=d(I,R),B=p(R,I),x=m(I=e[T-4],R=e[T-4+1]),O=v(R,I),N=e[T-14],j=e[T-14+1],F=e[T-32],L=e[T-32+1],D=B+j|0,U=P+N+g(D,B)|0;U=(U=U+x+g(D=D+O|0,O)|0)+F+g(D=D+L|0,L)|0,e[T]=U,e[T+1]=D}for(var K=0;K<160;K+=2){U=e[K],D=e[K+1];var q=f(r,i,n),z=f(w,_,E),V=c(r,w),H=c(w,r),Z=l(s,S),G=l(S,s),W=o[K],$=o[K+1],Q=h(s,u,y),Y=h(S,C,A),J=k+G|0,X=b+Z+g(J,k)|0;X=(X=(X=X+Q+g(J=J+Y|0,Y)|0)+W+g(J=J+$|0,$)|0)+U+g(J=J+D|0,D)|0;var tt=H+z|0,et=V+q+g(tt,H)|0;b=y,k=A,y=u,A=C,u=s,C=S,s=a+X+g(S=M+J|0,M)|0,a=n,M=E,n=i,E=_,i=r,_=w,r=X+et+g(w=J+tt|0,J)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+M|0,this._el=this._el+S|0,this._fl=this._fl+C|0,this._gl=this._gl+A|0,this._hl=this._hl+k|0,this._ah=this._ah+r+g(this._al,w)|0,this._bh=this._bh+i+g(this._bl,_)|0,this._ch=this._ch+n+g(this._cl,E)|0,this._dh=this._dh+a+g(this._dl,M)|0,this._eh=this._eh+s+g(this._el,S)|0,this._fh=this._fh+u+g(this._fl,C)|0,this._gh=this._gh+y+g(this._gl,A)|0,this._hh=this._hh+b+g(this._hl,k)|0},u.prototype._hash=function(){var t=a.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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),t},t.exports=u},function(t,e,r){"use strict";var i=r(1),n=r(327),a=r(23),o=r(2).Buffer,s=r(158),u=r(91),h=r(92),f=o.alloc(128);function c(t,e){a.call(this,"digest"),"string"==typeof e&&(e=o.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:h(t)).update(e).digest():e.lengthr||a!=a)throw new TypeError("Bad key length")}}).call(this,r(0).Buffer)},function(t,e,r){(function(e){var r;e.browser?r="utf-8":r=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";t.exports=r}).call(this,r(3))},function(t,e,r){var i=r(158),n=r(91),a=r(92),o=r(161),s=r(162),u=r(2).Buffer,h=u.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var o=function(t){function e(e){return a(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new n).update(t).digest()}:"md5"===t?i:e}(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=o(e):e.length>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+o&1}for(o=6;o>=0;o-=2){for(s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1;for(s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},e.rip=function(t,e,r,i){for(var n=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+o&1,n<<=1,n|=t>>>s+o&1;for(o=4;o<8;o++)for(s=24;s>=0;s-=8)a<<=1,a|=e>>>s+o&1,a<<=1,a|=t>>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.pc1=function(t,e,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+o&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(o=1;o<=3;o++){for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1}for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.r28shl=function(t,e){return t<>>28-e};var i=[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];e.pc2=function(t,e,r,n){for(var a=0,o=0,s=i.length>>>1,u=0;u>>i[u]&1;for(u=s;u>>i[u]&1;r[n+0]=a>>>0,r[n+1]=o>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=t>>>a&63;for(a=11;a>=3;a-=4)n|=t>>>a&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var n=[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];e.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var a=[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];e.permute=function(t){for(var e=0,r=0;r>>a[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length>>1];r=a.r28shl(r,s),n=a.r28shl(n,s),a.pc2(r,n,t.keys,o)}},u.prototype._update=function(t,e,r,i){var n=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,s,n.tmp,0):this._decrypt(n,o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],a.writeUInt32BE(r,o,i),a.writeUInt32BE(r,s,i+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=l}a.rip(s,o,i,n)},u.prototype._decrypt=function(t,e,r,i,n){for(var o=r,s=e,u=t.keys.length-2;u>=0;u-=2){var h=t.keys[u],f=t.keys[u+1];a.expand(o,t.tmp,0),h^=t.tmp[0],f^=t.tmp[1];var c=a.substitute(h,f),l=o;o=(s^a.permute(c))>>>0,s=l}a.rip(o,s,i,n)}},function(t,e,r){var i=r(47),n=r(2).Buffer,a=r(167);function o(t){var e=t._cipher.encryptBlockRaw(t._prev);return a(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),a=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var s=0;st;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(h))for(;r.mod(f).cmp(c);)r.iadd(d)}else for(;r.mod(a).cmp(l);)r.iadd(d);if(v(p=r.shrn(1))&&v(r)&&g(p)&&g(r)&&o.test(p)&&o.test(r))return r}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(346).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){var i=r(347),n=r(96);function a(t){this.rand=t||new n.Rand}t.exports=a,a.create=function(t){return new a(t)},a.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},a.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},a.prototype.test=function(t,e,r){var n=t.bitLength(),a=i.mont(t),o=new i(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var h=t.shrn(u),f=s.toRed(a);e>0;e--){var c=this._randrange(new i(2),s);r&&r(c);var l=c.toRed(a).redPow(h);if(0!==l.cmp(o)&&0!==l.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),o),c=t.gcd(f);if(0!==c.cmpn(1))return c;var l=f.toRed(n).redPow(u);if(0!==l.cmp(a)&&0!==l.cmp(h)){for(var d=1;d0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?E(t,new _):k(t,o,e,!0);else if(o.ended)E(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?k(t,o,e,!1):P(t,o)):k(t,o,e,!1)}else i||(o.reading=!1,P(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(R,t))}function R(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){h("readable nexttick read 0"),t.read(0)}function N(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function F(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function L(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function U(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):I(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&L(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?F(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&L(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){E(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:v;function s(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",v),r.removeListener("data",l),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var c=!1;function l(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==U(n.pipes,t))&&!c&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),v(),t.removeListener("error",d),0===a(t,"error")&&E(t,e)}function p(){t.removeListener("finish",m),v()}function m(){h("onfinish"),t.removeListener("close",p),v()}function v(){h("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(O,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(x,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(x,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=c.destroy,C.prototype._undestroy=c.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(7),r(3))},function(t,e,r){"use strict";t.exports=f;var i=r(35).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(36);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>8,o=255&n;a?r.push(a,o):r.push(o)}return r},i.zero2=n,i.toHex=a,i.encode=function(t,e){return"hex"===e?a(t):t}},function(t,e,r){"use strict";var i=e;i.base=r(61),i.short=r(366),i.mont=r(367),i.edwards=r(368)},function(t,e,r){"use strict";var i=r(16).rotr32;function n(t,e,r){return t&e^~t&r}function a(t,e,r){return t&e^t&r^e&r}function o(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?o(e,r,i):2===t?a(e,r,i):void 0},e.ch32=n,e.maj32=a,e.p32=o,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,r){"use strict";var i=r(16),n=r(48),a=r(182),o=r(10),s=i.sum32,u=i.sum32_4,h=i.sum32_5,f=a.ch32,c=a.maj32,l=a.s0_256,d=a.s1_256,p=a.g0_256,m=a.g1_256,v=n.BlockHash,g=[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];function y(){if(!(this instanceof y))return new y;v.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}i.inherits(y,v),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i=49&&h<=54?h-49+10:h>=17&&h<=22?h-17+10:h,o|=u}return i(!(240&o),"Invalid character in "+t),n}function u(t,e,r,n){for(var a=0,o=0,s=Math.min(t.length,r),u=e;u=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&o"}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f:a.prototype.inspect=f;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"],l=[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];a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],f=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}a.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,a);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,a=0;n>8&255),r>16&255),6===a?(r>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===a?(r>=0&&(t[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function g(t,e,r){return v(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(m=p),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?v(this,t,e):g(this,t,e)},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,r+=a/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%t;return e?-n:n},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/t|0,r=a%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new C(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){C.call(this,t),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)}w.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(_,w),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new E;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},C.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},C.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},C.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},C.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},C.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},C.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},C.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},C.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},C.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},C.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},C.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},C.prototype.isqr=function(t){return this.imul(t,t.clone())},C.prototype.sqr=function(t){return this.mul(t,t)},C.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},C.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},C.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new A(t)},n(A,C),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e,r){var i=r(1),n=r(50).Reporter,a=r(0).Buffer;function o(t,e){n.call(this,e),a.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=a.byteLength(t);else{if(!a.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}i(o,n),e.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},o.prototype.restore=function(t){var e=new o(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},o.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},o.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.prototype.join=function(t,e){return t||(t=new a(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):a.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},function(t,e,r){var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r(391)},function(t,e,r){var i=r(1),n=r(49),a=n.base,o=n.bignum,s=n.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){a.Node.call(this,"der",t)}function f(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function c(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var a=0;a=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6}(t,e,r,this.reporter);if(i.length<128)return(a=new n(2))[0]=o,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var u=1,h=i.length;h>=256;h>>=8)u++;(a=new n(2+u))[0]=o,a[1]=128|u;h=1+u;for(var f=i.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,i])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var a=0;for(i=0;i=128;o>>=7)a++}var s=new n(a),u=s.length-1;for(i=t.length-1;i>=0;i--){o=t[i];for(s[u--]=127&o;(o>>=7)>0;)s[u--]=128|127&o}return this._createEncoderBuffer(s)},h.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[f(i.getFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[f(i.getFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var a=new n(i);return t.copy(a),0===t.length&&(a[0]=0),this._createEncoderBuffer(a)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var o=t;o>=256;o>>=8)i++;for(o=(a=new Array(i)).length-1;o>=0;o--)a[o]=255&t,t>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new n(a))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var a=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var o=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*a;case"hours":case"hour":case"hrs":case"hr":case"h":return o*n;case"minutes":case"minute":case"mins":case"min":case"m":return o*i;case"seconds":case"second":case"secs":case"sec":case"s":return o*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}(t);if("number"===s&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=a)return o(t,e,a,"day");if(e>=n)return o(t,e,n,"hour");if(e>=i)return o(t,e,i,"minute");if(e>=r)return o(t,e,r,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=a)return Math.round(t/a)+"d";if(e>=n)return Math.round(t/n)+"h";if(e>=i)return Math.round(t/i)+"m";if(e>=r)return Math.round(t/r)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){(function(e){var i=r(412);t.exports=i.satisfies(e.version,"^6.12.0 || >=8.0.0")}).call(this,r(3))},function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e};Object.defineProperty(e,"__esModule",{value:!0});const o=a(r(103));t.exports=o},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(202);const n=r(5),a=i(r(104)),o=i(r(241)),s=i(r(243)),u=i(r(244)),h=i(r(245)),f=i(r(246)),c=i(r(422)),l=i(r(423)),d=i(r(424)),p=i(r(425)),m=i(r(426)),v=i(r(427)),g=i(r(428)),y=i(r(429)),b=i(r(430)),w=i(r(431)),_=i(r(435)),E=i(r(437)),M=i(r(438)),S=i(r(439)),C=i(r(441)),A=i(r(442)),k=i(r(443)),T=i(r(444)),I=i(r(445)),R=i(r(446)),P=i(r(447)),B=i(r(448)),x=i(r(449)),O=i(r(450)),N=i(r(451)),j=i(r(452)),F=i(r(453)),L=i(r(454)),D=i(r(455)),U=i(r(456)),K=i(r(457)),q=i(r(458)),z=i(r(459)),V=i(r(460));n.container.register("fetcher",{useClass:w.default}),n.container.register("dpopHeaderCreator",{useClass:M.default}),n.container.register("dpopClientKeyManager",{useClass:S.default}),n.container.register("storageUtility",{useClass:C.default}),n.container.register("uuidGenerator",{useClass:A.default}),n.container.register("joseUtility",{useClass:f.default}),n.container.register("environmentDetector",{useClass:I.default}),n.container.register("urlRepresentationConverter",{useClass:P.default}),n.container.register("sessionCreator",{useClass:B.default}),n.container.register("authenticatedFetcher",{useClass:z.default}),n.container.register("aggregateAuthenticatedFetcher",{useClass:o.default}),n.container.register("authenticatedFetchers",{useClass:s.default}),n.container.register("authenticatedFetchers",{useClass:E.default}),n.container.register("authenticatedFetchers",{useClass:u.default}),n.container.register("loginHandler",{useClass:h.default}),n.container.register("loginHandlers",{useClass:D.default}),n.container.register("loginHandlers",{useClass:c.default}),n.container.register("postPopUpLoginHandler",{useClass:U.default}),n.container.register("postPopUpLoginHandlers",{useClass:c.default}),n.container.register("oidcHandler",{useClass:l.default}),n.container.register("oidcHandlers",{useClass:b.default}),n.container.register("oidcHandlers",{useClass:d.default}),n.container.register("oidcHandlers",{useClass:p.default}),n.container.register("oidcHandlers",{useClass:m.default}),n.container.register("oidcHandlers",{useClass:v.default}),n.container.register("oidcHandlers",{useClass:g.default}),n.container.register("oidcHandlers",{useClass:y.default}),n.container.register("redirector",{useClass:F.default}),n.container.register("clientRegistrar",{useClass:K.default}),n.container.register("tokenRequester",{useClass:V.default}),n.container.register("redirectHandler",{useClass:O.default}),n.container.register("redirectHandlers",{useClass:x.default}),n.container.register("redirectHandlers",{useClass:T.default}),n.container.register("redirectHandlers",{useClass:L.default}),n.container.register("tokenSaver",{useClass:j.default}),n.container.register("issuerConfigFetcher",{useClass:_.default}),n.container.register("tokenRefresher",{useClass:q.default}),n.container.register("logoutHandler",{useClass:R.default}),e.default=function(t){let e;e=t.storage?t.storage:"undefined"!=typeof document?new N.default:new k.default;const r=n.container.createChildContainer();return r.register("storage",{useValue:e}),r.resolve(a.default)}},function(t,e,r){(function(t,e){ /*! ***************************************************************************** Copyright (C) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use @@ -204,44 +204,44 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var r;!function(r){!function(i){var n="object"==typeof e?e:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),a=o(r);function o(t,e){return function(r,i){"function"!=typeof t[r]&&Object.defineProperty(t,r,{configurable:!0,writable:!0,value:i}),e&&e(r,i)}}void 0===n.Reflect?n.Reflect=r:a=o(n.Reflect,a),function(e){var r=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,n=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,u=!o&&!s,h={create:o?function(){return x(Object.create(null))}:s?function(){return x({__proto__:null})}:function(){return x({})},has:u?function(t,e){return r.call(t,e)}:function(t,e){return e in t},get:u?function(t,e){return r.call(t,e)?t[e]:void 0}:function(t,e){return t[e]}},f=Object.getPrototypeOf(Function),c="object"==typeof t&&t.env&&"true"===t.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var t={},e=[],r=function(){function t(t,e,r){this._index=0,this._keys=t,this._values=e,this._selector=r}return t.prototype["@@iterator"]=function(){return this},t.prototype[a]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var r=this._find(t,!0);return this._values[r]=e,this},e.prototype.delete=function(e){var r=this._find(e,!1);if(r>=0){for(var i=this._keys.length,n=r+1;n=0;--r){var i=(0,t[r])(e);if(!_(i)&&!E(i)){if(!T(i))throw new TypeError;e=i}}return e}(t,e)}if(!A(t))throw new TypeError;if(!M(e))throw new TypeError;if(!M(i)&&!_(i)&&!E(i))throw new TypeError;return E(i)&&(i=void 0),function(t,e,r,i){for(var n=t.length-1;n>=0;--n){var a=(0,t[n])(e,r,i);if(!_(a)&&!E(a)){if(!M(a))throw new TypeError;i=a}}return i}(t,e,r=C(r),i)})),e("metadata",(function(t,e){return function(r,i){if(!M(r))throw new TypeError;if(!_(i)&&!function(t){switch(w(t)){case 3:case 4:return!0;default:return!1}}(i))throw new TypeError;g(t,e,r,i)}})),e("defineMetadata",(function(t,e,r,i){if(!M(r))throw new TypeError;return _(i)||(i=C(i)),g(t,e,r,i)})),e("hasMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),function t(e,r,i){if(v(e,r,i))return!0;var n=B(r);return!E(n)&&t(e,n,i)}(t,e,r)})),e("hasOwnMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),v(t,e,r)})),e("getMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),function t(e,r,i){if(v(e,r,i))return y(e,r,i);var n=B(r);return E(n)?void 0:t(e,n,i)}(t,e,r)})),e("getOwnMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),y(t,e,r)})),e("getMetadataKeys",(function(t,e){if(!M(t))throw new TypeError;return _(e)||(e=C(e)),function t(e,r){var i=b(e,r),n=B(e);if(null===n)return i;var a=t(n,r);if(a.length<=0)return i;if(i.length<=0)return a;for(var o=new d,s=[],u=0,h=i;u0)return!0;var n=p.get(e);return n.delete(r),n.size>0||p.delete(e),!0}))}(a)}()}(r||(r={}))}).call(this,r(4),r(7))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loginInputOptionsSchema=void 0,e.loginInputOptionsSchema={type:"object",properties:{oidcIssuer:{type:"string",format:"uri",shouldConvertToUrl:!0},webId:{type:"string",format:"uri",shouldConvertToUrl:!0},redirect:{type:"string",format:"uri",shouldConvertToUrl:!0},popUp:{type:"boolean"},popUpRedirectPath:{type:"string"},state:{type:"string"},clientId:{type:"string"},doNotAutoRedirect:{type:"boolean"},clientName:{type:"string"}},oneOf:[{required:["oidcIssuer"]},{required:["webId"]}]}},function(t,e,r){"use strict";var i=r(204),n=r(64),a=r(208),o=r(106),s=r(107),u=r(209),h=r(210),f=r(231),c=r(29);t.exports=y,y.prototype.validate=function(t,e){var r;if("string"==typeof t){if(!(r=this.getSchema(t)))throw new Error('no schema with key or ref "'+t+'"')}else{var i=this._addSchema(t);r=i.validate||this._compile(i)}var n=r(e);!0!==r.$async&&(this.errors=r.errors);return n},y.prototype.compile=function(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)},y.prototype.addSchema=function(t,e,r,i){if(Array.isArray(t)){for(var a=0;a=0?{index:i,compiling:!0}:(i=this._compilations.length,this._compilations[i]={schema:t,root:e,baseId:r},{index:i,compiling:!1})}function l(t,e,r){var i=d.call(this,t,e,r);i>=0&&this._compilations.splice(i,1)}function d(t,e,r){for(var i=0;i=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var r=this._find(t,!0);return this._values[r]=e,this},e.prototype.delete=function(e){var r=this._find(e,!1);if(r>=0){for(var i=this._keys.length,n=r+1;n=0;--r){var i=(0,t[r])(e);if(!_(i)&&!E(i)){if(!T(i))throw new TypeError;e=i}}return e}(t,e)}if(!A(t))throw new TypeError;if(!M(e))throw new TypeError;if(!M(i)&&!_(i)&&!E(i))throw new TypeError;return E(i)&&(i=void 0),function(t,e,r,i){for(var n=t.length-1;n>=0;--n){var a=(0,t[n])(e,r,i);if(!_(a)&&!E(a)){if(!M(a))throw new TypeError;i=a}}return i}(t,e,r=C(r),i)})),e("metadata",(function(t,e){return function(r,i){if(!M(r))throw new TypeError;if(!_(i)&&!function(t){switch(w(t)){case 3:case 4:return!0;default:return!1}}(i))throw new TypeError;y(t,e,r,i)}})),e("defineMetadata",(function(t,e,r,i){if(!M(r))throw new TypeError;return _(i)||(i=C(i)),y(t,e,r,i)})),e("hasMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),function t(e,r,i){if(v(e,r,i))return!0;var n=B(r);return!E(n)&&t(e,n,i)}(t,e,r)})),e("hasOwnMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),v(t,e,r)})),e("getMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),function t(e,r,i){if(v(e,r,i))return g(e,r,i);var n=B(r);return E(n)?void 0:t(e,n,i)}(t,e,r)})),e("getOwnMetadata",(function(t,e,r){if(!M(e))throw new TypeError;return _(r)||(r=C(r)),g(t,e,r)})),e("getMetadataKeys",(function(t,e){if(!M(t))throw new TypeError;return _(e)||(e=C(e)),function t(e,r){var i=b(e,r),n=B(e);if(null===n)return i;var a=t(n,r);if(a.length<=0)return i;if(i.length<=0)return a;for(var o=new d,s=[],u=0,h=i;u0)return!0;var n=p.get(e);return n.delete(r),n.size>0||p.delete(e),!0}))}(a)}()}(r||(r={}))}).call(this,r(3),r(7))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loginInputOptionsSchema=void 0,e.loginInputOptionsSchema={type:"object",properties:{oidcIssuer:{type:"string",format:"uri",shouldConvertToUrl:!0},webId:{type:"string",format:"uri",shouldConvertToUrl:!0},redirect:{type:"string",format:"uri",shouldConvertToUrl:!0},popUp:{type:"boolean"},popUpRedirectPath:{type:"string"},state:{type:"string"},clientId:{type:"string"},doNotAutoRedirect:{type:"boolean"},clientName:{type:"string"}},oneOf:[{required:["oidcIssuer"]},{required:["webId"]}]}},function(t,e,r){"use strict";var i=r(205),n=r(64),a=r(209),o=r(106),s=r(107),u=r(210),h=r(211),f=r(232),c=r(29);t.exports=g,g.prototype.validate=function(t,e){var r;if("string"==typeof t){if(!(r=this.getSchema(t)))throw new Error('no schema with key or ref "'+t+'"')}else{var i=this._addSchema(t);r=i.validate||this._compile(i)}var n=r(e);!0!==r.$async&&(this.errors=r.errors);return n},g.prototype.compile=function(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)},g.prototype.addSchema=function(t,e,r,i){if(Array.isArray(t)){for(var a=0;a=0?{index:i,compiling:!0}:(i=this._compilations.length,this._compilations[i]={schema:t,root:e,baseId:r},{index:i,compiling:!1})}function l(t,e,r){var i=d.call(this,t,e,r);i>=0&&this._compilations.splice(i,1)}function d(t,e,r){for(var i=0;i1){e[0]=e[0].slice(0,-1);for(var i=e.length-1,n=1;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,m=String.fromCharCode;function v(t){throw new RangeError(d[t])}function y(t,e){var r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);var n=function(t,e){for(var r=[],i=t.length;i--;)r[i]=e(t[i]);return r}((t=t.replace(l,".")).split("."),e).join(".");return i+n}function g(t){for(var e=[],r=0,i=t.length;r=55296&&n<=56319&&r>1,t+=p(t/e);t>455;i+=36)t=p(t/35);return p(i+36*t/(t+38))},_=function(t){var e,r=[],i=t.length,n=0,a=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(var u=0;u=128&&v("not-basic"),r.push(t.charCodeAt(u));for(var f=s>0?s+1:0;f=i&&v("invalid-input");var m=(e=t.charCodeAt(f++))-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36;(m>=36||m>p((h-n)/l))&&v("overflow"),n+=m*l;var y=d<=o?1:d>=o+26?26:d-o;if(mp(h/g)&&v("overflow"),l*=g}var b=r.length+1;o=w(n-c,b,0==c),p(n/b)>h-a&&v("overflow"),a+=p(n/b),n%=b,r.splice(n++,0,a)}return String.fromCodePoint.apply(String,r)},E=function(t){var e=[],r=(t=g(t)).length,i=128,n=0,a=72,o=!0,s=!1,u=void 0;try{for(var f,c=t[Symbol.iterator]();!(o=(f=c.next()).done);o=!0){var l=f.value;l<128&&e.push(m(l))}}catch(t){s=!0,u=t}finally{try{!o&&c.return&&c.return()}finally{if(s)throw u}}var d=e.length,y=d;for(d&&e.push("-");y=i&&k<_&&(_=k)}}catch(t){M=!0,S=t}finally{try{!E&&A.return&&A.return()}finally{if(M)throw S}}var T=y+1;_-i>p((h-n)/T)&&v("overflow"),n+=(_-i)*T,i=_;var I=!0,R=!1,P=void 0;try{for(var B,x=t[Symbol.iterator]();!(I=(B=x.next()).done);I=!0){var O=B.value;if(Oh&&v("overflow"),O==i){for(var N=n,j=36;;j+=36){var L=j<=a?1:j>=a+26?26:j-a;if(N>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function k(t){for(var e="",r=0,i=t.length;r=194&&n<224){if(i-r>=6){var a=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&n)<<6|63&a)}else e+=t.substr(r,6);r+=6}else if(n>=224){if(i-r>=9){var o=parseInt(t.substr(r+4,2),16),s=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&n)<<12|(63&o)<<6|63&s)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function T(t,e){function r(t){var r=k(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,A).replace(e.PCT_ENCODED,n)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,A).replace(e.PCT_ENCODED,n)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,A).replace(e.PCT_ENCODED,n)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,A).replace(e.PCT_ENCODED,n)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,A).replace(e.PCT_ENCODED,n)),t}function I(t){return t.replace(/^0*(.*)/,"$1")||"0"}function R(t,e){var r=t.match(e.IPV4ADDRESS)||[],i=u(r,2)[1];return i?i.split(".").map(I).join("."):t}function P(t,e){var r=t.match(e.IPV6ADDRESS)||[],i=u(r,3),n=i[1],a=i[2];if(n){for(var o=n.toLowerCase().split("::").reverse(),s=u(o,2),h=s[0],f=s[1],c=f?f.split(":").map(I):[],l=h.split(":").map(I),d=e.IPV4ADDRESS.test(l[l.length-1]),p=d?7:8,m=l.length-p,v=Array(p),y=0;y1){var w=v.slice(0,g.index),_=v.slice(g.index+g.length);b=w.join(":")+"::"+_.join(":")}else b=v.join(":");return a&&(b+="%"+a),b}return t}var B=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,x=void 0==="".match(/(){0}/)[1];function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=!1!==e.iri?s:o;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var n=t.match(B);if(n){x?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==t.indexOf("@")?n[3]:void 0,r.host=-1!==t.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==t.indexOf("?")?n[7]:void 0,r.fragment=-1!==t.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=P(R(r.host,i),i)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var a=C[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||a&&a.unicodeSupport)T(r,i);else{if(r.host&&(e.domainHost||a&&a.domainHost))try{r.host=M(r.host.replace(i.PCT_ENCODED,k).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}T(r,o)}a&&a.parse&&a.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function N(t,e){var r=!1!==e.iri?s:o,i=[];return void 0!==t.userinfo&&(i.push(t.userinfo),i.push("@")),void 0!==t.host&&i.push(P(R(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(i.push(":"),i.push(String(t.port))),i.length?i.join(""):void 0}var j=/^\.\.?\//,L=/^\/\.(\/|$)/,F=/^\/\.\.(\/|$)/,D=/^\/?(?:.|\n)*?(?=\/|$)/;function U(t){for(var e=[];t.length;)if(t.match(j))t=t.replace(j,"");else if(t.match(L))t=t.replace(L,"/");else if(t.match(F))t=t.replace(F,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(D);if(!r)throw new Error("Unexpected dot segment condition");var i=r[0];t=t.slice(i.length),e.push(i)}return e.join("")}function K(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?s:o,i=[],n=C[(e.scheme||t.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||n&&n.domainHost)try{t.host=e.iri?S(t.host):M(t.host.replace(r.PCT_ENCODED,k).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}T(t,r),"suffix"!==e.reference&&t.scheme&&(i.push(t.scheme),i.push(":"));var a=N(t,e);if(void 0!==a&&("suffix"!==e.reference&&i.push("//"),i.push(a),t.path&&"/"!==t.path.charAt(0)&&i.push("/")),void 0!==t.path){var u=t.path;e.absolutePath||n&&n.absolutePath||(u=U(u)),void 0===a&&(u=u.replace(/^\/\//,"/%2F")),i.push(u)}return void 0!==t.query&&(i.push("?"),i.push(t.query)),void 0!==t.fragment&&(i.push("#"),i.push(t.fragment)),i.join("")}function q(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],n={};return i||(t=O(K(t,r),r),e=O(K(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=U(e.path||""),n.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=U(e.path||""),n.query=e.query):(e.path?("/"===e.path.charAt(0)?n.path=U(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path:n.path="/"+e.path,n.path=U(n.path)),n.query=e.query):(n.path=t.path,void 0!==e.query?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function z(t,e){return t&&t.toString().replace(e&&e.iri?s.PCT_ENCODED:o.PCT_ENCODED,k)}var V={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},H={scheme:"https",domainHost:V.domainHost,parse:V.parse,serialize:V.serialize};function Z(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var G={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=Z(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(Z(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),i=u(r,2),n=i[0],a=i[1];t.path=n&&"/"!==n?n:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},W={scheme:"wss",domainHost:G.domainHost,parse:G.parse,serialize:G.serialize},$={},Q="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Y="[0-9A-Fa-f]",J=r(r("%[EFef]"+Y+"%"+Y+Y+"%"+Y+Y)+"|"+r("%[89A-Fa-f]"+Y+"%"+Y+Y)+"|"+r("%"+Y+Y)),X=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),tt=new RegExp(Q,"g"),et=new RegExp(J,"g"),rt=new RegExp(e("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',X),"g"),it=new RegExp(e("[^]",Q,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),nt=it;function at(t){var e=k(t);return e.match(tt)?e:t}var ot={scheme:"mailto",parse:function(t,e){var r=t,i=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,a={},o=r.query.split("&"),s=0,u=o.length;s=55296&&e<=56319&&n%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,f=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,c=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,l=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,p=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(t){return t="full"==t?"full":"fast",i.copy(m[t])}function v(t){var e=t.match(n);if(!e)return!1;var r=+e[1],i=+e[2],o=+e[3];return i>=1&&i<=12&&o>=1&&o<=(2==i&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:a[i])}function y(t,e){var r=t.match(o);if(!r)return!1;var i=r[1],n=r[2],a=r[3],s=r[5];return(i<=23&&n<=59&&a<=59||23==i&&59==n&&60==a)&&(!e||s)}t.exports=m,m.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":h,url:f,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:_,uuid:c,"json-pointer":l,"json-pointer-uri-fragment":d,"relative-json-pointer":p},m.full={date:v,time:y,"date-time":function(t){var e=t.split(g);return 2==e.length&&v(e[0])&&y(e[1],!0)},uri:function(t){return b.test(t)&&u.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":h,url:f,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:_,uuid:c,"json-pointer":l,"json-pointer-uri-fragment":d,"relative-json-pointer":p};var g=/t|\s/i;var b=/\/|:/;var w=/[^\\]\\Z/;function _(t){if(w.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}}},function(t,e,r){"use strict";var i=r(211),n=r(29).toHash;t.exports=function(){var t=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],e=["type","$comment"];return t.all=n(e),t.types=n(["number","integer","string","array","object","boolean","null"]),t.forEach((function(r){r.rules=r.rules.map((function(r){var n;if("object"==typeof r){var a=Object.keys(r)[0];n=r[a],r=a,n.forEach((function(r){e.push(r),t.all[r]=!0}))}return e.push(r),t.all[r]={keyword:r,code:i[r],implements:n}})),t.all.$comment={keyword:"$comment",code:i.$comment},r.type&&(t.types[r.type]=r)})),t.keywords=n(e.concat(["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"])),t.custom={},t}},function(t,e,r){"use strict";t.exports={$ref:r(212),allOf:r(213),anyOf:r(214),$comment:r(215),const:r(216),contains:r(217),dependencies:r(218),enum:r(219),format:r(220),if:r(221),items:r(222),maximum:r(109),minimum:r(109),maxItems:r(110),minItems:r(110),maxLength:r(111),minLength:r(111),maxProperties:r(112),minProperties:r(112),multipleOf:r(223),not:r(224),oneOf:r(225),pattern:r(226),properties:r(227),propertyNames:r(228),required:r(229),uniqueItems:r(230),validate:r(108)}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n,a=" ",o=t.level,s=t.dataLevel,u=t.schema[e],h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(s||""),l="valid"+o;if("#"==u||"#/"==u)t.isRoot?(i=t.async,n="validate"):(i=!0===t.root.schema.$async,n="root.refVal[0]");else{var d=t.resolveRef(t.baseId,u,t.isRoot);if(void 0===d){var p=t.MissingRefError.message(t.baseId,u);if("fail"==t.opts.missingRefs){t.logger.error(p),(g=g||[]).push(a),a="",!1!==t.createErrors?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { ref: '"+t.util.escapeQuotes(u)+"' } ",!1!==t.opts.messages&&(a+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(u)+"' "),t.opts.verbose&&(a+=" , schema: "+t.util.toQuotedString(u)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),a+=" } "):a+=" {} ";var m=a;a=g.pop(),!t.compositeRule&&f?t.async?a+=" throw new ValidationError(["+m+"]); ":a+=" validate.errors = ["+m+"]; return false; ":a+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(a+=" if (false) { ")}else{if("ignore"!=t.opts.missingRefs)throw new t.MissingRefError(t.baseId,u,p);t.logger.warn(p),f&&(a+=" if (true) { ")}}else if(d.inline){var v=t.util.copy(t);v.level++;var y="valid"+v.level;v.schema=d.schema,v.schemaPath="",v.errSchemaPath=u,a+=" "+t.validate(v).replace(/validate\.schema/g,d.code)+" ",f&&(a+=" if ("+y+") { ")}else i=!0===d.$async||t.async&&!1!==d.$async,n=d.code}if(n){var g;(g=g||[]).push(a),a="",t.opts.passContext?a+=" "+n+".call(this, ":a+=" "+n+"( ",a+=" "+c+", (dataPath || '')",'""'!=t.errorPath&&(a+=" + "+t.errorPath);var b=a+=" , "+(s?"data"+(s-1||""):"parentData")+" , "+(s?t.dataPathArr[s]:"parentDataProperty")+", rootData) ";if(a=g.pop(),i){if(!t.async)throw new Error("async schema referenced by sync schema");f&&(a+=" var "+l+"; "),a+=" try { await "+b+"; ",f&&(a+=" "+l+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(a+=" "+l+" = false; "),a+=" } ",f&&(a+=" if ("+l+") { ")}else a+=" if (!"+b+") { if (vErrors === null) vErrors = "+n+".errors; else vErrors = vErrors.concat("+n+".errors); errors = vErrors.length; } ",f&&(a+=" else { ")}return a}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.schema[e],a=t.schemaPath+t.util.getProperty(e),o=t.errSchemaPath+"/"+e,s=!t.opts.allErrors,u=t.util.copy(t),h="";u.level++;var f="valid"+u.level,c=u.baseId,l=!0,d=n;if(d)for(var p,m=-1,v=d.length-1;m0||!1===p:t.util.schemaHasRules(p,t.RULES.all))&&(l=!1,u.schema=p,u.schemaPath=a+"["+m+"]",u.errSchemaPath=o+"/"+m,i+=" "+t.validate(u)+" ",u.baseId=c,s&&(i+=" if ("+f+") { ",h+="}"));return s&&(i+=l?" if (true) { ":" "+h.slice(0,-1)+" "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level;if(o.every((function(e){return t.opts.strictKeywords?"object"==typeof e&&Object.keys(e).length>0||!1===e:t.util.schemaHasRules(e,t.RULES.all)}))){var v=d.baseId;i+=" var "+l+" = errors; var "+c+" = false; ";var y=t.compositeRule;t.compositeRule=d.compositeRule=!0;var g=o;if(g)for(var b,w=-1,_=g.length-1;w<_;)b=g[w+=1],d.schema=b,d.schemaPath=s+"["+w+"]",d.errSchemaPath=u+"/"+w,i+=" "+t.validate(d)+" ",d.baseId=v,i+=" "+c+" = "+c+" || "+m+"; if (!"+c+") { ",p+="}";t.compositeRule=d.compositeRule=y,i+=" "+p+" if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should match some schema in anyOf' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",t.opts.allErrors&&(i+=" } ")}else h&&(i+=" if (true) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.schema[e],a=t.errSchemaPath+"/"+e,o=(t.opts.allErrors,t.util.toQuotedString(n));return!0===t.opts.$comment?i+=" console.log("+o+");":"function"==typeof t.opts.$comment&&(i+=" self._opts.$comment("+o+", "+t.util.toQuotedString(a)+", validate.root.schema);"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l=t.opts.$data&&o&&o.$data;l&&(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; "),l||(i+=" var schema"+n+" = validate.schema"+s+";"),i+="var "+c+" = equal("+f+", schema"+n+"); if (!"+c+") { ";var d=d||[];d.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be equal to constant' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var p=i;return i=d.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+p+"]); ":i+=" validate.errors = ["+p+"]; return false; ":i+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t);d.level++;var p="valid"+d.level,m="i"+n,v=d.dataLevel=t.dataLevel+1,y="data"+v,g=t.baseId,b=t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all);if(i+="var "+l+" = errors;var "+c+";",b){var w=t.compositeRule;t.compositeRule=d.compositeRule=!0,d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" var "+p+" = false; for (var "+m+" = 0; "+m+" < "+f+".length; "+m+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,m,t.opts.jsonPointers,!0);var _=f+"["+m+"]";d.dataPathArr[v]=m;var E=t.validate(d);d.baseId=g,t.util.varOccurences(E,y)<2?i+=" "+t.util.varReplace(E,y,_)+" ":i+=" var "+y+" = "+_+"; "+E+" ",i+=" if ("+p+") break; } ",t.compositeRule=d.compositeRule=w,i+=" if (!"+p+") {"}else i+=" if ("+f+".length == 0) {";var M=M||[];M.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should contain a valid item' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var S=i;return i=M.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",b&&(i+=" errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } "),t.opts.allErrors&&(i+=" } "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t),d="";l.level++;var p="valid"+l.level,m={},v={},y=t.opts.ownProperties;for(_ in o)if("__proto__"!=_){var g=o[_],b=Array.isArray(g)?v:m;b[_]=g}i+="var "+c+" = errors;";var w=t.errorPath;for(var _ in i+="var missing"+n+";",v)if((b=v[_]).length){if(i+=" if ( "+f+t.util.getProperty(_)+" !== undefined ",y&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes(_)+"') "),h){i+=" && ( ";var E=b;if(E)for(var M=-1,S=E.length-1;M0||!1===g:t.util.schemaHasRules(g,t.RULES.all))&&(i+=" "+p+" = true; if ( "+f+t.util.getProperty(_)+" !== undefined ",y&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes(_)+"') "),i+=") { ",l.schema=g,l.schemaPath=s+t.util.getProperty(_),l.errSchemaPath=u+"/"+t.util.escapeFragment(_),i+=" "+t.validate(l)+" ",l.baseId=N,i+=" } ",h&&(i+=" if ("+p+") { ",d+="}"))}return h&&(i+=" "+d+" if ("+c+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l=t.opts.$data&&o&&o.$data;l&&(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; ");var d="i"+n,p="schema"+n;l||(i+=" var "+p+" = validate.schema"+s+";"),i+="var "+c+";",l&&(i+=" if (schema"+n+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+n+")) "+c+" = false; else {"),i+=c+" = false;for (var "+d+"=0; "+d+"<"+p+".length; "+d+"++) if (equal("+f+", "+p+"["+d+"])) { "+c+" = true; break; }",l&&(i+=" } "),i+=" if (!"+c+") { ";var m=m||[];m.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValues: schema"+n+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var v=i;return i=m.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||"");if(!1===t.opts.format)return h&&(i+=" if (true) { "),i;var c,l=t.opts.$data&&o&&o.$data;l?(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; ",c="schema"+n):c=o;var d=t.opts.unknownFormats,p=Array.isArray(d);if(l){i+=" var "+(m="format"+n)+" = formats["+c+"]; var "+(v="isObject"+n)+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+(y="formatType"+n)+" = "+v+" && "+m+".type || 'string'; if ("+v+") { ",t.async&&(i+=" var async"+n+" = "+m+".async; "),i+=" "+m+" = "+m+".validate; } if ( ",l&&(i+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),i+=" (","ignore"!=d&&(i+=" ("+c+" && !"+m+" ",p&&(i+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),i+=") || "),i+=" ("+m+" && "+y+" == '"+r+"' && !(typeof "+m+" == 'function' ? ",t.async?i+=" (async"+n+" ? await "+m+"("+f+") : "+m+"("+f+")) ":i+=" "+m+"("+f+") ",i+=" : "+m+".test("+f+"))))) {"}else{var m;if(!(m=t.formats[o])){if("ignore"==d)return t.logger.warn('unknown format "'+o+'" ignored in schema at path "'+t.errSchemaPath+'"'),h&&(i+=" if (true) { "),i;if(p&&d.indexOf(o)>=0)return h&&(i+=" if (true) { "),i;throw new Error('unknown format "'+o+'" is used in schema at path "'+t.errSchemaPath+'"')}var v,y=(v="object"==typeof m&&!(m instanceof RegExp)&&m.validate)&&m.type||"string";if(v){var g=!0===m.async;m=m.validate}if(y!=r)return h&&(i+=" if (true) { "),i;if(g){if(!t.async)throw new Error("async format in sync schema");i+=" if (!(await "+(b="formats"+t.util.getProperty(o)+".validate")+"("+f+"))) { "}else{i+=" if (! ";var b="formats"+t.util.getProperty(o);v&&(b+=".validate"),i+="function"==typeof m?" "+b+"("+f+") ":" "+b+".test("+f+") ",i+=") { "}}var w=w||[];w.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { format: ",i+=l?""+c:""+t.util.toQuotedString(o),i+=" } ",!1!==t.opts.messages&&(i+=" , message: 'should match format \"",i+=l?"' + "+c+" + '":""+t.util.escapeQuotes(o),i+="\"' "),t.opts.verbose&&(i+=" , schema: ",i+=l?"validate.schema"+s:""+t.util.toQuotedString(o),i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var _=i;return i=w.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t);d.level++;var p="valid"+d.level,m=t.schema.then,v=t.schema.else,y=void 0!==m&&(t.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0||!1===m:t.util.schemaHasRules(m,t.RULES.all)),g=void 0!==v&&(t.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0||!1===v:t.util.schemaHasRules(v,t.RULES.all)),b=d.baseId;if(y||g){var w;d.createErrors=!1,d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" var "+l+" = errors; var "+c+" = true; ";var _=t.compositeRule;t.compositeRule=d.compositeRule=!0,i+=" "+t.validate(d)+" ",d.baseId=b,d.createErrors=!0,i+=" errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",t.compositeRule=d.compositeRule=_,y?(i+=" if ("+p+") { ",d.schema=t.schema.then,d.schemaPath=t.schemaPath+".then",d.errSchemaPath=t.errSchemaPath+"/then",i+=" "+t.validate(d)+" ",d.baseId=b,i+=" "+c+" = "+p+"; ",y&&g?i+=" var "+(w="ifClause"+n)+" = 'then'; ":w="'then'",i+=" } ",g&&(i+=" else { ")):i+=" if (!"+p+") { ",g&&(d.schema=t.schema.else,d.schemaPath=t.schemaPath+".else",d.errSchemaPath=t.errSchemaPath+"/else",i+=" "+t.validate(d)+" ",d.baseId=b,i+=" "+c+" = "+p+"; ",y&&g?i+=" var "+(w="ifClause"+n)+" = 'else'; ":w="'else'",i+=" } "),i+=" if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { failingKeyword: "+w+" } ",!1!==t.opts.messages&&(i+=" , message: 'should match \"' + "+w+" + '\" schema' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",h&&(i+=" else { ")}else h&&(i+=" if (true) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level,v="i"+n,y=d.dataLevel=t.dataLevel+1,g="data"+y,b=t.baseId;if(i+="var "+l+" = errors;var "+c+";",Array.isArray(o)){var w=t.schema.additionalItems;if(!1===w){i+=" "+c+" = "+f+".length <= "+o.length+"; ";var _=u;u=t.errSchemaPath+"/additionalItems",i+=" if (!"+c+") { ";var E=E||[];E.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have more than "+o.length+" items' "),t.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var M=i;i=E.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+M+"]); ":i+=" validate.errors = ["+M+"]; return false; ":i+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=_,h&&(p+="}",i+=" else { ")}var S=o;if(S)for(var C,A=-1,k=S.length-1;A0||!1===C:t.util.schemaHasRules(C,t.RULES.all)){i+=" "+m+" = true; if ("+f+".length > "+A+") { ";var T=f+"["+A+"]";d.schema=C,d.schemaPath=s+"["+A+"]",d.errSchemaPath=u+"/"+A,d.errorPath=t.util.getPathExpr(t.errorPath,A,t.opts.jsonPointers,!0),d.dataPathArr[y]=A;var I=t.validate(d);d.baseId=b,t.util.varOccurences(I,g)<2?i+=" "+t.util.varReplace(I,g,T)+" ":i+=" var "+g+" = "+T+"; "+I+" ",i+=" } ",h&&(i+=" if ("+m+") { ",p+="}")}if("object"==typeof w&&(t.opts.strictKeywords?"object"==typeof w&&Object.keys(w).length>0||!1===w:t.util.schemaHasRules(w,t.RULES.all))){d.schema=w,d.schemaPath=t.schemaPath+".additionalItems",d.errSchemaPath=t.errSchemaPath+"/additionalItems",i+=" "+m+" = true; if ("+f+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+f+".length; "+v+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,v,t.opts.jsonPointers,!0);T=f+"["+v+"]";d.dataPathArr[y]=v;I=t.validate(d);d.baseId=b,t.util.varOccurences(I,g)<2?i+=" "+t.util.varReplace(I,g,T)+" ":i+=" var "+g+" = "+T+"; "+I+" ",h&&(i+=" if (!"+m+") break; "),i+=" } } ",h&&(i+=" if ("+m+") { ",p+="}")}}else if(t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,v,t.opts.jsonPointers,!0);T=f+"["+v+"]";d.dataPathArr[y]=v;I=t.validate(d);d.baseId=b,t.util.varOccurences(I,g)<2?i+=" "+t.util.varReplace(I,g,T)+" ":i+=" var "+g+" = "+T+"; "+I+" ",h&&(i+=" if (!"+m+") break; "),i+=" }"}return h&&(i+=" "+p+" if ("+l+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="var division"+a+";if (",l&&(n+=" "+i+" !== undefined && ( typeof "+i+" != 'number' || "),n+=" (division"+a+" = "+c+" / "+i+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",l&&(n+=" ) "),n+=" ) { ";var d=d||[];d.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { multipleOf: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should be multiple of ",n+=l?"' + "+i:i+"'"),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var p=n;return n=d.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t);l.level++;var d="valid"+l.level;if(t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){l.schema=o,l.schemaPath=s,l.errSchemaPath=u,i+=" var "+c+" = errors; ";var p,m=t.compositeRule;t.compositeRule=l.compositeRule=!0,l.createErrors=!1,l.opts.allErrors&&(p=l.opts.allErrors,l.opts.allErrors=!1),i+=" "+t.validate(l)+" ",l.createErrors=!0,p&&(l.opts.allErrors=p),t.compositeRule=l.compositeRule=m,i+=" if ("+d+") { ";var v=v||[];v.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be valid' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;i=v.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",t.opts.allErrors&&(i+=" } ")}else i+=" var err = ",!1!==t.createErrors?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be valid' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(i+=" if (false) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level,v=d.baseId,y="prevValid"+n,g="passingSchemas"+n;i+="var "+l+" = errors , "+y+" = false , "+c+" = false , "+g+" = null; ";var b=t.compositeRule;t.compositeRule=d.compositeRule=!0;var w=o;if(w)for(var _,E=-1,M=w.length-1;E0||!1===_:t.util.schemaHasRules(_,t.RULES.all))?(d.schema=_,d.schemaPath=s+"["+E+"]",d.errSchemaPath=u+"/"+E,i+=" "+t.validate(d)+" ",d.baseId=v):i+=" var "+m+" = true; ",E&&(i+=" if ("+m+" && "+y+") { "+c+" = false; "+g+" = ["+g+", "+E+"]; } else { ",p+="}"),i+=" if ("+m+") { "+c+" = "+y+" = true; "+g+" = "+E+"; }";return t.compositeRule=d.compositeRule=b,i+=p+"if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { passingSchemas: "+g+" } ",!1!==t.opts.messages&&(i+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; }",t.opts.allErrors&&(i+=" } "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'string') || "),n+=" !"+(l?"(new RegExp("+i+"))":t.usePattern(s))+".test("+c+") ) { ";var d=d||[];d.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { pattern: ",n+=l?""+i:""+t.util.toQuotedString(s),n+=" } ",!1!==t.opts.messages&&(n+=" , message: 'should match pattern \"",n+=l?"' + "+i+" + '":""+t.util.escapeQuotes(s),n+="\"' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+t.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var p=n;return n=d.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t),d="";l.level++;var p="valid"+l.level,m="key"+n,v="idx"+n,y=l.dataLevel=t.dataLevel+1,g="data"+y,b="dataProperties"+n,w=Object.keys(o||{}).filter(x),_=t.schema.patternProperties||{},E=Object.keys(_).filter(x),M=t.schema.additionalProperties,S=w.length||E.length,C=!1===M,A="object"==typeof M&&Object.keys(M).length,k=t.opts.removeAdditional,T=C||A||k,I=t.opts.ownProperties,R=t.baseId,P=t.schema.required;if(P&&(!t.opts.$data||!P.$data)&&P.length8)i+=" || validate.schema"+s+".hasOwnProperty("+m+") ";else{var O=w;if(O)for(var N=-1,j=O.length-1;N0||!1===J:t.util.schemaHasRules(J,t.RULES.all)){var X=t.util.getProperty($),tt=(H=f+X,G&&void 0!==J.default);l.schema=J,l.schemaPath=s+X,l.errSchemaPath=u+"/"+t.util.escapeFragment($),l.errorPath=t.util.getPath(t.errorPath,$,t.opts.jsonPointers),l.dataPathArr[y]=t.util.toQuotedString($);Z=t.validate(l);if(l.baseId=R,t.util.varOccurences(Z,g)<2){Z=t.util.varReplace(Z,g,H);var et=H}else{et=g;i+=" var "+g+" = "+H+"; "}if(tt)i+=" "+Z+" ";else{if(B&&B[$]){i+=" if ( "+et+" === undefined ",I&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=") { "+p+" = false; ";U=t.errorPath,q=u;var rt,it=t.util.escapeQuotes($);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(U,$,t.opts.jsonPointers)),u=t.errSchemaPath+"/required",(rt=rt||[]).push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+it+"' } ",!1!==t.opts.messages&&(i+=" , message: '",t.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+it+"\\'",i+="' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";z=i;i=rt.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+z+"]); ":i+=" validate.errors = ["+z+"]; return false; ":i+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=q,t.errorPath=U,i+=" } else { "}else h?(i+=" if ( "+et+" === undefined ",I&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=") { "+p+" = true; } else { "):(i+=" if ("+et+" !== undefined ",I&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=" ) { ");i+=" "+Z+" } "}}h&&(i+=" if ("+p+") { ",d+="}")}}if(E.length){var nt=E;if(nt)for(var at,ot=-1,st=nt.length-1;ot0||!1===J:t.util.schemaHasRules(J,t.RULES.all)){l.schema=J,l.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(at),l.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(at),i+=I?" "+b+" = "+b+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+b+".length; "+v+"++) { var "+m+" = "+b+"["+v+"]; ":" for (var "+m+" in "+f+") { ",i+=" if ("+t.usePattern(at)+".test("+m+")) { ",l.errorPath=t.util.getPathExpr(t.errorPath,m,t.opts.jsonPointers);H=f+"["+m+"]";l.dataPathArr[y]=m;Z=t.validate(l);l.baseId=R,t.util.varOccurences(Z,g)<2?i+=" "+t.util.varReplace(Z,g,H)+" ":i+=" var "+g+" = "+H+"; "+Z+" ",h&&(i+=" if (!"+p+") break; "),i+=" } ",h&&(i+=" else "+p+" = true; "),i+=" } ",h&&(i+=" if ("+p+") { ",d+="}")}}}return h&&(i+=" "+d+" if ("+c+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t);l.level++;var d="valid"+l.level;if(i+="var "+c+" = errors;",t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){l.schema=o,l.schemaPath=s,l.errSchemaPath=u;var p="key"+n,m="idx"+n,v="i"+n,y="' + "+p+" + '",g="data"+(l.dataLevel=t.dataLevel+1),b="dataProperties"+n,w=t.opts.ownProperties,_=t.baseId;w&&(i+=" var "+b+" = undefined; "),i+=w?" "+b+" = "+b+" || Object.keys("+f+"); for (var "+m+"=0; "+m+"<"+b+".length; "+m+"++) { var "+p+" = "+b+"["+m+"]; ":" for (var "+p+" in "+f+") { ",i+=" var startErrs"+n+" = errors; ";var E=p,M=t.compositeRule;t.compositeRule=l.compositeRule=!0;var S=t.validate(l);l.baseId=_,t.util.varOccurences(S,g)<2?i+=" "+t.util.varReplace(S,g,E)+" ":i+=" var "+g+" = "+E+"; "+S+" ",t.compositeRule=l.compositeRule=M,i+=" if (!"+d+") { for (var "+v+"=startErrs"+n+"; "+v+"0||!1===b:t.util.schemaHasRules(b,t.RULES.all))||(p[p.length]=v)}}else p=o;if(l||p.length){var w=t.errorPath,_=l||p.length>=t.opts.loopRequired,E=t.opts.ownProperties;if(h)if(i+=" var missing"+n+"; ",_){l||(i+=" var "+d+" = validate.schema"+s+"; ");var M="' + "+(I="schema"+n+"["+(A="i"+n)+"]")+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(w,I,t.opts.jsonPointers)),i+=" var "+c+" = true; ",l&&(i+=" if (schema"+n+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+n+")) "+c+" = false; else {"),i+=" for (var "+A+" = 0; "+A+" < "+d+".length; "+A+"++) { "+c+" = "+f+"["+d+"["+A+"]] !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+d+"["+A+"]) "),i+="; if (!"+c+") break; } ",l&&(i+=" } "),i+=" if (!"+c+") { ",(T=T||[]).push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",!1!==t.opts.messages&&(i+=" , message: '",t.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var S=i;i=T.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var C=p;if(C)for(var A=-1,k=C.length-1;A 1) { ";var p=t.schema.items&&t.schema.items.type,m=Array.isArray(p);if(!p||"object"==p||"array"==p||m&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+l+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+c+"[i]; ";var v="checkDataType"+(m?"s":"");n+=" if ("+t.util[v](p,"item",t.opts.strictNumbers,!0)+") continue; ",m&&(n+=" if (typeof item == 'string') item = '\"' + item; "),n+=" if (typeof itemIndices[item] == 'number') { "+l+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+l+") { ";var y=y||[];y.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}},function(t,e,r){"use strict";var i=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];t.exports=function(t,e){for(var r=0;r-1},at.prototype.set=function(t,e){var r=this.__data__,i=ft(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},ot.prototype.clear=function(){this.__data__={hash:new nt,map:new(Z||at),string:new nt}},ot.prototype.delete=function(t){return mt(this,t).delete(t)},ot.prototype.get=function(t){return mt(this,t).get(t)},ot.prototype.has=function(t){return mt(this,t).has(t)},ot.prototype.set=function(t,e){return mt(this,t).set(t,e),this},st.prototype.clear=function(){this.__data__=new at},st.prototype.delete=function(t){return this.__data__.delete(t)},st.prototype.get=function(t){return this.__data__.get(t)},st.prototype.has=function(t){return this.__data__.has(t)},st.prototype.set=function(t,e){var r=this.__data__;if(r instanceof at){var i=r.__data__;if(!Z||i.length<199)return i.push([t,e]),this;r=this.__data__=new ot(i)}return r.set(t,e),this};var yt=q?M(q,Object):function(){return[]},gt=function(t){return x.call(t)};function bt(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||f.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}(t.length)&&!At(t)}var Ct=z||function(){return!1};function At(t){var e=kt(t)?x.call(t):"";return e==n||e==a}function kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Tt(t){return St(t)?ut(t):function(t){if(!wt(t))return V(t);var e=[];for(var r in Object(t))B.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}r.exports=function(t){return ct(t,!0,!0)}}).call(this,r(7),r(15)(t))},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(38));let h=class extends u.default{constructor(t){super(t)}};h=i([s.injectable(),a(0,s.injectAll("authenticatedFetchers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class i extends Error{constructor(t,e){super(`${t} cannot find a suitable handler for: ${e.map(t=>{try{return JSON.stringify(t)}catch(e){return t.toString()}}).join(", ")}`),this.params=e}}e.default=i},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(39)),u=r(5),h=r(114);let f=class{constructor(t,e,r,i){this.dpopHeaderCreator=t,this.fetcher=e,this.urlRepresentationConverter=r,this.storageUtility=i}async canHandle(t,e,r){return"dpop"===t.type&&null!==await this.storageUtility.getForUser(t.localUserId,"accessToken")}async handle(t,e,r){if(!await this.canHandle(t,e,r))throw new s.default("Dpop Authenticated Fetcher cannot handle "+JSON.stringify(t));const i=await this.storageUtility.getForUser(t.localUserId,"accessToken"),n={headers:{},method:"GET",...r};return this.fetcher.fetch(e,{...r,headers:{...h.flattenHeaders(n.headers),authorization:"DPOP "+i,dpop:await this.dpopHeaderCreator.createHeaderToken(this.urlRepresentationConverter.requestInfoToUrl(e),n.method)}})}};f=i([u.injectable(),a(0,u.inject("dpopHeaderCreator")),a(1,u.inject("fetcher")),a(2,u.inject("urlRepresentationConverter")),a(3,u.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object,Object])],f),e.default=f},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5),s=r(114);let u=class{constructor(t,e,r){this.fetcher=t,this.urlRepresentationConverter=e,this.storageUtility=r}async canHandle(t,e,r){return!0}async handle(t,e,r){var i;return this.fetcher.fetch(e,{...r,method:null!==(i=null==r?void 0:r.method)&&void 0!==i?i:"GET",headers:s.flattenHeaders(null==r?void 0:r.headers)})}};u=i([o.injectable(),a(0,o.inject("fetcher")),a(1,o.inject("urlRepresentationConverter")),a(2,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object])],u),e.default=u},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("loginHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=r(246),a=i(r(311)),o=i(r(421)),s=i(r(88));e.default=class{async generateJWK(t,e,r){return(await n.JWK.createKey(t,e,r)).toJSON(!0)}async signJWT(t,e,r){const i=(await n.JWK.asKey(e)).toPEM(!0);return a.default.sign(t,i,{...r})}async decodeJWT(t){return a.default.decode(t)}async privateJWKToPublicJWK(t){return await n.JWK.asKey(t,"public")}async generateCodeVerifier(){return o.default({length:50,type:"alphanumeric"})}async generateCodeChallenge(t){const e=s.default.createHash("sha256");return e.update(t),e.digest().toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}}},function(t,e,r){"use strict";(function(e,i,n){ +!function(t){"use strict";function e(){for(var t=arguments.length,e=Array(t),r=0;r1){e[0]=e[0].slice(0,-1);for(var i=e.length-1,n=1;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,m=String.fromCharCode;function v(t){throw new RangeError(d[t])}function g(t,e){var r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);var n=function(t,e){for(var r=[],i=t.length;i--;)r[i]=e(t[i]);return r}((t=t.replace(l,".")).split("."),e).join(".");return i+n}function y(t){for(var e=[],r=0,i=t.length;r=55296&&n<=56319&&r>1,t+=p(t/e);t>455;i+=36)t=p(t/35);return p(i+36*t/(t+38))},_=function(t){var e,r=[],i=t.length,n=0,a=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(var u=0;u=128&&v("not-basic"),r.push(t.charCodeAt(u));for(var f=s>0?s+1:0;f=i&&v("invalid-input");var m=(e=t.charCodeAt(f++))-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36;(m>=36||m>p((h-n)/l))&&v("overflow"),n+=m*l;var g=d<=o?1:d>=o+26?26:d-o;if(mp(h/y)&&v("overflow"),l*=y}var b=r.length+1;o=w(n-c,b,0==c),p(n/b)>h-a&&v("overflow"),a+=p(n/b),n%=b,r.splice(n++,0,a)}return String.fromCodePoint.apply(String,r)},E=function(t){var e=[],r=(t=y(t)).length,i=128,n=0,a=72,o=!0,s=!1,u=void 0;try{for(var f,c=t[Symbol.iterator]();!(o=(f=c.next()).done);o=!0){var l=f.value;l<128&&e.push(m(l))}}catch(t){s=!0,u=t}finally{try{!o&&c.return&&c.return()}finally{if(s)throw u}}var d=e.length,g=d;for(d&&e.push("-");g=i&&k<_&&(_=k)}}catch(t){M=!0,S=t}finally{try{!E&&A.return&&A.return()}finally{if(M)throw S}}var T=g+1;_-i>p((h-n)/T)&&v("overflow"),n+=(_-i)*T,i=_;var I=!0,R=!1,P=void 0;try{for(var B,x=t[Symbol.iterator]();!(I=(B=x.next()).done);I=!0){var O=B.value;if(Oh&&v("overflow"),O==i){for(var N=n,j=36;;j+=36){var F=j<=a?1:j>=a+26?26:j-a;if(N>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function k(t){for(var e="",r=0,i=t.length;r=194&&n<224){if(i-r>=6){var a=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&n)<<6|63&a)}else e+=t.substr(r,6);r+=6}else if(n>=224){if(i-r>=9){var o=parseInt(t.substr(r+4,2),16),s=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&n)<<12|(63&o)<<6|63&s)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function T(t,e){function r(t){var r=k(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,A).replace(e.PCT_ENCODED,n)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,A).replace(e.PCT_ENCODED,n)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,A).replace(e.PCT_ENCODED,n)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,A).replace(e.PCT_ENCODED,n)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,A).replace(e.PCT_ENCODED,n)),t}function I(t){return t.replace(/^0*(.*)/,"$1")||"0"}function R(t,e){var r=t.match(e.IPV4ADDRESS)||[],i=u(r,2)[1];return i?i.split(".").map(I).join("."):t}function P(t,e){var r=t.match(e.IPV6ADDRESS)||[],i=u(r,3),n=i[1],a=i[2];if(n){for(var o=n.toLowerCase().split("::").reverse(),s=u(o,2),h=s[0],f=s[1],c=f?f.split(":").map(I):[],l=h.split(":").map(I),d=e.IPV4ADDRESS.test(l[l.length-1]),p=d?7:8,m=l.length-p,v=Array(p),g=0;g1){var w=v.slice(0,y.index),_=v.slice(y.index+y.length);b=w.join(":")+"::"+_.join(":")}else b=v.join(":");return a&&(b+="%"+a),b}return t}var B=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,x=void 0==="".match(/(){0}/)[1];function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=!1!==e.iri?s:o;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var n=t.match(B);if(n){x?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==t.indexOf("@")?n[3]:void 0,r.host=-1!==t.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==t.indexOf("?")?n[7]:void 0,r.fragment=-1!==t.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=P(R(r.host,i),i)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var a=C[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||a&&a.unicodeSupport)T(r,i);else{if(r.host&&(e.domainHost||a&&a.domainHost))try{r.host=M(r.host.replace(i.PCT_ENCODED,k).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}T(r,o)}a&&a.parse&&a.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function N(t,e){var r=!1!==e.iri?s:o,i=[];return void 0!==t.userinfo&&(i.push(t.userinfo),i.push("@")),void 0!==t.host&&i.push(P(R(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(i.push(":"),i.push(String(t.port))),i.length?i.join(""):void 0}var j=/^\.\.?\//,F=/^\/\.(\/|$)/,L=/^\/\.\.(\/|$)/,D=/^\/?(?:.|\n)*?(?=\/|$)/;function U(t){for(var e=[];t.length;)if(t.match(j))t=t.replace(j,"");else if(t.match(F))t=t.replace(F,"/");else if(t.match(L))t=t.replace(L,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(D);if(!r)throw new Error("Unexpected dot segment condition");var i=r[0];t=t.slice(i.length),e.push(i)}return e.join("")}function K(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?s:o,i=[],n=C[(e.scheme||t.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||n&&n.domainHost)try{t.host=e.iri?S(t.host):M(t.host.replace(r.PCT_ENCODED,k).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}T(t,r),"suffix"!==e.reference&&t.scheme&&(i.push(t.scheme),i.push(":"));var a=N(t,e);if(void 0!==a&&("suffix"!==e.reference&&i.push("//"),i.push(a),t.path&&"/"!==t.path.charAt(0)&&i.push("/")),void 0!==t.path){var u=t.path;e.absolutePath||n&&n.absolutePath||(u=U(u)),void 0===a&&(u=u.replace(/^\/\//,"/%2F")),i.push(u)}return void 0!==t.query&&(i.push("?"),i.push(t.query)),void 0!==t.fragment&&(i.push("#"),i.push(t.fragment)),i.join("")}function q(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],n={};return i||(t=O(K(t,r),r),e=O(K(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=U(e.path||""),n.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=U(e.path||""),n.query=e.query):(e.path?("/"===e.path.charAt(0)?n.path=U(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path:n.path="/"+e.path,n.path=U(n.path)),n.query=e.query):(n.path=t.path,void 0!==e.query?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function z(t,e){return t&&t.toString().replace(e&&e.iri?s.PCT_ENCODED:o.PCT_ENCODED,k)}var V={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},H={scheme:"https",domainHost:V.domainHost,parse:V.parse,serialize:V.serialize};function Z(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var G={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=Z(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(Z(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),i=u(r,2),n=i[0],a=i[1];t.path=n&&"/"!==n?n:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},W={scheme:"wss",domainHost:G.domainHost,parse:G.parse,serialize:G.serialize},$={},Q="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Y="[0-9A-Fa-f]",J=r(r("%[EFef]"+Y+"%"+Y+Y+"%"+Y+Y)+"|"+r("%[89A-Fa-f]"+Y+"%"+Y+Y)+"|"+r("%"+Y+Y)),X=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),tt=new RegExp(Q,"g"),et=new RegExp(J,"g"),rt=new RegExp(e("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',X),"g"),it=new RegExp(e("[^]",Q,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),nt=it;function at(t){var e=k(t);return e.match(tt)?e:t}var ot={scheme:"mailto",parse:function(t,e){var r=t,i=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,a={},o=r.query.split("&"),s=0,u=o.length;s=55296&&e<=56319&&n%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,f=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,c=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,l=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,p=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(t){return t="full"==t?"full":"fast",i.copy(m[t])}function v(t){var e=t.match(n);if(!e)return!1;var r=+e[1],i=+e[2],o=+e[3];return i>=1&&i<=12&&o>=1&&o<=(2==i&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:a[i])}function g(t,e){var r=t.match(o);if(!r)return!1;var i=r[1],n=r[2],a=r[3],s=r[5];return(i<=23&&n<=59&&a<=59||23==i&&59==n&&60==a)&&(!e||s)}t.exports=m,m.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":h,url:f,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:_,uuid:c,"json-pointer":l,"json-pointer-uri-fragment":d,"relative-json-pointer":p},m.full={date:v,time:g,"date-time":function(t){var e=t.split(y);return 2==e.length&&v(e[0])&&g(e[1],!0)},uri:function(t){return b.test(t)&&u.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":h,url:f,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:_,uuid:c,"json-pointer":l,"json-pointer-uri-fragment":d,"relative-json-pointer":p};var y=/t|\s/i;var b=/\/|:/;var w=/[^\\]\\Z/;function _(t){if(w.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}}},function(t,e,r){"use strict";var i=r(212),n=r(29).toHash;t.exports=function(){var t=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],e=["type","$comment"];return t.all=n(e),t.types=n(["number","integer","string","array","object","boolean","null"]),t.forEach((function(r){r.rules=r.rules.map((function(r){var n;if("object"==typeof r){var a=Object.keys(r)[0];n=r[a],r=a,n.forEach((function(r){e.push(r),t.all[r]=!0}))}return e.push(r),t.all[r]={keyword:r,code:i[r],implements:n}})),t.all.$comment={keyword:"$comment",code:i.$comment},r.type&&(t.types[r.type]=r)})),t.keywords=n(e.concat(["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"])),t.custom={},t}},function(t,e,r){"use strict";t.exports={$ref:r(213),allOf:r(214),anyOf:r(215),$comment:r(216),const:r(217),contains:r(218),dependencies:r(219),enum:r(220),format:r(221),if:r(222),items:r(223),maximum:r(109),minimum:r(109),maxItems:r(110),minItems:r(110),maxLength:r(111),minLength:r(111),maxProperties:r(112),minProperties:r(112),multipleOf:r(224),not:r(225),oneOf:r(226),pattern:r(227),properties:r(228),propertyNames:r(229),required:r(230),uniqueItems:r(231),validate:r(108)}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n,a=" ",o=t.level,s=t.dataLevel,u=t.schema[e],h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(s||""),l="valid"+o;if("#"==u||"#/"==u)t.isRoot?(i=t.async,n="validate"):(i=!0===t.root.schema.$async,n="root.refVal[0]");else{var d=t.resolveRef(t.baseId,u,t.isRoot);if(void 0===d){var p=t.MissingRefError.message(t.baseId,u);if("fail"==t.opts.missingRefs){t.logger.error(p),(y=y||[]).push(a),a="",!1!==t.createErrors?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { ref: '"+t.util.escapeQuotes(u)+"' } ",!1!==t.opts.messages&&(a+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(u)+"' "),t.opts.verbose&&(a+=" , schema: "+t.util.toQuotedString(u)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),a+=" } "):a+=" {} ";var m=a;a=y.pop(),!t.compositeRule&&f?t.async?a+=" throw new ValidationError(["+m+"]); ":a+=" validate.errors = ["+m+"]; return false; ":a+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(a+=" if (false) { ")}else{if("ignore"!=t.opts.missingRefs)throw new t.MissingRefError(t.baseId,u,p);t.logger.warn(p),f&&(a+=" if (true) { ")}}else if(d.inline){var v=t.util.copy(t);v.level++;var g="valid"+v.level;v.schema=d.schema,v.schemaPath="",v.errSchemaPath=u,a+=" "+t.validate(v).replace(/validate\.schema/g,d.code)+" ",f&&(a+=" if ("+g+") { ")}else i=!0===d.$async||t.async&&!1!==d.$async,n=d.code}if(n){var y;(y=y||[]).push(a),a="",t.opts.passContext?a+=" "+n+".call(this, ":a+=" "+n+"( ",a+=" "+c+", (dataPath || '')",'""'!=t.errorPath&&(a+=" + "+t.errorPath);var b=a+=" , "+(s?"data"+(s-1||""):"parentData")+" , "+(s?t.dataPathArr[s]:"parentDataProperty")+", rootData) ";if(a=y.pop(),i){if(!t.async)throw new Error("async schema referenced by sync schema");f&&(a+=" var "+l+"; "),a+=" try { await "+b+"; ",f&&(a+=" "+l+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(a+=" "+l+" = false; "),a+=" } ",f&&(a+=" if ("+l+") { ")}else a+=" if (!"+b+") { if (vErrors === null) vErrors = "+n+".errors; else vErrors = vErrors.concat("+n+".errors); errors = vErrors.length; } ",f&&(a+=" else { ")}return a}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.schema[e],a=t.schemaPath+t.util.getProperty(e),o=t.errSchemaPath+"/"+e,s=!t.opts.allErrors,u=t.util.copy(t),h="";u.level++;var f="valid"+u.level,c=u.baseId,l=!0,d=n;if(d)for(var p,m=-1,v=d.length-1;m0||!1===p:t.util.schemaHasRules(p,t.RULES.all))&&(l=!1,u.schema=p,u.schemaPath=a+"["+m+"]",u.errSchemaPath=o+"/"+m,i+=" "+t.validate(u)+" ",u.baseId=c,s&&(i+=" if ("+f+") { ",h+="}"));return s&&(i+=l?" if (true) { ":" "+h.slice(0,-1)+" "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level;if(o.every((function(e){return t.opts.strictKeywords?"object"==typeof e&&Object.keys(e).length>0||!1===e:t.util.schemaHasRules(e,t.RULES.all)}))){var v=d.baseId;i+=" var "+l+" = errors; var "+c+" = false; ";var g=t.compositeRule;t.compositeRule=d.compositeRule=!0;var y=o;if(y)for(var b,w=-1,_=y.length-1;w<_;)b=y[w+=1],d.schema=b,d.schemaPath=s+"["+w+"]",d.errSchemaPath=u+"/"+w,i+=" "+t.validate(d)+" ",d.baseId=v,i+=" "+c+" = "+c+" || "+m+"; if (!"+c+") { ",p+="}";t.compositeRule=d.compositeRule=g,i+=" "+p+" if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should match some schema in anyOf' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",t.opts.allErrors&&(i+=" } ")}else h&&(i+=" if (true) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.schema[e],a=t.errSchemaPath+"/"+e,o=(t.opts.allErrors,t.util.toQuotedString(n));return!0===t.opts.$comment?i+=" console.log("+o+");":"function"==typeof t.opts.$comment&&(i+=" self._opts.$comment("+o+", "+t.util.toQuotedString(a)+", validate.root.schema);"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l=t.opts.$data&&o&&o.$data;l&&(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; "),l||(i+=" var schema"+n+" = validate.schema"+s+";"),i+="var "+c+" = equal("+f+", schema"+n+"); if (!"+c+") { ";var d=d||[];d.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be equal to constant' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var p=i;return i=d.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+p+"]); ":i+=" validate.errors = ["+p+"]; return false; ":i+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t);d.level++;var p="valid"+d.level,m="i"+n,v=d.dataLevel=t.dataLevel+1,g="data"+v,y=t.baseId,b=t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all);if(i+="var "+l+" = errors;var "+c+";",b){var w=t.compositeRule;t.compositeRule=d.compositeRule=!0,d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" var "+p+" = false; for (var "+m+" = 0; "+m+" < "+f+".length; "+m+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,m,t.opts.jsonPointers,!0);var _=f+"["+m+"]";d.dataPathArr[v]=m;var E=t.validate(d);d.baseId=y,t.util.varOccurences(E,g)<2?i+=" "+t.util.varReplace(E,g,_)+" ":i+=" var "+g+" = "+_+"; "+E+" ",i+=" if ("+p+") break; } ",t.compositeRule=d.compositeRule=w,i+=" if (!"+p+") {"}else i+=" if ("+f+".length == 0) {";var M=M||[];M.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should contain a valid item' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var S=i;return i=M.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",b&&(i+=" errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } "),t.opts.allErrors&&(i+=" } "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t),d="";l.level++;var p="valid"+l.level,m={},v={},g=t.opts.ownProperties;for(_ in o)if("__proto__"!=_){var y=o[_],b=Array.isArray(y)?v:m;b[_]=y}i+="var "+c+" = errors;";var w=t.errorPath;for(var _ in i+="var missing"+n+";",v)if((b=v[_]).length){if(i+=" if ( "+f+t.util.getProperty(_)+" !== undefined ",g&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes(_)+"') "),h){i+=" && ( ";var E=b;if(E)for(var M=-1,S=E.length-1;M0||!1===y:t.util.schemaHasRules(y,t.RULES.all))&&(i+=" "+p+" = true; if ( "+f+t.util.getProperty(_)+" !== undefined ",g&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes(_)+"') "),i+=") { ",l.schema=y,l.schemaPath=s+t.util.getProperty(_),l.errSchemaPath=u+"/"+t.util.escapeFragment(_),i+=" "+t.validate(l)+" ",l.baseId=N,i+=" } ",h&&(i+=" if ("+p+") { ",d+="}"))}return h&&(i+=" "+d+" if ("+c+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l=t.opts.$data&&o&&o.$data;l&&(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; ");var d="i"+n,p="schema"+n;l||(i+=" var "+p+" = validate.schema"+s+";"),i+="var "+c+";",l&&(i+=" if (schema"+n+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+n+")) "+c+" = false; else {"),i+=c+" = false;for (var "+d+"=0; "+d+"<"+p+".length; "+d+"++) if (equal("+f+", "+p+"["+d+"])) { "+c+" = true; break; }",l&&(i+=" } "),i+=" if (!"+c+") { ";var m=m||[];m.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValues: schema"+n+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var v=i;return i=m.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||"");if(!1===t.opts.format)return h&&(i+=" if (true) { "),i;var c,l=t.opts.$data&&o&&o.$data;l?(i+=" var schema"+n+" = "+t.util.getData(o.$data,a,t.dataPathArr)+"; ",c="schema"+n):c=o;var d=t.opts.unknownFormats,p=Array.isArray(d);if(l){i+=" var "+(m="format"+n)+" = formats["+c+"]; var "+(v="isObject"+n)+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+(g="formatType"+n)+" = "+v+" && "+m+".type || 'string'; if ("+v+") { ",t.async&&(i+=" var async"+n+" = "+m+".async; "),i+=" "+m+" = "+m+".validate; } if ( ",l&&(i+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),i+=" (","ignore"!=d&&(i+=" ("+c+" && !"+m+" ",p&&(i+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),i+=") || "),i+=" ("+m+" && "+g+" == '"+r+"' && !(typeof "+m+" == 'function' ? ",t.async?i+=" (async"+n+" ? await "+m+"("+f+") : "+m+"("+f+")) ":i+=" "+m+"("+f+") ",i+=" : "+m+".test("+f+"))))) {"}else{var m;if(!(m=t.formats[o])){if("ignore"==d)return t.logger.warn('unknown format "'+o+'" ignored in schema at path "'+t.errSchemaPath+'"'),h&&(i+=" if (true) { "),i;if(p&&d.indexOf(o)>=0)return h&&(i+=" if (true) { "),i;throw new Error('unknown format "'+o+'" is used in schema at path "'+t.errSchemaPath+'"')}var v,g=(v="object"==typeof m&&!(m instanceof RegExp)&&m.validate)&&m.type||"string";if(v){var y=!0===m.async;m=m.validate}if(g!=r)return h&&(i+=" if (true) { "),i;if(y){if(!t.async)throw new Error("async format in sync schema");i+=" if (!(await "+(b="formats"+t.util.getProperty(o)+".validate")+"("+f+"))) { "}else{i+=" if (! ";var b="formats"+t.util.getProperty(o);v&&(b+=".validate"),i+="function"==typeof m?" "+b+"("+f+") ":" "+b+".test("+f+") ",i+=") { "}}var w=w||[];w.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { format: ",i+=l?""+c:""+t.util.toQuotedString(o),i+=" } ",!1!==t.opts.messages&&(i+=" , message: 'should match format \"",i+=l?"' + "+c+" + '":""+t.util.escapeQuotes(o),i+="\"' "),t.opts.verbose&&(i+=" , schema: ",i+=l?"validate.schema"+s:""+t.util.toQuotedString(o),i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var _=i;return i=w.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+_+"]); ":i+=" validate.errors = ["+_+"]; return false; ":i+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",h&&(i+=" else { "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t);d.level++;var p="valid"+d.level,m=t.schema.then,v=t.schema.else,g=void 0!==m&&(t.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0||!1===m:t.util.schemaHasRules(m,t.RULES.all)),y=void 0!==v&&(t.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0||!1===v:t.util.schemaHasRules(v,t.RULES.all)),b=d.baseId;if(g||y){var w;d.createErrors=!1,d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" var "+l+" = errors; var "+c+" = true; ";var _=t.compositeRule;t.compositeRule=d.compositeRule=!0,i+=" "+t.validate(d)+" ",d.baseId=b,d.createErrors=!0,i+=" errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",t.compositeRule=d.compositeRule=_,g?(i+=" if ("+p+") { ",d.schema=t.schema.then,d.schemaPath=t.schemaPath+".then",d.errSchemaPath=t.errSchemaPath+"/then",i+=" "+t.validate(d)+" ",d.baseId=b,i+=" "+c+" = "+p+"; ",g&&y?i+=" var "+(w="ifClause"+n)+" = 'then'; ":w="'then'",i+=" } ",y&&(i+=" else { ")):i+=" if (!"+p+") { ",y&&(d.schema=t.schema.else,d.schemaPath=t.schemaPath+".else",d.errSchemaPath=t.errSchemaPath+"/else",i+=" "+t.validate(d)+" ",d.baseId=b,i+=" "+c+" = "+p+"; ",g&&y?i+=" var "+(w="ifClause"+n)+" = 'else'; ":w="'else'",i+=" } "),i+=" if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { failingKeyword: "+w+" } ",!1!==t.opts.messages&&(i+=" , message: 'should match \"' + "+w+" + '\" schema' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",h&&(i+=" else { ")}else h&&(i+=" if (true) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level,v="i"+n,g=d.dataLevel=t.dataLevel+1,y="data"+g,b=t.baseId;if(i+="var "+l+" = errors;var "+c+";",Array.isArray(o)){var w=t.schema.additionalItems;if(!1===w){i+=" "+c+" = "+f+".length <= "+o.length+"; ";var _=u;u=t.errSchemaPath+"/additionalItems",i+=" if (!"+c+") { ";var E=E||[];E.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have more than "+o.length+" items' "),t.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var M=i;i=E.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+M+"]); ":i+=" validate.errors = ["+M+"]; return false; ":i+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=_,h&&(p+="}",i+=" else { ")}var S=o;if(S)for(var C,A=-1,k=S.length-1;A0||!1===C:t.util.schemaHasRules(C,t.RULES.all)){i+=" "+m+" = true; if ("+f+".length > "+A+") { ";var T=f+"["+A+"]";d.schema=C,d.schemaPath=s+"["+A+"]",d.errSchemaPath=u+"/"+A,d.errorPath=t.util.getPathExpr(t.errorPath,A,t.opts.jsonPointers,!0),d.dataPathArr[g]=A;var I=t.validate(d);d.baseId=b,t.util.varOccurences(I,y)<2?i+=" "+t.util.varReplace(I,y,T)+" ":i+=" var "+y+" = "+T+"; "+I+" ",i+=" } ",h&&(i+=" if ("+m+") { ",p+="}")}if("object"==typeof w&&(t.opts.strictKeywords?"object"==typeof w&&Object.keys(w).length>0||!1===w:t.util.schemaHasRules(w,t.RULES.all))){d.schema=w,d.schemaPath=t.schemaPath+".additionalItems",d.errSchemaPath=t.errSchemaPath+"/additionalItems",i+=" "+m+" = true; if ("+f+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+f+".length; "+v+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,v,t.opts.jsonPointers,!0);T=f+"["+v+"]";d.dataPathArr[g]=v;I=t.validate(d);d.baseId=b,t.util.varOccurences(I,y)<2?i+=" "+t.util.varReplace(I,y,T)+" ":i+=" var "+y+" = "+T+"; "+I+" ",h&&(i+=" if (!"+m+") break; "),i+=" } } ",h&&(i+=" if ("+m+") { ",p+="}")}}else if(t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",d.errorPath=t.util.getPathExpr(t.errorPath,v,t.opts.jsonPointers,!0);T=f+"["+v+"]";d.dataPathArr[g]=v;I=t.validate(d);d.baseId=b,t.util.varOccurences(I,y)<2?i+=" "+t.util.varReplace(I,y,T)+" ":i+=" var "+y+" = "+T+"; "+I+" ",h&&(i+=" if (!"+m+") break; "),i+=" }"}return h&&(i+=" "+p+" if ("+l+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;if(l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,!l&&"number"!=typeof s)throw new Error(e+" must be number");n+="var division"+a+";if (",l&&(n+=" "+i+" !== undefined && ( typeof "+i+" != 'number' || "),n+=" (division"+a+" = "+c+" / "+i+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",l&&(n+=" ) "),n+=" ) { ";var d=d||[];d.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { multipleOf: "+i+" } ",!1!==t.opts.messages&&(n+=" , message: 'should be multiple of ",n+=l?"' + "+i:i+"'"),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var p=n;return n=d.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t);l.level++;var d="valid"+l.level;if(t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){l.schema=o,l.schemaPath=s,l.errSchemaPath=u,i+=" var "+c+" = errors; ";var p,m=t.compositeRule;t.compositeRule=l.compositeRule=!0,l.createErrors=!1,l.opts.allErrors&&(p=l.opts.allErrors,l.opts.allErrors=!1),i+=" "+t.validate(l)+" ",l.createErrors=!0,p&&(l.opts.allErrors=p),t.compositeRule=l.compositeRule=m,i+=" if ("+d+") { ";var v=v||[];v.push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be valid' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;i=v.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",t.opts.allErrors&&(i+=" } ")}else i+=" var err = ",!1!==t.createErrors?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be valid' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(i+=" if (false) { ");return i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="valid"+n,l="errs__"+n,d=t.util.copy(t),p="";d.level++;var m="valid"+d.level,v=d.baseId,g="prevValid"+n,y="passingSchemas"+n;i+="var "+l+" = errors , "+g+" = false , "+c+" = false , "+y+" = null; ";var b=t.compositeRule;t.compositeRule=d.compositeRule=!0;var w=o;if(w)for(var _,E=-1,M=w.length-1;E0||!1===_:t.util.schemaHasRules(_,t.RULES.all))?(d.schema=_,d.schemaPath=s+"["+E+"]",d.errSchemaPath=u+"/"+E,i+=" "+t.validate(d)+" ",d.baseId=v):i+=" var "+m+" = true; ",E&&(i+=" if ("+m+" && "+g+") { "+c+" = false; "+y+" = ["+y+", "+E+"]; } else { ",p+="}"),i+=" if ("+m+") { "+c+" = "+g+" = true; "+y+" = "+E+"; }";return t.compositeRule=d.compositeRule=b,i+=p+"if (!"+c+") { var err = ",!1!==t.createErrors?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { passingSchemas: "+y+" } ",!1!==t.opts.messages&&(i+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&h&&(t.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; }",t.opts.allErrors&&(i+=" } "),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i,n=" ",a=t.level,o=t.dataLevel,s=t.schema[e],u=t.schemaPath+t.util.getProperty(e),h=t.errSchemaPath+"/"+e,f=!t.opts.allErrors,c="data"+(o||""),l=t.opts.$data&&s&&s.$data;l?(n+=" var schema"+a+" = "+t.util.getData(s.$data,o,t.dataPathArr)+"; ",i="schema"+a):i=s,n+="if ( ",l&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'string') || "),n+=" !"+(l?"(new RegExp("+i+"))":t.usePattern(s))+".test("+c+") ) { ";var d=d||[];d.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { pattern: ",n+=l?""+i:""+t.util.toQuotedString(s),n+=" } ",!1!==t.opts.messages&&(n+=" , message: 'should match pattern \"",n+=l?"' + "+i+" + '":""+t.util.escapeQuotes(s),n+="\"' "),t.opts.verbose&&(n+=" , schema: ",n+=l?"validate.schema"+u:""+t.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var p=n;return n=d.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t),d="";l.level++;var p="valid"+l.level,m="key"+n,v="idx"+n,g=l.dataLevel=t.dataLevel+1,y="data"+g,b="dataProperties"+n,w=Object.keys(o||{}).filter(x),_=t.schema.patternProperties||{},E=Object.keys(_).filter(x),M=t.schema.additionalProperties,S=w.length||E.length,C=!1===M,A="object"==typeof M&&Object.keys(M).length,k=t.opts.removeAdditional,T=C||A||k,I=t.opts.ownProperties,R=t.baseId,P=t.schema.required;if(P&&(!t.opts.$data||!P.$data)&&P.length8)i+=" || validate.schema"+s+".hasOwnProperty("+m+") ";else{var O=w;if(O)for(var N=-1,j=O.length-1;N0||!1===J:t.util.schemaHasRules(J,t.RULES.all)){var X=t.util.getProperty($),tt=(H=f+X,G&&void 0!==J.default);l.schema=J,l.schemaPath=s+X,l.errSchemaPath=u+"/"+t.util.escapeFragment($),l.errorPath=t.util.getPath(t.errorPath,$,t.opts.jsonPointers),l.dataPathArr[g]=t.util.toQuotedString($);Z=t.validate(l);if(l.baseId=R,t.util.varOccurences(Z,y)<2){Z=t.util.varReplace(Z,y,H);var et=H}else{et=y;i+=" var "+y+" = "+H+"; "}if(tt)i+=" "+Z+" ";else{if(B&&B[$]){i+=" if ( "+et+" === undefined ",I&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=") { "+p+" = false; ";U=t.errorPath,q=u;var rt,it=t.util.escapeQuotes($);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(U,$,t.opts.jsonPointers)),u=t.errSchemaPath+"/required",(rt=rt||[]).push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+it+"' } ",!1!==t.opts.messages&&(i+=" , message: '",t.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+it+"\\'",i+="' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";z=i;i=rt.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+z+"]); ":i+=" validate.errors = ["+z+"]; return false; ":i+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=q,t.errorPath=U,i+=" } else { "}else h?(i+=" if ( "+et+" === undefined ",I&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=") { "+p+" = true; } else { "):(i+=" if ("+et+" !== undefined ",I&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+t.util.escapeQuotes($)+"') "),i+=" ) { ");i+=" "+Z+" } "}}h&&(i+=" if ("+p+") { ",d+="}")}}if(E.length){var nt=E;if(nt)for(var at,ot=-1,st=nt.length-1;ot0||!1===J:t.util.schemaHasRules(J,t.RULES.all)){l.schema=J,l.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(at),l.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(at),i+=I?" "+b+" = "+b+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+b+".length; "+v+"++) { var "+m+" = "+b+"["+v+"]; ":" for (var "+m+" in "+f+") { ",i+=" if ("+t.usePattern(at)+".test("+m+")) { ",l.errorPath=t.util.getPathExpr(t.errorPath,m,t.opts.jsonPointers);H=f+"["+m+"]";l.dataPathArr[g]=m;Z=t.validate(l);l.baseId=R,t.util.varOccurences(Z,y)<2?i+=" "+t.util.varReplace(Z,y,H)+" ":i+=" var "+y+" = "+H+"; "+Z+" ",h&&(i+=" if (!"+p+") break; "),i+=" } ",h&&(i+=" else "+p+" = true; "),i+=" } ",h&&(i+=" if ("+p+") { ",d+="}")}}}return h&&(i+=" "+d+" if ("+c+" == errors) {"),i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var i=" ",n=t.level,a=t.dataLevel,o=t.schema[e],s=t.schemaPath+t.util.getProperty(e),u=t.errSchemaPath+"/"+e,h=!t.opts.allErrors,f="data"+(a||""),c="errs__"+n,l=t.util.copy(t);l.level++;var d="valid"+l.level;if(i+="var "+c+" = errors;",t.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:t.util.schemaHasRules(o,t.RULES.all)){l.schema=o,l.schemaPath=s,l.errSchemaPath=u;var p="key"+n,m="idx"+n,v="i"+n,g="' + "+p+" + '",y="data"+(l.dataLevel=t.dataLevel+1),b="dataProperties"+n,w=t.opts.ownProperties,_=t.baseId;w&&(i+=" var "+b+" = undefined; "),i+=w?" "+b+" = "+b+" || Object.keys("+f+"); for (var "+m+"=0; "+m+"<"+b+".length; "+m+"++) { var "+p+" = "+b+"["+m+"]; ":" for (var "+p+" in "+f+") { ",i+=" var startErrs"+n+" = errors; ";var E=p,M=t.compositeRule;t.compositeRule=l.compositeRule=!0;var S=t.validate(l);l.baseId=_,t.util.varOccurences(S,y)<2?i+=" "+t.util.varReplace(S,y,E)+" ":i+=" var "+y+" = "+E+"; "+S+" ",t.compositeRule=l.compositeRule=M,i+=" if (!"+d+") { for (var "+v+"=startErrs"+n+"; "+v+"0||!1===b:t.util.schemaHasRules(b,t.RULES.all))||(p[p.length]=v)}}else p=o;if(l||p.length){var w=t.errorPath,_=l||p.length>=t.opts.loopRequired,E=t.opts.ownProperties;if(h)if(i+=" var missing"+n+"; ",_){l||(i+=" var "+d+" = validate.schema"+s+"; ");var M="' + "+(I="schema"+n+"["+(A="i"+n)+"]")+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(w,I,t.opts.jsonPointers)),i+=" var "+c+" = true; ",l&&(i+=" if (schema"+n+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+n+")) "+c+" = false; else {"),i+=" for (var "+A+" = 0; "+A+" < "+d+".length; "+A+"++) { "+c+" = "+f+"["+d+"["+A+"]] !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+d+"["+A+"]) "),i+="; if (!"+c+") break; } ",l&&(i+=" } "),i+=" if (!"+c+") { ",(T=T||[]).push(i),i="",!1!==t.createErrors?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",!1!==t.opts.messages&&(i+=" , message: '",t.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),t.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var S=i;i=T.pop(),!t.compositeRule&&h?t.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var C=p;if(C)for(var A=-1,k=C.length-1;A 1) { ";var p=t.schema.items&&t.schema.items.type,m=Array.isArray(p);if(!p||"object"==p||"array"==p||m&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+l+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+c+"[i]; ";var v="checkDataType"+(m?"s":"");n+=" if ("+t.util[v](p,"item",t.opts.strictNumbers,!0)+") continue; ",m&&(n+=" if (typeof item == 'string') item = '\"' + item; "),n+=" if (typeof itemIndices[item] == 'number') { "+l+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+l+") { ";var g=g||[];g.push(n),n="",!1!==t.createErrors?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==t.opts.messages&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+c+" "),n+=" } "):n+=" {} ";var y=n;n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}},function(t,e,r){"use strict";var i=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];t.exports=function(t,e){for(var r=0;r-1},at.prototype.set=function(t,e){var r=this.__data__,i=ft(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},ot.prototype.clear=function(){this.__data__={hash:new nt,map:new(Z||at),string:new nt}},ot.prototype.delete=function(t){return mt(this,t).delete(t)},ot.prototype.get=function(t){return mt(this,t).get(t)},ot.prototype.has=function(t){return mt(this,t).has(t)},ot.prototype.set=function(t,e){return mt(this,t).set(t,e),this},st.prototype.clear=function(){this.__data__=new at},st.prototype.delete=function(t){return this.__data__.delete(t)},st.prototype.get=function(t){return this.__data__.get(t)},st.prototype.has=function(t){return this.__data__.has(t)},st.prototype.set=function(t,e){var r=this.__data__;if(r instanceof at){var i=r.__data__;if(!Z||i.length<199)return i.push([t,e]),this;r=this.__data__=new ot(i)}return r.set(t,e),this};var gt=q?M(q,Object):function(){return[]},yt=function(t){return x.call(t)};function bt(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||f.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}(t.length)&&!At(t)}var Ct=z||function(){return!1};function At(t){var e=kt(t)?x.call(t):"";return e==n||e==a}function kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Tt(t){return St(t)?ut(t):function(t){if(!wt(t))return V(t);var e=[];for(var r in Object(t))B.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}r.exports=function(t){return ct(t,!0,!0)}}).call(this,r(7),r(15)(t))},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(38));let h=class extends u.default{constructor(t){super(t)}};h=i([s.injectable(),a(0,s.injectAll("authenticatedFetchers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class i extends Error{constructor(t,e){super(`${t} cannot find a suitable handler for: ${e.map(t=>{try{return JSON.stringify(t)}catch(e){return t.toString()}}).join(", ")}`),this.params=e}}e.default=i},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(39)),u=r(5),h=r(114);let f=class{constructor(t,e,r,i){this.dpopHeaderCreator=t,this.fetcher=e,this.urlRepresentationConverter=r,this.storageUtility=i}async canHandle(t,e,r){return"dpop"===t.type&&null!==await this.storageUtility.getForUser(t.localUserId,"accessToken")}async handle(t,e,r){if(!await this.canHandle(t,e,r))throw new s.default("Dpop Authenticated Fetcher cannot handle "+JSON.stringify(t));const i=await this.storageUtility.getForUser(t.localUserId,"accessToken"),n={headers:{},method:"GET",...r};return this.fetcher.fetch(e,{...r,headers:{...h.flattenHeaders(n.headers),authorization:"DPoP "+i,dpop:await this.dpopHeaderCreator.createHeaderToken(this.urlRepresentationConverter.requestInfoToUrl(e),n.method)}})}};f=i([u.injectable(),a(0,u.inject("dpopHeaderCreator")),a(1,u.inject("fetcher")),a(2,u.inject("urlRepresentationConverter")),a(3,u.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object,Object])],f),e.default=f},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5),s=r(114);let u=class{constructor(t,e,r){this.fetcher=t,this.urlRepresentationConverter=e,this.storageUtility=r}async canHandle(t,e,r){return!0}async handle(t,e,r){var i;return this.fetcher.fetch(e,{...r,method:null!==(i=null==r?void 0:r.method)&&void 0!==i?i:"GET",headers:s.flattenHeaders(null==r?void 0:r.headers)})}};u=i([o.injectable(),a(0,o.inject("fetcher")),a(1,o.inject("urlRepresentationConverter")),a(2,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object])],u),e.default=u},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("loginHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=r(247),a=i(r(312)),o=i(r(421)),s=i(r(88));e.default=class{async generateJWK(t,e,r){return(await n.JWK.createKey(t,e,r)).toJSON(!0)}async signJWT(t,e,r){const i=(await n.JWK.asKey(e)).toPEM(!0);return a.default.sign(t,i,{...r})}async decodeJWT(t){return a.default.decode(t)}async privateJWKToPublicJWK(t){return await n.JWK.asKey(t,"public")}async generateCodeVerifier(){return o.default({length:50,type:"alphanumeric"})}async generateCodeChallenge(t){const e=s.default.createHash("sha256");return e.update(t),e.digest().toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}}},function(t,e,r){"use strict";(function(e,i,n){ /*! * index.js - Main Entry Point * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -"undefined"==typeof Promise&&r(116).polyfill(),void 0===e&&((i||window).Buffer=r(0).Buffer),void 0===n&&((i||window).process=r(4)),n.version||(n.version="");var a=r(67);t.exports={JWA:r(76),JWE:r(82),JWK:r(30),JWS:a,util:r(9),parse:r(308),canYouSee:a.createVerify}}).call(this,r(0).Buffer,r(7),r(4))},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,i=h(t),o=i[0],s=i[1],u=new a(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),f=0,c=s>0?o-4:o;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,a=[],o=0,s=r-n;os?s:o+16383));1===n?(e=t[r-1],a.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],a.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var n,a,o=[],s=e;s>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,i,n){var a,o,s=8*n-i-1,u=(1<>1,f=-7,c=r?n-1:0,l=r?-1:1,d=t[e+c];for(c+=l,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+c],c+=l,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+c],c+=l,f-=8);if(0===a)a=1-h;else{if(a===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=h}return(d?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,r,i,n,a){var o,s,u,h=8*a-n-1,f=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=f?(s=0,o=f):o+c>=1?(s=(e*u-1)*Math.pow(2,n),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,h-=8);t[r+d-p]|=128*m}},function(t,e,r){"use strict";(function(e){ +"undefined"==typeof Promise&&r(116).polyfill(),void 0===e&&((i||window).Buffer=r(0).Buffer),void 0===n&&((i||window).process=r(3)),n.version||(n.version="");var a=r(67);t.exports={JWA:r(76),JWE:r(82),JWK:r(30),JWS:a,util:r(9),parse:r(309),canYouSee:a.createVerify}}).call(this,r(0).Buffer,r(7),r(3))},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,i=h(t),o=i[0],s=i[1],u=new a(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),f=0,c=s>0?o-4:o;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,a=[],o=0,s=r-n;os?s:o+16383));1===n?(e=t[r-1],a.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],a.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var n,a,o=[],s=e;s>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,i,n){var a,o,s=8*n-i-1,u=(1<>1,f=-7,c=r?n-1:0,l=r?-1:1,d=t[e+c];for(c+=l,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+c],c+=l,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+c],c+=l,f-=8);if(0===a)a=1-h;else{if(a===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=h}return(d?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,r,i,n,a){var o,s,u,h=8*a-n-1,f=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=f?(s=0,o=f):o+c>=1?(s=(e*u-1)*Math.pow(2,n),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,h-=8);t[r+d-p]|=128*m}},function(t,e,r){"use strict";(function(e){ /*! * jws/sign.js - Sign to JWS * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(12),n=r(20),a=r(9),o=r(30),s=r(281).slice,u=i.clone,h=i.uniq,f=r(282),c=function(t,r){var i=!1,n=t.format||"general",o=e.alloc(0);Object.defineProperty(this,"compact",{get:function(){return"compact"===n},enumerable:!0}),Object.defineProperty(this,"format",{get:function(){return n},enumerable:!0}),Object.defineProperty(this,"update",{value:function(t,r){if(i)throw new Error("already final");return null!=t&&(t=a.asBuffer(t,r),o=o.length?e.concat([o,t],o.length+t.length):t),this}}),Object.defineProperty(this,"final",{value:function(t,s){if(i)return Promise.reject(new Error("already final"));var h;switch(this.update(t,s),i=!0,h=(h=(h=Promise.all(r)).then((function(t){return o=a.base64url.encode(o),t=t.map((function(t){var r={},i=0,n=u(t.header),s=Object.keys(n).length;t.protected.forEach((function(t){t in n&&(r[t]=n[t],i++,delete n[t],s--)})),i>0?(r=JSON.stringify(r),r=a.base64url.encode(r)):r="";var h=e.from(r+"."+o,"ascii");return t=(t=t.key.sign(t.header.alg,h,t.header)).then((function(t){var e={};return 00;)s.push(h%a),h=h/a|0}for(n=0;0===t[n]&&n=0;--n)i+=e[s[n]]}else i=function(t,e){var r=0,i=e.length,n=e.charAt(0),a=[0];for(r=0;r0;)a.push(s%i),s=s/i|0}var u="";for(r=0;0===t.at(r)&&r=0;--r)u+=e[a[r]];return u}(t,e);if(r){var f=new RegExp(".{1,"+r+"}","g");i=i.match(f).join("\r\n")}return i},r.decode=function(t,r){if("string"!=typeof t)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=i[r];if(!n){n=i[r]=[];for(var a=0;a>=8;for(;c>0;)u.push(255&c),c>>=8}for(var l=0;t[l]===s&&l0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a=r&&o0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,e)),a.length>0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,a)),o.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,t.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.type).getBytes()),o])},addSigner:function(e){var r=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=i.pki.certificateFromPem(a)),r=a.issuer.attributes,n=a.serialNumber}var o=e.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=i.pki.privateKeyFromPem(o));var s=e.digestAlgorithm||i.pki.oids.sha1;switch(s){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+s)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var h=!1,f=!1,c=0;c>16-e},s=function(t,e){return(65535&t)>>e|t<<16-e&65535};t.exports=i.rc2=i.rc2||{},i.rc2.expandKey=function(t,e){"string"==typeof t&&(t=i.util.createBuffer(t)),e=e||128;var r,a=t,o=t.length(),s=e,u=Math.ceil(s/8),h=255>>(7&s);for(r=o;r<128;r++)a.putByte(n[a.at(r-1)+a.at(r-o)&255]);for(a.setAt(128-u,n[a.at(128-u)&h]),r=127-u;r>=0;r--)a.setAt(r,n[a.at(r+1)^a.at(r+u)]);return a};var u=function(t,e,r){var n,u,h,f,c=!1,l=null,d=null,p=null,m=[];for(t=i.rc2.expandKey(t,e),h=0;h<64;h++)m.push(t.getInt16Le());r?(n=function(t){for(h=0;h<4;h++)t[h]+=m[f]+(t[(h+3)%4]&t[(h+2)%4])+(~t[(h+3)%4]&t[(h+1)%4]),t[h]=o(t[h],a[h]),f++},u=function(t){for(h=0;h<4;h++)t[h]+=m[63&t[(h+3)%4]]}):(n=function(t){for(h=3;h>=0;h--)t[h]=s(t[h],a[h]),t[h]-=m[f]+(t[(h+3)%4]&t[(h+2)%4])+(~t[(h+3)%4]&t[(h+1)%4]),f--},u=function(t){for(h=3;h>=0;h--)t[h]-=m[63&t[(h+3)%4]]});var v=function(t){var e=[];for(h=0;h<4;h++){var i=l.getInt16Le();null!==p&&(r?i^=p.getInt16Le():p.putInt16Le(i)),e.push(65535&i)}f=r?0:63;for(var n=0;n=8;)v([[5,n],[1,u],[6,n],[1,u],[5,n]])},finish:function(t){var e=!0;if(r)if(t)e=t(8,l,!r);else{var i=8===l.length()?8:8-l.length();l.fillWithByte(i,i)}if(e&&(c=!0,y.update()),!r&&(e=0===l.length()))if(t)e=t(8,d,!r);else{var n=d.length(),a=d.at(n-1);a>n?e=!1:d.truncate(a)}return e}}};i.rc2.startEncrypting=function(t,e,r){var n=i.rc2.createEncryptionCipher(t,128);return n.start(e,r),n},i.rc2.createEncryptionCipher=function(t,e){return u(t,e,!0)},i.rc2.startDecrypting=function(t,e,r){var n=i.rc2.createDecryptionCipher(t,128);return n.start(e,r),n},i.rc2.createDecryptionCipher=function(t,e){return u(t,e,!1)}},function(t,e,r){var i=r(3);r(21),r(69),r(24),r(123),r(126),r(22),r(51),r(72),r(6),r(74);var n=i.asn1,a=i.pki,o=t.exports=i.pkcs12=i.pkcs12||{},s={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},s,{name:"PFX.macData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},h={name:"SafeBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f={name:"Attribute",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:n.Class.UNIVERSAL,type:n.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(t,e,r,i){for(var n=[],a=0;a=0&&n.push(s):n.push(s))}return n}function d(t){if(t.composed||t.constructed){for(var e=i.util.createBuffer(),r=0;r0&&(u=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,c));var l=[],d=[];null!==e&&(d=i.util.isArray(e)?e:[e]);for(var p=[],m=0;m0){var b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,p),w=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(b).getBytes())])]);l.push(w)}var _=null;if(null!==t){var E=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));_=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[E]),u]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(E,r,s)]),u]);var M=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[_]),S=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(M).getBytes())])]);l.push(S)}var C,A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,l);if(s.useMac){var k=i.md.sha1.create(),T=new i.util.ByteBuffer(i.random.getBytes(s.saltSize)),I=s.count,R=(t=o.generateKey(r,T,3,I,20),i.hmac.create());R.start(k,t),R.update(n.toDer(A).getBytes());var P=R.getMac();C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,P.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,T.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(I).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(A).getBytes())])]),C])},o.generateKey=i.pbe.generatePkcs12Key},function(t,e,r){var i=r(3);r(25),r(6);var n=t.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=n;var a=i.sha384=i.sha512.sha384=i.sha512.sha384||{};a.create=function(){return n.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=a,i.sha512.sha256=i.sha512.sha256||{create:function(){return n.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return n.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,n.create=function(t){if(s||(o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),128),u=[[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]],(h={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0),void 0===t&&(t="SHA-512"),!(t in h))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=h[t],r=null,n=i.util.createBuffer(),a=new Array(80),c=0;c<80;++c)a[c]=new Array(2);var l=64;switch(t){case"SHA-384":l=48;break;case"SHA-512/256":l=32;break;case"SHA-512/224":l=28}var d={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:l,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var t=d.messageLengthSize/4,a=0;a>>0,o>>>0];for(var s=d.fullMessageLength.length-1;s>=0;--s)d.fullMessageLength[s]+=o[1],o[1]=o[0]+(d.fullMessageLength[s]/4294967296>>>0),d.fullMessageLength[s]=d.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return n.putBytes(t),f(r,a,n),(n.read>2048||0===n.length())&&n.compact(),d},d.digest=function(){var e=i.util.createBuffer();e.putBytes(n.bytes());var s,u=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;e.putBytes(o.substr(0,d.blockLength-u));for(var h=8*d.fullMessageLength[0],c=0;c>>0,e.putInt32(h>>>0),h=s>>>0;e.putInt32(h);var l=new Array(r.length);for(c=0;c=128;){for(R=0;R<16;++R)e[R][0]=r.getInt32()>>>0,e[R][1]=r.getInt32()>>>0;for(;R<80;++R)i=(((P=(x=e[R-2])[0])>>>19|(B=x[1])<<13)^(B>>>29|P<<3)^P>>>6)>>>0,n=((P<<13|B>>>19)^(B<<3|P>>>29)^(P<<26|B>>>6))>>>0,a=(((P=(N=e[R-15])[0])>>>1|(B=N[1])<<31)^(P>>>8|B<<24)^P>>>7)>>>0,o=((P<<31|B>>>1)^(P<<24|B>>>8)^(P<<25|B>>>7))>>>0,O=e[R-7],j=e[R-16],B=n+O[1]+o+j[1],e[R][0]=i+O[0]+a+j[0]+(B/4294967296>>>0)>>>0,e[R][1]=B>>>0;for(p=t[0][0],m=t[0][1],v=t[1][0],y=t[1][1],g=t[2][0],b=t[2][1],w=t[3][0],_=t[3][1],E=t[4][0],M=t[4][1],S=t[5][0],C=t[5][1],A=t[6][0],k=t[6][1],T=t[7][0],I=t[7][1],R=0;R<80;++R)f=((E>>>14|M<<18)^(E>>>18|M<<14)^(M>>>9|E<<23))>>>0,c=(A^E&(S^A))>>>0,s=((p>>>28|m<<4)^(m>>>2|p<<30)^(m>>>7|p<<25))>>>0,h=((p<<4|m>>>28)^(m<<30|p>>>2)^(m<<25|p>>>7))>>>0,l=(p&v|g&(p^v))>>>0,d=(m&y|b&(m^y))>>>0,B=I+(((E<<18|M>>>14)^(E<<14|M>>>18)^(M<<23|E>>>9))>>>0)+((k^M&(C^k))>>>0)+u[R][1]+e[R][1],i=T+f+c+u[R][0]+e[R][0]+(B/4294967296>>>0)>>>0,n=B>>>0,a=s+l+((B=h+d)/4294967296>>>0)>>>0,o=B>>>0,T=A,I=k,A=S,k=C,S=E,C=M,E=w+i+((B=_+n)/4294967296>>>0)>>>0,M=B>>>0,w=g,_=b,g=v,b=y,v=p,y=m,p=i+a+((B=n+o)/4294967296>>>0)>>>0,m=B>>>0;B=t[0][1]+m,t[0][0]=t[0][0]+p+(B/4294967296>>>0)>>>0,t[0][1]=B>>>0,B=t[1][1]+y,t[1][0]=t[1][0]+v+(B/4294967296>>>0)>>>0,t[1][1]=B>>>0,B=t[2][1]+b,t[2][0]=t[2][0]+g+(B/4294967296>>>0)>>>0,t[2][1]=B>>>0,B=t[3][1]+_,t[3][0]=t[3][0]+w+(B/4294967296>>>0)>>>0,t[3][1]=B>>>0,B=t[4][1]+M,t[4][0]=t[4][0]+E+(B/4294967296>>>0)>>>0,t[4][1]=B>>>0,B=t[5][1]+C,t[5][0]=t[5][0]+S+(B/4294967296>>>0)>>>0,t[5][1]=B>>>0,B=t[6][1]+k,t[6][0]=t[6][0]+A+(B/4294967296>>>0)>>>0,t[6][1]=B>>>0,B=t[7][1]+I,t[7][0]=t[7][0]+T+(B/4294967296>>>0)>>>0,t[7][1]=B>>>0,L-=128}}},function(t,e,r){t.exports=r(259).default,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var i=r(260);function n(e,r){return void 0===r&&(r="utf8"),t.isBuffer(e)?o(e.toString("base64")):o(t.from(e,r).toString("base64"))}function a(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var s=n;s.encode=n,s.decode=function(e,r){return void 0===r&&(r="utf8"),t.from(a(e),"base64").toString(r)},s.toBase64=a,s.fromBase64=o,s.toBuffer=function(e){return t.from(a(e),"base64")},e.default=s}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var r=e.length,i=r%4;if(!i)return e;var n=r,a=4-i,o=r+a,s=t.alloc(o);for(s.write(e);a--;)s.write("=",n++);return s.toString()}}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; +var i=r(12),n=r(20),a=r(9),o=r(30),s=r(282).slice,u=i.clone,h=i.uniq,f=r(283),c=function(t,r){var i=!1,n=t.format||"general",o=e.alloc(0);Object.defineProperty(this,"compact",{get:function(){return"compact"===n},enumerable:!0}),Object.defineProperty(this,"format",{get:function(){return n},enumerable:!0}),Object.defineProperty(this,"update",{value:function(t,r){if(i)throw new Error("already final");return null!=t&&(t=a.asBuffer(t,r),o=o.length?e.concat([o,t],o.length+t.length):t),this}}),Object.defineProperty(this,"final",{value:function(t,s){if(i)return Promise.reject(new Error("already final"));var h;switch(this.update(t,s),i=!0,h=(h=(h=Promise.all(r)).then((function(t){return o=a.base64url.encode(o),t=t.map((function(t){var r={},i=0,n=u(t.header),s=Object.keys(n).length;t.protected.forEach((function(t){t in n&&(r[t]=n[t],i++,delete n[t],s--)})),i>0?(r=JSON.stringify(r),r=a.base64url.encode(r)):r="";var h=e.from(r+"."+o,"ascii");return t=(t=t.key.sign(t.header.alg,h,t.header)).then((function(t){var e={};return 00;)s.push(h%a),h=h/a|0}for(n=0;0===t[n]&&n=0;--n)i+=e[s[n]]}else i=function(t,e){var r=0,i=e.length,n=e.charAt(0),a=[0];for(r=0;r0;)a.push(s%i),s=s/i|0}var u="";for(r=0;0===t.at(r)&&r=0;--r)u+=e[a[r]];return u}(t,e);if(r){var f=new RegExp(".{1,"+r+"}","g");i=i.match(f).join("\r\n")}return i},r.decode=function(t,r){if("string"!=typeof t)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=i[r];if(!n){n=i[r]=[];for(var a=0;a>=8;for(;c>0;)u.push(255&c),c>>=8}for(var l=0;t[l]===s&&l0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a=r&&o0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,e)),a.length>0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,a)),o.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,t.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.type).getBytes()),o])},addSigner:function(e){var r=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=i.pki.certificateFromPem(a)),r=a.issuer.attributes,n=a.serialNumber}var o=e.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=i.pki.privateKeyFromPem(o));var s=e.digestAlgorithm||i.pki.oids.sha1;switch(s){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+s)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var h=!1,f=!1,c=0;c>16-e},s=function(t,e){return(65535&t)>>e|t<<16-e&65535};t.exports=i.rc2=i.rc2||{},i.rc2.expandKey=function(t,e){"string"==typeof t&&(t=i.util.createBuffer(t)),e=e||128;var r,a=t,o=t.length(),s=e,u=Math.ceil(s/8),h=255>>(7&s);for(r=o;r<128;r++)a.putByte(n[a.at(r-1)+a.at(r-o)&255]);for(a.setAt(128-u,n[a.at(128-u)&h]),r=127-u;r>=0;r--)a.setAt(r,n[a.at(r+1)^a.at(r+u)]);return a};var u=function(t,e,r){var n,u,h,f,c=!1,l=null,d=null,p=null,m=[];for(t=i.rc2.expandKey(t,e),h=0;h<64;h++)m.push(t.getInt16Le());r?(n=function(t){for(h=0;h<4;h++)t[h]+=m[f]+(t[(h+3)%4]&t[(h+2)%4])+(~t[(h+3)%4]&t[(h+1)%4]),t[h]=o(t[h],a[h]),f++},u=function(t){for(h=0;h<4;h++)t[h]+=m[63&t[(h+3)%4]]}):(n=function(t){for(h=3;h>=0;h--)t[h]=s(t[h],a[h]),t[h]-=m[f]+(t[(h+3)%4]&t[(h+2)%4])+(~t[(h+3)%4]&t[(h+1)%4]),f--},u=function(t){for(h=3;h>=0;h--)t[h]-=m[63&t[(h+3)%4]]});var v=function(t){var e=[];for(h=0;h<4;h++){var i=l.getInt16Le();null!==p&&(r?i^=p.getInt16Le():p.putInt16Le(i)),e.push(65535&i)}f=r?0:63;for(var n=0;n=8;)v([[5,n],[1,u],[6,n],[1,u],[5,n]])},finish:function(t){var e=!0;if(r)if(t)e=t(8,l,!r);else{var i=8===l.length()?8:8-l.length();l.fillWithByte(i,i)}if(e&&(c=!0,g.update()),!r&&(e=0===l.length()))if(t)e=t(8,d,!r);else{var n=d.length(),a=d.at(n-1);a>n?e=!1:d.truncate(a)}return e}}};i.rc2.startEncrypting=function(t,e,r){var n=i.rc2.createEncryptionCipher(t,128);return n.start(e,r),n},i.rc2.createEncryptionCipher=function(t,e){return u(t,e,!0)},i.rc2.startDecrypting=function(t,e,r){var n=i.rc2.createDecryptionCipher(t,128);return n.start(e,r),n},i.rc2.createDecryptionCipher=function(t,e){return u(t,e,!1)}},function(t,e,r){var i=r(4);r(21),r(69),r(24),r(123),r(126),r(22),r(51),r(72),r(6),r(74);var n=i.asn1,a=i.pki,o=t.exports=i.pkcs12=i.pkcs12||{},s={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},s,{name:"PFX.macData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},h={name:"SafeBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f={name:"Attribute",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:n.Class.UNIVERSAL,type:n.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(t,e,r,i){for(var n=[],a=0;a=0&&n.push(s):n.push(s))}return n}function d(t){if(t.composed||t.constructed){for(var e=i.util.createBuffer(),r=0;r0&&(u=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,c));var l=[],d=[];null!==e&&(d=i.util.isArray(e)?e:[e]);for(var p=[],m=0;m0){var b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,p),w=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(b).getBytes())])]);l.push(w)}var _=null;if(null!==t){var E=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));_=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[E]),u]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(E,r,s)]),u]);var M=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[_]),S=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(M).getBytes())])]);l.push(S)}var C,A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,l);if(s.useMac){var k=i.md.sha1.create(),T=new i.util.ByteBuffer(i.random.getBytes(s.saltSize)),I=s.count,R=(t=o.generateKey(r,T,3,I,20),i.hmac.create());R.start(k,t),R.update(n.toDer(A).getBytes());var P=R.getMac();C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,P.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,T.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(I).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(A).getBytes())])]),C])},o.generateKey=i.pbe.generatePkcs12Key},function(t,e,r){var i=r(4);r(25),r(6);var n=t.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=n;var a=i.sha384=i.sha512.sha384=i.sha512.sha384||{};a.create=function(){return n.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=a,i.sha512.sha256=i.sha512.sha256||{create:function(){return n.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return n.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,n.create=function(t){if(s||(o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),128),u=[[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]],(h={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0),void 0===t&&(t="SHA-512"),!(t in h))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=h[t],r=null,n=i.util.createBuffer(),a=new Array(80),c=0;c<80;++c)a[c]=new Array(2);var l=64;switch(t){case"SHA-384":l=48;break;case"SHA-512/256":l=32;break;case"SHA-512/224":l=28}var d={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:l,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var t=d.messageLengthSize/4,a=0;a>>0,o>>>0];for(var s=d.fullMessageLength.length-1;s>=0;--s)d.fullMessageLength[s]+=o[1],o[1]=o[0]+(d.fullMessageLength[s]/4294967296>>>0),d.fullMessageLength[s]=d.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return n.putBytes(t),f(r,a,n),(n.read>2048||0===n.length())&&n.compact(),d},d.digest=function(){var e=i.util.createBuffer();e.putBytes(n.bytes());var s,u=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;e.putBytes(o.substr(0,d.blockLength-u));for(var h=8*d.fullMessageLength[0],c=0;c>>0,e.putInt32(h>>>0),h=s>>>0;e.putInt32(h);var l=new Array(r.length);for(c=0;c=128;){for(R=0;R<16;++R)e[R][0]=r.getInt32()>>>0,e[R][1]=r.getInt32()>>>0;for(;R<80;++R)i=(((P=(x=e[R-2])[0])>>>19|(B=x[1])<<13)^(B>>>29|P<<3)^P>>>6)>>>0,n=((P<<13|B>>>19)^(B<<3|P>>>29)^(P<<26|B>>>6))>>>0,a=(((P=(N=e[R-15])[0])>>>1|(B=N[1])<<31)^(P>>>8|B<<24)^P>>>7)>>>0,o=((P<<31|B>>>1)^(P<<24|B>>>8)^(P<<25|B>>>7))>>>0,O=e[R-7],j=e[R-16],B=n+O[1]+o+j[1],e[R][0]=i+O[0]+a+j[0]+(B/4294967296>>>0)>>>0,e[R][1]=B>>>0;for(p=t[0][0],m=t[0][1],v=t[1][0],g=t[1][1],y=t[2][0],b=t[2][1],w=t[3][0],_=t[3][1],E=t[4][0],M=t[4][1],S=t[5][0],C=t[5][1],A=t[6][0],k=t[6][1],T=t[7][0],I=t[7][1],R=0;R<80;++R)f=((E>>>14|M<<18)^(E>>>18|M<<14)^(M>>>9|E<<23))>>>0,c=(A^E&(S^A))>>>0,s=((p>>>28|m<<4)^(m>>>2|p<<30)^(m>>>7|p<<25))>>>0,h=((p<<4|m>>>28)^(m<<30|p>>>2)^(m<<25|p>>>7))>>>0,l=(p&v|y&(p^v))>>>0,d=(m&g|b&(m^g))>>>0,B=I+(((E<<18|M>>>14)^(E<<14|M>>>18)^(M<<23|E>>>9))>>>0)+((k^M&(C^k))>>>0)+u[R][1]+e[R][1],i=T+f+c+u[R][0]+e[R][0]+(B/4294967296>>>0)>>>0,n=B>>>0,a=s+l+((B=h+d)/4294967296>>>0)>>>0,o=B>>>0,T=A,I=k,A=S,k=C,S=E,C=M,E=w+i+((B=_+n)/4294967296>>>0)>>>0,M=B>>>0,w=y,_=b,y=v,b=g,v=p,g=m,p=i+a+((B=n+o)/4294967296>>>0)>>>0,m=B>>>0;B=t[0][1]+m,t[0][0]=t[0][0]+p+(B/4294967296>>>0)>>>0,t[0][1]=B>>>0,B=t[1][1]+g,t[1][0]=t[1][0]+v+(B/4294967296>>>0)>>>0,t[1][1]=B>>>0,B=t[2][1]+b,t[2][0]=t[2][0]+y+(B/4294967296>>>0)>>>0,t[2][1]=B>>>0,B=t[3][1]+_,t[3][0]=t[3][0]+w+(B/4294967296>>>0)>>>0,t[3][1]=B>>>0,B=t[4][1]+M,t[4][0]=t[4][0]+E+(B/4294967296>>>0)>>>0,t[4][1]=B>>>0,B=t[5][1]+C,t[5][0]=t[5][0]+S+(B/4294967296>>>0)>>>0,t[5][1]=B>>>0,B=t[6][1]+k,t[6][0]=t[6][0]+A+(B/4294967296>>>0)>>>0,t[6][1]=B>>>0,B=t[7][1]+I,t[7][0]=t[7][0]+T+(B/4294967296>>>0)>>>0,t[7][1]=B>>>0,F-=128}}},function(t,e,r){t.exports=r(260).default,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var i=r(261);function n(e,r){return void 0===r&&(r="utf8"),t.isBuffer(e)?o(e.toString("base64")):o(t.from(e,r).toString("base64"))}function a(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var s=n;s.encode=n,s.decode=function(e,r){return void 0===r&&(r="utf8"),t.from(a(e),"base64").toString(r)},s.toBase64=a,s.fromBase64=o,s.toBuffer=function(e){return t.from(a(e),"base64")},e.default=s}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var r=e.length,i=r%4;if(!i)return e;var n=r,a=4-i,o=r+a,s=t.alloc(o);for(s.write(e);a--;)s.write("=",n++);return s.toString()}}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; /*! * util/utf8.js - Implementation of UTF-8 Encoder/Decoder * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. - */var i=e;i.encode=function(t){var e=encodeURIComponent(t||"");return e=e.replace(/%([0-9a-fA-F]{2})/g,(function(t,e){return e=parseInt(e,16),String.fromCharCode(e)}))},i.decode=function(t){var e=(t||"").replace(/[\u0080-\u00ff]/g,(function(t){return"%"+(256|t.charCodeAt(0)).toString(16).substring(1)}));return e=decodeURIComponent(e)}},function(t,e,r){var i=r(263),n=r(264),a=n;a.v1=i,a.v4=n,t.exports=a},function(t,e,r){var i,n,a=r(127),o=r(128),s=0,u=0;t.exports=function(t,e,r){var h=e&&r||0,f=e||[],c=(t=t||{}).node||i,l=void 0!==t.clockseq?t.clockseq:n;if(null==c||null==l){var d=a();null==c&&(c=i=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=n=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:(new Date).getTime(),m=void 0!==t.nsecs?t.nsecs:u+1,v=p-s+(m-u)/1e4;if(v<0&&void 0===t.clockseq&&(l=l+1&16383),(v<0||p>s)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=p,u=m,n=l;var y=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;f[h++]=y>>>24&255,f[h++]=y>>>16&255,f[h++]=y>>>8&255,f[h++]=255&y;var g=p/4294967296*1e4&268435455;f[h++]=g>>>8&255,f[h++]=255&g,f[h++]=g>>>24&15|16,f[h++]=g>>>16&255,f[h++]=l>>>8|128,f[h++]=255&l;for(var b=0;b<6;++b)f[h+b]=c[b];return e||o(f)}},function(t,e,r){var i=r(127),n=r(128);t.exports=function(t,e,r){var a=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var s=0;s<16;++s)e[a+s]=o[s];return e||n(o)}},function(t,e,r){"use strict";(function(e){ + */var i=e;i.encode=function(t){var e=encodeURIComponent(t||"");return e=e.replace(/%([0-9a-fA-F]{2})/g,(function(t,e){return e=parseInt(e,16),String.fromCharCode(e)}))},i.decode=function(t){var e=(t||"").replace(/[\u0080-\u00ff]/g,(function(t){return"%"+(256|t.charCodeAt(0)).toString(16).substring(1)}));return e=decodeURIComponent(e)}},function(t,e,r){var i=r(264),n=r(265),a=n;a.v1=i,a.v4=n,t.exports=a},function(t,e,r){var i,n,a=r(127),o=r(128),s=0,u=0;t.exports=function(t,e,r){var h=e&&r||0,f=e||[],c=(t=t||{}).node||i,l=void 0!==t.clockseq?t.clockseq:n;if(null==c||null==l){var d=a();null==c&&(c=i=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=n=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:(new Date).getTime(),m=void 0!==t.nsecs?t.nsecs:u+1,v=p-s+(m-u)/1e4;if(v<0&&void 0===t.clockseq&&(l=l+1&16383),(v<0||p>s)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=p,u=m,n=l;var g=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;f[h++]=g>>>24&255,f[h++]=g>>>16&255,f[h++]=g>>>8&255,f[h++]=255&g;var y=p/4294967296*1e4&268435455;f[h++]=y>>>8&255,f[h++]=255&y,f[h++]=y>>>24&15|16,f[h++]=y>>>16&255,f[h++]=l>>>8|128,f[h++]=255&l;for(var b=0;b<6;++b)f[h+b]=c[b];return e||o(f)}},function(t,e,r){var i=r(127),n=r(128);t.exports=function(t,e,r){var a=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var s=0;s<16;++s)e[a+s]=o[s];return e||n(o)}},function(t,e,r){"use strict";(function(e){ /*! * algorithms/aes-cbc-hmac-sha2.js - AES-CBC-HMAC-SHA2 Composited Encryption * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(13),n=r(77),a=r(55),o=r(8),s=r(42),u=r(9);function h(t){if(16!==t.length)throw new Error("invalid iv")}function f(t){return i.setupFallback((function(r,n,a){try{h(a)}catch(t){return Promise.reject(t)}var o=Promise.resolve(n);return o=o.then((function(n){var o="AES-"+t+"-CBC",s=i.nodeCrypto.createCipheriv(o,r,a);return e.concat([s.update(n),s.final()])}))}),(function(t,r,n){try{h(n)}catch(t){return Promise.reject(t)}var a=Promise.resolve();return a=(a=(a=a.then((function(){return i.subtleCrypto.importKey("raw",t,{name:"AES-CBC"},!0,["encrypt"])}))).then((function(t){var e={name:"AES-CBC",iv:n};return i.subtleCrypto.encrypt(e,t,r)}))).then((function(t){return t=e.from(t)}))}),(function(t,r,i){try{h(i)}catch(t){return Promise.reject(t)}var n=Promise.resolve();return n=n.then((function(){var n=o.cipher.createCipher("AES-CBC",new s(t));return n.start({iv:new s(i)}),n.update(new s(r)),n.finish()?e.from(n.output.bytes(),"binary"):Promise.reject(new Error("encryption failed"))}))}))}function c(t){return i.setupFallback((function(r,n,a){try{h(a)}catch(t){return Promise.reject(t)}var o=Promise.resolve();return o=o.then((function(){var o="AES-"+t+"-CBC",s=i.nodeCrypto.createDecipheriv(o,r,a);return e.concat([s.update(n),s.final()])}))}),(function(t,r,n){try{h(n)}catch(t){return Promise.reject(t)}var a=Promise.resolve();return a=(a=(a=a.then((function(){return i.subtleCrypto.importKey("raw",t,{name:"AES-CBC"},!0,["decrypt"])}))).then((function(t){var e={name:"AES-CBC",iv:n};return i.subtleCrypto.decrypt(e,t,r)}))).then((function(t){return t=e.from(t)}))}),(function(t,r,i){try{h(i)}catch(t){return Promise.reject(t)}var n=Promise.resolve();return n=n.then((function(){var n=o.cipher.createDecipher("AES-CBC",new s(t));return n.start({iv:new s(i)}),n.update(new s(r)),n.finish()?e.from(n.output.bytes(),"binary"):Promise.reject(new Error("encryption failed"))}))}))}function l(t,e){if(e<<1!=t.length<<3)throw new Error("invalid encryption key size")}function d(t){var r=f(t);return function(a,o,s){try{l(a,t)}catch(t){return Promise.reject(t)}var u=a.slice(t/8),h=a.slice(0,t/8),f=s.iv||e.alloc(0),c=s.aad||s.adata||e.alloc(0),d=r(u,o,f);return d=d.then((function(r){var a=e.concat([c,f,r,i.int64ToBuffer(8*c.length)]);return n["HS"+2*t].sign(h,a,{length:t}).then((function(e){var i=e.mac.slice(0,t/8);return{data:r,tag:i}}))}))}}function p(t){var r=c(t);return function(a,o,s){try{l(a,t)}catch(t){return Promise.reject(t)}var u=a.slice(t/8),h=a.slice(0,t/8),f=s.iv||e.alloc(0),c=s.aad||s.adata||e.alloc(0),d=s.tag||s.mac||e.alloc(0),p=Promise.resolve();return p=(p=p.then((function(){var r=e.concat([c,f,o,i.int64ToBuffer(8*c.length)]);return n["HS"+2*t].verify(h,r,d,{length:t}).then((function(){return o}),(function(){throw new Error("mac check failed")}))}))).then((function(){return r(u,o,f)}))}}var m=e.from("Encryption","utf8"),v=e.from("Integrity","utf8"),y=e.from(".","utf8");function g(t,r,n,o){var s=8*t.length,u=s/2,h=Promise.resolve();return h=(h=h.then((function(){return e.concat([i.int32ToBuffer(1),t,i.int32ToBuffer(u),e.from(r,"utf8"),n,o,m])}))).then((function(t){return a["SHA-"+s].digest(t).then((function(t){return t.slice(0,u/8)}))})),h=Promise.resolve(h)}function b(t,r,n,o){var s=8*t.length,u=s,h=Promise.resolve();return h=(h=h.then((function(){return e.concat([i.int32ToBuffer(1),t,i.int32ToBuffer(u),e.from(r,"utf8"),n,o,v])}))).then((function(t){return a["SHA-"+s].digest(t).then((function(t){return t.slice(0,u/8)}))})),h=Promise.resolve(h)}function w(t,r){var a=f(t);return function(o,s,h){var f,c,l=h.epu||i.int32ToBuffer(0),d=h.epv||i.int32ToBuffer(0),p=h.iv||e.alloc(0),m=h.aad||h.adata||e.alloc(0),v=h.kdata||e.alloc(0),w=[g(o,r,l,d),b(o,r,l,d)],_=Promise.all(w).then((function(t){f=t[0],c=t[1]}));return _=(_=(_=_.then((function(){return a(f,s,p)}))).then((function(r){var i=e.concat([m,y,e.from(v),y,e.from(u.base64url.encode(p),"utf8"),y,e.from(u.base64url.encode(r),"utf8")]);return Promise.all([Promise.resolve(r),n["HS"+2*t].sign(c,i,{length:t})])}))).then((function(t){return{data:t[0],tag:t[1].mac}}))}}function _(t,r){var a=c(t);return function(o,s,h){var f,c,l=h.epu||i.int32ToBuffer(0),d=h.epv||i.int32ToBuffer(0),p=h.iv||e.alloc(0),m=h.aad||h.adata||e.alloc(0),v=h.kdata||e.alloc(0),w=h.tag||h.mac||e.alloc(0),_=[g(o,r,l,d),b(o,r,l,d)],E=Promise.all(_).then((function(t){f=t[0],c=t[1]}));return E=(E=E.then((function(){var r=e.concat([m,y,e.from(v),y,e.from(u.base64url.encode(p),"utf8"),y,e.from(u.base64url.encode(s),"utf8")]);try{return n["HS"+2*t].verify(c,r,w,{loose:!1})}catch(t){throw new Error("mac check failed")}}))).then((function(){return a(f,s,p)}))}}var E={};["A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"].forEach((function(t){var e=parseInt(/A(\d+)CBC-HS(\d+)?/g.exec(t)[1]);E[t]={encrypt:d(e),decrypt:p(e)}})),["A128CBC+HS256","A192CBC+HS384","A256CBC+HS512"].forEach((function(t){var e=parseInt(/A(\d+)CBC\+HS(\d+)?/g.exec(t)[1]);E[t]={encrypt:w(e,t),decrypt:_(e,t)}})),t.exports=E}).call(this,r(0).Buffer)},function(t,e){},function(t,e,r){"use strict";(function(e){ +var i=r(13),n=r(77),a=r(55),o=r(8),s=r(42),u=r(9);function h(t){if(16!==t.length)throw new Error("invalid iv")}function f(t){return i.setupFallback((function(r,n,a){try{h(a)}catch(t){return Promise.reject(t)}var o=Promise.resolve(n);return o=o.then((function(n){var o="AES-"+t+"-CBC",s=i.nodeCrypto.createCipheriv(o,r,a);return e.concat([s.update(n),s.final()])}))}),(function(t,r,n){try{h(n)}catch(t){return Promise.reject(t)}var a=Promise.resolve();return a=(a=(a=a.then((function(){return i.subtleCrypto.importKey("raw",t,{name:"AES-CBC"},!0,["encrypt"])}))).then((function(t){var e={name:"AES-CBC",iv:n};return i.subtleCrypto.encrypt(e,t,r)}))).then((function(t){return t=e.from(t)}))}),(function(t,r,i){try{h(i)}catch(t){return Promise.reject(t)}var n=Promise.resolve();return n=n.then((function(){var n=o.cipher.createCipher("AES-CBC",new s(t));return n.start({iv:new s(i)}),n.update(new s(r)),n.finish()?e.from(n.output.bytes(),"binary"):Promise.reject(new Error("encryption failed"))}))}))}function c(t){return i.setupFallback((function(r,n,a){try{h(a)}catch(t){return Promise.reject(t)}var o=Promise.resolve();return o=o.then((function(){var o="AES-"+t+"-CBC",s=i.nodeCrypto.createDecipheriv(o,r,a);return e.concat([s.update(n),s.final()])}))}),(function(t,r,n){try{h(n)}catch(t){return Promise.reject(t)}var a=Promise.resolve();return a=(a=(a=a.then((function(){return i.subtleCrypto.importKey("raw",t,{name:"AES-CBC"},!0,["decrypt"])}))).then((function(t){var e={name:"AES-CBC",iv:n};return i.subtleCrypto.decrypt(e,t,r)}))).then((function(t){return t=e.from(t)}))}),(function(t,r,i){try{h(i)}catch(t){return Promise.reject(t)}var n=Promise.resolve();return n=n.then((function(){var n=o.cipher.createDecipher("AES-CBC",new s(t));return n.start({iv:new s(i)}),n.update(new s(r)),n.finish()?e.from(n.output.bytes(),"binary"):Promise.reject(new Error("encryption failed"))}))}))}function l(t,e){if(e<<1!=t.length<<3)throw new Error("invalid encryption key size")}function d(t){var r=f(t);return function(a,o,s){try{l(a,t)}catch(t){return Promise.reject(t)}var u=a.slice(t/8),h=a.slice(0,t/8),f=s.iv||e.alloc(0),c=s.aad||s.adata||e.alloc(0),d=r(u,o,f);return d=d.then((function(r){var a=e.concat([c,f,r,i.int64ToBuffer(8*c.length)]);return n["HS"+2*t].sign(h,a,{length:t}).then((function(e){var i=e.mac.slice(0,t/8);return{data:r,tag:i}}))}))}}function p(t){var r=c(t);return function(a,o,s){try{l(a,t)}catch(t){return Promise.reject(t)}var u=a.slice(t/8),h=a.slice(0,t/8),f=s.iv||e.alloc(0),c=s.aad||s.adata||e.alloc(0),d=s.tag||s.mac||e.alloc(0),p=Promise.resolve();return p=(p=p.then((function(){var r=e.concat([c,f,o,i.int64ToBuffer(8*c.length)]);return n["HS"+2*t].verify(h,r,d,{length:t}).then((function(){return o}),(function(){throw new Error("mac check failed")}))}))).then((function(){return r(u,o,f)}))}}var m=e.from("Encryption","utf8"),v=e.from("Integrity","utf8"),g=e.from(".","utf8");function y(t,r,n,o){var s=8*t.length,u=s/2,h=Promise.resolve();return h=(h=h.then((function(){return e.concat([i.int32ToBuffer(1),t,i.int32ToBuffer(u),e.from(r,"utf8"),n,o,m])}))).then((function(t){return a["SHA-"+s].digest(t).then((function(t){return t.slice(0,u/8)}))})),h=Promise.resolve(h)}function b(t,r,n,o){var s=8*t.length,u=s,h=Promise.resolve();return h=(h=h.then((function(){return e.concat([i.int32ToBuffer(1),t,i.int32ToBuffer(u),e.from(r,"utf8"),n,o,v])}))).then((function(t){return a["SHA-"+s].digest(t).then((function(t){return t.slice(0,u/8)}))})),h=Promise.resolve(h)}function w(t,r){var a=f(t);return function(o,s,h){var f,c,l=h.epu||i.int32ToBuffer(0),d=h.epv||i.int32ToBuffer(0),p=h.iv||e.alloc(0),m=h.aad||h.adata||e.alloc(0),v=h.kdata||e.alloc(0),w=[y(o,r,l,d),b(o,r,l,d)],_=Promise.all(w).then((function(t){f=t[0],c=t[1]}));return _=(_=(_=_.then((function(){return a(f,s,p)}))).then((function(r){var i=e.concat([m,g,e.from(v),g,e.from(u.base64url.encode(p),"utf8"),g,e.from(u.base64url.encode(r),"utf8")]);return Promise.all([Promise.resolve(r),n["HS"+2*t].sign(c,i,{length:t})])}))).then((function(t){return{data:t[0],tag:t[1].mac}}))}}function _(t,r){var a=c(t);return function(o,s,h){var f,c,l=h.epu||i.int32ToBuffer(0),d=h.epv||i.int32ToBuffer(0),p=h.iv||e.alloc(0),m=h.aad||h.adata||e.alloc(0),v=h.kdata||e.alloc(0),w=h.tag||h.mac||e.alloc(0),_=[y(o,r,l,d),b(o,r,l,d)],E=Promise.all(_).then((function(t){f=t[0],c=t[1]}));return E=(E=E.then((function(){var r=e.concat([m,g,e.from(v),g,e.from(u.base64url.encode(p),"utf8"),g,e.from(u.base64url.encode(s),"utf8")]);try{return n["HS"+2*t].verify(c,r,w,{loose:!1})}catch(t){throw new Error("mac check failed")}}))).then((function(){return a(f,s,p)}))}}var E={};["A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"].forEach((function(t){var e=parseInt(/A(\d+)CBC-HS(\d+)?/g.exec(t)[1]);E[t]={encrypt:d(e),decrypt:p(e)}})),["A128CBC+HS256","A192CBC+HS384","A256CBC+HS512"].forEach((function(t){var e=parseInt(/A(\d+)CBC\+HS(\d+)?/g.exec(t)[1]);E[t]={encrypt:w(e,t),decrypt:_(e,t)}})),t.exports=E}).call(this,r(0).Buffer)},function(t,e){},function(t,e,r){"use strict";(function(e){ /*! * algorithms/aes-gcm.js - AES-GCM Encryption and Key-Wrapping * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(13),n=r(9),a=r(17),o=r(268);function s(t,r){function s(e,i){if(t!==e.length<<3)throw new Error("invalid key size");if(!i&&!r)throw new Error("invalid iv");if(i&&12!==i.length)throw new Error("invalid iv")}function u(t){if(r){var e=n.base64url.encode(t.iv),i=n.base64url.encode(t.tag);t={data:t.data,header:{iv:e,tag:i}}}return t}return i.setupFallback((function(t,r,a){var o=a.iv,h=a.aad||a.adata||e.alloc(0);try{s(t,o)}catch(t){return Promise.reject(t)}o=o||n.randomBytes(12);var f,c="aes-"+8*t.length+"-gcm";try{f=i.nodeCrypto.createCipheriv(c,t,o)}catch(t){throw new Error("unsupported algorithm: "+c)}if("function"!=typeof f.setAAD)throw new Error("unsupported algorithm: "+c);return h.length&&f.setAAD(h),u({data:e.concat([f.update(r),f.final()]),iv:o,tag:f.getAuthTag()})}),(function(t,r,a){var o=a.iv,h=a.aad||a.adata||e.alloc(0);try{s(t,o)}catch(t){return Promise.reject(t)}o=o||n.randomBytes(12);var f={name:"AES-GCM"};return i.subtleCrypto.importKey("raw",t,f,!0,["encrypt"]).then((function(t){return f.iv=o,f.tagLength=128,h.length&&(f.additionalData=h),i.subtleCrypto.encrypt(f,t,r)})).then((function(t){var r=t.byteLength-16,i=t.slice(r);i=e.from(i);var n=t.slice(0,r);return u({data:n=e.from(n),iv:o,tag:i})}))}),(function(t,r,i){var h,f,c=i.iv,l=i.aad||i.adata||e.alloc(0);try{s(t,c)}catch(t){return Promise.reject(t)}return c=c||n.randomBytes(12),h=o.createCipher({key:t,iv:c,additionalData:l}),f=e.alloc(r.length),new Promise((function(t,e){var i=a.CHUNK_SIZE,n=0,o=0;!function a(){var s=Math.min(i,r.length-o);if(n+=h.update(r,o,s,f,n),o+=s,r.length>o)setTimeout(a,0);else if((n+=h.finish(f,n))===r.length){var l=h.tag;t(u({data:f,iv:c,tag:l}))}else e(new Error("encryption failed"))}()}))}))}function u(t){function r(e,r,i){if(t!==e.length<<3)throw new Error("invalid key size");if(12!==r.length)throw new Error("invalid iv");if(16!==i.length)throw new Error("invalid tag length")}return i.setupFallback((function(t,n,a){var o=a.aad||a.adata||e.alloc(0),s=a.iv||e.alloc(0),u=a.tag||a.mac||e.alloc(0);try{r(t,s,u)}catch(t){return Promise.reject(t)}var h,f="aes-"+8*t.length+"-gcm";try{h=i.nodeCrypto.createDecipheriv(f,t,s)}catch(t){throw new Error("unsupported algorithm: "+f)}if("function"!=typeof h.setAAD)throw new Error("unsupported algorithm: "+f);h.setAuthTag(u),o.length&&h.setAAD(o);try{return e.concat([h.update(n),h.final()])}catch(t){throw new Error("decryption failed")}}),(function(t,n,a){var o=a.aad||a.adata||e.alloc(0),s=a.iv||e.alloc(0),u=a.tag||a.mac||e.alloc(0);try{r(t,s,u)}catch(t){return Promise.reject(t)}var h={name:"AES-GCM"};return i.subtleCrypto.importKey("raw",t,h,!0,["decrypt"]).then((function(t){return h.iv=s,h.tagLength=128,o.length&&(h.additionalData=o),n=e.concat([n,u],n.length+u.length),i.subtleCrypto.decrypt(h,t,n)})).then((function(t){return t=e.from(t)}))}),(function(t,i,n){var s,u,h=n.aad||n.adata||e.alloc(0),f=n.iv||e.alloc(0),c=n.tag||n.mac||e.alloc(0);try{r(t,f,c)}catch(t){return Promise.reject(t)}return s=o.createDecipher({key:t,iv:f,additionalData:h,tag:c}),u=e.alloc(i.length),new Promise((function(t,e){var r=a.CHUNK_SIZE,n=0,o=0;!function a(){var h=Math.min(r,i.length-o);if(n+=s.update(i,o,h,u,n),o+=h,i.length>o)setTimeout(a,0);else{try{n+=s.finish(u,n)}catch(t){return void e(new Error("decryption failed"))}n===i.length?t(u):e(new Error("decryption failed"))}}()}))}))}var h={};["A128GCM","A192GCM","A256GCM","A128GCMKW","A192GCMKW","A256GCMKW"].forEach((function(t){var e=/A(\d+)GCM(KW)?/g.exec(t),r=parseInt(e[1]),i="KW"===e[2];h[t]={encrypt:s(r,i),decrypt:u(r)}})),t.exports=h}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ +var i=r(13),n=r(9),a=r(17),o=r(269);function s(t,r){function s(e,i){if(t!==e.length<<3)throw new Error("invalid key size");if(!i&&!r)throw new Error("invalid iv");if(i&&12!==i.length)throw new Error("invalid iv")}function u(t){if(r){var e=n.base64url.encode(t.iv),i=n.base64url.encode(t.tag);t={data:t.data,header:{iv:e,tag:i}}}return t}return i.setupFallback((function(t,r,a){var o=a.iv,h=a.aad||a.adata||e.alloc(0);try{s(t,o)}catch(t){return Promise.reject(t)}o=o||n.randomBytes(12);var f,c="aes-"+8*t.length+"-gcm";try{f=i.nodeCrypto.createCipheriv(c,t,o)}catch(t){throw new Error("unsupported algorithm: "+c)}if("function"!=typeof f.setAAD)throw new Error("unsupported algorithm: "+c);return h.length&&f.setAAD(h),u({data:e.concat([f.update(r),f.final()]),iv:o,tag:f.getAuthTag()})}),(function(t,r,a){var o=a.iv,h=a.aad||a.adata||e.alloc(0);try{s(t,o)}catch(t){return Promise.reject(t)}o=o||n.randomBytes(12);var f={name:"AES-GCM"};return i.subtleCrypto.importKey("raw",t,f,!0,["encrypt"]).then((function(t){return f.iv=o,f.tagLength=128,h.length&&(f.additionalData=h),i.subtleCrypto.encrypt(f,t,r)})).then((function(t){var r=t.byteLength-16,i=t.slice(r);i=e.from(i);var n=t.slice(0,r);return u({data:n=e.from(n),iv:o,tag:i})}))}),(function(t,r,i){var h,f,c=i.iv,l=i.aad||i.adata||e.alloc(0);try{s(t,c)}catch(t){return Promise.reject(t)}return c=c||n.randomBytes(12),h=o.createCipher({key:t,iv:c,additionalData:l}),f=e.alloc(r.length),new Promise((function(t,e){var i=a.CHUNK_SIZE,n=0,o=0;!function a(){var s=Math.min(i,r.length-o);if(n+=h.update(r,o,s,f,n),o+=s,r.length>o)setTimeout(a,0);else if((n+=h.finish(f,n))===r.length){var l=h.tag;t(u({data:f,iv:c,tag:l}))}else e(new Error("encryption failed"))}()}))}))}function u(t){function r(e,r,i){if(t!==e.length<<3)throw new Error("invalid key size");if(12!==r.length)throw new Error("invalid iv");if(16!==i.length)throw new Error("invalid tag length")}return i.setupFallback((function(t,n,a){var o=a.aad||a.adata||e.alloc(0),s=a.iv||e.alloc(0),u=a.tag||a.mac||e.alloc(0);try{r(t,s,u)}catch(t){return Promise.reject(t)}var h,f="aes-"+8*t.length+"-gcm";try{h=i.nodeCrypto.createDecipheriv(f,t,s)}catch(t){throw new Error("unsupported algorithm: "+f)}if("function"!=typeof h.setAAD)throw new Error("unsupported algorithm: "+f);h.setAuthTag(u),o.length&&h.setAAD(o);try{return e.concat([h.update(n),h.final()])}catch(t){throw new Error("decryption failed")}}),(function(t,n,a){var o=a.aad||a.adata||e.alloc(0),s=a.iv||e.alloc(0),u=a.tag||a.mac||e.alloc(0);try{r(t,s,u)}catch(t){return Promise.reject(t)}var h={name:"AES-GCM"};return i.subtleCrypto.importKey("raw",t,h,!0,["decrypt"]).then((function(t){return h.iv=s,h.tagLength=128,o.length&&(h.additionalData=o),n=e.concat([n,u],n.length+u.length),i.subtleCrypto.decrypt(h,t,n)})).then((function(t){return t=e.from(t)}))}),(function(t,i,n){var s,u,h=n.aad||n.adata||e.alloc(0),f=n.iv||e.alloc(0),c=n.tag||n.mac||e.alloc(0);try{r(t,f,c)}catch(t){return Promise.reject(t)}return s=o.createDecipher({key:t,iv:f,additionalData:h,tag:c}),u=e.alloc(i.length),new Promise((function(t,e){var r=a.CHUNK_SIZE,n=0,o=0;!function a(){var h=Math.min(r,i.length-o);if(n+=s.update(i,o,h,u,n),o+=h,i.length>o)setTimeout(a,0);else{try{n+=s.finish(u,n)}catch(t){return void e(new Error("decryption failed"))}n===i.length?t(u):e(new Error("decryption failed"))}}()}))}))}var h={};["A128GCM","A192GCM","A256GCM","A128GCMKW","A192GCMKW","A256GCMKW"].forEach((function(t){var e=/A(\d+)GCM(KW)?/g.exec(t),r=parseInt(e[1]),i="KW"===e[2];h[t]={encrypt:s(r,i),decrypt:u(r)}})),t.exports=h}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ /*! * deps/ciphermodes/gcm/index.js - AES-GCM implementation Entry Point * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(78),n=r(8),a=r(269),o=r(129),s=r(56),u=r(42),h=r(270);function f(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=this.blockSize||16}t.exports={createCipher:function(t){var e=new n.aes.Algorithm("AES-GCM",f);return e.initialize({key:new u(t.key)}),e.mode.start(t),e.mode},createDecipher:function(t){var e=new n.aes.Algorithm("AES-GCM",f);return e.initialize({key:new u(t.key)}),e.mode._decrypt=!0,e.mode.start(t),e.mode}},f.prototype.start=function(t){if(this.tag=null,!("iv"in(t=t||{})))throw new Error("Gcm needs ParametersWithIV or AEADParameters");if(this.nonce=t.iv,null==this.nonce||this.nonce.length<1)throw new Error("IV must be at least 1 byte");this.tagLength=16,"tag"in t&&(this.tag=e.from(t.tag));var r=this._decrypt?this.blockSize+this.tagLength:this.blockSize;this.bufBlock=e.alloc(r);var n=t.multiplier;if(null==n&&(n=new a["8k"]),this.multiplier=n,this.H=this.zeroBlock(),h.encrypt(this.cipher,this.H,0,this.H,0),this.multiplier.init(this.H),this.exp=null,this.J0=this.zeroBlock(),12===this.nonce.length)this.nonce.copy(this.J0,0,0,this.nonce.length),this.J0[this.blockSize-1]=1;else{this.gHASH(this.J0,this.nonce,this.nonce.length);var o=this.zeroBlock();s.longToBigEndian(new i(this.nonce.length).multiply(8),o,8),this.gHASHBlock(this.J0,o)}this.S=this.zeroBlock(),this.SAt=this.zeroBlock(),this.SAtPre=this.zeroBlock(),this.atBlock=this.zeroBlock(),this.atBlockPos=0,this.atLength=i.ZERO,this.atLengthPre=i.ZERO,this.counter=e.from(this.J0),this.bufOff=0,this.totalLength=i.ZERO,"additionalData"in t&&this.processAADBytes(t.additionalData,0,t.additionalData.length)},f.prototype.update=function(t,e,r,i,n){for(var a=0;r>0;){var o=Math.min(r,this.bufBlock.length-this.bufOff);t.copy(this.bufBlock,this.bufOff,e,e+o),r-=o,e+=o,this.bufOff+=o,this.bufOff===this.bufBlock.length&&(this.outputBlock(i,n+a),a+=this.blockSize)}return a},f.prototype.finish=function(t,r){var i=0;this._decrypt&&(i+=this.update(this.tag,0,this.tag.length,t,r)),this.totalLength.isZero()&&this.initCipher();var n=this.bufOff;if(this._decrypt){if(n0&&(this.gCTRPartial(this.bufBlock,0,n,t,r+i),i+=n),this.atLength=this.atLength.add(this.atBlockPos);var a=this.zeroBlock();s.longToBigEndian(this.atLength.multiply(8),a,0),s.longToBigEndian(this.totalLength.multiply(8),a,8),this.gHASHBlock(this.S,a);var u=e.alloc(this.blockSize);if(h.encrypt(this.cipher,this.J0,0,u,0),this.xor(u,this.S),this._decrypt){if(!o.arrayEqual(this.tag,u))throw new Error("mac check in Gcm failed")}else this.tag=e.alloc(this.tagLength),u.copy(this.tag,0,0,this.tagLength);return i},f.prototype.initCipher=function(){this.atLength.greaterThan(i.ZERO)&&(this.SAt.copy(this.SAtPre,0,0,this.blockSize),this.atLengthPre=this.atLength.add(i.ZERO)),this.atBlockPos>0&&(this.gHASHPartial(this.SAtPre,this.atBlock,0,this.atBlockPos),this.atLengthPre=this.atLengthPre.add(this.atBlockPos)),this.atLengthPre.greaterThan(i.ZERO)&&this.SAtPre.copy(this.S,0,0,this.blockSize)},f.prototype.outputBlock=function(t,e){this.totalLength.isZero()&&this.initCipher(),this.gCTRBlock(this.bufBlock,t,e),this._decrypt?(this.bufBlock.copy(this.bufBlock,0,this.blockSize,this.blockSize+this.tagLength),this.bufOff=this.tagLength):this.bufOff=0},f.prototype.processAADBytes=function(t,e,r){for(var i=0;i=12;--t){var r=this.counter[t]+1&255;if(this.counter[t]=r,0!==r)break}var i=e.alloc(this.blockSize);return h.encrypt(this.cipher,this.counter,0,i,0),i},f.prototype.gCTRBlock=function(t,e,r){var i=this.getNextCounterBlock();this.xor(i,t),i.copy(e,r,0,this.blockSize),this.gHASHBlock(this.S,this._decrypt?t:i),this.totalLength=this.totalLength.add(this.blockSize)},f.prototype.gCTRPartial=function(t,e,r,i,n){var a=this.getNextCounterBlock();this.xor(a,t,e,r),a.copy(i,n,0,r),this.gHASHPartial(this.S,this._decrypt?t:a,0,r),this.totalLength=this.totalLength.add(r)},f.prototype.gHASHBlock=function(t,e){this.xor(t,e),this.multiplier.multiplyH(t)},f.prototype.gHASHPartial=function(t,e,r,i){this.xor(t,e,r,i),this.multiplier.multiplyH(t)},f.prototype.xor=function(t,e,r,i){switch(arguments.length){case 2:for(var n=15;n>=0;--n)t[n]^=e[n];break;case 4:for(;i-- >0;)t[i]^=e[r+i];break;default:throw new TypeError("Expected 2 or 4 arguments.")}return t},f.prototype.zeroBlock=function(){return e.alloc(16)}}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; +var i=r(78),n=r(8),a=r(270),o=r(129),s=r(56),u=r(42),h=r(271);function f(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=this.blockSize||16}t.exports={createCipher:function(t){var e=new n.aes.Algorithm("AES-GCM",f);return e.initialize({key:new u(t.key)}),e.mode.start(t),e.mode},createDecipher:function(t){var e=new n.aes.Algorithm("AES-GCM",f);return e.initialize({key:new u(t.key)}),e.mode._decrypt=!0,e.mode.start(t),e.mode}},f.prototype.start=function(t){if(this.tag=null,!("iv"in(t=t||{})))throw new Error("Gcm needs ParametersWithIV or AEADParameters");if(this.nonce=t.iv,null==this.nonce||this.nonce.length<1)throw new Error("IV must be at least 1 byte");this.tagLength=16,"tag"in t&&(this.tag=e.from(t.tag));var r=this._decrypt?this.blockSize+this.tagLength:this.blockSize;this.bufBlock=e.alloc(r);var n=t.multiplier;if(null==n&&(n=new a["8k"]),this.multiplier=n,this.H=this.zeroBlock(),h.encrypt(this.cipher,this.H,0,this.H,0),this.multiplier.init(this.H),this.exp=null,this.J0=this.zeroBlock(),12===this.nonce.length)this.nonce.copy(this.J0,0,0,this.nonce.length),this.J0[this.blockSize-1]=1;else{this.gHASH(this.J0,this.nonce,this.nonce.length);var o=this.zeroBlock();s.longToBigEndian(new i(this.nonce.length).multiply(8),o,8),this.gHASHBlock(this.J0,o)}this.S=this.zeroBlock(),this.SAt=this.zeroBlock(),this.SAtPre=this.zeroBlock(),this.atBlock=this.zeroBlock(),this.atBlockPos=0,this.atLength=i.ZERO,this.atLengthPre=i.ZERO,this.counter=e.from(this.J0),this.bufOff=0,this.totalLength=i.ZERO,"additionalData"in t&&this.processAADBytes(t.additionalData,0,t.additionalData.length)},f.prototype.update=function(t,e,r,i,n){for(var a=0;r>0;){var o=Math.min(r,this.bufBlock.length-this.bufOff);t.copy(this.bufBlock,this.bufOff,e,e+o),r-=o,e+=o,this.bufOff+=o,this.bufOff===this.bufBlock.length&&(this.outputBlock(i,n+a),a+=this.blockSize)}return a},f.prototype.finish=function(t,r){var i=0;this._decrypt&&(i+=this.update(this.tag,0,this.tag.length,t,r)),this.totalLength.isZero()&&this.initCipher();var n=this.bufOff;if(this._decrypt){if(n0&&(this.gCTRPartial(this.bufBlock,0,n,t,r+i),i+=n),this.atLength=this.atLength.add(this.atBlockPos);var a=this.zeroBlock();s.longToBigEndian(this.atLength.multiply(8),a,0),s.longToBigEndian(this.totalLength.multiply(8),a,8),this.gHASHBlock(this.S,a);var u=e.alloc(this.blockSize);if(h.encrypt(this.cipher,this.J0,0,u,0),this.xor(u,this.S),this._decrypt){if(!o.arrayEqual(this.tag,u))throw new Error("mac check in Gcm failed")}else this.tag=e.alloc(this.tagLength),u.copy(this.tag,0,0,this.tagLength);return i},f.prototype.initCipher=function(){this.atLength.greaterThan(i.ZERO)&&(this.SAt.copy(this.SAtPre,0,0,this.blockSize),this.atLengthPre=this.atLength.add(i.ZERO)),this.atBlockPos>0&&(this.gHASHPartial(this.SAtPre,this.atBlock,0,this.atBlockPos),this.atLengthPre=this.atLengthPre.add(this.atBlockPos)),this.atLengthPre.greaterThan(i.ZERO)&&this.SAtPre.copy(this.S,0,0,this.blockSize)},f.prototype.outputBlock=function(t,e){this.totalLength.isZero()&&this.initCipher(),this.gCTRBlock(this.bufBlock,t,e),this._decrypt?(this.bufBlock.copy(this.bufBlock,0,this.blockSize,this.blockSize+this.tagLength),this.bufOff=this.tagLength):this.bufOff=0},f.prototype.processAADBytes=function(t,e,r){for(var i=0;i=12;--t){var r=this.counter[t]+1&255;if(this.counter[t]=r,0!==r)break}var i=e.alloc(this.blockSize);return h.encrypt(this.cipher,this.counter,0,i,0),i},f.prototype.gCTRBlock=function(t,e,r){var i=this.getNextCounterBlock();this.xor(i,t),i.copy(e,r,0,this.blockSize),this.gHASHBlock(this.S,this._decrypt?t:i),this.totalLength=this.totalLength.add(this.blockSize)},f.prototype.gCTRPartial=function(t,e,r,i,n){var a=this.getNextCounterBlock();this.xor(a,t,e,r),a.copy(i,n,0,r),this.gHASHPartial(this.S,this._decrypt?t:a,0,r),this.totalLength=this.totalLength.add(r)},f.prototype.gHASHBlock=function(t,e){this.xor(t,e),this.multiplier.multiplyH(t)},f.prototype.gHASHPartial=function(t,e,r,i){this.xor(t,e,r,i),this.multiplier.multiplyH(t)},f.prototype.xor=function(t,e,r,i){switch(arguments.length){case 2:for(var n=15;n>=0;--n)t[n]^=e[n];break;case 4:for(;i-- >0;)t[i]^=e[r+i];break;default:throw new TypeError("Expected 2 or 4 arguments.")}return t},f.prototype.zeroBlock=function(){return e.alloc(16)}}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; /*! * deps/ciphermodes/gcm/multipliers.js - AES-GCM Multipliers * @@ -262,7 +262,7 @@ var i=r(78),n=r(8),a=r(269),o=r(129),s=r(56),u=r(42),h=r(270);function f(t){t=t| * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(12),n=r(20),a=r(9),o=r(80),s=r(133),u=r(130),h=r(79),f=r(13),c=r(17),l=i.clone,d=i.omit,p=i.pick;function m(t){switch(t){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Error("unsupported curve: "+t)}}var v=t.exports={};function y(t,r,i){function n(t){return e.concat([f.int32ToBuffer(t.length),t])}var o=i.algorithm||"",s=c.KEYLENGTH[o],u=a.asBuffer(i.apu||"","base64url"),h=a.asBuffer(i.apv||"","base64url"),l={public:r,length:s/8,hash:"SHA-256",otherInfo:e.concat([n(e.from(o,"utf8")),n(u),n(h),f.int32ToBuffer(s)])};return v["ECDH-CONCAT"].derive(t,l)}["ECDH","ECDH-HKDF","ECDH-CONCAT"].forEach((function(t){var r,i,a=/^ECDH(?:-(\w+))?$/g.exec(t||"")[1],h=v[t]=v[t]||{};switch(a||""){case"CONCAT":h.derive=function(t,e){var r;e=e||{};try{if(!(r=e.hash||m(t.crv)))throw new Error("invalid hash: "+r);r.toUpperCase()}catch(t){return Promise.reject(t)}var i=["public"],n=v.ECDH.derive(t,p(e,i));return n=n.then((function(t){return u["CONCAT-"+r].derive(t,d(e,i))}))};break;case"HKDF":h.derive=function(t,e){var r;e=e||{};try{if(!(r=e.hash||m(t.crv)))throw new Error("invalid hash: "+r);r.toUpperCase()}catch(t){return Promise.reject(t)}var i=["public"],n=v.ECDH.derive(t,p(e,i));return n=n.then((function(t){return s["HKDF-"+r].derive(t,d(e,i))}))};break;case"":h.derive=(r={name:"ECDH"},i=function(t,e){var r=t&&o.convertToForge(t,!0);if(!r||!r.isValid())return Promise.reject(new Error("invalid EC public key"));switch(e){case"jwk":r=o.convertToJWK(t,!0);break;case"buffer":r=o.convertToBuffer(t,!0)}return Promise.resolve(r)},f.setupFallback((function(t,e){if("function"!=typeof f.nodeCrypto.createECDH)throw new Error("unsupported algorithm: ECDH");var r,n=(e=e||{}).length||0;switch(t.crv){case"P-256":r="prime256v1";break;case"P-384":r="secp384r1";break;case"P-521":r="secp521r1";break;default:return Promise.reject(new Error("invalid curve: "+r))}var a=o.convertToBuffer(t,!1),s=i(e.public,"buffer");return s=s.then((function(t){var e=f.nodeCrypto.createECDH(r);e.setPrivateKey(a);var i=e.computeSecret(t);if(n){if(i.length0&&(w=f(w,o),e.unprotected=o),i&&a>0&&(w=f(w,i),i=JSON.stringify(i),e.protected=n.base64url.encode(i,"utf8")),e}))).then((function(t){var r=p;return w.zip?"DEF"===w.zip?new Promise((function(i,n){u.deflateRaw(e.from(r,"binary"),(function(e,r){e?n(e):(t.plaintext=r,i(t))}))})):Promise.reject(new Error("unsupported 'zip' mode")):(t.plaintext=r,t)}))).then((function(r){w.adata=r.protected,"aad"in t&&null!=t.aad&&(w.adata+="."+t.aad,w.adata=e.from(w.adata,"utf8"));var i=t.iv||n.randomBytes(h.NONCELENGTH[b]/8);"string"==typeof i&&(i=n.base64url.decode(i)),w.iv=i,"recipients"in r&&1===r.recipients.length&&(w.kdata=r.recipients[0].encrypted_key),"epu"in t&&null!=t.epu&&(w.epu=t.epu),"epv"in t&&null!=t.epv&&(w.epv=t.epv);var a=r.plaintext;return delete r.plaintext,y.then((function(e){var o=e.encrypt(b,a,w);return o=o.then((function(e){return r.iv=n.base64url.encode(i,"binary"),"aad"in t&&null!=t.aad&&(r.aad=t.aad),r.ciphertext=n.base64url.encode(e.data,"binary"),r.tag=n.base64url.encode(e.tag,"binary"),r}))}))})),l){case"compact":g=g.then((function(t){var e=new Array(5);return e[0]=t.protected,t.recipients&&t.recipients[0]&&(e[1]=t.recipients[0].encrypted_key),e[2]=t.iv,e[3]=t.ciphertext,e[4]=t.tag,e=e.join(".")}));break;case"flattened":g=g.then((function(t){var e={},r=t.recipients&&t.recipients[0];return t.protected&&(e.protected=t.protected),t.unprotected&&(e.unprotected=t.unprotected),["header","encrypted_key"].forEach((function(t){r&&t in r&&r[t]&&("object"!=typeof r[t]||Object.keys(r[t]).length)&&(e[t]=r[t])})),t.aad&&(e.aad=t.aad),e.iv=t.iv,e.ciphertext=t.ciphertext,e.tag=t.tag,e}));break;case"general":g=g.then((function(t){var e=t.recipients||[];return(e=(e=e.map((function(t){if(Object.keys(t).length)return t}))).filter((function(t){return!!t}))).length?t.recipients=e:delete t.recipients,t}))}return g}})}t.exports={encrypter:d,createEncrypt:function(t,e){var r=t,i=1,a=e;if(0===arguments.length)throw new Error("at least one recipient must be provided");1===arguments.length||o.isKey(t)||t&&"kty"in t||t&&"key"in t&&(o.isKey(t.key)||"kty"in t.key)?(a=t,i=0,r={}):r=c(t),Array.isArray(a)||(a=s(arguments,i)),r=f(c(l),r);var u=c(r.fields||{});switch(r.zip&&(u.zip="boolean"==typeof r.zip?!!r.zip&&"DEF":r.zip),r.format=(r.compact?"compact":r.format)||"general",r.format){case"compact":if("aad"in t)throw new Error("additional authenticated data cannot be used for compact serialization");case"flattened":if(a.length>1)throw new Error("too many recipients for compact serialization")}var h=!1;if("compact"===r.format||"*"===r.protect)h=!0,r.protect=Object.keys(u).concat("enc");else if("string"==typeof r.protect)r.protect=[r.protect];else if(Array.isArray(r.protect))r.protect=r.protect.concat();else{if(r.protect)throw new Error("protect must be a list of fields");r.protect=[]}if(h&&10?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e,r,n,a=i.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=a,n=s,e.copy(r,n),s+=o.data.length,o=o.next;return a},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){var i=r(0),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";t.exports=a;var i=r(141),n=Object.create(r(45));function a(t){if(!(this instanceof a))return new a(t);i.call(this,t)}n.inherits=r(1),n.inherits(a,i),a.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(85)},function(t,e,r){t.exports=r(26)},function(t,e,r){t.exports=r(83).Transform},function(t,e,r){t.exports=r(83).PassThrough},function(t,e,r){"use strict";(function(t,i){var n=r(142),a=r(298),o=r(299),s=r(302),u=r(305);for(var h in u)e[h]=u[h];e.NONE=0,e.DEFLATE=1,e.INFLATE=2,e.GZIP=3,e.GUNZIP=4,e.DEFLATERAW=5,e.INFLATERAW=6,e.UNZIP=7;function f(t){if("number"!=typeof t||te.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}f.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,n(this.init_done,"close before init"),n(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==e.INFLATE&&this.mode!==e.GUNZIP&&this.mode!==e.INFLATERAW&&this.mode!==e.UNZIP||s.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null)},f.prototype.write=function(t,e,r,i,n,a,o){return this._write(!0,t,e,r,i,n,a,o)},f.prototype.writeSync=function(t,e,r,i,n,a,o){return this._write(!1,t,e,r,i,n,a,o)},f.prototype._write=function(r,a,o,s,u,h,f,c){if(n.equal(arguments.length,8),n(this.init_done,"write before init"),n(this.mode!==e.NONE,"already finalized"),n.equal(!1,this.write_in_progress,"write already in progress"),n.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,n.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==e.Z_NO_FLUSH&&a!==e.Z_PARTIAL_FLUSH&&a!==e.Z_SYNC_FLUSH&&a!==e.Z_FULL_FLUSH&&a!==e.Z_FINISH&&a!==e.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=t.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=c,this.strm.output=h,this.strm.next_out=f,this.flush=a,!r)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return i.nextTick((function(){l._process(),l._after()})),this},f.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},f.prototype._process=function(){var t=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=e.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},f.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},f.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},f.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},f.prototype.init=function(t,r,i,a,o){n(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),n(t>=8&&t<=15,"invalid windowBits"),n(r>=-1&&r<=9,"invalid compression level"),n(i>=1&&i<=9,"invalid memlevel"),n(a===e.Z_FILTERED||a===e.Z_HUFFMAN_ONLY||a===e.Z_RLE||a===e.Z_FIXED||a===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,t,i,a,o),this._setDictionary()},f.prototype.params=function(){throw new Error("deflateParams Not supported")},f.prototype.reset=function(){this._reset(),this._setDictionary()},f.prototype._init=function(t,r,i,n,u){switch(this.level=t,this.windowBits=r,this.memLevel=i,this.strategy=n,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,this.mode!==e.GZIP&&this.mode!==e.GUNZIP||(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),this.mode!==e.DEFLATERAW&&this.mode!==e.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},f.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},f.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=o.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=f}).call(this,r(0).Buffer,r(4))},function(t,e,r){"use strict"; +var i=r(12),n=r(9),a=r(136).generateCEK,o=r(30),s=r(136).slice,u=r(137),h=r(17),f=i.assign,c=i.clone,l=r(307);function d(t,r,i){var s=!1,l=t.format||"general",d=!!t.protectAll,p=e.alloc(0);Object.defineProperty(this,"zip",{get:function(){return r.zip||""},enumerable:!0}),Object.defineProperty(this,"compact",{get:function(){return"compact"===l},enumerable:!0}),Object.defineProperty(this,"format",{get:function(){return l},enumerable:!0}),Object.defineProperty(this,"protected",{get:function(){return c(t.protect)},enumerable:!0}),Object.defineProperty(this,"header",{get:function(){return c(r)},enumerable:!0}),Object.defineProperty(this,"update",{value:function(t,r){if(s)throw new Error("already final");return null!=t&&(t=n.asBuffer(t,r),p=p.length?e.concat([p,t],p.length+t.length):t),this}}),Object.defineProperty(this,"final",{value:function(m,v){if(s)return Promise.reject(new Error("already final"));this.update(m,v),s=!0;var g,y=Promise.resolve({}),b=r.enc;y=(y=y.then((function(e){return t.cek&&(g=o.asKey(t.cek)),e}))).then((function(e){var s=Promise.all(i);return s=(s=s.then((function(e){var i=1===e.length;return e=e.map((function(e){return function(e,i){var s={};s=f(s,r),s=f(s,e.header);var u,h,l=e.key,d=s.alg;return 0===(s.alg||"").indexOf("ECDH-ES")?(u=l.keystore.temp(),h=e.epk?Promise.resolve(e.epk).then((function(t){e.header.epk=t.toJSON(!1,["kid"]),s.epk=t.toObject(!0,["kid"])})):u.generate("EC",l.get("crv")).then((function(t){e.header.epk=t.toJSON(!1,["kid"]),s.epk=t.toObject(!0,["kid"])}))):h=Promise.resolve(),h=(h=h.then((function(){var e,n;return"dir"===d&&i?n=(g=Promise.resolve(l)).then((function(t){return b||(s.enc=r.enc=b=t.algorithms(o.MODE_ENCRYPT)[0]),{once:!0,direct:!0}})):(g||(b||(s.enc=r.enc=b=t.contentAlg),g=a(b)),n=(n=g.then((function(t){return e=t.get("k",!0),l}))).then((function(t){return t.wrap(d,e,s)}))),n}))).then((function(t){if(t.once&&!i)return Promise.reject(new Error("cannot use 'alg':'"+d+"' with multiple recipients"));var r,a={};return t.data&&(r=t.data,r=n.base64url.encode(r)),t.direct&&r?g=o.asKey({kty:"oct",k:r}):r&&(a.encrypted_key=r),e.header&&Object.keys(e.header).length&&(a.header=c(e.header||{})),t.header&&(a.header=f(a.header||{},t.header)),a}))}(e,i)})),Promise.all(e)}))).then((function(t){return e.recipients=t.filter((function(t){return!!t})),e}))}));var w={};switch(y=(y=(y=y.then((function(e){var i,a,o,s;return o=c(r),d&&1===e.recipients.length||"compact"===l?(i={},i=f({},o,e.recipients[0].header),a=Object.keys(i).length,o=void 0,s=0,delete e.recipients[0].header,0===Object.keys(e.recipients[0]).length&&e.recipients.splice(0,1)):(i={},a=0,s=Object.keys(o).length,t.protect.forEach((function(t){t in o&&(i[t]=o[t],a++,delete o[t],s--)})),e.recipients=(e.recipients||[]).map((function(t){var e=(t=t||{}).header;return e&&(Object.keys(e).forEach((function(t){t in i&&delete e[t]})),Object.keys(e).length||delete t.header),t}))),e.recipients&&0!==e.recipients.length||delete e.recipients,o&&s>0&&(w=f(w,o),e.unprotected=o),i&&a>0&&(w=f(w,i),i=JSON.stringify(i),e.protected=n.base64url.encode(i,"utf8")),e}))).then((function(t){var r=p;return w.zip?"DEF"===w.zip?new Promise((function(i,n){u.deflateRaw(e.from(r,"binary"),(function(e,r){e?n(e):(t.plaintext=r,i(t))}))})):Promise.reject(new Error("unsupported 'zip' mode")):(t.plaintext=r,t)}))).then((function(r){w.adata=r.protected,"aad"in t&&null!=t.aad&&(w.adata+="."+t.aad,w.adata=e.from(w.adata,"utf8"));var i=t.iv||n.randomBytes(h.NONCELENGTH[b]/8);"string"==typeof i&&(i=n.base64url.decode(i)),w.iv=i,"recipients"in r&&1===r.recipients.length&&(w.kdata=r.recipients[0].encrypted_key),"epu"in t&&null!=t.epu&&(w.epu=t.epu),"epv"in t&&null!=t.epv&&(w.epv=t.epv);var a=r.plaintext;return delete r.plaintext,g.then((function(e){var o=e.encrypt(b,a,w);return o=o.then((function(e){return r.iv=n.base64url.encode(i,"binary"),"aad"in t&&null!=t.aad&&(r.aad=t.aad),r.ciphertext=n.base64url.encode(e.data,"binary"),r.tag=n.base64url.encode(e.tag,"binary"),r}))}))})),l){case"compact":y=y.then((function(t){var e=new Array(5);return e[0]=t.protected,t.recipients&&t.recipients[0]&&(e[1]=t.recipients[0].encrypted_key),e[2]=t.iv,e[3]=t.ciphertext,e[4]=t.tag,e=e.join(".")}));break;case"flattened":y=y.then((function(t){var e={},r=t.recipients&&t.recipients[0];return t.protected&&(e.protected=t.protected),t.unprotected&&(e.unprotected=t.unprotected),["header","encrypted_key"].forEach((function(t){r&&t in r&&r[t]&&("object"!=typeof r[t]||Object.keys(r[t]).length)&&(e[t]=r[t])})),t.aad&&(e.aad=t.aad),e.iv=t.iv,e.ciphertext=t.ciphertext,e.tag=t.tag,e}));break;case"general":y=y.then((function(t){var e=t.recipients||[];return(e=(e=e.map((function(t){if(Object.keys(t).length)return t}))).filter((function(t){return!!t}))).length?t.recipients=e:delete t.recipients,t}))}return y}})}t.exports={encrypter:d,createEncrypt:function(t,e){var r=t,i=1,a=e;if(0===arguments.length)throw new Error("at least one recipient must be provided");1===arguments.length||o.isKey(t)||t&&"kty"in t||t&&"key"in t&&(o.isKey(t.key)||"kty"in t.key)?(a=t,i=0,r={}):r=c(t),Array.isArray(a)||(a=s(arguments,i)),r=f(c(l),r);var u=c(r.fields||{});switch(r.zip&&(u.zip="boolean"==typeof r.zip?!!r.zip&&"DEF":r.zip),r.format=(r.compact?"compact":r.format)||"general",r.format){case"compact":if("aad"in t)throw new Error("additional authenticated data cannot be used for compact serialization");case"flattened":if(a.length>1)throw new Error("too many recipients for compact serialization")}var h=!1;if("compact"===r.format||"*"===r.protect)h=!0,r.protect=Object.keys(u).concat("enc");else if("string"==typeof r.protect)r.protect=[r.protect];else if(Array.isArray(r.protect))r.protect=r.protect.concat();else{if(r.protect)throw new Error("protect must be a list of fields");r.protect=[]}if(h&&10?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e,r,n,a=i.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=a,n=s,e.copy(r,n),s+=o.data.length,o=o.next;return a},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){var i=r(0),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";t.exports=a;var i=r(141),n=Object.create(r(45));function a(t){if(!(this instanceof a))return new a(t);i.call(this,t)}n.inherits=r(1),n.inherits(a,i),a.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(85)},function(t,e,r){t.exports=r(26)},function(t,e,r){t.exports=r(83).Transform},function(t,e,r){t.exports=r(83).PassThrough},function(t,e,r){"use strict";(function(t,i){var n=r(142),a=r(299),o=r(300),s=r(303),u=r(306);for(var h in u)e[h]=u[h];e.NONE=0,e.DEFLATE=1,e.INFLATE=2,e.GZIP=3,e.GUNZIP=4,e.DEFLATERAW=5,e.INFLATERAW=6,e.UNZIP=7;function f(t){if("number"!=typeof t||te.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}f.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,n(this.init_done,"close before init"),n(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==e.INFLATE&&this.mode!==e.GUNZIP&&this.mode!==e.INFLATERAW&&this.mode!==e.UNZIP||s.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null)},f.prototype.write=function(t,e,r,i,n,a,o){return this._write(!0,t,e,r,i,n,a,o)},f.prototype.writeSync=function(t,e,r,i,n,a,o){return this._write(!1,t,e,r,i,n,a,o)},f.prototype._write=function(r,a,o,s,u,h,f,c){if(n.equal(arguments.length,8),n(this.init_done,"write before init"),n(this.mode!==e.NONE,"already finalized"),n.equal(!1,this.write_in_progress,"write already in progress"),n.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,n.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==e.Z_NO_FLUSH&&a!==e.Z_PARTIAL_FLUSH&&a!==e.Z_SYNC_FLUSH&&a!==e.Z_FULL_FLUSH&&a!==e.Z_FINISH&&a!==e.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=t.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=c,this.strm.output=h,this.strm.next_out=f,this.flush=a,!r)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return i.nextTick((function(){l._process(),l._after()})),this},f.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},f.prototype._process=function(){var t=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=e.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},f.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},f.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},f.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},f.prototype.init=function(t,r,i,a,o){n(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),n(t>=8&&t<=15,"invalid windowBits"),n(r>=-1&&r<=9,"invalid compression level"),n(i>=1&&i<=9,"invalid memlevel"),n(a===e.Z_FILTERED||a===e.Z_HUFFMAN_ONLY||a===e.Z_RLE||a===e.Z_FIXED||a===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,t,i,a,o),this._setDictionary()},f.prototype.params=function(){throw new Error("deflateParams Not supported")},f.prototype.reset=function(){this._reset(),this._setDictionary()},f.prototype._init=function(t,r,i,n,u){switch(this.level=t,this.windowBits=r,this.memLevel=i,this.strategy=n,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,this.mode!==e.GZIP&&this.mode!==e.GUNZIP||(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),this.mode!==e.DEFLATERAW&&this.mode!==e.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},f.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},f.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=o.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=f}).call(this,r(0).Buffer,r(3))},function(t,e,r){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT -*/var i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,u=o(t),h=1;h4?9:0)}function c(t){for(var e=t.length;--e>=0;)t[e]=0}function l(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(n.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function d(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,l(t.strm)}function p(t,e){t.pending_buf[t.pending++]=e}function m(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function v(t,e){var r,i,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,f=t.w_mask,c=t.prev,l=t.strstart+258,d=h[a+o-1],p=h[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(h[(r=e)+o]===p&&h[r+o-1]===d&&h[r]===h[a]&&h[++r]===h[a+1]){a+=2,r++;do{}while(h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&ao){if(t.match_start=e,o=i,i>=s)break;d=h[a+o-1],p=h[a+o]}}}while((e=c[e&f])>u&&0!=--n);return o<=t.lookahead?o:t.lookahead}function y(t){var e,r,i,a,u,h,f,c,l,d,p=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-262)){n.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=p?i-p:0}while(--r);e=r=p;do{i=t.prev[--e],t.prev[e]=i>=p?i-p:0}while(--r);a+=p}if(0===t.strm.avail_in)break;if(h=t.strm,f=t.window,c=t.strstart+t.lookahead,l=a,d=void 0,(d=h.avail_in)>l&&(d=l),r=0===d?0:(h.avail_in-=d,n.arraySet(f,h.input,h.next_in,d,c),1===h.state.wrap?h.adler=o(h.adler,f,d,c):2===h.state.wrap&&(h.adler=s(h.adler,f,d,c)),h.next_in+=d,h.total_in+=d,d),t.lookahead+=r,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(i=a._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(s=2,i-=16),a<1||a>9||8!==r||i<8||i>15||e<0||e>9||o<0||o>4)return h(t,-2);8===i&&(i=9);var u=new _;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=i,u.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(y(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,d(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(d(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,g),new w(4,5,16,8,g),new w(4,6,32,32,g),new w(4,4,16,16,b),new w(8,16,32,32,b),new w(8,16,128,128,b),new w(8,32,128,256,b),new w(32,128,258,1024,b),new w(32,258,258,4096,b)],e.deflateInit=function(t,e){return S(t,e,8,15,8,0)},e.deflateInit2=S,e.deflateReset=M,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,n,o,u;if(!t||!t.state||e>5||e<0)return t?h(t,-2):-2;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||666===n.status&&4!==e)return h(t,0===t.avail_out?-5:-2);if(n.strm=t,r=n.last_flush,n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,p(n,31),p(n,139),p(n,8),n.gzhead?(p(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),p(n,255&n.gzhead.time),p(n,n.gzhead.time>>8&255),p(n,n.gzhead.time>>16&255),p(n,n.gzhead.time>>24&255),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(p(n,255&n.gzhead.extra.length),p(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=s(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(p(n,0),p(n,0),p(n,0),p(n,0),p(n,0),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,3),n.status=113);else{var v=8+(n.w_bits-8<<4)<<8;v|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(v|=32),v+=31-v%31,n.status=113,m(n,v),0!==n.strstart&&(m(n,t.adler>>>16),m(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending!==n.pending_buf_size));)p(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&l(t),n.pending+2<=n.pending_buf_size&&(p(n,255&t.adler),p(n,t.adler>>8&255),t.adler=0,n.status=113)):n.status=113),0!==n.pending){if(l(t),0===t.avail_out)return n.last_flush=-1,0}else if(0===t.avail_in&&f(e)<=f(r)&&4!==e)return h(t,-5);if(666===n.status&&0!==t.avail_in)return h(t,-5);if(0!==t.avail_in||0!==n.lookahead||0!==e&&666!==n.status){var g=2===n.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(y(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var r,i,n,o,s=t.window;;){if(t.lookahead<=258){if(y(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=s[n=t.strstart-1])===s[++n]&&i===s[++n]&&i===s[++n]){o=t.strstart+258;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=a._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(n,e):i[n.level].func(n,e);if(3!==g&&4!==g||(n.status=666),1===g||3===g)return 0===t.avail_out&&(n.last_flush=-1),0;if(2===g&&(1===e?a._tr_align(n):5!==e&&(a._tr_stored_block(n,0,0,!1),3===e&&(c(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),l(t),0===t.avail_out))return n.last_flush=-1,0}return 4!==e?0:n.wrap<=0?1:(2===n.wrap?(p(n,255&t.adler),p(n,t.adler>>8&255),p(n,t.adler>>16&255),p(n,t.adler>>24&255),p(n,255&t.total_in),p(n,t.total_in>>8&255),p(n,t.total_in>>16&255),p(n,t.total_in>>24&255)):(m(n,t.adler>>>16),m(n,65535&t.adler)),l(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?h(t,-2):(t.state=null,113===e?h(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,i,a,s,u,h,f,l,d=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=o(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===s&&(c(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new n.Buf8(r.w_size),n.arraySet(l,e,d-r.w_size,r.w_size,0),e=l,d=r.w_size),u=t.avail_in,h=t.next_in,f=t.input,t.avail_in=d,t.next_in=0,t.input=e,y(r);r.lookahead>=3;){i=r.strstart,a=r.lookahead-2;do{r.ins_h=(r.ins_h<=0;)t[e]=0}var a=[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],o=[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],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],h=new Array(576);n(h);var f=new Array(60);n(f);var c=new Array(512);n(c);var l=new Array(256);n(l);var d=new Array(29);n(d);var p,m,v,y=new Array(30);function g(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function b(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function w(t){return t<256?c[t]:c[256+(t>>>7)]}function _(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function E(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function C(t,e,r){var i,n,a=new Array(16),o=0;for(i=1;i<=15;i++)a[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=S(a[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function k(t){t.bi_valid>8?_(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function T(t,e,r,i){var n=2*e,a=2*r;return t[n]>1;r>=1;r--)I(t,a,r);n=u;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],I(t,a,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,a[2*n]=a[2*r]+a[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,a[2*r+1]=a[2*i+1]=n,t.heap[1]=n++,I(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,a,o,s,u=e.dyn_tree,h=e.max_code,f=e.stat_desc.static_tree,c=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(a=0;a<=15;a++)t.bl_count[a]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(a=u[2*u[2*(i=t.heap[r])+1]+1]+1)>p&&(a=p,m++),u[2*i+1]=a,i>h||(t.bl_count[a]++,o=0,i>=d&&(o=l[i-d]),s=u[2*i],t.opt_len+=s*(a+o),c&&(t.static_len+=s*(f[2*i+1]+o)));if(0!==m){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(i=t.bl_count[a];0!==i;)(n=t.heap[--r])>h||(u[2*n+1]!==a&&(t.opt_len+=(a-u[2*n+1])*u[2*n],u[2*n+1]=a),i--)}}(t,e),C(a,h,t.bl_count)}function B(t,e,r){var i,n,a=-1,o=e[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++s>=7;i<30;i++)for(y[i]=n<<7,t=0;t<1<0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),P(t,t.l_desc),P(t,t.d_desc),o=function(t){var e;for(B(t,t.dyn_ltree,t.l_desc.max_code),B(t,t.dyn_dtree,t.d_desc.max_code),P(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=n&&(n=a)):n=a=r+5,r+4<=n&&-1!==e?N(t,e,r,i):4===t.strategy||a===n?(E(t,2+(i?1:0),3),R(t,h,f)):(E(t,4+(i?1:0),3),function(t,e,r,i){var n;for(E(t,e-257,5),E(t,r-1,5),E(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(l[r]+256+1)]++,t.dyn_dtree[2*w(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){E(t,2,3),M(t,256,h),function(t){16===t.bi_valid?(_(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,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"}},function(t,e,r){"use strict";var i=r(58),n=r(143),a=r(144),o=r(303),s=r(304);function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function h(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(852),e.distcode=e.distdyn=new i.Buf32(592),e.sane=1,e.back=-1,0):-2}function c(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,f(t)):-2}function l(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,c(t))):-2}function d(t,e){var r,i;return t?(i=new h,t.state=i,i.window=null,0!==(r=l(t,e))&&(t.state=null),r):-2}var p,m,v=!0;function y(t){if(v){var e;for(p=new i.Buf32(512),m=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,m,0,t.work,{bits:5}),v=!1}t.lencode=p,t.lenbits=9,t.distcode=m,t.distbits=5}function g(t,e,r,n){var a,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),i.arraySet(o.window,e,r-n,a,o.wnext),(n-=a)?(i.arraySet(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=a(r.check,N,2,0),m=0,v=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&m)<<8)+(m>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&m)){t.msg="unknown compression method",r.mode=30;break}if(v-=4,R=8+(15&(m>>>=4)),0===r.wbits)r.wbits=R;else if(R>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(N[0]=255&m,N[1]=m>>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0,r.mode=3;case 3:for(;v<32;){if(0===d)break t;d--,m+=h[c++]<>>8&255,N[2]=m>>>16&255,N[3]=m>>>24&255,r.check=a(r.check,N,4,0)),m=0,v=0,r.mode=4;case 4:for(;v<16;){if(0===d)break t;d--,m+=h[c++]<>8),512&r.flags&&(N[0]=255&m,N[1]=m>>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0,r.mode=5;case 5:if(1024&r.flags){for(;v<16;){if(0===d)break t;d--,m+=h[c++]<>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((_=r.length)>d&&(_=d),_&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,h,c,_,R)),512&r.flags&&(r.check=a(r.check,h,_,c)),d-=_,c+=_,r.length-=_),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break t;_=0;do{R=h[c+_++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R))}while(R&&_>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;v<32;){if(0===d)break t;d--,m+=h[c++]<>>=7&v,v-=7&v,r.mode=27;break}for(;v<3;){if(0===d)break t;d--,m+=h[c++]<>>=1)){case 0:r.mode=14;break;case 1:if(y(r),r.mode=20,6===e){m>>>=2,v-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}m>>>=2,v-=2;break;case 14:for(m>>>=7&v,v-=7&v;v<32;){if(0===d)break t;d--,m+=h[c++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&m,m=0,v=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(_=r.length){if(_>d&&(_=d),_>p&&(_=p),0===_)break t;i.arraySet(f,h,c,_,l),d-=_,c+=_,p-=_,l+=_,r.length-=_;break}r.mode=12;break;case 17:for(;v<14;){if(0===d)break t;d--,m+=h[c++]<>>=5,v-=5,r.ndist=1+(31&m),m>>>=5,v-=5,r.ncode=4+(15&m),m>>>=4,v-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,v-=3}for(;r.have<19;)r.lens[j[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,B={bits:r.lenbits},P=s(0,r.lens,0,19,r.lencode,0,r.work,B),r.lenbits=B.bits,P){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=S,v-=S,r.lens[r.have++]=A;else{if(16===A){for(x=S+2;v>>=S,v-=S,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}R=r.lens[r.have-1],_=3+(3&m),m>>>=2,v-=2}else if(17===A){for(x=S+3;v>>=S)),m>>>=3,v-=3}else{for(x=S+7;v>>=S)),m>>>=7,v-=7}if(r.have+_>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=R}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,B={bits:r.lenbits},P=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,B),r.lenbits=B.bits,P){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,B={bits:r.distbits},P=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,B),r.distbits=B.bits,P){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(d>=6&&p>=258){t.next_out=l,t.avail_out=p,t.next_in=c,t.avail_in=d,r.hold=m,r.bits=v,o(t,w),l=t.next_out,f=t.output,p=t.avail_out,c=t.next_in,h=t.input,d=t.avail_in,m=r.hold,v=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(O=r.lencode[m&(1<>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>k)])>>>16&255,A=65535&O,!(k+(S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=k,v-=k,r.back+=k}if(m>>>=S,v-=S,r.back+=S,r.length=A,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(x=r.extra;v>>=r.extra,v-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(O=r.distcode[m&(1<>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>k)])>>>16&255,A=65535&O,!(k+(S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=k,v-=k,r.back+=k}if(m>>>=S,v-=S,r.back+=S,64&C){t.msg="invalid distance code",r.mode=30;break}r.offset=A,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(x=r.extra;v>>=r.extra,v-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break t;if(_=w-p,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}_>r.wnext?(_-=r.wnext,E=r.wsize-_):E=r.wnext-_,_>r.length&&(_=r.length),M=r.window}else M=f,E=l-r.offset,_=r.length;_>p&&(_=p),p-=_,r.length-=_;do{f[l++]=M[E++]}while(--_);0===r.length&&(r.mode=21);break;case 26:if(0===p)break t;f[l++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;v<32;){if(0===d)break t;d--,m|=h[c++]<>>=w=b>>>24,p-=w,0===(w=b>>>16&255))A[a++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=m[(65535&b)+(d&(1<>>=w,p-=w),p<15&&(d+=C[i++]<>>=w=b>>>24,p-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=v[(65535&b)+(d&(1<u){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,E>(w=a-o)){if((w=E-w)>f&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(M=0,S=l,0===c){if(M+=h-w,w<_){_-=w;do{A[a++]=l[M++]}while(--w);M=a-E,S=A}}else if(c2;)A[a++]=S[M++],A[a++]=S[M++],A[a++]=S[M++],_-=3;_&&(A[a++]=S[M++],_>1&&(A[a++]=S[M++]))}else{M=a-E;do{A[a++]=A[M++],A[a++]=A[M++],A[a++]=A[M++],_-=3}while(_>2);_&&(A[a++]=A[M++],_>1&&(A[a++]=A[M++]))}break}}break}}while(i>3,d&=(1<<(p-=_<<3))-1,t.next_in=i,t.next_out=a,t.avail_in=i=1&&0===N[A];A--);if(k>A&&(k=A),0===A)return h[f++]=20971520,h[f++]=20971520,l.bits=1,0;for(C=1;C0&&(0===t||1!==A))return-1;for(j[1]=0,M=1;M<15;M++)j[M+1]=j[M]+N[M];for(S=0;S852||2===t&&P>592)return 1;for(;;){b=M-I,c[S]g?(w=L[F+c[S]],_=x[O+c[S]]):(w=96,_=0),d=1<>I)+(p-=d)]=b<<24|w<<16|_|0}while(0!==p);for(d=1<>=1;if(0!==d?(B&=d-1,B+=d):B=0,S++,0==--N[M]){if(M===A)break;M=e[r+c[S]]}if(M>k&&(B&v)!==m){for(0===I&&(I=k),y+=C,R=1<<(T=M-I);T+I852||2===t&&P>592)return 1;h[m=B&v]=k<<24|T<<16|y-f|0}}return 0!==B&&(h[y+B]=M-I<<24|64<<16|0),l.bits=k,0}},function(t,e,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}},function(t,e,r){"use strict"; +*/var i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,u=o(t),h=1;h4?9:0)}function c(t){for(var e=t.length;--e>=0;)t[e]=0}function l(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(n.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function d(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,l(t.strm)}function p(t,e){t.pending_buf[t.pending++]=e}function m(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function v(t,e){var r,i,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,f=t.w_mask,c=t.prev,l=t.strstart+258,d=h[a+o-1],p=h[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(h[(r=e)+o]===p&&h[r+o-1]===d&&h[r]===h[a]&&h[++r]===h[a+1]){a+=2,r++;do{}while(h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&h[++a]===h[++r]&&ao){if(t.match_start=e,o=i,i>=s)break;d=h[a+o-1],p=h[a+o]}}}while((e=c[e&f])>u&&0!=--n);return o<=t.lookahead?o:t.lookahead}function g(t){var e,r,i,a,u,h,f,c,l,d,p=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-262)){n.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=p?i-p:0}while(--r);e=r=p;do{i=t.prev[--e],t.prev[e]=i>=p?i-p:0}while(--r);a+=p}if(0===t.strm.avail_in)break;if(h=t.strm,f=t.window,c=t.strstart+t.lookahead,l=a,d=void 0,(d=h.avail_in)>l&&(d=l),r=0===d?0:(h.avail_in-=d,n.arraySet(f,h.input,h.next_in,d,c),1===h.state.wrap?h.adler=o(h.adler,f,d,c):2===h.state.wrap&&(h.adler=s(h.adler,f,d,c)),h.next_in+=d,h.total_in+=d,d),t.lookahead+=r,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(i=a._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(s=2,i-=16),a<1||a>9||8!==r||i<8||i>15||e<0||e>9||o<0||o>4)return h(t,-2);8===i&&(i=9);var u=new _;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=i,u.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(g(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,d(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(d(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,y),new w(4,5,16,8,y),new w(4,6,32,32,y),new w(4,4,16,16,b),new w(8,16,32,32,b),new w(8,16,128,128,b),new w(8,32,128,256,b),new w(32,128,258,1024,b),new w(32,258,258,4096,b)],e.deflateInit=function(t,e){return S(t,e,8,15,8,0)},e.deflateInit2=S,e.deflateReset=M,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,n,o,u;if(!t||!t.state||e>5||e<0)return t?h(t,-2):-2;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||666===n.status&&4!==e)return h(t,0===t.avail_out?-5:-2);if(n.strm=t,r=n.last_flush,n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,p(n,31),p(n,139),p(n,8),n.gzhead?(p(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),p(n,255&n.gzhead.time),p(n,n.gzhead.time>>8&255),p(n,n.gzhead.time>>16&255),p(n,n.gzhead.time>>24&255),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(p(n,255&n.gzhead.extra.length),p(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=s(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(p(n,0),p(n,0),p(n,0),p(n,0),p(n,0),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,3),n.status=113);else{var v=8+(n.w_bits-8<<4)<<8;v|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(v|=32),v+=31-v%31,n.status=113,m(n,v),0!==n.strstart&&(m(n,t.adler>>>16),m(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending!==n.pending_buf_size));)p(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),l(t),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&l(t),n.pending+2<=n.pending_buf_size&&(p(n,255&t.adler),p(n,t.adler>>8&255),t.adler=0,n.status=113)):n.status=113),0!==n.pending){if(l(t),0===t.avail_out)return n.last_flush=-1,0}else if(0===t.avail_in&&f(e)<=f(r)&&4!==e)return h(t,-5);if(666===n.status&&0!==t.avail_in)return h(t,-5);if(0!==t.avail_in||0!==n.lookahead||0!==e&&666!==n.status){var y=2===n.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(g(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var r,i,n,o,s=t.window;;){if(t.lookahead<=258){if(g(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=s[n=t.strstart-1])===s[++n]&&i===s[++n]&&i===s[++n]){o=t.strstart+258;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=a._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(n,e):i[n.level].func(n,e);if(3!==y&&4!==y||(n.status=666),1===y||3===y)return 0===t.avail_out&&(n.last_flush=-1),0;if(2===y&&(1===e?a._tr_align(n):5!==e&&(a._tr_stored_block(n,0,0,!1),3===e&&(c(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),l(t),0===t.avail_out))return n.last_flush=-1,0}return 4!==e?0:n.wrap<=0?1:(2===n.wrap?(p(n,255&t.adler),p(n,t.adler>>8&255),p(n,t.adler>>16&255),p(n,t.adler>>24&255),p(n,255&t.total_in),p(n,t.total_in>>8&255),p(n,t.total_in>>16&255),p(n,t.total_in>>24&255)):(m(n,t.adler>>>16),m(n,65535&t.adler)),l(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?h(t,-2):(t.state=null,113===e?h(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,i,a,s,u,h,f,l,d=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=o(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===s&&(c(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new n.Buf8(r.w_size),n.arraySet(l,e,d-r.w_size,r.w_size,0),e=l,d=r.w_size),u=t.avail_in,h=t.next_in,f=t.input,t.avail_in=d,t.next_in=0,t.input=e,g(r);r.lookahead>=3;){i=r.strstart,a=r.lookahead-2;do{r.ins_h=(r.ins_h<=0;)t[e]=0}var a=[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],o=[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],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],h=new Array(576);n(h);var f=new Array(60);n(f);var c=new Array(512);n(c);var l=new Array(256);n(l);var d=new Array(29);n(d);var p,m,v,g=new Array(30);function y(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function b(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function w(t){return t<256?c[t]:c[256+(t>>>7)]}function _(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function E(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function C(t,e,r){var i,n,a=new Array(16),o=0;for(i=1;i<=15;i++)a[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=S(a[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function k(t){t.bi_valid>8?_(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function T(t,e,r,i){var n=2*e,a=2*r;return t[n]>1;r>=1;r--)I(t,a,r);n=u;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],I(t,a,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,a[2*n]=a[2*r]+a[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,a[2*r+1]=a[2*i+1]=n,t.heap[1]=n++,I(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,a,o,s,u=e.dyn_tree,h=e.max_code,f=e.stat_desc.static_tree,c=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(a=0;a<=15;a++)t.bl_count[a]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(a=u[2*u[2*(i=t.heap[r])+1]+1]+1)>p&&(a=p,m++),u[2*i+1]=a,i>h||(t.bl_count[a]++,o=0,i>=d&&(o=l[i-d]),s=u[2*i],t.opt_len+=s*(a+o),c&&(t.static_len+=s*(f[2*i+1]+o)));if(0!==m){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(i=t.bl_count[a];0!==i;)(n=t.heap[--r])>h||(u[2*n+1]!==a&&(t.opt_len+=(a-u[2*n+1])*u[2*n],u[2*n+1]=a),i--)}}(t,e),C(a,h,t.bl_count)}function B(t,e,r){var i,n,a=-1,o=e[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++s>=7;i<30;i++)for(g[i]=n<<7,t=0;t<1<0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),P(t,t.l_desc),P(t,t.d_desc),o=function(t){var e;for(B(t,t.dyn_ltree,t.l_desc.max_code),B(t,t.dyn_dtree,t.d_desc.max_code),P(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=n&&(n=a)):n=a=r+5,r+4<=n&&-1!==e?N(t,e,r,i):4===t.strategy||a===n?(E(t,2+(i?1:0),3),R(t,h,f)):(E(t,4+(i?1:0),3),function(t,e,r,i){var n;for(E(t,e-257,5),E(t,r-1,5),E(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(l[r]+256+1)]++,t.dyn_dtree[2*w(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){E(t,2,3),M(t,256,h),function(t){16===t.bi_valid?(_(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,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"}},function(t,e,r){"use strict";var i=r(58),n=r(143),a=r(144),o=r(304),s=r(305);function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function h(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(852),e.distcode=e.distdyn=new i.Buf32(592),e.sane=1,e.back=-1,0):-2}function c(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,f(t)):-2}function l(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,c(t))):-2}function d(t,e){var r,i;return t?(i=new h,t.state=i,i.window=null,0!==(r=l(t,e))&&(t.state=null),r):-2}var p,m,v=!0;function g(t){if(v){var e;for(p=new i.Buf32(512),m=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,m,0,t.work,{bits:5}),v=!1}t.lencode=p,t.lenbits=9,t.distcode=m,t.distbits=5}function y(t,e,r,n){var a,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),i.arraySet(o.window,e,r-n,a,o.wnext),(n-=a)?(i.arraySet(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=a(r.check,N,2,0),m=0,v=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&m)<<8)+(m>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&m)){t.msg="unknown compression method",r.mode=30;break}if(v-=4,R=8+(15&(m>>>=4)),0===r.wbits)r.wbits=R;else if(R>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(N[0]=255&m,N[1]=m>>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0,r.mode=3;case 3:for(;v<32;){if(0===d)break t;d--,m+=h[c++]<>>8&255,N[2]=m>>>16&255,N[3]=m>>>24&255,r.check=a(r.check,N,4,0)),m=0,v=0,r.mode=4;case 4:for(;v<16;){if(0===d)break t;d--,m+=h[c++]<>8),512&r.flags&&(N[0]=255&m,N[1]=m>>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0,r.mode=5;case 5:if(1024&r.flags){for(;v<16;){if(0===d)break t;d--,m+=h[c++]<>>8&255,r.check=a(r.check,N,2,0)),m=0,v=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((_=r.length)>d&&(_=d),_&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,h,c,_,R)),512&r.flags&&(r.check=a(r.check,h,_,c)),d-=_,c+=_,r.length-=_),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break t;_=0;do{R=h[c+_++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R))}while(R&&_>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;v<32;){if(0===d)break t;d--,m+=h[c++]<>>=7&v,v-=7&v,r.mode=27;break}for(;v<3;){if(0===d)break t;d--,m+=h[c++]<>>=1)){case 0:r.mode=14;break;case 1:if(g(r),r.mode=20,6===e){m>>>=2,v-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}m>>>=2,v-=2;break;case 14:for(m>>>=7&v,v-=7&v;v<32;){if(0===d)break t;d--,m+=h[c++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&m,m=0,v=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(_=r.length){if(_>d&&(_=d),_>p&&(_=p),0===_)break t;i.arraySet(f,h,c,_,l),d-=_,c+=_,p-=_,l+=_,r.length-=_;break}r.mode=12;break;case 17:for(;v<14;){if(0===d)break t;d--,m+=h[c++]<>>=5,v-=5,r.ndist=1+(31&m),m>>>=5,v-=5,r.ncode=4+(15&m),m>>>=4,v-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,v-=3}for(;r.have<19;)r.lens[j[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,B={bits:r.lenbits},P=s(0,r.lens,0,19,r.lencode,0,r.work,B),r.lenbits=B.bits,P){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=S,v-=S,r.lens[r.have++]=A;else{if(16===A){for(x=S+2;v>>=S,v-=S,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}R=r.lens[r.have-1],_=3+(3&m),m>>>=2,v-=2}else if(17===A){for(x=S+3;v>>=S)),m>>>=3,v-=3}else{for(x=S+7;v>>=S)),m>>>=7,v-=7}if(r.have+_>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=R}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,B={bits:r.lenbits},P=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,B),r.lenbits=B.bits,P){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,B={bits:r.distbits},P=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,B),r.distbits=B.bits,P){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(d>=6&&p>=258){t.next_out=l,t.avail_out=p,t.next_in=c,t.avail_in=d,r.hold=m,r.bits=v,o(t,w),l=t.next_out,f=t.output,p=t.avail_out,c=t.next_in,h=t.input,d=t.avail_in,m=r.hold,v=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(O=r.lencode[m&(1<>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>k)])>>>16&255,A=65535&O,!(k+(S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=k,v-=k,r.back+=k}if(m>>>=S,v-=S,r.back+=S,r.length=A,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(x=r.extra;v>>=r.extra,v-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(O=r.distcode[m&(1<>>16&255,A=65535&O,!((S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>k)])>>>16&255,A=65535&O,!(k+(S=O>>>24)<=v);){if(0===d)break t;d--,m+=h[c++]<>>=k,v-=k,r.back+=k}if(m>>>=S,v-=S,r.back+=S,64&C){t.msg="invalid distance code",r.mode=30;break}r.offset=A,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(x=r.extra;v>>=r.extra,v-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break t;if(_=w-p,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}_>r.wnext?(_-=r.wnext,E=r.wsize-_):E=r.wnext-_,_>r.length&&(_=r.length),M=r.window}else M=f,E=l-r.offset,_=r.length;_>p&&(_=p),p-=_,r.length-=_;do{f[l++]=M[E++]}while(--_);0===r.length&&(r.mode=21);break;case 26:if(0===p)break t;f[l++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;v<32;){if(0===d)break t;d--,m|=h[c++]<>>=w=b>>>24,p-=w,0===(w=b>>>16&255))A[a++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=m[(65535&b)+(d&(1<>>=w,p-=w),p<15&&(d+=C[i++]<>>=w=b>>>24,p-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=v[(65535&b)+(d&(1<u){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,E>(w=a-o)){if((w=E-w)>f&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(M=0,S=l,0===c){if(M+=h-w,w<_){_-=w;do{A[a++]=l[M++]}while(--w);M=a-E,S=A}}else if(c2;)A[a++]=S[M++],A[a++]=S[M++],A[a++]=S[M++],_-=3;_&&(A[a++]=S[M++],_>1&&(A[a++]=S[M++]))}else{M=a-E;do{A[a++]=A[M++],A[a++]=A[M++],A[a++]=A[M++],_-=3}while(_>2);_&&(A[a++]=A[M++],_>1&&(A[a++]=A[M++]))}break}}break}}while(i>3,d&=(1<<(p-=_<<3))-1,t.next_in=i,t.next_out=a,t.avail_in=i=1&&0===N[A];A--);if(k>A&&(k=A),0===A)return h[f++]=20971520,h[f++]=20971520,l.bits=1,0;for(C=1;C0&&(0===t||1!==A))return-1;for(j[1]=0,M=1;M<15;M++)j[M+1]=j[M]+N[M];for(S=0;S852||2===t&&P>592)return 1;for(;;){b=M-I,c[S]y?(w=F[L+c[S]],_=x[O+c[S]]):(w=96,_=0),d=1<>I)+(p-=d)]=b<<24|w<<16|_|0}while(0!==p);for(d=1<>=1;if(0!==d?(B&=d-1,B+=d):B=0,S++,0==--N[M]){if(M===A)break;M=e[r+c[S]]}if(M>k&&(B&v)!==m){for(0===I&&(I=k),g+=C,R=1<<(T=M-I);T+I852||2===t&&P>592)return 1;h[m=B&v]=k<<24|T<<16|g-f|0}}return 0!==B&&(h[g+B]=M-I<<24|64<<16|0),l.bits=k,0}},function(t,e,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}},function(t,e,r){"use strict"; /*! * jwe/defaults.js - Defaults for JWEs * @@ -342,13 +342,13 @@ object-assign * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(52),n=r(135),a=r(30),o=r(20),s=r(137),u={algorithms:"*"};function h(t,r){var h,f;if(a.isKey(t))f=(h=t).keystore;else{if(!a.isKeyStore(t))throw new TypeError("Keystore must be provided");f=t}r=o(u,r),Object.defineProperty(this,"decrypt",{value:function(t,u){var c=(u=o({},r,u||{})).handlers||{},l=Object.keys(c),d=new n(u.algorithms);if("string"==typeof t)t={protected:(t=t.split("."))[0],recipients:[{encrypted_key:t[1]}],iv:t[2],ciphertext:t[3],tag:t[4]};else if(!t||"object"!=typeof t)throw new Error("invalid input");"encrypted_key"in t&&(t.recipients=[{encrypted_key:t.encrypted_key}]);var p,m,v,y,g,b=t.recipients||[{}];return Promise.resolve(b).then((function(e){if(t.protected){m=i.decode(t.protected).toString("utf8");var r=(m=JSON.parse(m)).crit;if(r){if(!Array.isArray(r))return Promise.reject(new Error("Invalid 'crit' header"));for(var n=0;r.length>n;n++)if(-1===l.indexOf(r[n]))return Promise.reject(new Error("Critical extension is not supported: "+r[n]))}p=m,m=Object.keys(m)}else p={},m=[];return p=o(t.unprotected||{},p),e=e.map((function(t){var e=Promise.resolve(),r=t.header||{};return r=o(r,p),t.header=r,t.protected=m,d.match(r.alg)||(e=e.then((function(){return Promise.reject(new Error("Algorithm not allowed: "+r.alg))}))),d.match(r.enc)||(e=e.then((function(){return Promise.reject(new Error("Algorithm not allowed: "+r.enc))}))),r.epk&&(e=(e=e.then((function(){return a.asKey(r.epk)}))).then((function(t){r.epk=t.toObject(!1)}))),e.then((function(){return t}))})),Promise.all(e)})).then((function(t){var e={};return new Promise((function(r,n){var o=function(){var s=t.shift();if(s){var u=Promise.resolve(s);(u=(u=u.then((function(t){var e=g=t.encrypted_key||"";return e=i.decode(e),(v=h||f.get({use:"enc",alg:t.header.alg,kid:t.header.kid}))?v.unwrap(t.header.alg,e,t.header):Promise.reject()}))).then((function(t){y={kty:"oct",k:i.encode(t)},y=a.asKey(y),e.key=v,e.header=s.header,e.protected=s.protected,r(e)}))).catch(o)}else n(new Error("no key found"))};o()}))})).then((function(e){return e.iv=t.iv,e.tag=t.tag,e.ciphertext=t.ciphertext,e})).then((function(t){var e=[];return l.forEach((function(r){var i;"function"==typeof(r=c[r])?i=r(t):"object"==typeof r&&"function"==typeof r.prepare&&(i=r.prepare(t)),i&&e.push(Promise.resolve(i))})),Promise.all(e).then((function(){return t}))})).then((function(t){return e.isBuffer(t.ciphertext)||(t.ciphertext=i.decode(t.ciphertext)),t})).then((function(e){var r=t.protected;"aad"in t&&null!=t.aad&&(r+="."+t.aad);var i={iv:e.iv,adata:r,tag:e.tag,kdata:g,epu:e.epu,epv:e.epv},n=e.ciphertext;return delete e.iv,delete e.tag,delete e.ciphertext,y.then((function(t){return t.decrypt(e.header.enc,n,i).then((function(t){return e.payload=e.plaintext=t,e}))}))})).then((function(t){return"DEF"===t.header.zip?new Promise((function(r,i){s.inflateRaw(e.from(t.plaintext),(function(e,n){e?i(e):(t.payload=t.plaintext=n,r(t))}))})):t})).then((function(t){var e=[];return l.forEach((function(r){var i;"object"==typeof(r=c[r])&&"function"==typeof r.complete&&(i=r.complete(t)),i&&e.push(Promise.resolve(i))})),Promise.all(e).then((function(){return t}))}))}})}t.exports={decrypter:h,createDecrypt:function(t,e){return new h(t,e)}}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ +var i=r(52),n=r(135),a=r(30),o=r(20),s=r(137),u={algorithms:"*"};function h(t,r){var h,f;if(a.isKey(t))f=(h=t).keystore;else{if(!a.isKeyStore(t))throw new TypeError("Keystore must be provided");f=t}r=o(u,r),Object.defineProperty(this,"decrypt",{value:function(t,u){var c=(u=o({},r,u||{})).handlers||{},l=Object.keys(c),d=new n(u.algorithms);if("string"==typeof t)t={protected:(t=t.split("."))[0],recipients:[{encrypted_key:t[1]}],iv:t[2],ciphertext:t[3],tag:t[4]};else if(!t||"object"!=typeof t)throw new Error("invalid input");"encrypted_key"in t&&(t.recipients=[{encrypted_key:t.encrypted_key}]);var p,m,v,g,y,b=t.recipients||[{}];return Promise.resolve(b).then((function(e){if(t.protected){m=i.decode(t.protected).toString("utf8");var r=(m=JSON.parse(m)).crit;if(r){if(!Array.isArray(r))return Promise.reject(new Error("Invalid 'crit' header"));for(var n=0;r.length>n;n++)if(-1===l.indexOf(r[n]))return Promise.reject(new Error("Critical extension is not supported: "+r[n]))}p=m,m=Object.keys(m)}else p={},m=[];return p=o(t.unprotected||{},p),e=e.map((function(t){var e=Promise.resolve(),r=t.header||{};return r=o(r,p),t.header=r,t.protected=m,d.match(r.alg)||(e=e.then((function(){return Promise.reject(new Error("Algorithm not allowed: "+r.alg))}))),d.match(r.enc)||(e=e.then((function(){return Promise.reject(new Error("Algorithm not allowed: "+r.enc))}))),r.epk&&(e=(e=e.then((function(){return a.asKey(r.epk)}))).then((function(t){r.epk=t.toObject(!1)}))),e.then((function(){return t}))})),Promise.all(e)})).then((function(t){var e={};return new Promise((function(r,n){var o=function(){var s=t.shift();if(s){var u=Promise.resolve(s);(u=(u=u.then((function(t){var e=y=t.encrypted_key||"";return e=i.decode(e),(v=h||f.get({use:"enc",alg:t.header.alg,kid:t.header.kid}))?v.unwrap(t.header.alg,e,t.header):Promise.reject()}))).then((function(t){g={kty:"oct",k:i.encode(t)},g=a.asKey(g),e.key=v,e.header=s.header,e.protected=s.protected,r(e)}))).catch(o)}else n(new Error("no key found"))};o()}))})).then((function(e){return e.iv=t.iv,e.tag=t.tag,e.ciphertext=t.ciphertext,e})).then((function(t){var e=[];return l.forEach((function(r){var i;"function"==typeof(r=c[r])?i=r(t):"object"==typeof r&&"function"==typeof r.prepare&&(i=r.prepare(t)),i&&e.push(Promise.resolve(i))})),Promise.all(e).then((function(){return t}))})).then((function(t){return e.isBuffer(t.ciphertext)||(t.ciphertext=i.decode(t.ciphertext)),t})).then((function(e){var r=t.protected;"aad"in t&&null!=t.aad&&(r+="."+t.aad);var i={iv:e.iv,adata:r,tag:e.tag,kdata:y,epu:e.epu,epv:e.epv},n=e.ciphertext;return delete e.iv,delete e.tag,delete e.ciphertext,g.then((function(t){return t.decrypt(e.header.enc,n,i).then((function(t){return e.payload=e.plaintext=t,e}))}))})).then((function(t){return"DEF"===t.header.zip?new Promise((function(r,i){s.inflateRaw(e.from(t.plaintext),(function(e,n){e?i(e):(t.payload=t.plaintext=n,r(t))}))})):t})).then((function(t){var e=[];return l.forEach((function(r){var i;"object"==typeof(r=c[r])&&"function"==typeof r.complete&&(i=r.complete(t)),i&&e.push(Promise.resolve(i))})),Promise.all(e).then((function(){return t}))}))}})}t.exports={decrypter:h,createDecrypt:function(t,e){return new h(t,e)}}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){ /*! * parse/index.js - JOSE Parser Entry Point * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. */ -var i=r(309),n=r(310),a=t.exports=function(t){if(e.isBuffer(t))return i(t.toString("ascii"));if("string"==typeof t)return i(t);if(t)return n(t);throw new TypeError("invalid input")};a.compact=i,a.json=n}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; +var i=r(310),n=r(311),a=t.exports=function(t){if(e.isBuffer(t))return i(t.toString("ascii"));if("string"==typeof t)return i(t);if(t)return n(t);throw new TypeError("invalid input")};a.compact=i,a.json=n}).call(this,r(0).Buffer)},function(t,e,r){"use strict"; /*! * parse/compact.js - JOSE Compact Serialization Parser * @@ -358,4 +358,4 @@ var i=r(309),n=r(310),a=t.exports=function(t){if(e.isBuffer(t))return i(t.toStri * parse/compact.js - JOSE JSON Serialization Parser * * Copyright (c) 2015 Cisco Systems, Inc. See LICENSE file. - */var i=r(20),n={JWE:r(82),JWS:r(67),util:r(9)};t.exports=function(t){var e,r,a;if("signatures"in t||"signature"in t)e="JWS",r=function(e,r){return n.JWS.createVerify(e).verify(t,r)},a=(a=t.signatures||[{protected:t.protected,header:t.header,signature:t.signature}]).map((function(t){var e,r={};return t.header&&(r=i(r,t.header)),t.protected&&(e=t.protected,e=n.util.base64url.decode(e,"utf8"),e=JSON.parse(e),r=i(r,e)),r}));else if("ciphertext"in t){e="JWE",r=function(e,r){return n.JWE.createDecrypt(e).decrypt(t,r)};var o={};t.protected&&(o.protected=t.protected,o.protected=n.util.base64url.decode(o.protected,"utf8"),o.protected=JSON.parse(o.protected)),t.unprotected&&(o.unprotected=t.unprotected),a=(a=t.recipients||[{}]).map((function(t){var e={};return t.header&&(e=i(e,t.header)),o.unprotected&&(e=i(e,o.unprotected)),o.protected&&(e=i(e,o.protected)),e}))}return{type:e,format:"json",input:t,all:a,perform:r}}},function(t,e,r){t.exports={decode:r(145),verify:r(410),sign:r(413),JsonWebTokenError:r(63),NotBeforeError:r(195),TokenExpiredError:r(196)}},function(t,e,r){var i=r(2).Buffer,n=r(146),a=r(147),o=r(44),s=r(194),u=r(28);function h(t,e){return i.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function f(t){var e=t.header,r=t.payload,i=t.secret||t.privateKey,n=t.encoding,o=a(e.alg),f=function(t,e,r){r=r||"utf8";var i=h(s(t),"binary"),n=h(s(e),r);return u.format("%s.%s",i,n)}(e,r,n),c=o.sign(f,i);return u.format("%s.%s",f,c)}function c(t){var e=t.secret||t.privateKey||t.key,r=new n(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=r,this.payload=new n(t.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}u.inherits(c,o),c.prototype.sign=function(){try{var t=f({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},c.sign=f,t.exports=c},function(t,e,r){"use strict";var i=r(0).Buffer,n=r(0).SlowBuffer;function a(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))return!1;if(t.length!==e.length)return!1;for(var r=0,n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(h),a||(o.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function h(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=i)<<5|e>>>27)+f(d,n,a,s)+u+r[l]+o[d];u=s,s=a,a=h(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function h(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function c(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=h(i)+c(p,n,a,s)+u+r[d]+o[p]|0;u=s,s=a,a=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(1),n=r(155),a=r(34),o=r(2).Buffer,s=new Array(64);function u(){this.init(),this._w=s,a.call(this,64,56)}i(u,n),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 t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var i=r(1),n=r(156),a=r(34),o=r(2).Buffer,s=new Array(160);function u(){this.init(),this._w=s,a.call(this,128,112)}i(u,n),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 t=o.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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),t},t.exports=u},function(t,e,r){"use strict";var i=r(1),n=r(2).Buffer,a=r(23),o=n.alloc(128);function s(t,e){a.call(this,"digest"),"string"==typeof e&&(e=n.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=n.concat([e,o],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^e[s],i[s]=92^e[s];this._hash=[r]}i(s,a),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,t]))},t.exports=s},function(t,e,r){t.exports=r(159)},function(t,e,r){(function(e,i){var n,a=r(161),o=r(162),s=r(163),u=r(2).Buffer,h=e.crypto&&e.crypto.subtle,f={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"},c=[];function l(t,e,r,i,n){return h.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return h.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return u.from(t)}))}t.exports=function(t,r,d,p,m,v){"function"==typeof m&&(v=m,m=void 0);var y=f[(m=m||"sha1").toLowerCase()];if(!y||"function"!=typeof e.Promise)return i.nextTick((function(){var e;try{e=s(t,r,d,p,m)}catch(t){return v(t)}v(null,e)}));if(a(t,r,d,p),"function"!=typeof v)throw new Error("No callback provided to pbkdf2");u.isBuffer(t)||(t=u.from(t,o)),u.isBuffer(r)||(r=u.from(r,o)),function(t,e){t.then((function(t){i.nextTick((function(){e(null,t)}))}),(function(t){i.nextTick((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var r=l(n=n||u.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=r,r}(y).then((function(e){return e?l(t,r,d,p,y):s(t,r,d,p,m)})),v)}}).call(this,r(7),r(4))},function(t,e,r){var i=r(330),n=r(94),a=r(95),o=r(343),s=r(60);function u(t,e,r){if(t=t.toLowerCase(),a[t])return n.createCipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function h(t,e,r){if(t=t.toLowerCase(),a[t])return n.createDecipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return u(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return h(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=h,e.listCiphers=e.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},function(t,e,r){var i=r(23),n=r(331),a=r(1),o=r(2).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(t){i.call(this);var e,r=t.mode.toLowerCase(),n=s[r];e=t.decrypt?"decrypt":"encrypt";var a=t.key;o.isBuffer(a)||(a=o.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=o.concat([a,a.slice(0,8)]));var u=t.iv;o.isBuffer(u)||(u=o.from(u)),this._des=n.create({key:a,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,a(u,i),u.prototype._update=function(t){return o.from(this._des.update(t))},u.prototype._final=function(){return o.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(164),e.Cipher=r(93),e.DES=r(165),e.CBC=r(332),e.EDE=r(333)},function(t,e,r){"use strict";var i=r(10),n=r(1),a={};function o(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},l.prototype.flush=function(){for(var t=16-this.cache.length,e=a.allocUnsafe(t),r=-1;++r>o%8,t._prev=a(t._prev,r?i:n);return s}function a(t,e){var r=t.length,n=-1,a=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return a}e.encrypt=function(t,e,r){for(var a=e.length,o=i.allocUnsafe(a),s=-1;++s>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},o.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,t,0,e])),this.state},t.exports=o},function(t,e,r){var i=r(169),n=r(2).Buffer,a=r(95),o=r(170),s=r(23),u=r(59),h=r(60);function f(t,e,r){s.call(this),this._cache=new c,this._last=void 0,this._cipher=new u.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function c(){this.cache=n.allocUnsafe(0)}function l(t,e,r){var s=a[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=n.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new o(s.module,e,r,!0):"auth"===s.type?new i(s.module,e,r,!0):new f(s.module,e,r)}r(1)(f,s),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},c.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=h(e,!1,r.key,r.iv);return l(t,i.key,i.iv)},e.createDecipheriv=l},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,r){(function(t){var i=r(171),n=r(349),a=r(350);var o={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(n[e].prime,"hex"),i=new t(n[e].gen,"hex");return new a(r,i)},e.createDiffieHellman=e.DiffieHellman=function e(r,n,s,u){return t.isBuffer(n)||void 0===o[n]?e(r,"binary",n,s):(n=n||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof r?new a(i(r,s),s,!0):(t.isBuffer(r)||(r=new t(r,n)),new a(r,s,!0)))}}).call(this,r(0).Buffer)},function(t,e){},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(347).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"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"}}')},function(t,e,r){(function(e){var i=r(172),n=new(r(173)),a=new i(24),o=new i(11),s=new i(10),u=new i(3),h=new i(7),f=r(171),c=r(31);function l(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new i(t),this}function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new i(t),this}t.exports=m;var p={};function m(t,e,r){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function v(t,r){var i=new e(t.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),i=[r,t.toString(16)].join("_");if(i in p)return p[i];var c,l=0;if(t.isEven()||!f.simpleSieve||!f.fermatTest(t)||!n.test(t))return l+=1,l+="02"===r||"05"===r?8:4,p[i]=l,l;switch(n.test(t.shrn(1))||(l+=2),r){case"02":t.mod(a).cmp(o)&&(l+=8);break;case"05":(c=t.mod(s)).cmp(u)&&c.cmp(h)&&(l+=8);break;default:l+=4}return p[i]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var r=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new e(r.toArray()),a=this.getPrime();if(n.length0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(h),a||(o.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(2).Buffer,n=r(157),a=r(98),o=r(99).ec,s=r(185),u=r(62),h=r(190);function f(t,e,r,a){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function l(t,e,r){var a,o;do{for(a=i.alloc(0);8*a.length=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t){t.exports=JSON.parse('{"_args":[["elliptic@6.5.2","C:\\\\Users\\\\yvo\\\\docker2\\\\PDS Interop\\\\solid-auth-fetcher"]],"_development":true,"_from":"elliptic@6.5.2","_id":"elliptic@6.5.2","_inBundle":false,"_integrity":"sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==","_location":"/elliptic","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"elliptic@6.5.2","name":"elliptic","escapedName":"elliptic","rawSpec":"6.5.2","saveSpec":null,"fetchSpec":"6.5.2"},"_requiredBy":["/browserify-sign","/create-ecdh"],"_resolved":"https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz","_spec":"6.5.2","_where":"C:\\\\Users\\\\yvo\\\\docker2\\\\PDS Interop\\\\solid-auth-fetcher","author":{"name":"Fedor Indutny","email":"fedor@indutny.com"},"bugs":{"url":"https://github.com/indutny/elliptic/issues"},"dependencies":{"bn.js":"^4.4.0","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},"description":"EC cryptography","devDependencies":{"brfs":"^1.4.3","coveralls":"^3.0.8","grunt":"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.2","jscs":"^3.0.7","jshint":"^2.10.3","mocha":"^6.2.2"},"files":["lib"],"homepage":"https://github.com/indutny/elliptic","keywords":["EC","Elliptic","curve","Cryptography"],"license":"MIT","main":"lib/elliptic.js","name":"elliptic","repository":{"type":"git","url":"git+ssh://git@github.com/indutny/elliptic.git"},"scripts":{"jscs":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","jshint":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","lint":"npm run jscs && npm run jshint","test":"npm run lint && npm run unit","unit":"istanbul test _mocha --reporter=spec test/index.js","version":"grunt dist && git add dist/"},"version":"6.5.2"}')},function(t,e){},function(t,e,r){"use strict";var i=r(11),n=r(18),a=r(1),o=r(61),s=i.assert;function u(t){o.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function h(t,e,r,i){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(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(t,e,r,i){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,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,o),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(e))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),a=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,i,a,o,s,u,h,f,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new n(1),m=new n(0),v=new n(0),y=new n(1),g=0;0!==l.cmpn(0);){var b=d.div(l);h=d.sub(b.mul(l)),f=v.sub(b.mul(p));var w=y.sub(b.mul(m));if(!i&&h.cmp(c)<0)e=u.neg(),r=p,i=h.neg(),a=f;else if(i&&2==++g)break;u=h,d=l,l=h,v=p,p=f,y=m,m=w}o=h.neg(),s=f;var _=i.sqr().add(a.sqr());return o.sqr().add(s.sqr()).cmp(_)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),a=a.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:a},{a:o,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),a=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),u=n.mul(r.b),h=a.mul(i.b);return{k1:t.sub(o).sub(s),k2:u.add(h).neg()}},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=i.fromRed().isOdd();return(e&&!a||!e&&a)&&(i=i.redNeg()),this.point(t,i)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},h.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),a=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=a.redSub(o);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(a.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,a=t.y.redMul(e).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),h=u.redMul(o),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),d=this.z.redMul(o);return this.curve.jpoint(c,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var i=r(18),n=r(1),a=r(61),o=r(11);function s(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.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 u(t,e,r){a.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,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)))}n(s,a),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(u,a.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),a=t.x.redSub(t.z).redMul(r),o=n.redMul(i),s=e.z.redMul(a.redAdd(o).redSqr()),u=e.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(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(t){return 0===this.getX().cmp(t.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()}},function(t,e,r){"use strict";var i=r(11),n=r(18),a=r(1),o=r(61),s=i.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function h(t,e,r,i,a){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=a&&new n(a,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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(u,o),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},a(h,o.BasePoint),u.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},u.prototype.point=function(t,e,r,i){return new h(this,t,e,r,i)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),a=i.redAdd(e),o=a.redSub(r),s=i.redSub(e),u=n.redMul(o),h=a.redMul(s),f=n.redMul(s),c=o.redMul(a);return this.curve.point(u,h,c,f)},h.prototype._projDbl=function(){var t,e,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=(h=this.curve._mulA(n)).redAdd(a);if(this.zOne)t=i.redSub(n).redSub(a).redMul(o.redSub(this.curve.two)),e=o.redMul(h.redSub(a)),r=o.redSqr().redSub(o).redSub(o);else{var s=this.z.redSqr(),u=o.redSub(s).redISub(s);t=i.redSub(n).redISub(a).redMul(u),e=o.redMul(h.redSub(a)),r=o.redMul(u)}}else{var h=n.redAdd(a);s=this.curve._mulC(this.z).redSqr(),u=h.redSub(s).redSub(s);t=this.curve._mulC(i.redISub(h)).redMul(u),e=this.curve._mulC(h).redMul(n.redISub(a)),r=h.redMul(u)}return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),a=r.redSub(e),o=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=a.redMul(o),f=s.redMul(u),c=a.redMul(u),l=o.redMul(s);return this.curve.point(h,f,l,c)},h.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(a).redMul(o),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(o.redSub(this.curve._mulA(a))),r=u.redMul(h)):(e=i.redMul(h).redMul(o.redSub(a)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},function(t,e,r){"use strict";e.sha1=r(369),e.sha224=r(370),e.sha256=r(183),e.sha384=r(371),e.sha512=r(184)},function(t,e,r){"use strict";var i=r(16),n=r(48),a=r(182),o=i.rotl32,s=i.sum32,u=i.sum32_5,h=a.ft_1,f=n.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),u=t.toArray("be",o),h=new n({hash:this.hash,entropy:s,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),c=this.n.sub(new i(1)),l=0;;l++){var d=a.k?a.k(l):new i(h.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(c)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),v=m.umod(this.n);if(0!==v.cmpn(0)){var y=d.invm(this.n).mul(v.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==m.cmp(v)?2:0);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),g^=1),new f({r:v,s:y,recoveryParam:g})}}}}}},c.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var a=(e=new f(e,"hex")).r,o=e.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,u=o.invm(this.n),h=u.mul(t).umod(this.n),c=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),c)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(h,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},c.prototype.recoverPubKey=function(t,e,r,n){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,n);var a=this.n,o=new i(t),s=e.r,h=e.s,c=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var d=e.r.invm(a),p=a.sub(o).mul(d).umod(a),m=h.mul(d).umod(a);return this.g.mulAdd(p,s,m)},c.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(t,e,n)}catch(t){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var i=r(101),n=r(180),a=r(10);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var a=[];a.length"}},function(t,e,r){"use strict";var i=r(18),n=r(11),a=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(a(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;for(var i=15&r,n=0,a=0,o=e.place;a>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;if(u(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r),o=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var h=u(t,r);if(t.length!==h+r.place)return!1;var f=t.slice(r.place,h+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new i(o),this.s=new i(f),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var a=i.concat(r),o=[48];return f(o,a.length),o=o.concat(a),n.encode(o,t)}},function(t,e,r){"use strict";var i=r(101),n=r(100),a=r(11),o=a.assert,s=a.parseBytes,u=r(380),h=r(381);function f(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=n[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),t).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:a})},f.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),a=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(a)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e,r){var i=r(49),n=r(1);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){var e;try{e=r(387).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},function(module,exports){var indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0;r=e)throw new Error("invalid sig")}t.exports=function(t,e,r,h,f){var c=o(r);if("ec"===c.type){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,c)}if("dsa"===c.type){if("dsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,a=r.data.q,s=r.data.g,h=r.data.pub_key,f=o.signature.decode(t,"der"),c=f.s,l=f.r;u(c,a),u(l,a);var d=n.mont(i),p=c.invm(a);return 0===s.toRed(d).redPow(new n(e).mul(p).mod(a)).fromRed().mul(h.toRed(d).redPow(l.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(l)}(t,e,c)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");e=i.concat([f,e]);for(var l=c.modulus.byteLength(),d=[1],p=0;e.length+d.length+2=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,L=0|o[9],F=8191&L,D=L>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var yt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(g,K)|0,a=Math.imul(g,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(g,ct)|0,a=a+Math.imul(g,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((a=a+Math.imul(g,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(F,X),n=(n=Math.imul(F,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(F,rt),n=(n=Math.imul(F,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(F,at),n=(n=Math.imul(F,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(F,ut),n=(n=Math.imul(F,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(F,ct),n=(n=Math.imul(F,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e,r){e.publicEncrypt=r(403),e.privateDecrypt=r(405),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var i=r(62),n=r(31),a=r(46),o=r(191),s=r(192),u=r(102),h=r(193),f=r(98),c=r(2).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===l)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,h=a("sha1").update(c.alloc(0)).digest(),f=h.length,l=2*f;if(i>r-l-2)throw new Error("message too long");var d=c.alloc(r-i-l-2),p=r-f-1,m=n(f),v=s(c.concat([h,d,c.alloc(1,1),e],p),o(m,p)),y=s(m,o(v,f));return new u(c.concat([c.alloc(1),y,v],r))}(p,e);else if(1===l)d=function(t,e,r){var i,a=e.length,o=t.modulus.byteLength();if(a>o-11)throw new Error("message too long");i=r?c.alloc(o-a-3,255):function(t){var e,r=c.allocUnsafe(t),i=0,a=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):h(d,p)}},function(t,e){},function(t,e,r){var i=r(62),n=r(191),a=r(192),o=r(102),s=r(98),u=r(46),h=r(193),f=r(2).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var l,d=i(t),p=d.modulus.byteLength();if(e.length>p||new o(e).cmp(d.modulus)>=0)throw new Error("decryption error");l=r?h(new o(e),d):s(e,d);var m=f.alloc(p-l.length);if(l=f.concat([m,l],p),4===c)return function(t,e){var r=t.modulus.byteLength(),i=u("sha1").update(f.alloc(0)).digest(),o=i.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,o+1),h=e.slice(o+1),c=a(s,n(h,o)),l=a(h,n(c,r-o-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));var n=-1;for(;++n=e.length){a++;break}var o=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++;o.length<8&&a++;if(a)throw new Error("decryption error");return e.slice(n)}(0,l,r);if(3===c)return l;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var a=r(2),o=r(31),s=a.Buffer,u=a.kMaxLength,h=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function c(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function l(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function d(t,e,r,n){if(i.browser){var a=t.buffer,s=new Uint8Array(a,e,r);return h.getRandomValues(s),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return o(r).copy(t,e),t;o(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}h&&h.getRandomValues||!i.browser?(e.randomFill=function(e,r,i,n){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=e.length;else if("function"==typeof i)n=i,i=e.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return c(r,e.length),l(i,r,e.length),d(e,r,i,n)},e.randomFillSync=function(e,r,i){void 0===r&&(r=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');c(r,e.length),void 0===i&&(i=e.length-r);return l(i,r,e.length),d(e,r,i)}):(e.randomFill=n,e.randomFillSync=n)}).call(this,r(7),r(4))},function(t,e,r){"use strict";var i=r(2).Buffer,n=r(408);function a(t){if(i.isBuffer(t))return t;if("string"==typeof t)return i.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function o(t,e,r){for(var i=0;e+i=128&&--i,i}t.exports={derToJose:function(t,e){t=a(t);var r=n(e),o=r+1,s=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var h=t[u++];if(129===h&&(h=t[u++]),s-up+(r.clockTolerance||0))return d(new n("jwt not active",new Date(1e3*b.nbf)))}if(void 0!==b.exp&&!r.ignoreExpiration){if("number"!=typeof b.exp)return d(new i("invalid exp value"));if(p>=b.exp+(r.clockTolerance||0))return d(new a("jwt expired",new Date(1e3*b.exp)))}if(r.audience){var w=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(b.aud)?b.aud:[b.aud]).some((function(t){return w.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return d(new i("jwt audience invalid. expected: "+w.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&b.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(b.iss)))return d(new i("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&b.sub!==r.subject)return d(new i("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&b.jti!==r.jwtid)return d(new i("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&b.nonce!==r.nonce)return d(new i("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof b.iat)return d(new i("iat required when maxAge is specified"));var _=s(r.maxAge,b.iat);if(void 0===_)return d(new i('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(p>=_+(r.clockTolerance||0))return d(new a("maxAge exceeded",new Date(1e3*_)))}if(!0===r.complete){var E=m.signature;return d(null,{header:g,payload:b,signature:E})}return d(null,b)}))}},function(t,e){var r=1e3,i=6e4,n=60*i,a=24*n;function o(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var o=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*a;case"hours":case"hour":case"hrs":case"hr":case"h":return o*n;case"minutes":case"minute":case"mins":case"min":case"m":return o*i;case"seconds":case"second":case"secs":case"sec":case"s":return o*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}(t);if("number"===s&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=a)return o(t,e,a,"day");if(e>=n)return o(t,e,n,"hour");if(e>=i)return o(t,e,i,"minute");if(e>=r)return o(t,e,r,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=a)return Math.round(t/a)+"d";if(e>=n)return Math.round(t/n)+"h";if(e>=i)return Math.round(t/i)+"m";if(e>=r)return Math.round(t/r)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){(function(r){var i;e=t.exports=G,i="object"==typeof r&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var n=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],o=e.src=[],s=0,u=s++;o[u]="0|[1-9]\\d*";var h=s++;o[h]="[0-9]+";var f=s++;o[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var c=s++;o[c]="("+o[u]+")\\.("+o[u]+")\\.("+o[u]+")";var l=s++;o[l]="("+o[h]+")\\.("+o[h]+")\\.("+o[h]+")";var d=s++;o[d]="(?:"+o[u]+"|"+o[f]+")";var p=s++;o[p]="(?:"+o[h]+"|"+o[f]+")";var m=s++;o[m]="(?:-("+o[d]+"(?:\\."+o[d]+")*))";var v=s++;o[v]="(?:-?("+o[p]+"(?:\\."+o[p]+")*))";var y=s++;o[y]="[0-9A-Za-z-]+";var g=s++;o[g]="(?:\\+("+o[y]+"(?:\\."+o[y]+")*))";var b=s++,w="v?"+o[c]+o[m]+"?"+o[g]+"?";o[b]="^"+w+"$";var _="[v=\\s]*"+o[l]+o[v]+"?"+o[g]+"?",E=s++;o[E]="^"+_+"$";var M=s++;o[M]="((?:<|>)?=?)";var S=s++;o[S]=o[h]+"|x|X|\\*";var C=s++;o[C]=o[u]+"|x|X|\\*";var A=s++;o[A]="[v=\\s]*("+o[C]+")(?:\\.("+o[C]+")(?:\\.("+o[C]+")(?:"+o[m]+")?"+o[g]+"?)?)?";var k=s++;o[k]="[v=\\s]*("+o[S]+")(?:\\.("+o[S]+")(?:\\.("+o[S]+")(?:"+o[v]+")?"+o[g]+"?)?)?";var T=s++;o[T]="^"+o[M]+"\\s*"+o[A]+"$";var I=s++;o[I]="^"+o[M]+"\\s*"+o[k]+"$";var R=s++;o[R]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var P=s++;o[P]="(?:~>?)";var B=s++;o[B]="(\\s*)"+o[P]+"\\s+",a[B]=new RegExp(o[B],"g");var x=s++;o[x]="^"+o[P]+o[A]+"$";var O=s++;o[O]="^"+o[P]+o[k]+"$";var N=s++;o[N]="(?:\\^)";var j=s++;o[j]="(\\s*)"+o[N]+"\\s+",a[j]=new RegExp(o[j],"g");var L=s++;o[L]="^"+o[N]+o[A]+"$";var F=s++;o[F]="^"+o[N]+o[k]+"$";var D=s++;o[D]="^"+o[M]+"\\s*("+_+")$|^$";var U=s++;o[U]="^"+o[M]+"\\s*("+w+")$|^$";var K=s++;o[K]="(\\s*)"+o[M]+"\\s*("+_+"|"+o[A]+")",a[K]=new RegExp(o[K],"g");var q=s++;o[q]="^\\s*("+o[A]+")\\s+-\\s+("+o[A]+")\\s*$";var z=s++;o[z]="^\\s*("+o[k]+")\\s+-\\s+("+o[k]+")\\s*$";var V=s++;o[V]="(<|>)?=?\\s*\\*";for(var H=0;H<35;H++)i(H,o[H]),a[H]||(a[H]=new RegExp(o[H]));function Z(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof G)return t;if("string"!=typeof t)return null;if(t.length>256)return null;if(!(e.loose?a[E]:a[b]).test(t))return null;try{return new G(t,e)}catch(t){return null}}function G(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof G){if(t.loose===e.loose)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof G))return new G(t,e);i("SemVer",t,e),this.options=e,this.loose=!!e.loose;var r=t.trim().match(e.loose?a[E]:a[b]);if(!r)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,r,i){"string"==typeof r&&(i=r,r=void 0);try{return new G(t,r).inc(e,i).version}catch(t){return null}},e.diff=function(t,e){if(X(t,e))return null;var r=Z(t),i=Z(e),n="";if(r.prerelease.length||i.prerelease.length){n="pre";var a="prerelease"}for(var o in r)if(("major"===o||"minor"===o||"patch"===o)&&r[o]!==i[o])return n+o;return a},e.compareIdentifiers=$;var W=/^[0-9]+$/;function $(t,e){var r=W.test(t),i=W.test(e);return r&&i&&(t=+t,e=+e),t===e?0:r&&!i?-1:i&&!r?1:t0}function J(t,e,r){return Q(t,e,r)<0}function X(t,e,r){return 0===Q(t,e,r)}function tt(t,e,r){return 0!==Q(t,e,r)}function et(t,e,r){return Q(t,e,r)>=0}function rt(t,e,r){return Q(t,e,r)<=0}function it(t,e,r,i){switch(e){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),t===r;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),t!==r;case"":case"=":case"==":return X(t,r,i);case"!=":return tt(t,r,i);case">":return Y(t,r,i);case">=":return et(t,r,i);case"<":return J(t,r,i);case"<=":return rt(t,r,i);default:throw new TypeError("Invalid operator: "+e)}}function nt(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof nt){if(t.loose===!!e.loose)return t;t=t.value}if(!(this instanceof nt))return new nt(t,e);i("comparator",t,e),this.options=e,this.loose=!!e.loose,this.parse(t),this.semver===at?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}e.rcompareIdentifiers=function(t,e){return $(e,t)},e.major=function(t,e){return new G(t,e).major},e.minor=function(t,e){return new G(t,e).minor},e.patch=function(t,e){return new G(t,e).patch},e.compare=Q,e.compareLoose=function(t,e){return Q(t,e,!0)},e.rcompare=function(t,e,r){return Q(e,t,r)},e.sort=function(t,r){return t.sort((function(t,i){return e.compare(t,i,r)}))},e.rsort=function(t,r){return t.sort((function(t,i){return e.rcompare(t,i,r)}))},e.gt=Y,e.lt=J,e.eq=X,e.neq=tt,e.gte=et,e.lte=rt,e.cmp=it,e.Comparator=nt;var at={};function ot(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof ot)return t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease?t:new ot(t.raw,e);if(t instanceof nt)return new ot(t.value,e);if(!(this instanceof ot))return new ot(t,e);if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map((function(t){return this.parseRange(t.trim())}),this).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function st(t){return!t||"x"===t.toLowerCase()||"*"===t}function ut(t,e,r,i,n,a,o,s,u,h,f,c,l){return((e=st(r)?"":st(i)?">="+r+".0.0":st(n)?">="+r+"."+i+".0":">="+e)+" "+(s=st(u)?"":st(h)?"<"+(+u+1)+".0.0":st(f)?"<"+u+"."+(+h+1)+".0":c?"<="+u+"."+h+"."+f+"-"+c:"<="+s)).trim()}function ht(t,e,r){for(var n=0;n0){var a=t[n].semver;if(a.major===e.major&&a.minor===e.minor&&a.patch===e.patch)return!0}return!1}return!0}function ft(t,e,r){try{e=new ot(e,r)}catch(t){return!1}return e.test(t)}function ct(t,e,r,i){var n,a,o,s,u;switch(t=new G(t,i),e=new ot(e,i),r){case">":n=Y,a=rt,o=J,s=">",u=">=";break;case"<":n=J,a=et,o=Y,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ft(t,e,i))return!1;for(var h=0;h=0.0.0")),c=c||t,l=l||t,n(t.semver,c.semver,i)?c=t:o(t.semver,l.semver,i)&&(l=t)})),c.operator===s||c.operator===u)return!1;if((!l.operator||l.operator===s)&&a(t,l.semver))return!1;if(l.operator===u&&o(t,l.semver))return!1}return!0}nt.prototype.parse=function(t){var e=this.options.loose?a[D]:a[U],r=t.match(e);if(!r)throw new TypeError("Invalid comparator: "+t);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new G(r[2],this.options.loose):this.semver=at},nt.prototype.toString=function(){return this.value},nt.prototype.test=function(t){return i("Comparator.test",t,this.options.loose),this.semver===at||("string"==typeof t&&(t=new G(t,this.options)),it(t,this.operator,this.semver,this.options))},nt.prototype.intersects=function(t,e){if(!(t instanceof nt))throw new TypeError("a Comparator is required");var r;if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),""===this.operator)return r=new ot(t.value,e),ft(this.value,r,e);if(""===t.operator)return r=new ot(this.value,e),ft(t.semver,r,e);var i=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),a=this.semver.version===t.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=it(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=it(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return i||n||a&&o||s||u},e.Range=ot,ot.prototype.format=function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range},ot.prototype.toString=function(){return this.range},ot.prototype.parseRange=function(t){var e=this.options.loose;t=t.trim();var r=e?a[z]:a[q];t=t.replace(r,ut),i("hyphen replace",t),t=t.replace(a[K],"$1$2$3"),i("comparator trim",t,a[K]),t=(t=(t=t.replace(a[B],"$1~")).replace(a[j],"$1^")).split(/\s+/).join(" ");var n=e?a[D]:a[U],o=t.split(" ").map((function(t){return function(t,e){return i("comp",t,e),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){i("caret",t,e);var r=e.loose?a[F]:a[L];return t.replace(r,(function(e,r,n,a,o){var s;return i("caret",t,e,r,n,a,o),st(r)?s="":st(n)?s=">="+r+".0.0 <"+(+r+1)+".0.0":st(a)?s="0"===r?">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0":">="+r+"."+n+".0 <"+(+r+1)+".0.0":o?(i("replaceCaret pr",o),s="0"===r?"0"===n?">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+n+"."+(+a+1):">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+(+n+1)+".0":">="+r+"."+n+"."+a+"-"+o+" <"+(+r+1)+".0.0"):(i("no pr"),s="0"===r?"0"===n?">="+r+"."+n+"."+a+" <"+r+"."+n+"."+(+a+1):">="+r+"."+n+"."+a+" <"+r+"."+(+n+1)+".0":">="+r+"."+n+"."+a+" <"+(+r+1)+".0.0"),i("caret return",s),s}))}(t,e)})).join(" ")}(t,e),i("caret",t),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){var r=e.loose?a[O]:a[x];return t.replace(r,(function(e,r,n,a,o){var s;return i("tilde",t,e,r,n,a,o),st(r)?s="":st(n)?s=">="+r+".0.0 <"+(+r+1)+".0.0":st(a)?s=">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0":o?(i("replaceTilde pr",o),s=">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+(+n+1)+".0"):s=">="+r+"."+n+"."+a+" <"+r+"."+(+n+1)+".0",i("tilde return",s),s}))}(t,e)})).join(" ")}(t,e),i("tildes",t),t=function(t,e){return i("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return function(t,e){t=t.trim();var r=e.loose?a[I]:a[T];return t.replace(r,(function(e,r,n,a,o,s){i("xRange",t,e,r,n,a,o,s);var u=st(n),h=u||st(a),f=h||st(o);return"="===r&&f&&(r=""),u?e=">"===r||"<"===r?"<0.0.0":"*":r&&f?(h&&(a=0),o=0,">"===r?(r=">=",h?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===r&&(r="<",h?n=+n+1:a=+a+1),e=r+n+"."+a+"."+o):h?e=">="+n+".0.0 <"+(+n+1)+".0.0":f&&(e=">="+n+"."+a+".0 <"+n+"."+(+a+1)+".0"),i("xRange return",e),e}))}(t,e)})).join(" ")}(t,e),i("xrange",t),t=function(t,e){return i("replaceStars",t,e),t.trim().replace(a[V],"")}(t,e),i("stars",t),t}(t,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(o=o.filter((function(t){return!!t.match(n)}))),o=o.map((function(t){return new nt(t,this.options)}),this)},ot.prototype.intersects=function(t,e){if(!(t instanceof ot))throw new TypeError("a Range is required");return this.set.some((function(r){return r.every((function(r){return t.set.some((function(t){return t.every((function(t){return r.intersects(t,e)}))}))}))}))},e.toComparators=function(t,e){return new ot(t,e).set.map((function(t){return t.map((function(t){return t.value})).join(" ").trim().split(" ")}))},ot.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new G(t,this.options));for(var e=0;e":0===e.prerelease.length?e.patch++:e.prerelease.push(0),e.raw=e.format();case"":case">=":r&&!Y(r,e)||(r=e);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+t.operator)}}))}if(r&&t.test(r))return r;return null},e.validRange=function(t,e){try{return new ot(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,r){return ct(t,e,"<",r)},e.gtr=function(t,e,r){return ct(t,e,">",r)},e.outside=ct,e.prerelease=function(t,e){var r=Z(t,e);return r&&r.prerelease.length?r.prerelease:null},e.intersects=function(t,e,r){return t=new ot(t,r),e=new ot(e,r),t.intersects(e)},e.coerce=function(t){if(t instanceof G)return t;if("string"!=typeof t)return null;var e=t.match(a[R]);if(null==e)return null;return Z(e[1]+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,r(4))},function(t,e,r){(function(e){var i=r(197),n=r(198),a=r(87),o=r(414),s=r(415),u=r(416),h=r(417),f=r(418),c=r(419),l=r(420),d=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];n&&d.splice(3,0,"PS256","PS384","PS512");var p={expiresIn:{isValid:function(t){return u(t)||c(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return u(t)||c(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return c(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,d),message:'"algorithm" must be a valid string enum value'},header:{isValid:f,message:'"header" must be an object'},encoding:{isValid:c,message:'"encoding" must be a string'},issuer:{isValid:c,message:'"issuer" must be a string'},subject:{isValid:c,message:'"subject" must be a string'},jwtid:{isValid:c,message:'"jwtid" must be a string'},noTimestamp:{isValid:s,message:'"noTimestamp" must be a boolean'},keyid:{isValid:c,message:'"keyid" must be a string'},mutatePayload:{isValid:s,message:'"mutatePayload" must be a boolean'}},m={iat:{isValid:h,message:'"iat" should be a number of seconds'},exp:{isValid:h,message:'"exp" should be a number of seconds'},nbf:{isValid:h,message:'"nbf" should be a number of seconds'}};function v(t,e,r,i){if(!f(r))throw new Error('Expected "'+i+'" to be a plain object.');Object.keys(r).forEach((function(n){var a=t[n];if(a){if(!a.isValid(r[n]))throw new Error(a.message)}else if(!e)throw new Error('"'+n+'" is not allowed in "'+i+'"')}))}var y={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},g=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(t,r,n,o){"function"==typeof n?(o=n,n={}):n=n||{};var s="object"==typeof t&&!e.isBuffer(t),u=Object.assign({alg:n.algorithm||"HS256",typ:s?"JWT":void 0,kid:n.keyid},n.header);function h(t){if(o)return o(t);throw t}if(!r&&"none"!==n.algorithm)return h(new Error("secretOrPrivateKey must have a value"));if(void 0===t)return h(new Error("payload is required"));if(s){try{!function(t){v(m,!0,t,"payload")}(t)}catch(t){return h(t)}n.mutatePayload||(t=Object.assign({},t))}else{var f=g.filter((function(t){return void 0!==n[t]}));if(f.length>0)return h(new Error("invalid "+f.join(",")+" option for "+typeof t+" payload"))}if(void 0!==t.exp&&void 0!==n.expiresIn)return h(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==t.nbf&&void 0!==n.notBefore)return h(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(t){v(p,!1,t,"options")}(n)}catch(t){return h(t)}var c=t.iat||Math.floor(Date.now()/1e3);if(n.noTimestamp?delete t.iat:s&&(t.iat=c),void 0!==n.notBefore){try{t.nbf=i(n.notBefore,c)}catch(t){return h(t)}if(void 0===t.nbf)return h(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==n.expiresIn&&"object"==typeof t){try{t.exp=i(n.expiresIn,c)}catch(t){return h(t)}if(void 0===t.exp)return h(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(y).forEach((function(e){var r=y[e];if(void 0!==n[e]){if(void 0!==t[r])return h(new Error('Bad "options.'+e+'" option. The payload already has an "'+r+'" property.'));t[r]=n[e]}}));var d=n.encoding||"utf8";if("function"!=typeof o)return a.sign({header:u,payload:t,secret:r,encoding:d});o=o&&l(o),a.createSign({header:u,privateKey:r,payload:t,encoding:d}).once("error",o).once("done",(function(t){o(null,t)}))}}).call(this,r(0).Buffer)},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=/^(?:0|[1-9]\d*)$/,s=parseInt;function u(t){return t!=t}function h(t,e){return function(t,e){for(var r=-1,i=t?t.length:0,n=Array(i);++r-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}(t.length)&&!function(t){var e=M(t)?p.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)}function M(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function S(t){return!!t&&"object"==typeof t}t.exports=function(t,e,o,f){var c;t=E(t)?t:(c=t)?h(c,function(t){return E(t)?g(t):b(t)}(c)):[],o=o&&!f?function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"==p.call(t)}(t))return NaN;if(M(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=M(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var o=n.test(t);return o||a.test(t)?s(t.slice(2),o?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),o=e%1;return e==e?o?e-o:e:0}(o):0;var l=t.length;return o<0&&(o=y(l+o,0)),function(t){return"string"==typeof t||!_(t)&&S(t)&&"[object String]"==p.call(t)}(t)?o<=l&&t.indexOf(e,o)>-1:!!l&&function(t,e,r){if(e!=e)return function(t,e,r,i){for(var n=t.length,a=r+(i?1:-1);i?a--:++a-1}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return!0===t||!1===t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Boolean]"==r.call(t)}},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s=Object.prototype.toString;function u(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return"number"==typeof t&&t==function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(u(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=u(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var h=n.test(t);return h||a.test(t)?o(t.slice(2),h?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),h=e%1;return e==e?h?e-h:e:0}(t)}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return"number"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Number]"==r.call(t)}},function(t,e){var r,i,n=Function.prototype,a=Object.prototype,o=n.toString,s=a.hasOwnProperty,u=o.call(Object),h=a.toString,f=(r=Object.getPrototypeOf,i=Object,function(t){return r(i(t))});t.exports=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=h.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=f(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&o.call(r)==u}},function(t,e){var r=Object.prototype.toString,i=Array.isArray;t.exports=function(t){return"string"==typeof t||!i(t)&&function(t){return!!t&&"object"==typeof t}(t)&&"[object String]"==r.call(t)}},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s=Object.prototype.toString;function u(t,e){var u;if("function"!=typeof e)throw new TypeError("Expected a function");return t=function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(h(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=h(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var u=n.test(t);return u||a.test(t)?o(t.slice(2),u?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),u=e%1;return e==e?u?e-u:e:0}(t),function(){return--t>0&&(u=e.apply(this,arguments)),t<=1&&(e=void 0),u}}function h(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return u(2,t)}},function(t,e,r){"use strict";const{promisify:i}=r(28),n=r(88),a=i(n.randomBytes),o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~".split(""),s="0123456789".split(""),u="CDEHKMPRTUWXY012458".split(""),h="!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".split(""),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),c=[void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"],l=(t,e)=>({length:r,type:i,characters:n})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(void 0!==i&&void 0!==n)throw new TypeError("Expected either `type` or `characters`");if(void 0!==n&&"string"!=typeof n)throw new TypeError("Expected `characters` to be string");if(!c.includes(i))throw new TypeError("Unknown type: "+i);if(void 0===i&&void 0===n&&(i="hex"),"hex"===i||void 0===i&&void 0===n)return e(Math.ceil(.5*r),"hex",r);if("base64"===i)return e(Math.ceil(.75*r),"base64",r);if("url-safe"===i)return t(r,o);if("numeric"===i)return t(r,s);if("distinguishable"===i)return t(r,u);if("ascii-printable"===i)return t(r,h);if("alphanumeric"===i)return t(r,f);if(0===n.length)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(n.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return t(r,n.split(""))};t.exports=l((t,e)=>{const r=e.length,i=Math.floor(65536/r)*r-1,a=2*Math.ceil(1.1*t);let o="",s=0;for(;si||(o+=e[t%r],s++)}}return o},(t,e,r)=>n.randomBytes(t).toString(e).slice(0,r)),t.exports.async=l(async(t,e)=>{const r=e.length,i=Math.floor(65536/r)*r-1,n=2*Math.ceil(1.1*t);let o="",s=0;for(;si||(o+=e[t%r],s++)}}return o},async(t,e,r)=>(await a(t)).toString(e).slice(0,r))},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(39));let h=class{constructor(t,e,r,i,n){this.oidcHandler=t,this.issuerConfigFetcher=e,this.dpopClientKeyManager=r,this.storageUtility=i,this.clientRegistrar=n}checkOptions(t){return t.oidcIssuer&&t.redirect?null:new u.default("OidcLoginHandler requires an oidcIssuer")}async canHandle(t){return!this.checkOptions(t)}async handle(t){const e=this.checkOptions(t);if(e)throw e;const r=await this.issuerConfigFetcher.fetchConfig(t.oidcIssuer),i={issuer:t.oidcIssuer,dpop:!0,redirectUrl:t.redirect,issuerConfiguration:r,client:await this.clientRegistrar.getClient(t,r),localUserId:t.localUserId,doNotAutoRedirect:t.doNotAutoRedirect};return await this.dpopClientKeyManager.generateClientKeyIfNotAlready(i),await this.oidcHandler.handle(i)}};h=i([s.injectable(),a(0,s.inject("oidcHandler")),a(1,s.inject("issuerConfigFetcher")),a(2,s.inject("dpopClientKeyManager")),a(3,s.inject("storageUtility")),a(4,s.inject("clientRegistrar")),n("design:paramtypes",[Object,Object,Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("oidcHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("AuthorizationCodeOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5);let h=class{constructor(t,e,r,i){this.sessionCreator=t,this.joseUtility=e,this.storageUtility=r,this.redirector=i}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1)}async handle(t){const e=new s.default(t.issuerConfiguration.authorizationEndpoint.toString()),r=await this.joseUtility.generateCodeVerifier(),i=this.sessionCreator.create({localUserId:t.localUserId,loggedIn:!1}),n={response_type:"id_token code",redirect_uri:t.redirectUrl.toString(),scope:"openid profile offline_access",client_id:t.client.clientId,code_challenge_method:"S256",code_challenge:await this.joseUtility.generateCodeChallenge(r),state:i.localUserId};return e.set("query",n),await this.storageUtility.setForUser(i.localUserId,"codeVerifier",r),await this.storageUtility.setForUser(i.localUserId,"issuer",t.issuer.toString()),await this.storageUtility.setForUser(i.localUserId,"clientId",t.client.clientId),await this.storageUtility.setForUser(i.localUserId,"redirectUri",t.redirectUrl.toString()),t.client.clientSecret&&await this.storageUtility.setForUser(i.localUserId,"clientSecret",t.client.clientSecret),i.neededAction=this.redirector.redirect(e.toString(),{doNotAutoRedirect:!!t.doNotAutoRedirect}),i}};h=i([u.injectable(),a(0,u.inject("sessionCreator")),a(1,u.inject("joseUtility")),a(2,u.inject("storageUtility")),a(3,u.inject("redirector")),n("design:paramtypes",[Object,Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("ClientCredentialsOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("PrimaryDeviceOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("SecondaryDeviceOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5);let h=class{constructor(t,e,r){this.fetcher=t,this.dpopHeaderCreator=e,this.sessionCreator=r}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("implicit")>-1)}async handle(t){const e=new s.default(t.issuerConfiguration.authorizationEndpoint.toString()),r={response_type:"id_token token",redirect_url:t.redirectUrl.toString(),scope:"openid id_vc"};return t.dpop&&(r.dpop=await this.dpopHeaderCreator.createHeaderToken(t.issuer,"GET")),e.set("query",r),this.sessionCreator.create({neededAction:{actionType:"redirect",redirectUrl:e.toString()},loggedIn:!1})}};h=i([u.injectable(),a(0,u.inject("fetcher")),a(1,u.inject("dpopHeaderCreator")),a(2,u.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("RefreshTokenOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(14)),a=i(r(432));e.default=class{async fetch(t,e){const r=t instanceof n.default?t.toString():t;return"undefined"!=typeof window&&void 0!==window.fetch?window.fetch(r,e):a.default(r,e)}}},function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:this);!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in t,o="ArrayBuffer"in t;if(o)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},y.call(b.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];_.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function M(t,r){return new Promise((function(i,a){var o=new b(t,r);if(o.signal&&o.signal.aborted)return a(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;i(new _(n,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new e.DOMException("Aborted","AbortError"))},s.open(o.method,o.url,!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&n&&(s.responseType="blob"),o.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",u)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}M.polyfill=!0,t.fetch||(t.fetch=M,t.Headers=l,t.Request=b,t.Response=_),e.Headers=l,e.Request=b,e.Response=_,e.fetch=M}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5),h=o(r(434)),f=o(r(39)),c={issuer:{toKey:"issuer",convertToUrl:!0},authorization_endpoint:{toKey:"authorizationEndpoint",convertToUrl:!0},token_endpoint:{toKey:"tokenEndpoint",convertToUrl:!0},userinfo_endpoint:{toKey:"userinfoEndpoint",convertToUrl:!0},jwks_uri:{toKey:"jwksUri",convertToUrl:!0},registration_endpoint:{toKey:"registrationEndpoint",convertToUrl:!0},scopes_supported:{toKey:"scopesSupported"},response_types_supported:{toKey:"responseTypesSupported"},response_modes_supported:{toKey:"responseModesSupported"},grant_types_supported:{toKey:"grantTypesSupported"},acr_values_supported:{toKey:"acrValuesSupported"},subject_types_supported:{toKey:"subjectTypesSupported"},id_token_signing_alg_values_supported:{toKey:"idTokenSigningAlgValuesSupported"},id_token_encryption_alg_values_supported:{toKey:"idTokenEncryptionAlgValuesSupported"},id_token_encryption_enc_values_supported:{toKey:"idTokenEncryptionEncValuesSupported"},userinfo_signing_alg_values_supported:{toKey:"userinfoSigningAlgValuesSupported"},userinfo_encryption_alg_values_supported:{toKey:"userinfoEncryptionAlgValuesSupported"},userinfo_encryption_enc_values_supported:{toKey:"userinfoEncryptionEncValuesSupported"},request_object_signing_alg_values_supported:{toKey:"requestObjectSigningAlgValuesSupported"},request_object_encryption_alg_values_supported:{toKey:"requestObjectEncryptionAlgValuesSupported"},request_object_encryption_enc_values_supported:{toKey:"requestObjectEncryptionEncValuesSupported"},token_endpoint_auth_methods_supported:{toKey:"tokenEndpointAuthMethodsSupported"},token_endpoint_auth_signing_alg_values_supported:{toKey:"tokenEndpointAuthSigningAlgValuesSupported"},display_values_supported:{toKey:"displayValuesSupported"},claim_types_supported:{toKey:"claimTypesSupported"},claims_supported:{toKey:"claimsSupported"},service_documentation:{toKey:"serviceDocumentation"},claims_locales_supported:{toKey:"claimsLocalesSupported"},ui_locales_supported:{toKey:"uiLocalesSupported"},claims_parameter_supported:{toKey:"claimsParameterSupported"},request_parameter_supported:{toKey:"requestParameterSupported"},request_uri_parameter_supported:{toKey:"requestUriParameterSupported"},require_request_uri_registration:{toKey:"requireRequestUriRegistration"},op_policy_uri:{toKey:"opPolicyUri",convertToUrl:!0},op_tos_uri:{toKey:"opTosUri",convertToUrl:!0}};let l=class{constructor(t,e){this.fetcher=t,this.storageUtility=e}getLocalStorageKey(t){return"issuerConfig:"+t.toString()}processConfig(t){const e={};return Object.keys(t).forEach(r=>{c[r]&&(e[c[r].toKey]=c[r].convertToUrl?new s.default(t[r]):t[r])}),e}async fetchConfig(t){let e=await this.storageUtility.safeGet(this.getLocalStorageKey(t),{schema:h.default});if(!e){const r=new s.default(t.toString());r.set("pathname","/.well-known/openid-configuration");const i=await this.fetcher.fetch(r);try{e=this.processConfig(await i.json())}catch(e){throw new f.default(`${t.toString()} has an invalid configuration: ${e.message}`)}}return await this.storageUtility.set(this.getLocalStorageKey(t),JSON.stringify(e)),e}};l=i([u.injectable(),a(0,u.inject("fetcher")),a(1,u.inject("storageUtility")),n("design:paramtypes",[Object,Object])],l),e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={type:"object",properties:{issuer:{type:"string",format:"uri"},authorization_endpoint:{type:"string",format:"uri"},token_endpoint:{type:"string",format:"uri"},userinfo_endpoint:{type:"string",format:"uri"},jwks_uri:{type:"string",format:"uri"},registration_endpoint:{type:"string",format:"uri"},scopes_supported:{type:"array",items:{type:"string"}},response_types_supported:{type:"array",items:{type:"string",joinedStringOf:["code","id_token","token","none"]}},response_modes_supported:{type:"array",items:{type:"string",enum:["query","fragment"]},default:["query","fragment"]},grant_types_supported:{type:"array",items:{type:"string",enum:["authorization_code","implicit","client_credentials","device_code","refresh_token"]},default:["authorization_code","implicit"]},acr_values_supported:{type:"array",items:{type:"string"}},subject_types_supported:{type:"array",items:{type:"string",enum:["pairwise","public"]}},id_token_signing_alg_values_supported:{type:"array",items:{type:"string"}},id_token_encryption_alg_values_supported:{type:"array",items:{type:"string"}},id_token_encryption_enc_values_supported:{type:"array",items:{type:"string"}},userinfo_signing_alg_values_supported:{type:"array",items:{type:"string"}},userinfo_encryption_alg_values_supported:{type:"array",items:{type:"string"}},userinfo_encryption_enc_values_supported:{type:"array",items:{type:"string"}},request_object_signing_alg_values_supported:{type:"array",items:{type:"string"}},request_object_encryption_alg_values_supported:{type:"array",items:{type:"string"}},request_object_encryption_enc_values_supported:{type:"array",items:{type:"string"}},token_endpoint_auth_methods_supported:{type:"array",items:{type:"string"}},token_endpoint_auth_signing_alg_values_supported:{type:"array",items:{type:"string"}},display_values_supported:{type:"array",items:{type:"string"}},claim_types_supported:{type:"array",items:{type:"string"}},claims_supported:{type:"array",items:{type:"string"}},service_documentation:{type:"array",items:{type:"string"}},claims_locales_supported:{type:"array",items:{type:"string"}},ui_locales_supported:{type:"array",items:{type:"string"}},claims_parameter_supported:{type:"boolean"},request_parameter_supported:{type:"boolean"},request_uri_parameter_supported:{type:"boolean"},require_request_uri_registration:{type:"boolean"},op_policy_uri:{type:"string",format:"uri"},op_tos_uri:{type:"string",format:"uri"}},additionalProperties:!0}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t,e,r){return"bearer"===t.type}async handle(t,e,r){throw new n.default("BearerAuthenticatedFetcher")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r){this.joseUtility=t,this.dpopClientKeyManager=e,this.uuidGenerator=r}normalizeHtu(t){return`${t.origin}${t.pathname}`}async createHeaderToken(t,e){const r=await this.dpopClientKeyManager.getClientKey();if(null===r)throw new Error("Could not obtain the key to sign the token with.");return this.joseUtility.signJWT({htu:this.normalizeHtu(t),htm:e,jti:this.uuidGenerator.v4()},r,{header:{jwk:await this.joseUtility.privateJWKToPublicJWK(r),typ:"dpop+jwt"},expiresIn:"1 hour",algorithm:"RS256"})}};s=i([o.injectable(),a(0,o.inject("joseUtility")),a(1,o.inject("dpopClientKeyManager")),a(2,o.inject("uuidGenerator")),n("design:paramtypes",[Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(438));let h=class{constructor(t,e){this.storageUtility=t,this.joseUtility=e}getLocalStorageKey(){return"clientKey"}async generateClientKeyIfNotAlready(t){let e=await this.storageUtility.safeGet(this.getLocalStorageKey(),{schema:u.default});e||(e=await this.joseUtility.generateJWK("RSA",2048,{alg:"RSA",use:"sig"}),await this.storageUtility.set(this.getLocalStorageKey(),JSON.stringify(e)))}async getClientKey(){return await this.storageUtility.safeGet(this.getLocalStorageKey(),{schema:u.default})}};h=i([s.injectable(),a(0,s.inject("storageUtility")),a(1,s.inject("joseUtility")),n("design:paramtypes",[Object,Object])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={description:"json web key",type:"object",required:["kty","e","n"],properties:{kty:{type:"string"},e:{type:"string"},n:{type:"string"}}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(105));let h=class{constructor(t){this.storage=t}getKey(t){return"solidAuthFetcherUser:"+t}async getUserData(t){const e=await this.storage.get(this.getKey(t));if(null===e)return{};try{return JSON.parse(e)}catch(t){return{}}}async setUserData(t,e){await this.storage.set(this.getKey(t),JSON.stringify(e))}async get(t,e){const r=await this.storage.get(t);if(null==r&&e)throw new Error(t+" is not stored");return r}async set(t,e){return this.storage.set(t,e)}async delete(t){return this.storage.delete(t)}async getForUser(t,e,r){const i=await this.getUserData(t);let n;if(i[e]||(n=null),n=i[e],null==n&&r)throw new Error(`Field ${e} for user ${t} is not stored`);return n||null}async setForUser(t,e,r){const i=await this.getUserData(t);i[e]=r,await this.setUserData(t,i)}async deleteForUser(t,e){const r=await this.getUserData(t);delete r[e],await this.setUserData(t,r)}async deleteAllUserData(t){await this.storage.delete(this.getKey(t))}async safeGet(t,e={}){const r=e.userId?await this.getForUser(e.userId,t):await this.get(t);if(r)try{const t=JSON.parse(r);if(e.schema){return u.default(e.schema,t)}return t}catch(r){e.userId?await this.deleteForUser(e.userId,t):await this.delete(t)}return null}};h=i([s.injectable(),a(0,s.inject("storage")),n("design:paramtypes",[Object])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=r(462);e.default=class{v4(){return i.v4()}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(){this.map={}}async get(t){return this.map[t]||null}async set(t,e){this.map[t]=e}async delete(t){delete this.map[t]}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=o(r(39)),h=r(5);let f=class{constructor(t){this.tokenSaver=t}async canHandle(t){const e=new s.default(t,!0);return!!(e.query&&e.query.id_token&&e.query.access_token&&e.query.state)}async handle(t){if(!await this.canHandle(t))throw new u.default("Cannot handle redirect url "+t);const e=new s.default(t,!0);return this.tokenSaver.saveTokenAndGetSession(e.query.state,e.query.id_token,e.query.access_token)}};f=i([h.injectable(),a(0,h.inject("tokenSaver")),n("design:paramtypes",[Object])],f),e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{detect(){return"undefined"!=typeof document?"browser":"undefined"!=typeof navigator&&"ReactNative"==navigator.product?"react-native":"server"}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.storageUtility=t}async canHandle(){return!0}async handle(t){this.storageUtility.deleteAllUserData(t)}};s=i([o.injectable(),a(0,o.inject("storageUtility")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(14));e.default=class{requestInfoToUrl(t){return new n.default(t)}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r,i){this.uuidGenerator=t,this.authenticatedFetcher=e,this.logoutHandler=r,this.storageUtility=i}create(t){const e=t.localUserId||this.uuidGenerator.v4();return t.loggedIn?{localUserId:e,loggedIn:!0,webId:t.webId,neededAction:t.neededAction||{actionType:"inaction"},state:t.state,logout:async()=>this.logoutHandler.handle(e),fetch:(t,r)=>this.authenticatedFetcher.handle({localUserId:e,type:"dpop"},t,r)}:{localUserId:e,loggedIn:!1,neededAction:t.neededAction||{actionType:"inaction"}}}async getSession(t){const e=await this.storageUtility.getForUser(t,"webId"),r=await this.storageUtility.getForUser(t,"accessToken");return e?this.create({localUserId:t,webId:e,loggedIn:!!r}):null}};s=i([o.injectable(),a(0,o.inject("uuidGenerator")),a(1,o.inject("authenticatedFetcher")),a(2,o.inject("logoutHandler")),a(3,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=o(r(39)),h=r(5);let f=class{constructor(t,e,r,i){this.storageUtility=t,this.redirector=e,this.tokenRequester=r,this.sessionCreator=i}async canHandle(t){const e=new s.default(t,!0);return!!(e.query&&e.query.code&&e.query.state)}async handle(t){if(!await this.canHandle(t))throw new u.default("Cannot handle redirect url "+t);const e=new s.default(t,!0),r=e.query.state,[i,n]=await Promise.all([await this.storageUtility.getForUser(r,"codeVerifier",!0),await this.storageUtility.getForUser(r,"redirectUri",!0)]);await this.tokenRequester.request(r,{grant_type:"authorization_code",code_verifier:i,code:e.query.code,redirect_uri:n}),e.set("query",{});const a=await this.sessionCreator.getSession(r);if(!a)throw new Error("There was a problem creating a session.");return a.neededAction=this.redirector.redirect(e.toString(),{redirectByReplacingState:!0}),a}};f=i([h.injectable(),a(0,h.inject("storageUtility")),a(1,h.inject("redirector")),a(2,h.inject("tokenRequester")),a(3,h.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object,Object])],f),e.default=f},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("redirectHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{async get(t){return window.localStorage.getItem(t)}async set(t,e){window.localStorage.setItem(t,e)}async delete(t){window.localStorage.removeItem(t)}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r){this.sessionCreator=t,this.joseUtility=e,this.storageUtility=r}async saveTokenAndGetSession(t,e,r,i){const n=await this.joseUtility.decodeJWT(r),a=this.sessionCreator.create({localUserId:t,webId:n.sub,neededAction:{actionType:"inaction"},loggedIn:!0});return await this.storageUtility.setForUser(a.localUserId,"accessToken",r),await this.storageUtility.setForUser(a.localUserId,"idToken",e),await this.storageUtility.setForUser(a.localUserId,"webId",n.sub),await this.storageUtility.setForUser(a.localUserId,"refreshToken",i),a}};s=i([o.injectable(),a(0,o.inject("sessionCreator")),a(1,o.inject("joseUtility")),a(2,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.environmentDetector=t}redirect(t,e){return"browser"!==this.environmentDetector.detect()||(null==e?void 0:e.doNotAutoRedirect)?{actionType:"redirect",redirectUrl:t}:(e&&e.redirectByReplacingState?window.history.replaceState({},"",t):window.location.href=t,{actionType:"inaction"})}};s=i([o.injectable(),a(0,o.inject("environmentDetector")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.sessionCreator=t}async canHandle(t){return!0}async handle(t){return this.sessionCreator.create({loggedIn:!1})}};s=i([o.injectable(),a(0,o.inject("sessionCreator")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(14));let h=class{constructor(t,e,r){this.environmentDetector=t,this.loginHandler=e,this.sessionCreator=r}async canHandle(t){return!(!t.popUp||!t.popUpRedirectPath||"browser"!==this.environmentDetector.detect())}async handle(t){const e=new u.default(window.location.href);e.set("pathname",t.popUpRedirectPath);const r=await this.loginHandler.handle({...t,redirect:e,doNotAutoRedirect:!0}),i=window.open(r.neededAction.redirectUrl,"Log In","resizable,scrollbars,width=500,height=500,");return new Promise((e,r)=>{const n=setInterval(async()=>{i&&!i.closed||(clearInterval(n),e(await this.sessionCreator.getSession(t.localUserId||"global")))},500)})}};h=i([s.injectable(),a(0,s.inject("environmentDetector")),a(1,s.inject("postPopUpLoginHandler")),a(2,s.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("postPopUpLoginHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.fetcher=t}async performDynamicRegistration(t,e){var r;const i={client_name:t.clientName,application_type:"web",redirect_uris:[null===(r=t.redirect)||void 0===r?void 0:r.toString()],subject_type:"pairwise",token_endpoint_auth_method:"client_secret_basic",code_challenge_method:"S256"};if(!e.registrationEndpoint)throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");const n=await this.fetcher.fetch(e.registrationEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new Error("Login Registration Error: "+await n.text());const a=await n.json();return{clientId:a.client_id,clientSecret:a.client_secret}}async getClient(t,e){return t.clientId?{clientId:t.clientId}:await this.performDynamicRegistration(t,e)}};s=i([o.injectable(),a(0,o.inject("fetcher")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e){this.storageUtility=t,this.tokenRequester=e}async refresh(t){const e=await this.storageUtility.getForUser(t,"refreshToken",!0);await this.tokenRequester.request(t,{grant_type:"refresh_token",refresh_token:e})}};s=i([o.injectable(),a(0,o.inject("storageUtility")),a(1,o.inject("tokenRequester")),n("design:paramtypes",[Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e){this.aggregateAuthenticatedFetcher=t,this.tokenRefresher=e}async canHandle(t,e,r){return!0}async handle(t,e,r){const i=await this.aggregateAuthenticatedFetcher.handle(t,e,r);if(401===i.status)try{return await this.tokenRefresher.refresh(t.localUserId),this.aggregateAuthenticatedFetcher.handle(t,e,r)}catch(t){}return i}};s=i([o.injectable(),a(0,o.inject("aggregateAuthenticatedFetcher")),a(1,o.inject("tokenRefresher")),n("design:paramtypes",[Object,Object])],s),e.default=s},function(t,e,r){"use strict";(function(t){var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(14)),h=o(r(459));let f=class{constructor(t,e,r,i,n){this.storageUtility=t,this.issuerConfigFetcher=e,this.fetcher=r,this.dpopHeaderCreator=i,this.joseUtility=n}async request(t,e){const[r,i,n]=await Promise.all([this.storageUtility.getForUser(t,"issuer",!0),this.storageUtility.getForUser(t,"clientId",!0),this.storageUtility.getForUser(t,"clientSecret")]),a=await this.issuerConfigFetcher.fetchConfig(new u.default(r));if(e.grant_type&&(!a.grantTypesSupported||!a.grantTypesSupported.includes(e.grant_type)))throw new Error(`The issuer ${r} does not support the ${e.grant_type} grant`);if(!a.tokenEndpoint)throw new Error(`This issuer ${r} does not have a token endpoint`);const o={method:"POST",headers:{DPoP:await this.dpopHeaderCreator.createHeaderToken(a.tokenEndpoint,"POST"),"content-type":"application/x-www-form-urlencoded"},body:h.default({...e,client_id:i})};n&&(o.headers.Authorization="Basic "+this.btoa(`${i}:${n}`));const s=await(await this.fetcher.fetch(a.tokenEndpoint,o)).json();if(!(s&&s.access_token&&s.id_token&&"string"==typeof s.access_token&&"string"==typeof s.id_token)||s.refresh_token&&"string"!=typeof s.refresh_token)throw new Error("IDP token route returned an invalid response.");await this.storageUtility.setForUser(t,"accessToken",s.access_token),await this.storageUtility.setForUser(t,"idToken",s.id_token),await this.storageUtility.setForUser(t,"refreshToken",s.refresh_token);const f=await this.joseUtility.decodeJWT(s.access_token);if(!f||!f.sub)throw new Error("The idp returned a bad token without a sub.");await this.storageUtility.setForUser(t,"webId",f.sub)}btoa(e){return t.from(e.toString(),"binary").toString("base64")}};f=i([s.injectable(),a(0,s.inject("storageUtility")),a(1,s.inject("issuerConfigFetcher")),a(2,s.inject("fetcher")),a(3,s.inject("dpopHeaderCreator")),a(4,s.inject("joseUtility")),n("design:paramtypes",[Object,Object,Object,Object,Object])],f),e.default=f}).call(this,r(0).Buffer)},function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.sorted,n=e.skipIndex,a=e.ignorenull,o=e.skipBracket,s=e.useDot,u=function(t){return String(t).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~*]/g,(function(t){return"%".concat(t.charCodeAt().toString(16).slice(-2).toUpperCase())}))},h=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(t);return r?e.sort():e},f=function(t){return t.filter((function(t){return t})).join("&")},c=function(t,e){return f(h(e).map((function(r){return p(s?"".concat(t,".").concat(r):"".concat(t,"[").concat(r,"]"),e[r])})))},l=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o?"":"[]";return e.length?f(e.map((function(e,i){return p(n?t+r:t+"["+i+"]",e)}))):u(t+r)},d=function(t,e){return f(Array.from(e).map((function(e){return p(t,e)})))},p=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i(e),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e===n?n=a?n:u(t)+"="+n:/string|number|boolean/.test(r)?n=u(t)+"="+u(e):Array.isArray(e)?n=l(t,e):e instanceof Set?n=d(t,e):"object"===r&&(n=c(t,e)),n};return t&&f(h(t).map((function(e){return p(e,t[e])})))}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getAuthHeaders=e.getPhpSolidServerCookie=e.getNodeSolidServerCookie=e.getAuthFetcher=void 0;const n=r(103),a=i(r(461)),o=i(r(104));e.getAuthFetcher=async function(t,e,r,i=!0){if(!e.length&&i)return{fetch:a.default};const o=await n.customAuthFetcher();let s=(await o.login({oidcIssuer:t,redirect:r})).neededAction.redirectUrl;do{if(s=(await a.default(s,{headers:{cookie:e},redirect:"manual"})).headers.get("location"),null===s)throw new Error(`Please make sure the cookie is valid, and add "${r}" as a trusted app!`)}while(!(null==s?void 0:s.startsWith(r)));return await o.handleRedirect(s),o},e.getNodeSolidServerCookie=async function(t,e,r){const i=await n.customAuthFetcher();return(await i.fetch(t+"/login/password",{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`username=${e}&password=${r}`,method:"POST",redirect:"manual"})).headers.get("set-cookie")},e.getPhpSolidServerCookie=async function(t,e,r){const i=await n.customAuthFetcher();return(await i.fetch(t+"/login",{headers:{"content-type":"application/x-www-form-urlencoded"},body:`username=${e}&password=${r}`,method:"POST",redirect:"manual"})).headers.get("set-cookie")},e.getAuthHeaders=async function(t,e,r){return r instanceof o.default?{Authorization:JSON.parse(r.authenticatedFetcher.tokenRefresher.storageUtility.storage.map["solidAuthFetcherUser:global"]).accessToken,DPop:await r.authenticatedFetcher.tokenRefresher.tokenRequester.dpopHeaderCreator.createHeaderToken(new URL(t),e)}:{Authorization:"",DPop:""}}},function(t,e,r){"use strict";var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();t.exports=e=i.fetch,e.default=i.fetch.bind(i),e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response},function(t,e,r){"use strict";r.r(e),r.d(e,"v1",(function(){return d})),r.d(e,"v3",(function(){return E})),r.d(e,"v4",(function(){return M})),r.d(e,"v5",(function(){return A}));var i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),n=new Uint8Array(16);function a(){if(!i)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(n)}for(var o=[],s=0;s<256;++s)o.push((s+256).toString(16).substr(1));var u,h,f=function(t,e){var r=e||0;return(o[t[r+0]]+o[t[r+1]]+o[t[r+2]]+o[t[r+3]]+"-"+o[t[r+4]]+o[t[r+5]]+"-"+o[t[r+6]]+o[t[r+7]]+"-"+o[t[r+8]]+o[t[r+9]]+"-"+o[t[r+10]]+o[t[r+11]]+o[t[r+12]]+o[t[r+13]]+o[t[r+14]]+o[t[r+15]]).toLowerCase()},c=0,l=0;var d=function(t,e,r){var i=e&&r||0,n=e||new Array(16),o=(t=t||{}).node||u,s=void 0!==t.clockseq?t.clockseq:h;if(null==o||null==s){var d=t.random||(t.rng||a)();null==o&&(o=u=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==s&&(s=h=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:Date.now(),m=void 0!==t.nsecs?t.nsecs:l+1,v=p-c+(m-l)/1e4;if(v<0&&void 0===t.clockseq&&(s=s+1&16383),(v<0||p>c)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,l=m,h=s;var y=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;n[i++]=y>>>24&255,n[i++]=y>>>16&255,n[i++]=y>>>8&255,n[i++]=255&y;var g=p/4294967296*1e4&268435455;n[i++]=g>>>8&255,n[i++]=255&g,n[i++]=g>>>24&15|16,n[i++]=g>>>16&255,n[i++]=s>>>8|128,n[i++]=255&s;for(var b=0;b<6;++b)n[i+b]=o[b];return e||f(n)};var p=function(t,e,r){function i(t,i,n,a){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r>>9<<4)+1}function v(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function y(t,e,r,i,n,a){return v((o=v(v(e,t),v(i,a)))<<(s=n)|o>>>32-s,r);var o,s}function g(t,e,r,i,n,a,o){return y(e&r|~e&i,t,e,n,a,o)}function b(t,e,r,i,n,a,o){return y(e&i|r&~i,t,e,n,a,o)}function w(t,e,r,i,n,a,o){return y(e^r^i,t,e,n,a,o)}function _(t,e,r,i,n,a,o){return y(r^(e|~i),t,e,n,a,o)}var E=p("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r>5]>>>i%32&255,a=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<>5]|=(255&t[i/8])<>>32-e}var A=p("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var i=unescape(encodeURIComponent(t));t=[];for(var n=0;n>>0;b=g,g=y,y=C(v,30)>>>0,v=m,m=E}r[0]=r[0]+m>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+g>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]}))}]); \ No newline at end of file + */var i=r(20),n={JWE:r(82),JWS:r(67),util:r(9)};t.exports=function(t){var e,r,a;if("signatures"in t||"signature"in t)e="JWS",r=function(e,r){return n.JWS.createVerify(e).verify(t,r)},a=(a=t.signatures||[{protected:t.protected,header:t.header,signature:t.signature}]).map((function(t){var e,r={};return t.header&&(r=i(r,t.header)),t.protected&&(e=t.protected,e=n.util.base64url.decode(e,"utf8"),e=JSON.parse(e),r=i(r,e)),r}));else if("ciphertext"in t){e="JWE",r=function(e,r){return n.JWE.createDecrypt(e).decrypt(t,r)};var o={};t.protected&&(o.protected=t.protected,o.protected=n.util.base64url.decode(o.protected,"utf8"),o.protected=JSON.parse(o.protected)),t.unprotected&&(o.unprotected=t.unprotected),a=(a=t.recipients||[{}]).map((function(t){var e={};return t.header&&(e=i(e,t.header)),o.unprotected&&(e=i(e,o.unprotected)),o.protected&&(e=i(e,o.protected)),e}))}return{type:e,format:"json",input:t,all:a,perform:r}}},function(t,e,r){t.exports={decode:r(145),verify:r(411),sign:r(413),JsonWebTokenError:r(63),NotBeforeError:r(195),TokenExpiredError:r(196)}},function(t,e,r){var i=r(2).Buffer,n=r(146),a=r(147),o=r(44),s=r(194),u=r(28);function h(t,e){return i.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function f(t){var e=t.header,r=t.payload,i=t.secret||t.privateKey,n=t.encoding,o=a(e.alg),f=function(t,e,r){r=r||"utf8";var i=h(s(t),"binary"),n=h(s(e),r);return u.format("%s.%s",i,n)}(e,r,n),c=o.sign(f,i);return u.format("%s.%s",f,c)}function c(t){var e=t.secret||t.privateKey||t.key,r=new n(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=r,this.payload=new n(t.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}u.inherits(c,o),c.prototype.sign=function(){try{var t=f({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},c.sign=f,t.exports=c},function(t,e,r){"use strict";var i=r(0).Buffer,n=r(0).SlowBuffer;function a(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))return!1;if(t.length!==e.length)return!1;for(var r=0,n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(h),a||(o.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function h(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=i)<<5|e>>>27)+f(d,n,a,s)+u+r[l]+o[d];u=s,s=a,a=h(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(1),n=r(34),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function h(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function c(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=h(i)+c(p,n,a,s)+u+r[d]+o[p]|0;u=s,s=a,a=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(1),n=r(155),a=r(34),o=r(2).Buffer,s=new Array(64);function u(){this.init(),this._w=s,a.call(this,64,56)}i(u,n),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 t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var i=r(1),n=r(156),a=r(34),o=r(2).Buffer,s=new Array(160);function u(){this.init(),this._w=s,a.call(this,128,112)}i(u,n),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 t=o.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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),t},t.exports=u},function(t,e,r){"use strict";var i=r(1),n=r(2).Buffer,a=r(23),o=n.alloc(128);function s(t,e){a.call(this,"digest"),"string"==typeof e&&(e=n.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=n.concat([e,o],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^e[s],i[s]=92^e[s];this._hash=[r]}i(s,a),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,t]))},t.exports=s},function(t,e,r){t.exports=r(159)},function(t,e,r){(function(e,i){var n,a=r(161),o=r(162),s=r(163),u=r(2).Buffer,h=e.crypto&&e.crypto.subtle,f={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"},c=[];function l(t,e,r,i,n){return h.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return h.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return u.from(t)}))}t.exports=function(t,r,d,p,m,v){"function"==typeof m&&(v=m,m=void 0);var g=f[(m=m||"sha1").toLowerCase()];if(!g||"function"!=typeof e.Promise)return i.nextTick((function(){var e;try{e=s(t,r,d,p,m)}catch(t){return v(t)}v(null,e)}));if(a(t,r,d,p),"function"!=typeof v)throw new Error("No callback provided to pbkdf2");u.isBuffer(t)||(t=u.from(t,o)),u.isBuffer(r)||(r=u.from(r,o)),function(t,e){t.then((function(t){i.nextTick((function(){e(null,t)}))}),(function(t){i.nextTick((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var r=l(n=n||u.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=r,r}(g).then((function(e){return e?l(t,r,d,p,g):s(t,r,d,p,m)})),v)}}).call(this,r(7),r(3))},function(t,e,r){var i=r(331),n=r(94),a=r(95),o=r(344),s=r(60);function u(t,e,r){if(t=t.toLowerCase(),a[t])return n.createCipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function h(t,e,r){if(t=t.toLowerCase(),a[t])return n.createDecipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return u(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return h(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=h,e.listCiphers=e.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},function(t,e,r){var i=r(23),n=r(332),a=r(1),o=r(2).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(t){i.call(this);var e,r=t.mode.toLowerCase(),n=s[r];e=t.decrypt?"decrypt":"encrypt";var a=t.key;o.isBuffer(a)||(a=o.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=o.concat([a,a.slice(0,8)]));var u=t.iv;o.isBuffer(u)||(u=o.from(u)),this._des=n.create({key:a,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,a(u,i),u.prototype._update=function(t){return o.from(this._des.update(t))},u.prototype._final=function(){return o.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(164),e.Cipher=r(93),e.DES=r(165),e.CBC=r(333),e.EDE=r(334)},function(t,e,r){"use strict";var i=r(10),n=r(1),a={};function o(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},l.prototype.flush=function(){for(var t=16-this.cache.length,e=a.allocUnsafe(t),r=-1;++r>o%8,t._prev=a(t._prev,r?i:n);return s}function a(t,e){var r=t.length,n=-1,a=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return a}e.encrypt=function(t,e,r){for(var a=e.length,o=i.allocUnsafe(a),s=-1;++s>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},o.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,t,0,e])),this.state},t.exports=o},function(t,e,r){var i=r(169),n=r(2).Buffer,a=r(95),o=r(170),s=r(23),u=r(59),h=r(60);function f(t,e,r){s.call(this),this._cache=new c,this._last=void 0,this._cipher=new u.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function c(){this.cache=n.allocUnsafe(0)}function l(t,e,r){var s=a[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=n.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new o(s.module,e,r,!0):"auth"===s.type?new i(s.module,e,r,!0):new f(s.module,e,r)}r(1)(f,s),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},c.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=h(e,!1,r.key,r.iv);return l(t,i.key,i.iv)},e.createDecipheriv=l},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,r){(function(t){var i=r(171),n=r(350),a=r(351);var o={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(n[e].prime,"hex"),i=new t(n[e].gen,"hex");return new a(r,i)},e.createDiffieHellman=e.DiffieHellman=function e(r,n,s,u){return t.isBuffer(n)||void 0===o[n]?e(r,"binary",n,s):(n=n||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof r?new a(i(r,s),s,!0):(t.isBuffer(r)||(r=new t(r,n)),new a(r,s,!0)))}}).call(this,r(0).Buffer)},function(t,e){},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o=r(348).Buffer}catch(t){}function s(t,e,r){for(var i=0,n=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"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"}}')},function(t,e,r){(function(e){var i=r(172),n=new(r(173)),a=new i(24),o=new i(11),s=new i(10),u=new i(3),h=new i(7),f=r(171),c=r(31);function l(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new i(t),this}function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new i(t),this}t.exports=m;var p={};function m(t,e,r){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function v(t,r){var i=new e(t.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),i=[r,t.toString(16)].join("_");if(i in p)return p[i];var c,l=0;if(t.isEven()||!f.simpleSieve||!f.fermatTest(t)||!n.test(t))return l+=1,l+="02"===r||"05"===r?8:4,p[i]=l,l;switch(n.test(t.shrn(1))||(l+=2),r){case"02":t.mod(a).cmp(o)&&(l+=8);break;case"05":(c=t.mod(s)).cmp(u)&&c.cmp(h)&&(l+=8);break;default:l+=4}return p[i]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var r=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new e(r.toArray()),a=this.getPrime();if(n.length0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(h),a||(o.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(2).Buffer,n=r(157),a=r(98),o=r(99).ec,s=r(185),u=r(62),h=r(190);function f(t,e,r,a){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function l(t,e,r){var a,o;do{for(a=i.alloc(0);8*a.length=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.2","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"jscs":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","jshint":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","lint":"npm run jscs && npm run jshint","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^1.4.3","coveralls":"^3.0.8","grunt":"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.2","jscs":"^3.0.7","jshint":"^2.10.3","mocha":"^6.2.2"},"dependencies":{"bn.js":"^4.4.0","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},"_resolved":"https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz","_integrity":"sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==","_from":"elliptic@6.5.2"}')},function(t,e){},function(t,e,r){"use strict";var i=r(11),n=r(18),a=r(1),o=r(61),s=i.assert;function u(t){o.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function h(t,e,r,i){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(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(t,e,r,i){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,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,o),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(e))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),a=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,i,a,o,s,u,h,f,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new n(1),m=new n(0),v=new n(0),g=new n(1),y=0;0!==l.cmpn(0);){var b=d.div(l);h=d.sub(b.mul(l)),f=v.sub(b.mul(p));var w=g.sub(b.mul(m));if(!i&&h.cmp(c)<0)e=u.neg(),r=p,i=h.neg(),a=f;else if(i&&2==++y)break;u=h,d=l,l=h,v=p,p=f,g=m,m=w}o=h.neg(),s=f;var _=i.sqr().add(a.sqr());return o.sqr().add(s.sqr()).cmp(_)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),a=a.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:a},{a:o,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),a=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),u=n.mul(r.b),h=a.mul(i.b);return{k1:t.sub(o).sub(s),k2:u.add(h).neg()}},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=i.fromRed().isOdd();return(e&&!a||!e&&a)&&(i=i.redNeg()),this.point(t,i)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},h.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),a=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=a.redSub(o);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(a.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,a=t.y.redMul(e).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),h=u.redMul(o),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),d=this.z.redMul(o);return this.curve.jpoint(c,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var i=r(18),n=r(1),a=r(61),o=r(11);function s(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.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 u(t,e,r){a.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,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)))}n(s,a),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(u,a.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),a=t.x.redSub(t.z).redMul(r),o=n.redMul(i),s=e.z.redMul(a.redAdd(o).redSqr()),u=e.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(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(t){return 0===this.getX().cmp(t.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()}},function(t,e,r){"use strict";var i=r(11),n=r(18),a=r(1),o=r(61),s=i.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function h(t,e,r,i,a){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=a&&new n(a,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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(u,o),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},a(h,o.BasePoint),u.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},u.prototype.point=function(t,e,r,i){return new h(this,t,e,r,i)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),a=i.redAdd(e),o=a.redSub(r),s=i.redSub(e),u=n.redMul(o),h=a.redMul(s),f=n.redMul(s),c=o.redMul(a);return this.curve.point(u,h,c,f)},h.prototype._projDbl=function(){var t,e,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=(h=this.curve._mulA(n)).redAdd(a);if(this.zOne)t=i.redSub(n).redSub(a).redMul(o.redSub(this.curve.two)),e=o.redMul(h.redSub(a)),r=o.redSqr().redSub(o).redSub(o);else{var s=this.z.redSqr(),u=o.redSub(s).redISub(s);t=i.redSub(n).redISub(a).redMul(u),e=o.redMul(h.redSub(a)),r=o.redMul(u)}}else{var h=n.redAdd(a);s=this.curve._mulC(this.z).redSqr(),u=h.redSub(s).redSub(s);t=this.curve._mulC(i.redISub(h)).redMul(u),e=this.curve._mulC(h).redMul(n.redISub(a)),r=h.redMul(u)}return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),a=r.redSub(e),o=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=a.redMul(o),f=s.redMul(u),c=a.redMul(u),l=o.redMul(s);return this.curve.point(h,f,l,c)},h.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(a).redMul(o),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(o.redSub(this.curve._mulA(a))),r=u.redMul(h)):(e=i.redMul(h).redMul(o.redSub(a)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},function(t,e,r){"use strict";e.sha1=r(370),e.sha224=r(371),e.sha256=r(183),e.sha384=r(372),e.sha512=r(184)},function(t,e,r){"use strict";var i=r(16),n=r(48),a=r(182),o=i.rotl32,s=i.sum32,u=i.sum32_5,h=a.ft_1,f=n.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),u=t.toArray("be",o),h=new n({hash:this.hash,entropy:s,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),c=this.n.sub(new i(1)),l=0;;l++){var d=a.k?a.k(l):new i(h.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(c)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),v=m.umod(this.n);if(0!==v.cmpn(0)){var g=d.invm(this.n).mul(v.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(v)?2:0);return a.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new f({r:v,s:g,recoveryParam:y})}}}}}},c.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var a=(e=new f(e,"hex")).r,o=e.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,u=o.invm(this.n),h=u.mul(t).umod(this.n),c=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),c)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(h,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},c.prototype.recoverPubKey=function(t,e,r,n){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,n);var a=this.n,o=new i(t),s=e.r,h=e.s,c=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var d=e.r.invm(a),p=a.sub(o).mul(d).umod(a),m=h.mul(d).umod(a);return this.g.mulAdd(p,s,m)},c.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(t,e,n)}catch(t){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var i=r(101),n=r(180),a=r(10);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var a=[];a.length"}},function(t,e,r){"use strict";var i=r(18),n=r(11),a=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(a(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;for(var i=15&r,n=0,a=0,o=e.place;a>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;if(u(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r),o=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var h=u(t,r);if(t.length!==h+r.place)return!1;var f=t.slice(r.place,h+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new i(o),this.s=new i(f),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var a=i.concat(r),o=[48];return f(o,a.length),o=o.concat(a),n.encode(o,t)}},function(t,e,r){"use strict";var i=r(101),n=r(100),a=r(11),o=a.assert,s=a.parseBytes,u=r(381),h=r(382);function f(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=n[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),t).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:a})},f.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),a=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(a)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e,r){var i=r(49),n=r(1);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){var e;try{e=r(388).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},function(module,exports){var indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0;r=e)throw new Error("invalid sig")}t.exports=function(t,e,r,h,f){var c=o(r);if("ec"===c.type){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,c)}if("dsa"===c.type){if("dsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,a=r.data.q,s=r.data.g,h=r.data.pub_key,f=o.signature.decode(t,"der"),c=f.s,l=f.r;u(c,a),u(l,a);var d=n.mont(i),p=c.invm(a);return 0===s.toRed(d).redPow(new n(e).mul(p).mod(a)).fromRed().mul(h.toRed(d).redPow(l.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(l)}(t,e,c)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");e=i.concat([f,e]);for(var l=c.modulus.byteLength(),d=[1],p=0;e.length+d.length+2=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=s(t,r,r+6),this.words[i]|=n<>>26-a&4194303,(a+=24)>=26&&(a-=26,i++);r+6!==e&&(n=s(t,e,r+6),this.words[i]|=n<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=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 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"],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],c=[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(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===e,h=new t(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),h[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],w=8191&b,_=b>>>13,E=0|o[4],M=8191&E,S=E>>>13,C=0|o[5],A=8191&C,k=C>>>13,T=0|o[6],I=8191&T,R=T>>>13,P=0|o[7],B=8191&P,x=P>>>13,O=0|o[8],N=8191&O,j=O>>>13,F=0|o[9],L=8191&F,D=F>>>13,U=0|s[0],K=8191&U,q=U>>>13,z=0|s[1],V=8191&z,H=z>>>13,Z=0|s[2],G=8191&Z,W=Z>>>13,$=0|s[3],Q=8191&$,Y=$>>>13,J=0|s[4],X=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,q))+Math.imul(l,K)|0))<<13)|0;h=((a=Math.imul(l,q))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(m,K)|0,a=Math.imul(m,q);var gt=(h+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(l,V)|0))<<13)|0;h=((a=a+Math.imul(l,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,q))+Math.imul(y,K)|0,a=Math.imul(y,q),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,H)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((a=a+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,q))+Math.imul(_,K)|0,a=Math.imul(_,q),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var bt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,Q)|0))<<13)|0;h=((a=a+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,K),n=(n=Math.imul(M,q))+Math.imul(S,K)|0,a=Math.imul(S,q),i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,W)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var wt=(h+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((a=a+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,K),n=(n=Math.imul(A,q))+Math.imul(k,K)|0,a=Math.imul(k,q),i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,W)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,tt)|0;var _t=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((a=a+Math.imul(l,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(R,K)|0,a=Math.imul(R,q),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,H)|0,i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,W)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(g,X)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,X)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var Et=(h+(i=i+Math.imul(c,at)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(l,at)|0))<<13)|0;h=((a=a+Math.imul(l,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(x,K)|0,a=Math.imul(x,q),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,W)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,X)|0,a=a+Math.imul(_,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((a=a+Math.imul(l,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,q))+Math.imul(j,K)|0,a=Math.imul(j,q),i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(x,V)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,a=a+Math.imul(m,ht)|0;var St=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((a=a+Math.imul(l,lt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,K),n=(n=Math.imul(L,q))+Math.imul(D,K)|0,a=Math.imul(D,q),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(j,V)|0,a=a+Math.imul(j,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,W)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,X)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,a=a+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,a=a+Math.imul(m,lt)|0;var Ct=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((a=a+Math.imul(l,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,H))+Math.imul(D,V)|0,a=Math.imul(D,H),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(M,at)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,a=a+Math.imul(_,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,a=a+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,W))+Math.imul(D,G)|0,a=Math.imul(D,W),i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,Y)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(S,ut)|0,a=a+Math.imul(S,ht)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,a=a+Math.imul(_,lt)|0;var kt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;h=((a=a+Math.imul(y,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(D,Q)|0,a=Math.imul(D,Y),i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(j,X)|0,a=a+Math.imul(j,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(x,rt)|0,a=a+Math.imul(x,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,a=a+Math.imul(k,ht)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,lt)|0)+Math.imul(S,ct)|0,a=a+Math.imul(S,lt)|0;var Tt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((a=a+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,tt))+Math.imul(D,X)|0,a=Math.imul(D,tt),i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(j,rt)|0,a=a+Math.imul(j,it)|0,i=i+Math.imul(B,at)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(x,at)|0,a=a+Math.imul(x,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(k,ct)|0,a=a+Math.imul(k,lt)|0;var It=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,mt)|0)+Math.imul(S,pt)|0))<<13)|0;h=((a=a+Math.imul(S,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(L,rt),n=(n=Math.imul(L,it))+Math.imul(D,rt)|0,a=Math.imul(D,it),i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(x,ut)|0,a=a+Math.imul(x,ht)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,lt)|0)+Math.imul(R,ct)|0,a=a+Math.imul(R,lt)|0;var Rt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(L,at),n=(n=Math.imul(L,ot))+Math.imul(D,at)|0,a=Math.imul(D,ot),i=i+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,ht)|0)+Math.imul(j,ut)|0,a=a+Math.imul(j,ht)|0,i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,lt)|0)+Math.imul(x,ct)|0,a=a+Math.imul(x,lt)|0;var Pt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((a=a+Math.imul(R,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(L,ut),n=(n=Math.imul(L,ht))+Math.imul(D,ut)|0,a=Math.imul(D,ht),i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(j,ct)|0,a=a+Math.imul(j,lt)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((a=a+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(L,ct),n=(n=Math.imul(L,lt))+Math.imul(D,ct)|0,a=Math.imul(D,lt);var xt=(h+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(j,pt)|0))<<13)|0;h=((a=a+Math.imul(j,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Ot=(h+(i=Math.imul(L,pt))|0)+((8191&(n=(n=Math.imul(L,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((a=Math.imul(D,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=Mt,u[8]=St,u[9]=Ct,u[10]=At,u[11]=kt,u[12]=Tt,u[13]=It,u[14]=Rt,u[15]=Pt,u[16]=Bt,u[17]=xt,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,h=0;h=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-a|c>>>a,f=c&s}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(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(n,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(c)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new E(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),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)}g.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();i(v=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},n(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(15)(t))},function(t,e){},function(t,e,r){e.publicEncrypt=r(404),e.privateDecrypt=r(406),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var i=r(62),n=r(31),a=r(46),o=r(191),s=r(192),u=r(102),h=r(193),f=r(98),c=r(2).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===l)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,h=a("sha1").update(c.alloc(0)).digest(),f=h.length,l=2*f;if(i>r-l-2)throw new Error("message too long");var d=c.alloc(r-i-l-2),p=r-f-1,m=n(f),v=s(c.concat([h,d,c.alloc(1,1),e],p),o(m,p)),g=s(m,o(v,f));return new u(c.concat([c.alloc(1),g,v],r))}(p,e);else if(1===l)d=function(t,e,r){var i,a=e.length,o=t.modulus.byteLength();if(a>o-11)throw new Error("message too long");i=r?c.alloc(o-a-3,255):function(t){var e,r=c.allocUnsafe(t),i=0,a=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):h(d,p)}},function(t,e){},function(t,e,r){var i=r(62),n=r(191),a=r(192),o=r(102),s=r(98),u=r(46),h=r(193),f=r(2).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var l,d=i(t),p=d.modulus.byteLength();if(e.length>p||new o(e).cmp(d.modulus)>=0)throw new Error("decryption error");l=r?h(new o(e),d):s(e,d);var m=f.alloc(p-l.length);if(l=f.concat([m,l],p),4===c)return function(t,e){var r=t.modulus.byteLength(),i=u("sha1").update(f.alloc(0)).digest(),o=i.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,o+1),h=e.slice(o+1),c=a(s,n(h,o)),l=a(h,n(c,r-o-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));var n=-1;for(;++n=e.length){a++;break}var o=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++;o.length<8&&a++;if(a)throw new Error("decryption error");return e.slice(n)}(0,l,r);if(3===c)return l;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var a=r(2),o=r(31),s=a.Buffer,u=a.kMaxLength,h=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function c(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function l(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function d(t,e,r,n){if(i.browser){var a=t.buffer,s=new Uint8Array(a,e,r);return h.getRandomValues(s),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return o(r).copy(t,e),t;o(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}h&&h.getRandomValues||!i.browser?(e.randomFill=function(e,r,i,n){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=e.length;else if("function"==typeof i)n=i,i=e.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return c(r,e.length),l(i,r,e.length),d(e,r,i,n)},e.randomFillSync=function(e,r,i){void 0===r&&(r=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');c(r,e.length),void 0===i&&(i=e.length-r);return l(i,r,e.length),d(e,r,i)}):(e.randomFill=n,e.randomFillSync=n)}).call(this,r(7),r(3))},function(t,e,r){"use strict";var i=r(2).Buffer,n=r(409);function a(t){if(i.isBuffer(t))return t;if("string"==typeof t)return i.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function o(t,e,r){for(var i=0;e+i=128&&--i,i}t.exports={derToJose:function(t,e){t=a(t);var r=n(e),o=r+1,s=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var h=t[u++];if(129===h&&(h=t[u++]),s-up+(r.clockTolerance||0))return d(new n("jwt not active",new Date(1e3*b.nbf)))}if(void 0!==b.exp&&!r.ignoreExpiration){if("number"!=typeof b.exp)return d(new i("invalid exp value"));if(p>=b.exp+(r.clockTolerance||0))return d(new a("jwt expired",new Date(1e3*b.exp)))}if(r.audience){var w=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(b.aud)?b.aud:[b.aud]).some((function(t){return w.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return d(new i("jwt audience invalid. expected: "+w.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&b.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(b.iss)))return d(new i("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&b.sub!==r.subject)return d(new i("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&b.jti!==r.jwtid)return d(new i("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&b.nonce!==r.nonce)return d(new i("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof b.iat)return d(new i("iat required when maxAge is specified"));var _=s(r.maxAge,b.iat);if(void 0===_)return d(new i('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(p>=_+(r.clockTolerance||0))return d(new a("maxAge exceeded",new Date(1e3*_)))}if(!0===r.complete){var E=m.signature;return d(null,{header:y,payload:b,signature:E})}return d(null,b)}))}},function(t,e,r){(function(r){var i;e=t.exports=G,i="object"==typeof r&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var n=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],o=e.src=[],s=0,u=s++;o[u]="0|[1-9]\\d*";var h=s++;o[h]="[0-9]+";var f=s++;o[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var c=s++;o[c]="("+o[u]+")\\.("+o[u]+")\\.("+o[u]+")";var l=s++;o[l]="("+o[h]+")\\.("+o[h]+")\\.("+o[h]+")";var d=s++;o[d]="(?:"+o[u]+"|"+o[f]+")";var p=s++;o[p]="(?:"+o[h]+"|"+o[f]+")";var m=s++;o[m]="(?:-("+o[d]+"(?:\\."+o[d]+")*))";var v=s++;o[v]="(?:-?("+o[p]+"(?:\\."+o[p]+")*))";var g=s++;o[g]="[0-9A-Za-z-]+";var y=s++;o[y]="(?:\\+("+o[g]+"(?:\\."+o[g]+")*))";var b=s++,w="v?"+o[c]+o[m]+"?"+o[y]+"?";o[b]="^"+w+"$";var _="[v=\\s]*"+o[l]+o[v]+"?"+o[y]+"?",E=s++;o[E]="^"+_+"$";var M=s++;o[M]="((?:<|>)?=?)";var S=s++;o[S]=o[h]+"|x|X|\\*";var C=s++;o[C]=o[u]+"|x|X|\\*";var A=s++;o[A]="[v=\\s]*("+o[C]+")(?:\\.("+o[C]+")(?:\\.("+o[C]+")(?:"+o[m]+")?"+o[y]+"?)?)?";var k=s++;o[k]="[v=\\s]*("+o[S]+")(?:\\.("+o[S]+")(?:\\.("+o[S]+")(?:"+o[v]+")?"+o[y]+"?)?)?";var T=s++;o[T]="^"+o[M]+"\\s*"+o[A]+"$";var I=s++;o[I]="^"+o[M]+"\\s*"+o[k]+"$";var R=s++;o[R]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var P=s++;o[P]="(?:~>?)";var B=s++;o[B]="(\\s*)"+o[P]+"\\s+",a[B]=new RegExp(o[B],"g");var x=s++;o[x]="^"+o[P]+o[A]+"$";var O=s++;o[O]="^"+o[P]+o[k]+"$";var N=s++;o[N]="(?:\\^)";var j=s++;o[j]="(\\s*)"+o[N]+"\\s+",a[j]=new RegExp(o[j],"g");var F=s++;o[F]="^"+o[N]+o[A]+"$";var L=s++;o[L]="^"+o[N]+o[k]+"$";var D=s++;o[D]="^"+o[M]+"\\s*("+_+")$|^$";var U=s++;o[U]="^"+o[M]+"\\s*("+w+")$|^$";var K=s++;o[K]="(\\s*)"+o[M]+"\\s*("+_+"|"+o[A]+")",a[K]=new RegExp(o[K],"g");var q=s++;o[q]="^\\s*("+o[A]+")\\s+-\\s+("+o[A]+")\\s*$";var z=s++;o[z]="^\\s*("+o[k]+")\\s+-\\s+("+o[k]+")\\s*$";var V=s++;o[V]="(<|>)?=?\\s*\\*";for(var H=0;H<35;H++)i(H,o[H]),a[H]||(a[H]=new RegExp(o[H]));function Z(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof G)return t;if("string"!=typeof t)return null;if(t.length>256)return null;if(!(e.loose?a[E]:a[b]).test(t))return null;try{return new G(t,e)}catch(t){return null}}function G(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof G){if(t.loose===e.loose)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof G))return new G(t,e);i("SemVer",t,e),this.options=e,this.loose=!!e.loose;var r=t.trim().match(e.loose?a[E]:a[b]);if(!r)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,r,i){"string"==typeof r&&(i=r,r=void 0);try{return new G(t,r).inc(e,i).version}catch(t){return null}},e.diff=function(t,e){if(X(t,e))return null;var r=Z(t),i=Z(e),n="";if(r.prerelease.length||i.prerelease.length){n="pre";var a="prerelease"}for(var o in r)if(("major"===o||"minor"===o||"patch"===o)&&r[o]!==i[o])return n+o;return a},e.compareIdentifiers=$;var W=/^[0-9]+$/;function $(t,e){var r=W.test(t),i=W.test(e);return r&&i&&(t=+t,e=+e),t===e?0:r&&!i?-1:i&&!r?1:t0}function J(t,e,r){return Q(t,e,r)<0}function X(t,e,r){return 0===Q(t,e,r)}function tt(t,e,r){return 0!==Q(t,e,r)}function et(t,e,r){return Q(t,e,r)>=0}function rt(t,e,r){return Q(t,e,r)<=0}function it(t,e,r,i){switch(e){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),t===r;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),t!==r;case"":case"=":case"==":return X(t,r,i);case"!=":return tt(t,r,i);case">":return Y(t,r,i);case">=":return et(t,r,i);case"<":return J(t,r,i);case"<=":return rt(t,r,i);default:throw new TypeError("Invalid operator: "+e)}}function nt(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof nt){if(t.loose===!!e.loose)return t;t=t.value}if(!(this instanceof nt))return new nt(t,e);i("comparator",t,e),this.options=e,this.loose=!!e.loose,this.parse(t),this.semver===at?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}e.rcompareIdentifiers=function(t,e){return $(e,t)},e.major=function(t,e){return new G(t,e).major},e.minor=function(t,e){return new G(t,e).minor},e.patch=function(t,e){return new G(t,e).patch},e.compare=Q,e.compareLoose=function(t,e){return Q(t,e,!0)},e.rcompare=function(t,e,r){return Q(e,t,r)},e.sort=function(t,r){return t.sort((function(t,i){return e.compare(t,i,r)}))},e.rsort=function(t,r){return t.sort((function(t,i){return e.rcompare(t,i,r)}))},e.gt=Y,e.lt=J,e.eq=X,e.neq=tt,e.gte=et,e.lte=rt,e.cmp=it,e.Comparator=nt;var at={};function ot(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof ot)return t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease?t:new ot(t.raw,e);if(t instanceof nt)return new ot(t.value,e);if(!(this instanceof ot))return new ot(t,e);if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map((function(t){return this.parseRange(t.trim())}),this).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function st(t){return!t||"x"===t.toLowerCase()||"*"===t}function ut(t,e,r,i,n,a,o,s,u,h,f,c,l){return((e=st(r)?"":st(i)?">="+r+".0.0":st(n)?">="+r+"."+i+".0":">="+e)+" "+(s=st(u)?"":st(h)?"<"+(+u+1)+".0.0":st(f)?"<"+u+"."+(+h+1)+".0":c?"<="+u+"."+h+"."+f+"-"+c:"<="+s)).trim()}function ht(t,e,r){for(var n=0;n0){var a=t[n].semver;if(a.major===e.major&&a.minor===e.minor&&a.patch===e.patch)return!0}return!1}return!0}function ft(t,e,r){try{e=new ot(e,r)}catch(t){return!1}return e.test(t)}function ct(t,e,r,i){var n,a,o,s,u;switch(t=new G(t,i),e=new ot(e,i),r){case">":n=Y,a=rt,o=J,s=">",u=">=";break;case"<":n=J,a=et,o=Y,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ft(t,e,i))return!1;for(var h=0;h=0.0.0")),c=c||t,l=l||t,n(t.semver,c.semver,i)?c=t:o(t.semver,l.semver,i)&&(l=t)})),c.operator===s||c.operator===u)return!1;if((!l.operator||l.operator===s)&&a(t,l.semver))return!1;if(l.operator===u&&o(t,l.semver))return!1}return!0}nt.prototype.parse=function(t){var e=this.options.loose?a[D]:a[U],r=t.match(e);if(!r)throw new TypeError("Invalid comparator: "+t);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new G(r[2],this.options.loose):this.semver=at},nt.prototype.toString=function(){return this.value},nt.prototype.test=function(t){return i("Comparator.test",t,this.options.loose),this.semver===at||("string"==typeof t&&(t=new G(t,this.options)),it(t,this.operator,this.semver,this.options))},nt.prototype.intersects=function(t,e){if(!(t instanceof nt))throw new TypeError("a Comparator is required");var r;if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),""===this.operator)return r=new ot(t.value,e),ft(this.value,r,e);if(""===t.operator)return r=new ot(this.value,e),ft(t.semver,r,e);var i=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),a=this.semver.version===t.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=it(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=it(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return i||n||a&&o||s||u},e.Range=ot,ot.prototype.format=function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range},ot.prototype.toString=function(){return this.range},ot.prototype.parseRange=function(t){var e=this.options.loose;t=t.trim();var r=e?a[z]:a[q];t=t.replace(r,ut),i("hyphen replace",t),t=t.replace(a[K],"$1$2$3"),i("comparator trim",t,a[K]),t=(t=(t=t.replace(a[B],"$1~")).replace(a[j],"$1^")).split(/\s+/).join(" ");var n=e?a[D]:a[U],o=t.split(" ").map((function(t){return function(t,e){return i("comp",t,e),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){i("caret",t,e);var r=e.loose?a[L]:a[F];return t.replace(r,(function(e,r,n,a,o){var s;return i("caret",t,e,r,n,a,o),st(r)?s="":st(n)?s=">="+r+".0.0 <"+(+r+1)+".0.0":st(a)?s="0"===r?">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0":">="+r+"."+n+".0 <"+(+r+1)+".0.0":o?(i("replaceCaret pr",o),s="0"===r?"0"===n?">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+n+"."+(+a+1):">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+(+n+1)+".0":">="+r+"."+n+"."+a+"-"+o+" <"+(+r+1)+".0.0"):(i("no pr"),s="0"===r?"0"===n?">="+r+"."+n+"."+a+" <"+r+"."+n+"."+(+a+1):">="+r+"."+n+"."+a+" <"+r+"."+(+n+1)+".0":">="+r+"."+n+"."+a+" <"+(+r+1)+".0.0"),i("caret return",s),s}))}(t,e)})).join(" ")}(t,e),i("caret",t),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){var r=e.loose?a[O]:a[x];return t.replace(r,(function(e,r,n,a,o){var s;return i("tilde",t,e,r,n,a,o),st(r)?s="":st(n)?s=">="+r+".0.0 <"+(+r+1)+".0.0":st(a)?s=">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0":o?(i("replaceTilde pr",o),s=">="+r+"."+n+"."+a+"-"+o+" <"+r+"."+(+n+1)+".0"):s=">="+r+"."+n+"."+a+" <"+r+"."+(+n+1)+".0",i("tilde return",s),s}))}(t,e)})).join(" ")}(t,e),i("tildes",t),t=function(t,e){return i("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return function(t,e){t=t.trim();var r=e.loose?a[I]:a[T];return t.replace(r,(function(e,r,n,a,o,s){i("xRange",t,e,r,n,a,o,s);var u=st(n),h=u||st(a),f=h||st(o);return"="===r&&f&&(r=""),u?e=">"===r||"<"===r?"<0.0.0":"*":r&&f?(h&&(a=0),o=0,">"===r?(r=">=",h?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===r&&(r="<",h?n=+n+1:a=+a+1),e=r+n+"."+a+"."+o):h?e=">="+n+".0.0 <"+(+n+1)+".0.0":f&&(e=">="+n+"."+a+".0 <"+n+"."+(+a+1)+".0"),i("xRange return",e),e}))}(t,e)})).join(" ")}(t,e),i("xrange",t),t=function(t,e){return i("replaceStars",t,e),t.trim().replace(a[V],"")}(t,e),i("stars",t),t}(t,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(o=o.filter((function(t){return!!t.match(n)}))),o=o.map((function(t){return new nt(t,this.options)}),this)},ot.prototype.intersects=function(t,e){if(!(t instanceof ot))throw new TypeError("a Range is required");return this.set.some((function(r){return r.every((function(r){return t.set.some((function(t){return t.every((function(t){return r.intersects(t,e)}))}))}))}))},e.toComparators=function(t,e){return new ot(t,e).set.map((function(t){return t.map((function(t){return t.value})).join(" ").trim().split(" ")}))},ot.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new G(t,this.options));for(var e=0;e":0===e.prerelease.length?e.patch++:e.prerelease.push(0),e.raw=e.format();case"":case">=":r&&!Y(r,e)||(r=e);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+t.operator)}}))}if(r&&t.test(r))return r;return null},e.validRange=function(t,e){try{return new ot(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,r){return ct(t,e,"<",r)},e.gtr=function(t,e,r){return ct(t,e,">",r)},e.outside=ct,e.prerelease=function(t,e){var r=Z(t,e);return r&&r.prerelease.length?r.prerelease:null},e.intersects=function(t,e,r){return t=new ot(t,r),e=new ot(e,r),t.intersects(e)},e.coerce=function(t){if(t instanceof G)return t;if("string"!=typeof t)return null;var e=t.match(a[R]);if(null==e)return null;return Z(e[1]+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,r(3))},function(t,e,r){(function(e){var i=r(197),n=r(199),a=r(87),o=r(414),s=r(415),u=r(416),h=r(417),f=r(418),c=r(419),l=r(420),d=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];n&&d.splice(3,0,"PS256","PS384","PS512");var p={expiresIn:{isValid:function(t){return u(t)||c(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return u(t)||c(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return c(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,d),message:'"algorithm" must be a valid string enum value'},header:{isValid:f,message:'"header" must be an object'},encoding:{isValid:c,message:'"encoding" must be a string'},issuer:{isValid:c,message:'"issuer" must be a string'},subject:{isValid:c,message:'"subject" must be a string'},jwtid:{isValid:c,message:'"jwtid" must be a string'},noTimestamp:{isValid:s,message:'"noTimestamp" must be a boolean'},keyid:{isValid:c,message:'"keyid" must be a string'},mutatePayload:{isValid:s,message:'"mutatePayload" must be a boolean'}},m={iat:{isValid:h,message:'"iat" should be a number of seconds'},exp:{isValid:h,message:'"exp" should be a number of seconds'},nbf:{isValid:h,message:'"nbf" should be a number of seconds'}};function v(t,e,r,i){if(!f(r))throw new Error('Expected "'+i+'" to be a plain object.');Object.keys(r).forEach((function(n){var a=t[n];if(a){if(!a.isValid(r[n]))throw new Error(a.message)}else if(!e)throw new Error('"'+n+'" is not allowed in "'+i+'"')}))}var g={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},y=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(t,r,n,o){"function"==typeof n?(o=n,n={}):n=n||{};var s="object"==typeof t&&!e.isBuffer(t),u=Object.assign({alg:n.algorithm||"HS256",typ:s?"JWT":void 0,kid:n.keyid},n.header);function h(t){if(o)return o(t);throw t}if(!r&&"none"!==n.algorithm)return h(new Error("secretOrPrivateKey must have a value"));if(void 0===t)return h(new Error("payload is required"));if(s){try{!function(t){v(m,!0,t,"payload")}(t)}catch(t){return h(t)}n.mutatePayload||(t=Object.assign({},t))}else{var f=y.filter((function(t){return void 0!==n[t]}));if(f.length>0)return h(new Error("invalid "+f.join(",")+" option for "+typeof t+" payload"))}if(void 0!==t.exp&&void 0!==n.expiresIn)return h(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==t.nbf&&void 0!==n.notBefore)return h(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(t){v(p,!1,t,"options")}(n)}catch(t){return h(t)}var c=t.iat||Math.floor(Date.now()/1e3);if(n.noTimestamp?delete t.iat:s&&(t.iat=c),void 0!==n.notBefore){try{t.nbf=i(n.notBefore,c)}catch(t){return h(t)}if(void 0===t.nbf)return h(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==n.expiresIn&&"object"==typeof t){try{t.exp=i(n.expiresIn,c)}catch(t){return h(t)}if(void 0===t.exp)return h(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(g).forEach((function(e){var r=g[e];if(void 0!==n[e]){if(void 0!==t[r])return h(new Error('Bad "options.'+e+'" option. The payload already has an "'+r+'" property.'));t[r]=n[e]}}));var d=n.encoding||"utf8";if("function"!=typeof o)return a.sign({header:u,payload:t,secret:r,encoding:d});o=o&&l(o),a.createSign({header:u,privateKey:r,payload:t,encoding:d}).once("error",o).once("done",(function(t){o(null,t)}))}}).call(this,r(0).Buffer)},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=/^(?:0|[1-9]\d*)$/,s=parseInt;function u(t){return t!=t}function h(t,e){return function(t,e){for(var r=-1,i=t?t.length:0,n=Array(i);++r-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}(t.length)&&!function(t){var e=M(t)?p.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)}function M(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function S(t){return!!t&&"object"==typeof t}t.exports=function(t,e,o,f){var c;t=E(t)?t:(c=t)?h(c,function(t){return E(t)?y(t):b(t)}(c)):[],o=o&&!f?function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"==p.call(t)}(t))return NaN;if(M(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=M(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var o=n.test(t);return o||a.test(t)?s(t.slice(2),o?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),o=e%1;return e==e?o?e-o:e:0}(o):0;var l=t.length;return o<0&&(o=g(l+o,0)),function(t){return"string"==typeof t||!_(t)&&S(t)&&"[object String]"==p.call(t)}(t)?o<=l&&t.indexOf(e,o)>-1:!!l&&function(t,e,r){if(e!=e)return function(t,e,r,i){for(var n=t.length,a=r+(i?1:-1);i?a--:++a-1}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return!0===t||!1===t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Boolean]"==r.call(t)}},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s=Object.prototype.toString;function u(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return"number"==typeof t&&t==function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(u(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=u(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var h=n.test(t);return h||a.test(t)?o(t.slice(2),h?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),h=e%1;return e==e?h?e-h:e:0}(t)}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return"number"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Number]"==r.call(t)}},function(t,e){var r,i,n=Function.prototype,a=Object.prototype,o=n.toString,s=a.hasOwnProperty,u=o.call(Object),h=a.toString,f=(r=Object.getPrototypeOf,i=Object,function(t){return r(i(t))});t.exports=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=h.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=f(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&o.call(r)==u}},function(t,e){var r=Object.prototype.toString,i=Array.isArray;t.exports=function(t){return"string"==typeof t||!i(t)&&function(t){return!!t&&"object"==typeof t}(t)&&"[object String]"==r.call(t)}},function(t,e){var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s=Object.prototype.toString;function u(t,e){var u;if("function"!=typeof e)throw new TypeError("Expected a function");return t=function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(h(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=h(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var u=n.test(t);return u||a.test(t)?o(t.slice(2),u?2:8):i.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),u=e%1;return e==e?u?e-u:e:0}(t),function(){return--t>0&&(u=e.apply(this,arguments)),t<=1&&(e=void 0),u}}function h(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return u(2,t)}},function(t,e,r){"use strict";const{promisify:i}=r(28),n=r(88),a=i(n.randomBytes),o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~".split(""),s="0123456789".split(""),u="CDEHKMPRTUWXY012458".split(""),h="!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".split(""),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),c=[void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"],l=(t,e)=>({length:r,type:i,characters:n})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(void 0!==i&&void 0!==n)throw new TypeError("Expected either `type` or `characters`");if(void 0!==n&&"string"!=typeof n)throw new TypeError("Expected `characters` to be string");if(!c.includes(i))throw new TypeError("Unknown type: "+i);if(void 0===i&&void 0===n&&(i="hex"),"hex"===i||void 0===i&&void 0===n)return e(Math.ceil(.5*r),"hex",r);if("base64"===i)return e(Math.ceil(.75*r),"base64",r);if("url-safe"===i)return t(r,o);if("numeric"===i)return t(r,s);if("distinguishable"===i)return t(r,u);if("ascii-printable"===i)return t(r,h);if("alphanumeric"===i)return t(r,f);if(0===n.length)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(n.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return t(r,n.split(""))};t.exports=l((t,e)=>{const r=e.length,i=Math.floor(65536/r)*r-1,a=2*Math.ceil(1.1*t);let o="",s=0;for(;si||(o+=e[t%r],s++)}}return o},(t,e,r)=>n.randomBytes(t).toString(e).slice(0,r)),t.exports.async=l(async(t,e)=>{const r=e.length,i=Math.floor(65536/r)*r-1,n=2*Math.ceil(1.1*t);let o="",s=0;for(;si||(o+=e[t%r],s++)}}return o},async(t,e,r)=>(await a(t)).toString(e).slice(0,r))},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(39));let h=class{constructor(t,e,r,i,n){this.oidcHandler=t,this.issuerConfigFetcher=e,this.dpopClientKeyManager=r,this.storageUtility=i,this.clientRegistrar=n}checkOptions(t){return t.oidcIssuer&&t.redirect?null:new u.default("OidcLoginHandler requires an oidcIssuer")}async canHandle(t){return!this.checkOptions(t)}async handle(t){const e=this.checkOptions(t);if(e)throw e;const r=await this.issuerConfigFetcher.fetchConfig(t.oidcIssuer),i={issuer:t.oidcIssuer,dpop:!0,redirectUrl:t.redirect,issuerConfiguration:r,client:await this.clientRegistrar.getClient(t,r),localUserId:t.localUserId,doNotAutoRedirect:t.doNotAutoRedirect};return await this.dpopClientKeyManager.generateClientKeyIfNotAlready(i),await this.oidcHandler.handle(i)}};h=i([s.injectable(),a(0,s.inject("oidcHandler")),a(1,s.inject("issuerConfigFetcher")),a(2,s.inject("dpopClientKeyManager")),a(3,s.inject("storageUtility")),a(4,s.inject("clientRegistrar")),n("design:paramtypes",[Object,Object,Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("oidcHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("AuthorizationCodeOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5);let h=class{constructor(t,e,r,i){this.sessionCreator=t,this.joseUtility=e,this.storageUtility=r,this.redirector=i}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1)}async handle(t){const e=new s.default(t.issuerConfiguration.authorizationEndpoint.toString()),r=await this.joseUtility.generateCodeVerifier(),i=this.sessionCreator.create({localUserId:t.localUserId,loggedIn:!1}),n={response_type:"id_token code",redirect_uri:t.redirectUrl.toString(),scope:"openid profile offline_access",client_id:t.client.clientId,code_challenge_method:"S256",code_challenge:await this.joseUtility.generateCodeChallenge(r),state:i.localUserId};return e.set("query",n),await this.storageUtility.setForUser(i.localUserId,"codeVerifier",r),await this.storageUtility.setForUser(i.localUserId,"issuer",t.issuer.toString()),await this.storageUtility.setForUser(i.localUserId,"clientId",t.client.clientId),await this.storageUtility.setForUser(i.localUserId,"redirectUri",t.redirectUrl.toString()),t.client.clientSecret&&await this.storageUtility.setForUser(i.localUserId,"clientSecret",t.client.clientSecret),i.neededAction=this.redirector.redirect(e.toString(),{doNotAutoRedirect:!!t.doNotAutoRedirect}),i}};h=i([u.injectable(),a(0,u.inject("sessionCreator")),a(1,u.inject("joseUtility")),a(2,u.inject("storageUtility")),a(3,u.inject("redirector")),n("design:paramtypes",[Object,Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("ClientCredentialsOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("PrimaryDeviceOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("SecondaryDeviceOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5);let h=class{constructor(t,e,r){this.fetcher=t,this.dpopHeaderCreator=e,this.sessionCreator=r}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("implicit")>-1)}async handle(t){const e=new s.default(t.issuerConfiguration.authorizationEndpoint.toString()),r={response_type:"id_token token",redirect_url:t.redirectUrl.toString(),scope:"openid id_vc"};return t.dpop&&(r.dpop=await this.dpopHeaderCreator.createHeaderToken(t.issuer,"GET")),e.set("query",r),this.sessionCreator.create({neededAction:{actionType:"redirect",redirectUrl:e.toString()},loggedIn:!1})}};h=i([u.injectable(),a(0,u.inject("fetcher")),a(1,u.inject("dpopHeaderCreator")),a(2,u.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t){return!1}async handle(t){throw new n.default("RefreshTokenOidcHandler handle")}}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(14)),a=i(r(432)),o=i(r(433)).default("SolidAuthFetcher");o("Ready to roll");e.default=class{async fetch(t,e){const r=t instanceof n.default?t.toString():t,i=[];return e&&(e.method&&i.push(`-X '${e.method}'`),e.body&&i.push(`-d '${e.body.toString().length>1e3?e.body.toString().substring(0,100)+"...":e.body}'`),e.headers&&(Array.isArray(e.headers)?e.headers.forEach(t=>{i.push(`-H '${t[0]}: ${t[1]}'`)}):Object.keys(e.headers).forEach(t=>{i.push(`-H '${t}: ${e.headers[t]}'`)}))),o(`curl -v ${i.join(" ")} ${t}`),"undefined"!=typeof window&&void 0!==window.fetch?window.fetch(r,e):a.default(r,e)}}},function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:this);!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in t,o="ArrayBuffer"in t;if(o)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];_.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function M(t,r){return new Promise((function(i,a){var o=new b(t,r);if(o.signal&&o.signal.aborted)return a(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;i(new _(n,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new e.DOMException("Aborted","AbortError"))},s.open(o.method,o.url,!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&n&&(s.responseType="blob"),o.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",u)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}M.polyfill=!0,t.fetch||(t.fetch=M,t.Headers=l,t.Request=b,t.Response=_),e.Headers=l,e.Request=b,e.Response=_,e.fetch=M}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e},function(t,e,r){(function(i){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(i++,"%c"===t&&(n=i))}),e.splice(n,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=r(434)(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r(3))},function(t,e,r){t.exports=function(t){function e(t){let r,n=null;function a(...t){if(!a.enabled)return;const i=a,n=Number(new Date),o=n-(r||n);i.diff=o,i.prev=r,i.curr=n,r=n,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,n)=>{if("%%"===r)return"%";s++;const a=e.formatters[n];if("function"==typeof a){const e=t[s];r=a.call(i,e),t.splice(s,1),s--}return r}),e.formatArgs.call(i,t);(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null===n?e.enabled(t):n,set:t=>{n=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,r){const i=e(this.namespace+(void 0===r?":":r)+t);return i.log=this.log,i}function n(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(n),...e.skips.map(n).map(t=>"-"+t)].join(",");return e.enable(""),t},e.enable=function(t){let r;e.save(t),e.names=[],e.skips=[];const i=("string"==typeof t?t:"").split(/[\s,]+/),n=i.length;for(r=0;r{e[r]=t[r]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=r(5),h=o(r(436)),f=o(r(39)),c={issuer:{toKey:"issuer",convertToUrl:!0},authorization_endpoint:{toKey:"authorizationEndpoint",convertToUrl:!0},token_endpoint:{toKey:"tokenEndpoint",convertToUrl:!0},userinfo_endpoint:{toKey:"userinfoEndpoint",convertToUrl:!0},jwks_uri:{toKey:"jwksUri",convertToUrl:!0},registration_endpoint:{toKey:"registrationEndpoint",convertToUrl:!0},scopes_supported:{toKey:"scopesSupported"},response_types_supported:{toKey:"responseTypesSupported"},response_modes_supported:{toKey:"responseModesSupported"},grant_types_supported:{toKey:"grantTypesSupported"},acr_values_supported:{toKey:"acrValuesSupported"},subject_types_supported:{toKey:"subjectTypesSupported"},id_token_signing_alg_values_supported:{toKey:"idTokenSigningAlgValuesSupported"},id_token_encryption_alg_values_supported:{toKey:"idTokenEncryptionAlgValuesSupported"},id_token_encryption_enc_values_supported:{toKey:"idTokenEncryptionEncValuesSupported"},userinfo_signing_alg_values_supported:{toKey:"userinfoSigningAlgValuesSupported"},userinfo_encryption_alg_values_supported:{toKey:"userinfoEncryptionAlgValuesSupported"},userinfo_encryption_enc_values_supported:{toKey:"userinfoEncryptionEncValuesSupported"},request_object_signing_alg_values_supported:{toKey:"requestObjectSigningAlgValuesSupported"},request_object_encryption_alg_values_supported:{toKey:"requestObjectEncryptionAlgValuesSupported"},request_object_encryption_enc_values_supported:{toKey:"requestObjectEncryptionEncValuesSupported"},token_endpoint_auth_methods_supported:{toKey:"tokenEndpointAuthMethodsSupported"},token_endpoint_auth_signing_alg_values_supported:{toKey:"tokenEndpointAuthSigningAlgValuesSupported"},display_values_supported:{toKey:"displayValuesSupported"},claim_types_supported:{toKey:"claimTypesSupported"},claims_supported:{toKey:"claimsSupported"},service_documentation:{toKey:"serviceDocumentation"},claims_locales_supported:{toKey:"claimsLocalesSupported"},ui_locales_supported:{toKey:"uiLocalesSupported"},claims_parameter_supported:{toKey:"claimsParameterSupported"},request_parameter_supported:{toKey:"requestParameterSupported"},request_uri_parameter_supported:{toKey:"requestUriParameterSupported"},require_request_uri_registration:{toKey:"requireRequestUriRegistration"},op_policy_uri:{toKey:"opPolicyUri",convertToUrl:!0},op_tos_uri:{toKey:"opTosUri",convertToUrl:!0}};let l=class{constructor(t,e){this.fetcher=t,this.storageUtility=e}getLocalStorageKey(t){return"issuerConfig:"+t.toString()}processConfig(t){const e={};return Object.keys(t).forEach(r=>{c[r]&&(e[c[r].toKey]=c[r].convertToUrl?new s.default(t[r]):t[r])}),e}async fetchConfig(t){let e=await this.storageUtility.safeGet(this.getLocalStorageKey(t),{schema:h.default});if(!e){const r=new s.default(t.toString());r.set("pathname","/.well-known/openid-configuration");const i=await this.fetcher.fetch(r);try{e=this.processConfig(await i.json())}catch(e){throw new f.default(`${t.toString()} has an invalid configuration: ${e.message}`)}}return await this.storageUtility.set(this.getLocalStorageKey(t),JSON.stringify(e)),e}};l=i([u.injectable(),a(0,u.inject("fetcher")),a(1,u.inject("storageUtility")),n("design:paramtypes",[Object,Object])],l),e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={type:"object",properties:{issuer:{type:"string",format:"uri"},authorization_endpoint:{type:"string",format:"uri"},token_endpoint:{type:"string",format:"uri"},userinfo_endpoint:{type:"string",format:"uri"},jwks_uri:{type:"string",format:"uri"},registration_endpoint:{type:"string",format:"uri"},scopes_supported:{type:"array",items:{type:"string"}},response_types_supported:{type:"array",items:{type:"string",joinedStringOf:["code","id_token","token","none"]}},response_modes_supported:{type:"array",items:{type:"string",enum:["query","fragment"]},default:["query","fragment"]},grant_types_supported:{type:"array",items:{type:"string",enum:["authorization_code","implicit","client_credentials","device_code","refresh_token"]},default:["authorization_code","implicit"]},acr_values_supported:{type:"array",items:{type:"string"}},subject_types_supported:{type:"array",items:{type:"string",enum:["pairwise","public"]}},id_token_signing_alg_values_supported:{type:"array",items:{type:"string"}},id_token_encryption_alg_values_supported:{type:"array",items:{type:"string"}},id_token_encryption_enc_values_supported:{type:"array",items:{type:"string"}},userinfo_signing_alg_values_supported:{type:"array",items:{type:"string"}},userinfo_encryption_alg_values_supported:{type:"array",items:{type:"string"}},userinfo_encryption_enc_values_supported:{type:"array",items:{type:"string"}},request_object_signing_alg_values_supported:{type:"array",items:{type:"string"}},request_object_encryption_alg_values_supported:{type:"array",items:{type:"string"}},request_object_encryption_enc_values_supported:{type:"array",items:{type:"string"}},token_endpoint_auth_methods_supported:{type:"array",items:{type:"string"}},token_endpoint_auth_signing_alg_values_supported:{type:"array",items:{type:"string"}},display_values_supported:{type:"array",items:{type:"string"}},claim_types_supported:{type:"array",items:{type:"string"}},claims_supported:{type:"array",items:{type:"string"}},service_documentation:{type:"array",items:{type:"string"}},claims_locales_supported:{type:"array",items:{type:"string"}},ui_locales_supported:{type:"array",items:{type:"string"}},claims_parameter_supported:{type:"boolean"},request_parameter_supported:{type:"boolean"},request_uri_parameter_supported:{type:"boolean"},require_request_uri_registration:{type:"boolean"},op_policy_uri:{type:"string",format:"uri"},op_tos_uri:{type:"string",format:"uri"}},additionalProperties:!0}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(37));e.default=class{async canHandle(t,e,r){return"bearer"===t.type}async handle(t,e,r){throw new n.default("BearerAuthenticatedFetcher")}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r){this.joseUtility=t,this.dpopClientKeyManager=e,this.uuidGenerator=r}normalizeHtu(t){return`${t.origin}${t.pathname}`}async createHeaderToken(t,e){const r=await this.dpopClientKeyManager.getClientKey();if(null===r)throw new Error("Could not obtain the key to sign the token with.");return this.joseUtility.signJWT({htu:this.normalizeHtu(t),htm:e,jti:this.uuidGenerator.v4()},r,{header:{jwk:await this.joseUtility.privateJWKToPublicJWK(r),typ:"dpop+jwt"},expiresIn:"1 hour",algorithm:"RS256"})}};s=i([o.injectable(),a(0,o.inject("joseUtility")),a(1,o.inject("dpopClientKeyManager")),a(2,o.inject("uuidGenerator")),n("design:paramtypes",[Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(440));let h=class{constructor(t,e){this.storageUtility=t,this.joseUtility=e}getLocalStorageKey(){return"clientKey"}async generateClientKeyIfNotAlready(t){let e=await this.storageUtility.safeGet(this.getLocalStorageKey(),{schema:u.default});e||(e=await this.joseUtility.generateJWK("RSA",2048,{alg:"RS256",use:"sig"}),await this.storageUtility.set(this.getLocalStorageKey(),JSON.stringify(e)))}async getClientKey(){return await this.storageUtility.safeGet(this.getLocalStorageKey(),{schema:u.default})}};h=i([s.injectable(),a(0,s.inject("storageUtility")),a(1,s.inject("joseUtility")),n("design:paramtypes",[Object,Object])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={description:"json web key",type:"object",required:["kty","e","n"],properties:{kty:{type:"string"},e:{type:"string"},n:{type:"string"}}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(105));let h=class{constructor(t){this.storage=t}getKey(t){return"solidAuthFetcherUser:"+t}async getUserData(t){const e=await this.storage.get(this.getKey(t));if(null===e)return{};try{return JSON.parse(e)}catch(t){return{}}}async setUserData(t,e){await this.storage.set(this.getKey(t),JSON.stringify(e))}async get(t,e){const r=await this.storage.get(t);if(null==r&&e)throw new Error(t+" is not stored");return r}async set(t,e){return this.storage.set(t,e)}async delete(t){return this.storage.delete(t)}async getForUser(t,e,r){const i=await this.getUserData(t);let n;if(i[e]||(n=null),n=i[e],null==n&&r)throw new Error(`Field ${e} for user ${t} is not stored`);return n||null}async setForUser(t,e,r){const i=await this.getUserData(t);i[e]=r,await this.setUserData(t,i)}async deleteForUser(t,e){const r=await this.getUserData(t);delete r[e],await this.setUserData(t,r)}async deleteAllUserData(t){await this.storage.delete(this.getKey(t))}async safeGet(t,e={}){const r=e.userId?await this.getForUser(e.userId,t):await this.get(t);if(r)try{const t=JSON.parse(r);if(e.schema){return u.default(e.schema,t)}return t}catch(r){e.userId?await this.deleteForUser(e.userId,t):await this.delete(t)}return null}};h=i([s.injectable(),a(0,s.inject("storage")),n("design:paramtypes",[Object])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=r(464);e.default=class{v4(){return i.v4()}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(){this.map={}}async get(t){return this.map[t]||null}async set(t,e){this.map[t]=e}async delete(t){delete this.map[t]}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=o(r(39)),h=r(5);let f=class{constructor(t){this.tokenSaver=t}async canHandle(t){const e=new s.default(t,!0);return!!(e.query&&e.query.id_token&&e.query.access_token&&e.query.state)}async handle(t){if(!await this.canHandle(t))throw new u.default("Cannot handle redirect url "+t);const e=new s.default(t,!0);return this.tokenSaver.saveTokenAndGetSession(e.query.state,e.query.id_token,e.query.access_token)}};f=i([h.injectable(),a(0,h.inject("tokenSaver")),n("design:paramtypes",[Object])],f),e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{detect(){return"undefined"!=typeof document?"browser":"undefined"!=typeof navigator&&"ReactNative"==navigator.product?"react-native":"server"}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.storageUtility=t}async canHandle(){return!0}async handle(t){this.storageUtility.deleteAllUserData(t)}};s=i([o.injectable(),a(0,o.inject("storageUtility")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(14));e.default=class{requestInfoToUrl(t){return new n.default(t)}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r,i){this.uuidGenerator=t,this.authenticatedFetcher=e,this.logoutHandler=r,this.storageUtility=i}create(t){const e=t.localUserId||this.uuidGenerator.v4();return t.loggedIn?{localUserId:e,loggedIn:!0,webId:t.webId,neededAction:t.neededAction||{actionType:"inaction"},state:t.state,logout:async()=>this.logoutHandler.handle(e),fetch:(t,r)=>this.authenticatedFetcher.handle({localUserId:e,type:"dpop"},t,r)}:{localUserId:e,loggedIn:!1,neededAction:t.neededAction||{actionType:"inaction"}}}async getSession(t){const e=await this.storageUtility.getForUser(t,"webId"),r=await this.storageUtility.getForUser(t,"accessToken");return e?this.create({localUserId:t,webId:e,loggedIn:!!r}):null}};s=i([o.injectable(),a(0,o.inject("uuidGenerator")),a(1,o.inject("authenticatedFetcher")),a(2,o.inject("logoutHandler")),a(3,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(14)),u=o(r(39)),h=r(5);let f=class{constructor(t,e,r,i){this.storageUtility=t,this.redirector=e,this.tokenRequester=r,this.sessionCreator=i}async canHandle(t){const e=new s.default(t,!0);return!!(e.query&&e.query.code&&e.query.state)}async handle(t){if(!await this.canHandle(t))throw new u.default("Cannot handle redirect url "+t);const e=new s.default(t,!0),r=e.query.state,[i,n]=await Promise.all([await this.storageUtility.getForUser(r,"codeVerifier",!0),await this.storageUtility.getForUser(r,"redirectUri",!0)]);await this.tokenRequester.request(r,{grant_type:"authorization_code",code_verifier:i,code:e.query.code,redirect_uri:n}),e.set("query",{});const a=await this.sessionCreator.getSession(r);if(!a)throw new Error("There was a problem creating a session.");return a.neededAction=this.redirector.redirect(e.toString(),{redirectByReplacingState:!0}),a}};f=i([h.injectable(),a(0,h.inject("storageUtility")),a(1,h.inject("redirector")),a(2,h.inject("tokenRequester")),a(3,h.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object,Object])],f),e.default=f},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("redirectHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{async get(t){return window.localStorage.getItem(t)}async set(t,e){window.localStorage.setItem(t,e)}async delete(t){window.localStorage.removeItem(t)}}},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e,r){this.sessionCreator=t,this.joseUtility=e,this.storageUtility=r}async saveTokenAndGetSession(t,e,r,i){const n=await this.joseUtility.decodeJWT(r),a=this.sessionCreator.create({localUserId:t,webId:n.sub,neededAction:{actionType:"inaction"},loggedIn:!0});return await this.storageUtility.setForUser(a.localUserId,"accessToken",r),await this.storageUtility.setForUser(a.localUserId,"idToken",e),await this.storageUtility.setForUser(a.localUserId,"webId",n.sub),await this.storageUtility.setForUser(a.localUserId,"refreshToken",i),a}};s=i([o.injectable(),a(0,o.inject("sessionCreator")),a(1,o.inject("joseUtility")),a(2,o.inject("storageUtility")),n("design:paramtypes",[Object,Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.environmentDetector=t}redirect(t,e){return"browser"!==this.environmentDetector.detect()||(null==e?void 0:e.doNotAutoRedirect)?{actionType:"redirect",redirectUrl:t}:(e&&e.redirectByReplacingState?window.history.replaceState({},"",t):window.location.href=t,{actionType:"inaction"})}};s=i([o.injectable(),a(0,o.inject("environmentDetector")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.sessionCreator=t}async canHandle(t){return!0}async handle(t){return this.sessionCreator.create({loggedIn:!1})}};s=i([o.injectable(),a(0,o.inject("sessionCreator")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(14));let h=class{constructor(t,e,r){this.environmentDetector=t,this.loginHandler=e,this.sessionCreator=r}async canHandle(t){return!(!t.popUp||!t.popUpRedirectPath||"browser"!==this.environmentDetector.detect())}async handle(t){const e=new u.default(window.location.href);e.set("pathname",t.popUpRedirectPath);const r=await this.loginHandler.handle({...t,redirect:e,doNotAutoRedirect:!0}),i=window.open(r.neededAction.redirectUrl,"Log In","resizable,scrollbars,width=500,height=500,");return new Promise((e,r)=>{const n=setInterval(async()=>{i&&!i.closed||(clearInterval(n),e(await this.sessionCreator.getSession(t.localUserId||"global")))},500)})}};h=i([s.injectable(),a(0,s.inject("environmentDetector")),a(1,s.inject("postPopUpLoginHandler")),a(2,s.inject("sessionCreator")),n("design:paramtypes",[Object,Object,Object])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=o(r(38)),u=r(5);let h=class extends s.default{constructor(t){super(t)}};h=i([u.injectable(),a(0,u.injectAll("postPopUpLoginHandlers")),n("design:paramtypes",[Array])],h),e.default=h},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t){this.fetcher=t}async performDynamicRegistration(t,e){var r;const i={client_name:t.clientName,application_type:"web",redirect_uris:[null===(r=t.redirect)||void 0===r?void 0:r.toString()],subject_type:"pairwise",token_endpoint_auth_method:"client_secret_basic",code_challenge_method:"S256"};if(!e.registrationEndpoint)throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");const n=await this.fetcher.fetch(e.registrationEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new Error("Login Registration Error: "+await n.text());const a=await n.json();return{clientId:a.client_id,clientSecret:a.client_secret}}async getClient(t,e){return t.clientId?{clientId:t.clientId}:await this.performDynamicRegistration(t,e)}};s=i([o.injectable(),a(0,o.inject("fetcher")),n("design:paramtypes",[Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e){this.storageUtility=t,this.tokenRequester=e}async refresh(t){const e=await this.storageUtility.getForUser(t,"refreshToken",!0);await this.tokenRequester.request(t,{grant_type:"refresh_token",refresh_token:e})}};s=i([o.injectable(),a(0,o.inject("storageUtility")),a(1,o.inject("tokenRequester")),n("design:paramtypes",[Object,Object])],s),e.default=s},function(t,e,r){"use strict";var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5);let s=class{constructor(t,e){this.aggregateAuthenticatedFetcher=t,this.tokenRefresher=e}async canHandle(t,e,r){return!0}async handle(t,e,r){const i=await this.aggregateAuthenticatedFetcher.handle(t,e,r);if(401===i.status)try{return await this.tokenRefresher.refresh(t.localUserId),this.aggregateAuthenticatedFetcher.handle(t,e,r)}catch(t){}return i}};s=i([o.injectable(),a(0,o.inject("aggregateAuthenticatedFetcher")),a(1,o.inject("tokenRefresher")),n("design:paramtypes",[Object,Object])],s),e.default=s},function(t,e,r){"use strict";(function(t){var i=this&&this.__decorate||function(t,e,r,i){var n,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,r,o):n(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__param||function(t,e){return function(r,i){e(r,i,t)}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(5),u=o(r(14)),h=o(r(461));let f=class{constructor(t,e,r,i,n){this.storageUtility=t,this.issuerConfigFetcher=e,this.fetcher=r,this.dpopHeaderCreator=i,this.joseUtility=n}async request(t,e){const[r,i,n]=await Promise.all([this.storageUtility.getForUser(t,"issuer",!0),this.storageUtility.getForUser(t,"clientId",!0),this.storageUtility.getForUser(t,"clientSecret")]),a=await this.issuerConfigFetcher.fetchConfig(new u.default(r));if(e.grant_type&&(!a.grantTypesSupported||!a.grantTypesSupported.includes(e.grant_type)))throw new Error(`The issuer ${r} does not support the ${e.grant_type} grant`);if(!a.tokenEndpoint)throw new Error(`This issuer ${r} does not have a token endpoint`);const o={method:"POST",headers:{DPoP:await this.dpopHeaderCreator.createHeaderToken(a.tokenEndpoint,"POST"),"content-type":"application/x-www-form-urlencoded"},body:h.default({...e,client_id:i})};n&&(o.headers.Authorization="Basic "+this.btoa(`${i}:${n}`));const s=await(await this.fetcher.fetch(a.tokenEndpoint,o)).json();if(!(s&&s.access_token&&s.id_token&&"string"==typeof s.access_token&&"string"==typeof s.id_token)||s.refresh_token&&"string"!=typeof s.refresh_token)throw new Error("IDP token route returned an invalid response.");await this.storageUtility.setForUser(t,"accessToken",s.access_token),await this.storageUtility.setForUser(t,"idToken",s.id_token),await this.storageUtility.setForUser(t,"refreshToken",s.refresh_token);const f=await this.joseUtility.decodeJWT(s.access_token);if(!f||!f.sub)throw new Error("The idp returned a bad token without a sub.");await this.storageUtility.setForUser(t,"webId",f.sub)}btoa(e){return t.from(e.toString(),"binary").toString("base64")}};f=i([s.injectable(),a(0,s.inject("storageUtility")),a(1,s.inject("issuerConfigFetcher")),a(2,s.inject("fetcher")),a(3,s.inject("dpopHeaderCreator")),a(4,s.inject("joseUtility")),n("design:paramtypes",[Object,Object,Object,Object,Object])],f),e.default=f}).call(this,r(0).Buffer)},function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.sorted,n=e.skipIndex,a=e.ignorenull,o=e.skipBracket,s=e.useDot,u=function(t){return String(t).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~*]/g,(function(t){return"%".concat(t.charCodeAt().toString(16).slice(-2).toUpperCase())}))},h=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(t);return r?e.sort():e},f=function(t){return t.filter((function(t){return t})).join("&")},c=function(t,e){return f(h(e).map((function(r){return p(s?"".concat(t,".").concat(r):"".concat(t,"[").concat(r,"]"),e[r])})))},l=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o?"":"[]";return e.length?f(e.map((function(e,i){return p(n?t+r:t+"["+i+"]",e)}))):u(t+r)},d=function(t,e){return f(Array.from(e).map((function(e){return p(t,e)})))},p=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i(e),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e===n?n=a?n:u(t)+"="+n:/string|number|boolean/.test(r)?n=u(t)+"="+u(e):Array.isArray(e)?n=l(t,e):e instanceof Set?n=d(t,e):"object"===r&&(n=c(t,e)),n};return t&&f(h(t).map((function(e){return p(e,t[e])})))}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getAuthHeaders=e.getPhpSolidServerCookie=e.getNodeSolidServerCookie=e.getAuthFetcher=void 0;const n=r(103),a=i(r(463)),o=i(r(104));e.getAuthFetcher=async function(t,e,r,i=!0){if(!e.length&&i)return{fetch:a.default};const o=await n.customAuthFetcher();let s=(await o.login({oidcIssuer:t,redirect:r})).neededAction.redirectUrl;do{if(s=(await a.default(s,{headers:{cookie:e},redirect:"manual"})).headers.get("location"),null===s)throw new Error(`Please make sure the cookie is valid, and add "${r}" as a trusted app!`)}while(!(null==s?void 0:s.startsWith(r)));return await o.handleRedirect(s),o},e.getNodeSolidServerCookie=async function(t,e,r){const i=await n.customAuthFetcher();return(await i.fetch(t+"/login/password",{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`username=${e}&password=${r}`,method:"POST",redirect:"manual"})).headers.get("set-cookie")},e.getPhpSolidServerCookie=async function(t,e,r){const i=await n.customAuthFetcher();return(await i.fetch(t+"/login",{headers:{"content-type":"application/x-www-form-urlencoded"},body:`username=${e}&password=${r}`,method:"POST",redirect:"manual"})).headers.get("set-cookie")},e.getAuthHeaders=async function(t,e,r){return r instanceof o.default?{Authorization:JSON.parse(r.authenticatedFetcher.tokenRefresher.storageUtility.storage.map["solidAuthFetcherUser:global"]).accessToken,DPop:await r.authenticatedFetcher.tokenRefresher.tokenRequester.dpopHeaderCreator.createHeaderToken(new URL(t),e)}:{Authorization:"",DPop:""}}},function(t,e,r){"use strict";var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();t.exports=e=i.fetch,e.default=i.fetch.bind(i),e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response},function(t,e,r){"use strict";r.r(e),r.d(e,"v1",(function(){return d})),r.d(e,"v3",(function(){return E})),r.d(e,"v4",(function(){return M})),r.d(e,"v5",(function(){return A}));var i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),n=new Uint8Array(16);function a(){if(!i)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(n)}for(var o=[],s=0;s<256;++s)o.push((s+256).toString(16).substr(1));var u,h,f=function(t,e){var r=e||0;return(o[t[r+0]]+o[t[r+1]]+o[t[r+2]]+o[t[r+3]]+"-"+o[t[r+4]]+o[t[r+5]]+"-"+o[t[r+6]]+o[t[r+7]]+"-"+o[t[r+8]]+o[t[r+9]]+"-"+o[t[r+10]]+o[t[r+11]]+o[t[r+12]]+o[t[r+13]]+o[t[r+14]]+o[t[r+15]]).toLowerCase()},c=0,l=0;var d=function(t,e,r){var i=e&&r||0,n=e||new Array(16),o=(t=t||{}).node||u,s=void 0!==t.clockseq?t.clockseq:h;if(null==o||null==s){var d=t.random||(t.rng||a)();null==o&&(o=u=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==s&&(s=h=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:Date.now(),m=void 0!==t.nsecs?t.nsecs:l+1,v=p-c+(m-l)/1e4;if(v<0&&void 0===t.clockseq&&(s=s+1&16383),(v<0||p>c)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,l=m,h=s;var g=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;n[i++]=g>>>24&255,n[i++]=g>>>16&255,n[i++]=g>>>8&255,n[i++]=255&g;var y=p/4294967296*1e4&268435455;n[i++]=y>>>8&255,n[i++]=255&y,n[i++]=y>>>24&15|16,n[i++]=y>>>16&255,n[i++]=s>>>8|128,n[i++]=255&s;for(var b=0;b<6;++b)n[i+b]=o[b];return e||f(n)};var p=function(t,e,r){function i(t,i,n,a){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r>>9<<4)+1}function v(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function g(t,e,r,i,n,a){return v((o=v(v(e,t),v(i,a)))<<(s=n)|o>>>32-s,r);var o,s}function y(t,e,r,i,n,a,o){return g(e&r|~e&i,t,e,n,a,o)}function b(t,e,r,i,n,a,o){return g(e&i|r&~i,t,e,n,a,o)}function w(t,e,r,i,n,a,o){return g(e^r^i,t,e,n,a,o)}function _(t,e,r,i,n,a,o){return g(r^(e|~i),t,e,n,a,o)}var E=p("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r>5]>>>i%32&255,a=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<>5]|=(255&t[i/8])<>>32-e}var A=p("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var i=unescape(encodeURIComponent(t));t=[];for(var n=0;n>>0;b=y,y=g,g=C(v,30)>>>0,v=m,m=E}r[0]=r[0]+m>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]}))}]); \ No newline at end of file diff --git a/solid/lib/BearerFactoryTrait.php b/solid/lib/BearerFactoryTrait.php new file mode 100644 index 00000000..b21e4993 --- /dev/null +++ b/solid/lib/BearerFactoryTrait.php @@ -0,0 +1,42 @@ +getBearerValidFor(); + + $replayDetector = new JtiReplayDetector($interval, $this->connection); + + $jtiValidator = new JtiValidator($replayDetector); + + return new Bearer($jtiValidator); + } + + final public function getBearerValidFor(): DateInterval + { + static $validFor; + + if ($validFor === null) { + $validFor = new DateInterval('PT10M'); + } + + return $validFor; + } + + ////////////////////////////// UTILITY METHODS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +} diff --git a/solid/lib/Controller/AppController.php b/solid/lib/Controller/AppController.php index 47f8b739..94addc28 100644 --- a/solid/lib/Controller/AppController.php +++ b/solid/lib/Controller/AppController.php @@ -30,21 +30,21 @@ public function __construct($AppName, IRequest $request, IConfig $config, IUserM $this->config = new \OCA\Solid\ServerConfig($config, $urlGenerator, $userManager); } - private function getUserApps($userId) { + private function getUserApps($userId) { $userApps = []; if ($this->userManager->userExists($userId)) { - $allowedClients = $this->config->getAllowedClients($userId); + $allowedClients = $this->config->getAllowedClients($userId); foreach ($allowedClients as $clientId) { $registration = $this->config->getClientRegistration($clientId); $userApps[] = $registration['client_name']; } } return $userApps; - } + } private function getAppsList() { - $path = __DIR__ . "/../solid-app-list.json"; - $appsListJson = file_get_contents($path); + $path = __DIR__ . "/../solid-app-list.json"; + $appsListJson = file_get_contents($path); $appsList = json_decode($appsListJson, true); $userApps = $this->getUserApps($this->userId); @@ -58,7 +58,7 @@ private function getAppsList() { $appsList[$key]['registered'] = 0; } } - return $appsList; + return $appsList; } private function getProfilePage() { @@ -74,11 +74,11 @@ private function getStorageUrl($userId) { * @NoCSRFRequired */ public function appLauncher() { - $appsList = $this->getAppsList(); + $appsList = $this->getAppsList(); if (!$appsList) { return new JSONResponse(array(), Http::STATUS_NOT_FOUND); } - $appLauncherData = array( + $appLauncherData = array( "appsListJson" => json_encode($appsList), "webId" => json_encode($this->getProfilePage()), "storageUrl" => json_encode($this->getStorageUrl($this->userId)), @@ -88,11 +88,11 @@ public function appLauncher() { ) ); $templateResponse = new TemplateResponse('solid', 'applauncher', $appLauncherData); - $policy = new ContentSecurityPolicy(); - $policy->addAllowedStyleDomain("data:"); - $policy->addAllowedScriptDomain("'self'"); - $policy->addAllowedScriptDomain("'unsafe-inline'"); - $policy->addAllowedScriptDomain("'unsafe-eval'"); + $policy = new ContentSecurityPolicy(); + $policy->addAllowedStyleDomain("data:"); + $policy->addAllowedScriptDomain("'self'"); + $policy->addAllowedScriptDomain("'unsafe-inline'"); + $policy->addAllowedScriptDomain("'unsafe-eval'"); $templateResponse->setContentSecurityPolicy($policy); return $templateResponse; } diff --git a/solid/lib/Controller/CalendarController.php b/solid/lib/Controller/CalendarController.php index 0d262f9c..c06bab02 100644 --- a/solid/lib/Controller/CalendarController.php +++ b/solid/lib/Controller/CalendarController.php @@ -235,7 +235,9 @@ private function respond($response) { $result = new PlainResponse($body); foreach ($headers as $header => $values) { - $result->addHeader($header, implode(", ", $values)); + foreach ($values as $value) { + $result->addHeader($header, $value); + } } $result->setStatus($statusCode); diff --git a/solid/lib/Controller/ContactsController.php b/solid/lib/Controller/ContactsController.php index cc07f7de..ff07c425 100644 --- a/solid/lib/Controller/ContactsController.php +++ b/solid/lib/Controller/ContactsController.php @@ -236,7 +236,9 @@ private function respond($response) { $result = new PlainResponse($body); foreach ($headers as $header => $values) { - $result->addHeader($header, implode(", ", $values)); + foreach ($values as $value) { + $result->addHeader($header, $value); + } } $result->setStatus($statusCode); diff --git a/solid/lib/Controller/ProfileController.php b/solid/lib/Controller/ProfileController.php index 65cf0fba..67cfc7da 100644 --- a/solid/lib/Controller/ProfileController.php +++ b/solid/lib/Controller/ProfileController.php @@ -256,7 +256,9 @@ private function respond($response) { $result = new PlainResponse($body); foreach ($headers as $header => $values) { - $result->addHeader($header, implode(", ", $values)); + foreach ($values as $value) { + $result->addHeader($header, $value); + } } // $origin = $_SERVER['HTTP_ORIGIN'] ?? "*"; // $result->addHeader('Access-Control-Allow-Credentials', 'true'); diff --git a/solid/lib/Controller/ServerController.php b/solid/lib/Controller/ServerController.php index ab0fe40b..12259391 100644 --- a/solid/lib/Controller/ServerController.php +++ b/solid/lib/Controller/ServerController.php @@ -181,12 +181,32 @@ public function authorize() { // return $result->addHeader('Access-Control-Allow-Origin', '*'); } } - $clientId = $getVars['client_id']; + + if (preg_match("/^http(s)?:/", $getVars['client_id'])) { + $parsedOrigin = parse_url($getVars['redirect_uri']); + $origin = 'https://' . $parsedOrigin['host']; + + $clientData = array( + "client_id_issued_at" => time(), + "client_name" => $getVars['client_id'], + "origin" => $origin, + "redirect_uris" => array( + $getVars['redirect_uri'] + ) + ); + $clientId = $this->config->saveClientRegistration($origin, $clientData); + $clientId = $this->config->saveClientRegistration($getVars['client_id'], $clientData); + $returnUrl = $getVars['redirect_uri']; + } else { + $clientId = $getVars['client_id']; + $returnUrl = $_SERVER['REQUEST_URI']; + } + $approval = $this->checkApproval($clientId); if (!$approval) { $result = new JSONResponse('Approval required'); $result->setStatus(302); - $approvalUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.page.approval", array("clientId" => $clientId, "returnUrl" => $_SERVER['REQUEST_URI']))); + $approvalUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.page.approval", array("clientId" => $clientId, "returnUrl" => $returnUrl))); $result->addHeader("Location", $approvalUrl); return $result; // ->addHeader('Access-Control-Allow-Origin', '*'); } @@ -200,12 +220,12 @@ public function authorize() { $response = $server->respondToAuthorizationRequest($request, $user, $approval); $response = $this->tokenGenerator->addIdTokenToResponse( - $response, - $clientId, - $this->getProfilePage(), - $this->session->get("nonce"), - $this->config->getPrivateKey() - ); + $response, + $clientId, + $this->getProfilePage(), + $this->session->get("nonce"), + $this->config->getPrivateKey() + ); return $this->respond($response); // ->addHeader('Access-Control-Allow-Origin', '*'); } @@ -325,7 +345,6 @@ public function register() { 'client_id_issued_at' => $clientData['client_id_issued_at'], 'redirect_uris' => $clientData['redirect_uris'], ); - error_log('allowingin POST:' . $origin); $registration = $this->tokenGenerator->respondToRegistration($registration, $this->config->getPrivateKey()); return (new JSONResponse($registration)); // ->addHeader('Access-Control-Allow-Origin', $origin) diff --git a/solid/lib/Controller/StorageController.php b/solid/lib/Controller/StorageController.php index 004ac82d..57f9d6c9 100644 --- a/solid/lib/Controller/StorageController.php +++ b/solid/lib/Controller/StorageController.php @@ -2,6 +2,7 @@ namespace OCA\Solid\Controller; use OCA\Solid\DpopFactoryTrait; +use OCA\Solid\BearerFactoryTrait; use OCA\Solid\PlainResponse; use OCA\Solid\Notifications\SolidNotifications; @@ -15,12 +16,15 @@ use OCP\IURLGenerator; use OCP\IUserManager; +use OCP\AppFramework\Http\EmptyContentSecurityPolicy; + use Pdsinterop\Solid\Auth\WAC; use Pdsinterop\Solid\Resources\Server as ResourceServer; class StorageController extends Controller { use DpopFactoryTrait; + use BearerFactoryTrait; /* @var IURLGenerator */ private $urlGenerator; @@ -304,19 +308,36 @@ public function handleRequest($userId, $path) { $dpop = $this->getDpop(); + $error = false; try { $webId = $dpop->getWebId($request); } catch(\Pdsinterop\Solid\Auth\Exception\Exception $e) { + $error = $e; + } + + if (!isset($webId)) { + $bearer = $this->getBearer(); + try { + $webId = $bearer->getWebId($request); + } catch(\Pdsinterop\Solid\Auth\Exception\Exception $e) { + $error = $e; + } + } + + if (!isset($webId)) { $response = $this->resourceServer->getResponse() - ->withStatus(Http::STATUS_CONFLICT, "Invalid token " . $e->getMessage()); + ->withStatus(Http::STATUS_CONFLICT, "Invalid token"); return $this->respond($response); } + $origin = $request->getHeaderLine("Origin"); $allowedClients = $this->config->getAllowedClients($userId); $allowedOrigins = array(); foreach ($allowedClients as $clientId) { $clientRegistration = $this->config->getClientRegistration($clientId); - $allowedOrigins[] = $clientRegistration['client_name']; + if (isset($clientRegistration['client_name'])) { + $allowedOrigins[] = $clientRegistration['client_name']; + } } if (!$this->WAC->isAllowed($request, $webId, $origin, $allowedOrigins)) { $response = $this->resourceServer->getResponse() @@ -407,7 +428,19 @@ private function respond($response) { // $result->addHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); // $result->addHeader('Access-Control-Allow-Origin', $origin); - $result->setStatus($statusCode); + $policy = new EmptyContentSecurityPolicy(); + $policy->addAllowedStyleDomain("*"); + $policy->addAllowedStyleDomain("data:"); + $policy->addAllowedScriptDomain("*"); + $policy->addAllowedImageDomain("*"); + $policy->addAllowedFontDomain("*"); + $policy->addAllowedConnectDomain("*"); + $policy->allowInlineStyle(true); + $policy->allowInlineScript(true); + $policy->allowEvalScript(true); + $result->setContentSecurityPolicy($policy); + + $result->setStatus($statusCode); return $result; } } diff --git a/solid/lib/ServerConfig.php b/solid/lib/ServerConfig.php index 2be2f281..590a3719 100644 --- a/solid/lib/ServerConfig.php +++ b/solid/lib/ServerConfig.php @@ -68,6 +68,14 @@ public function getClientConfigById($clientId) { return null; } + /** + * @return array|null + */ + public function getClients() { + $clients = (array)$this->config->getAppKeys('solid'); + return $clients; + } + /** * @param array $clientConfig * @return string @@ -151,9 +159,15 @@ public function saveClientRegistration($origin, $clientData) { $clientData['client_name'] = $origin; $clientData['client_secret'] = md5(random_bytes(32)); $this->config->setAppValue('solid', "client-" . $originHash, json_encode($clientData)); + + $this->config->setAppValue('solid', "client-" . $origin, json_encode($clientData)); return $originHash; } + public function removeClientRegistration($clientId) { + $this->config->deleteAppValue('solid', "client-" . $clientId); + } + public function getClientRegistration($clientId) { $data = $this->config->getAppValue('solid', "client-" . $clientId, "{}"); return json_decode($data, true); diff --git a/solid/lib/Settings.php b/solid/lib/Settings.php index fd1ed7cf..7ab6dfb0 100644 --- a/solid/lib/Settings.php +++ b/solid/lib/Settings.php @@ -9,7 +9,7 @@ class Settings implements ISettings { private $config; - public function __construct(Serverconfig $config) { + public function __construct(ServerConfig $config) { $this->config = $config; }