From 158327ef7000958668d8bb0eda0e662cff433299 Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Mon, 3 Aug 2020 18:55:43 -0700 Subject: [PATCH] yarn browserify --- dist/near-api-js.js | 410 ++++++++++++++++++++++++---------------- dist/near-api-js.min.js | 223 +++++++++++----------- 2 files changed, 356 insertions(+), 277 deletions(-) diff --git a/dist/near-api-js.js b/dist/near-api-js.js index 7cee383d24..4ce2fbbabd 100644 --- a/dist/near-api-js.js +++ b/dist/near-api-js.js @@ -5,7 +5,7 @@ window.nearApi = require('./lib/browser-index'); window.Buffer = Buffer; }).call(this,require("buffer").Buffer) -},{"./lib/browser-index":4,"buffer":41,"error-polyfill":48}],2:[function(require,module,exports){ +},{"./lib/browser-index":4,"buffer":42,"error-polyfill":49}],2:[function(require,module,exports){ (function (Buffer){ 'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { @@ -20,28 +20,28 @@ const serialize_1 = require("./utils/serialize"); const key_pair_1 = require("./utils/key_pair"); const errors_1 = require("./utils/errors"); const rpc_errors_1 = require("./utils/rpc_errors"); +const exponential_backoff_1 = __importDefault(require("./utils/exponential-backoff")); // Default amount of gas to be sent with the function calls. Used to pay for the fees // incurred while running the contract execution. The unused amount will be refunded back to // the originator. // Due to protocol changes that charge upfront for the maximum possible gas price inflation due to // full blocks, the price of max_prepaid_gas is decreased to `300 * 10**12`. // For discussion see https://github.com/nearprotocol/NEPs/issues/67 -const DEFAULT_FUNC_CALL_GAS = new bn_js_1.default('300000000000000'); +const DEFAULT_FUNC_CALL_GAS = new bn_js_1.default('30000000000000'); +// Default number of retries with different nonce before giving up on a transaction. +const TX_NONCE_RETRY_NUMBER = 12; // Default number of retries before giving up on a transaction. -const TX_STATUS_RETRY_NUMBER = 10; +const TX_STATUS_RETRY_NUMBER = 12; // Default wait until next retry in millis. const TX_STATUS_RETRY_WAIT = 500; // Exponential back off for waiting to retry. const TX_STATUS_RETRY_WAIT_BACKOFF = 1.5; -// Sleep given number of millis. -function sleep(millis) { - return new Promise(resolve => setTimeout(resolve, millis)); -} /** * More information on [the Account spec](https://nomicon.io/DataStructures/Account.html) */ class Account { constructor(connection, accountId) { + this.accessKeyByPublicKeyCache = {}; this.connection = connection; this.accountId = accountId; } @@ -77,34 +77,6 @@ class Account { console.log(`${prefix}Log [${contractId}]: ${log}`); } } - /** - * @param txHash The transaction hash to retry - * @param accountId The NEAR account sending the transaction - * @returns {Promise} - */ - async retryTxResult(txHash, accountId) { - console.warn(`Retrying transaction ${accountId}:${serialize_1.base_encode(txHash)} as it has timed out`); - let result; - let waitTime = TX_STATUS_RETRY_WAIT; - for (let i = 0; i < TX_STATUS_RETRY_NUMBER; i++) { - try { - result = await this.connection.provider.txStatus(txHash, accountId); - } - catch (error) { - if (!error.message.match(/Transaction \w+ doesn't exist/)) { - throw error; - } - } - if (result && typeof result.status === 'object' && - (typeof result.status.SuccessValue === 'string' || typeof result.status.Failure === 'object')) { - return result; - } - await sleep(waitTime); - waitTime *= TX_STATUS_RETRY_WAIT_BACKOFF; - i++; - } - throw new providers_1.TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} status check attempts for transaction ${serialize_1.base_encode(txHash)}.`, 'RetriesExceeded'); - } /** * @param receiverId NEAR account receiving the transaction * @param actions The transaction [Action as described in the spec](https://nomicon.io/RuntimeSpec/Actions.html). @@ -112,24 +84,47 @@ class Account { */ async signAndSendTransaction(receiverId, actions) { await this.ready; - // TODO: Find matching access key based on transaction - const accessKey = await this.findAccessKey(); - if (!accessKey) { - throw new providers_1.TypedError(`Can not sign transactions for account ${this.accountId}, no matching key pair found in Signer.`, 'KeyNotFound'); - } - const status = await this.connection.provider.status(); - const [txHash, signedTx] = await transaction_1.signTransaction(receiverId, ++accessKey.nonce, actions, serialize_1.base_decode(status.sync_info.latest_block_hash), this.connection.signer, this.accountId, this.connection.networkId); - let result; - try { - result = await this.connection.provider.sendTransaction(signedTx); - } - catch (error) { - if (error.type === 'TimeoutError') { - result = await this.retryTxResult(txHash, this.accountId); + let txHash, signedTx; + // TODO: TX_NONCE (different constants for different uses of exponentialBackoff?) + const result = await exponential_backoff_1.default(TX_STATUS_RETRY_WAIT, TX_NONCE_RETRY_NUMBER, TX_STATUS_RETRY_WAIT_BACKOFF, async () => { + const accessKeyInfo = await this.findAccessKey(receiverId, actions); + if (!accessKeyInfo) { + throw new providers_1.TypedError(`Can not sign transactions for account ${this.accountId}, no matching key pair found in Signer.`, 'KeyNotFound'); } - else { + const { publicKey, accessKey } = accessKeyInfo; + const status = await this.connection.provider.status(); + const nonce = ++accessKey.nonce; + [txHash, signedTx] = await transaction_1.signTransaction(receiverId, nonce, actions, serialize_1.base_decode(status.sync_info.latest_block_hash), this.connection.signer, this.accountId, this.connection.networkId); + try { + const result = await exponential_backoff_1.default(TX_STATUS_RETRY_WAIT, TX_STATUS_RETRY_NUMBER, TX_STATUS_RETRY_WAIT_BACKOFF, async () => { + try { + return await this.connection.provider.sendTransaction(signedTx); + } + catch (error) { + if (error.type === 'TimeoutError') { + console.warn(`Retrying transaction ${receiverId}:${serialize_1.base_encode(txHash)} as it has timed out`); + return null; + } + throw error; + } + }); + if (!result) { + throw new providers_1.TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} attempts for transaction ${serialize_1.base_encode(txHash)}.`, 'RetriesExceeded', new providers_1.ErrorContext(serialize_1.base_encode(txHash))); + } + return result; + } + catch (error) { + if (error.message.match(/Transaction nonce \d+ must be larger than nonce of the used access key \d+/)) { + console.warn(`Retrying transaction ${receiverId}:${serialize_1.base_encode(txHash)} with new nonce.`); + delete this.accessKeyByPublicKeyCache[publicKey.toString()]; + return null; + } + error.context = new providers_1.ErrorContext(serialize_1.base_encode(txHash)); throw error; } + }); + if (!result) { + throw new providers_1.TypedError(`nonce retries exceeded for transaction. This usually means there are too many parallel requests with the same access key.`, 'RetriesExceeded'); } const flatLogs = [result.transaction_outcome, ...result.receipts_outcome].reduce((acc, it) => { if (it.outcome.logs.length || @@ -154,17 +149,22 @@ class Account { } } // TODO: if Tx is Unknown or Started. - // TODO: deal with timeout on node side. return result; } - async findAccessKey() { + async findAccessKey(receiverId, actions) { + // TODO: Find matching access key based on transaction const publicKey = await this.connection.signer.getPublicKey(this.accountId, this.connection.networkId); if (!publicKey) { return null; } - // TODO: Cache keys and handle nonce errors automatically + const cachedAccessKey = this.accessKeyByPublicKeyCache[publicKey.toString()]; + if (cachedAccessKey !== undefined) { + return { publicKey, accessKey: cachedAccessKey }; + } try { - return await this.connection.provider.query(`access_key/${this.accountId}/${publicKey.toString()}`, ''); + const accessKey = await this.connection.provider.query(`access_key/${this.accountId}/${publicKey.toString()}`, ''); + this.accessKeyByPublicKeyCache[publicKey.toString()] = accessKey; + return { publicKey, accessKey }; } catch (e) { // TODO: Check based on .type when nearcore starts returning query errors in structured format @@ -220,16 +220,16 @@ class Account { /** * @param contractId NEAR account where the contract is deployed * @param methodName The method name on the contract as it is written in the contract code - * @param args Any arguments to the contract method, wrapped in JSON - * @param data The compiled contract code - * @param gas An amount of yoctoⓃ attached to cover the gas cost of this function call - * @param amount Payment in yoctoⓃ that is sent to the contract during this function call + * @param args arguments to pass to method. Can be either plain JS object which gets serialized as JSON automatically + * or `Uint8Array` instance which represents bytes passed as is. + * @param gas max amount of gas that method call can use + * @param deposit amount of NEAR (in yoctoNEAR) to send together with the call * @returns {Promise} */ async functionCall(contractId, methodName, args, gas, amount) { args = args || {}; this.validateArgs(args); - return this.signAndSendTransaction(contractId, [transaction_1.functionCall(methodName, Buffer.from(JSON.stringify(args)), gas || DEFAULT_FUNC_CALL_GAS, amount)]); + return this.signAndSendTransaction(contractId, [transaction_1.functionCall(methodName, args, gas || DEFAULT_FUNC_CALL_GAS, amount)]); } /** * @param publicKey A public key to be associated with the contract @@ -265,6 +265,10 @@ class Account { return this.signAndSendTransaction(this.accountId, [transaction_1.stake(amount, key_pair_1.PublicKey.from(publicKey))]); } validateArgs(args) { + const isUint8Array = args.byteLength !== undefined && args.byteLength === args.length; + if (isUint8Array) { + return; + } if (Array.isArray(args) || typeof args !== 'object') { throw new errors_1.PositionalArgsError(); } @@ -341,7 +345,7 @@ class Account { exports.Account = Account; }).call(this,require("buffer").Buffer) -},{"./providers":18,"./transaction":23,"./utils/errors":25,"./utils/key_pair":28,"./utils/rpc_errors":30,"./utils/serialize":31,"bn.js":37,"buffer":41}],3:[function(require,module,exports){ +},{"./providers":18,"./transaction":23,"./utils/errors":25,"./utils/exponential-backoff":26,"./utils/key_pair":29,"./utils/rpc_errors":31,"./utils/serialize":32,"bn.js":38,"buffer":42}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UrlAccountCreator = exports.LocalAccountCreator = exports.AccountCreator = void 0; @@ -388,7 +392,7 @@ class UrlAccountCreator extends AccountCreator { } exports.UrlAccountCreator = UrlAccountCreator; -},{"./utils/web":32}],4:[function(require,module,exports){ +},{"./utils/web":33}],4:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -468,7 +472,7 @@ const wallet_account_1 = require("./wallet-account"); Object.defineProperty(exports, "WalletAccount", { enumerable: true, get: function () { return wallet_account_1.WalletAccount; } }); Object.defineProperty(exports, "WalletConnection", { enumerable: true, get: function () { return wallet_account_1.WalletConnection; } }); -},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./near":17,"./providers":18,"./signer":22,"./transaction":23,"./utils":27,"./utils/key_pair":28,"./validators":33,"./wallet-account":34}],6:[function(require,module,exports){ +},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./near":17,"./providers":18,"./signer":22,"./transaction":23,"./utils":28,"./utils/key_pair":29,"./validators":34,"./wallet-account":35}],6:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Connection = void 0; @@ -590,7 +594,7 @@ function validateBNLike(argMap) { } } -},{"./providers":18,"./utils/errors":25,"bn.js":37}],8:[function(require,module,exports){ +},{"./providers":18,"./utils/errors":25,"bn.js":38}],8:[function(require,module,exports){ module.exports={ "schema": { "BadUTF16": { @@ -1553,7 +1557,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } /** * Sets a local storage item - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @param keyPair The key pair to store in local storage */ @@ -1562,7 +1566,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } /** * Gets a key from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @returns {Promise} */ @@ -1575,7 +1579,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } /** * Removes a key from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair */ async removeKey(networkId, accountId) { @@ -1607,7 +1611,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } /** * Gets the account(s) from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns{Promise} */ async getAccounts(networkId) { @@ -1624,7 +1628,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } /** * Helper function to retrieve a local storage key - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the storage keythat's sought * @returns {string} An example might be: `near-api-js:keystore:near-friend:default` */ @@ -1639,7 +1643,7 @@ class BrowserLocalStorageKeyStore extends keystore_1.KeyStore { } exports.BrowserLocalStorageKeyStore = BrowserLocalStorageKeyStore; -},{"../utils/key_pair":28,"./keystore":14}],12:[function(require,module,exports){ +},{"../utils/key_pair":29,"./keystore":14}],12:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InMemoryKeyStore = void 0; @@ -1655,7 +1659,7 @@ class InMemoryKeyStore extends keystore_1.KeyStore { } /** * Sets an in-memory storage item - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @param keyPair The key pair to store in local storage */ @@ -1664,7 +1668,7 @@ class InMemoryKeyStore extends keystore_1.KeyStore { } /** * Gets a key from in-memory storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @returns {Promise} */ @@ -1677,7 +1681,7 @@ class InMemoryKeyStore extends keystore_1.KeyStore { } /** * Removes a key from in-memory storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair */ async removeKey(networkId, accountId) { @@ -1703,7 +1707,7 @@ class InMemoryKeyStore extends keystore_1.KeyStore { } /** * Gets the account(s) from in-memory storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns{Promise} */ async getAccounts(networkId) { @@ -1719,7 +1723,7 @@ class InMemoryKeyStore extends keystore_1.KeyStore { } exports.InMemoryKeyStore = InMemoryKeyStore; -},{"../utils/key_pair":28,"./keystore":14}],13:[function(require,module,exports){ +},{"../utils/key_pair":29,"./keystore":14}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MergeKeyStore = exports.UnencryptedFileSystemKeyStore = exports.BrowserLocalStorageKeyStore = exports.InMemoryKeyStore = exports.KeyStore = void 0; @@ -1763,16 +1767,16 @@ class MergeKeyStore extends keystore_1.KeyStore { } /** * Sets a storage item to the first index of a key store array - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @param keyPair The key pair to store in local storage */ async setKey(networkId, accountId, keyPair) { - this.keyStores[0].setKey(networkId, accountId, keyPair); + await this.keyStores[0].setKey(networkId, accountId, keyPair); } /** * Gets a key from the array of key stores - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @returns {Promise} */ @@ -1787,12 +1791,12 @@ class MergeKeyStore extends keystore_1.KeyStore { } /** * Removes a key from the array of key stores - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair */ async removeKey(networkId, accountId) { for (const keyStore of this.keyStores) { - keyStore.removeKey(networkId, accountId); + await keyStore.removeKey(networkId, accountId); } } /** @@ -1800,7 +1804,7 @@ class MergeKeyStore extends keystore_1.KeyStore { */ async clear() { for (const keyStore of this.keyStores) { - keyStore.clear(); + await keyStore.clear(); } } /** @@ -1818,7 +1822,7 @@ class MergeKeyStore extends keystore_1.KeyStore { } /** * Gets the account(s) from the array of key stores - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns{Promise} */ async getAccounts(networkId) { @@ -1890,7 +1894,7 @@ class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore { } /** * Sets a storage item in a file, unencrypted - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @param keyPair The key pair to store in local storage */ @@ -1901,7 +1905,7 @@ class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore { } /** * Gets a key from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair * @returns {Promise} */ @@ -1915,7 +1919,7 @@ class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore { } /** * Removes a key from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @param accountId The NEAR account tied to the key pair */ async removeKey(networkId, accountId) { @@ -1950,7 +1954,7 @@ class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore { } /** * Gets the account(s) from local storage - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns{Promise} */ async getAccounts(networkId) { @@ -1965,7 +1969,7 @@ class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore { } exports.UnencryptedFileSystemKeyStore = UnencryptedFileSystemKeyStore; -},{"../utils/key_pair":28,"./keystore":14,"fs":39,"util":81}],17:[function(require,module,exports){ +},{"../utils/key_pair":29,"./keystore":14,"fs":40,"util":82}],17:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -2072,10 +2076,10 @@ async function connect(config) { } exports.connect = connect; -},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./key_stores":13,"./key_stores/unencrypted_file_system_keystore":16,"bn.js":37}],18:[function(require,module,exports){ +},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./key_stores":13,"./key_stores/unencrypted_file_system_keystore":16,"bn.js":38}],18:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypedError = exports.getTransactionLastResult = exports.FinalExecutionStatusBasic = exports.JsonRpcProvider = exports.Provider = void 0; +exports.ErrorContext = exports.TypedError = exports.getTransactionLastResult = exports.FinalExecutionStatusBasic = exports.JsonRpcProvider = exports.Provider = void 0; const provider_1 = require("./provider"); Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return provider_1.Provider; } }); Object.defineProperty(exports, "getTransactionLastResult", { enumerable: true, get: function () { return provider_1.getTransactionLastResult; } }); @@ -2083,6 +2087,7 @@ Object.defineProperty(exports, "FinalExecutionStatusBasic", { enumerable: true, const json_rpc_provider_1 = require("./json-rpc-provider"); Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return json_rpc_provider_1.JsonRpcProvider; } }); Object.defineProperty(exports, "TypedError", { enumerable: true, get: function () { return json_rpc_provider_1.TypedError; } }); +Object.defineProperty(exports, "ErrorContext", { enumerable: true, get: function () { return json_rpc_provider_1.ErrorContext; } }); },{"./json-rpc-provider":19,"./provider":20}],19:[function(require,module,exports){ (function (Buffer){ @@ -2091,12 +2096,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.JsonRpcProvider = exports.TypedError = void 0; +exports.JsonRpcProvider = exports.ErrorContext = exports.TypedError = void 0; const depd_1 = __importDefault(require("depd")); const provider_1 = require("./provider"); const web_1 = require("../utils/web"); const errors_1 = require("../utils/errors"); Object.defineProperty(exports, "TypedError", { enumerable: true, get: function () { return errors_1.TypedError; } }); +Object.defineProperty(exports, "ErrorContext", { enumerable: true, get: function () { return errors_1.ErrorContext; } }); const serialize_1 = require("../utils/serialize"); const rpc_errors_1 = require("../utils/rpc_errors"); /// Keep ids unique across all connections. @@ -2252,7 +2258,7 @@ class JsonRpcProvider extends provider_1.Provider { exports.JsonRpcProvider = JsonRpcProvider; }).call(this,require("buffer").Buffer) -},{"../utils/errors":25,"../utils/rpc_errors":30,"../utils/serialize":31,"../utils/web":32,"./provider":20,"buffer":41,"depd":47}],20:[function(require,module,exports){ +},{"../utils/errors":25,"../utils/rpc_errors":31,"../utils/serialize":32,"../utils/web":33,"./provider":20,"buffer":42,"depd":48}],20:[function(require,module,exports){ (function (Buffer){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -2305,7 +2311,7 @@ function adaptTransactionResult(txResult) { exports.adaptTransactionResult = adaptTransactionResult; }).call(this,require("buffer").Buffer) -},{"buffer":41}],21:[function(require,module,exports){ +},{"buffer":42}],21:[function(require,module,exports){ module.exports={ "GasLimitExceeded": "Exceeded the maximum amount of gas allowed to burn per contract", "MethodEmptyName": "Method name is empty", @@ -2350,7 +2356,7 @@ module.exports={ "CostOverflow": "Transaction gas or balance cost is too high", "InvalidSignature": "Transaction is not signed with the given public key", "AccessKeyNotFound": "Signer \"{{account_id}}\" doesn't have access key with the given public_key {{public_key}}", - "NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {} for operation costing {}", + "NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {{balance}} for operation costing {{cost}}", "NotEnoughAllowance": "Access Key {account_id}:{public_key} does not have enough balance {{allowance}} for transaction costing {{cost}}", "Expired": "Transaction has expired", "DeleteAccountStaking": "Account {{account_id}} is staking and can not be deleted", @@ -2366,8 +2372,8 @@ module.exports={ "InvalidChain": "Transaction parent block hash doesn't belong to the current chain", "AccountDoesNotExist": "Can't complete the action because account {{account_id}} doesn't exist", "MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key", - "DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover the rent", - "DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover it's storage", + "DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover the rent", + "DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover it's storage", "InvalidReceiver": "Invalid receiver account ID {{receiver_id}} according to requirements", "DeleteKeyDoesNotExist": "Account {{account_id}} tries to remove an access key that doesn't exist", "Timeout": "Timeout exceeded", @@ -2400,7 +2406,7 @@ class InMemorySigner extends Signer { /** * Creates a public key for the account given * @param accountId The NEAR account to assign a public key to - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns {Promise} */ async createKey(accountId, networkId) { @@ -2411,7 +2417,7 @@ class InMemorySigner extends Signer { /** * Gets the existing public key for a given account * @param accountId The NEAR account to assign a public key to - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns {Promise} Returns the public key or null if not found */ async getPublicKey(accountId, networkId) { @@ -2424,7 +2430,7 @@ class InMemorySigner extends Signer { /** * @param message A message to be signed, typically a serialized transaction * @param accountId the NEAR account signing the message - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) * @returns {Promise} */ async signMessage(message, accountId, networkId) { @@ -2441,7 +2447,8 @@ class InMemorySigner extends Signer { } exports.InMemorySigner = InMemorySigner; -},{"./utils/key_pair":28,"js-sha256":61}],23:[function(require,module,exports){ +},{"./utils/key_pair":29,"js-sha256":62}],23:[function(require,module,exports){ +(function (Buffer){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -2499,8 +2506,20 @@ function deployContract(code) { return new Action({ deployContract: new DeployContract({ code }) }); } exports.deployContract = deployContract; +/** + * Constructs {@link Action} instance representing contract method call. + * + * @param methodName the name of the method to call + * @param args arguments to pass to method. Can be either plain JS object which gets serialized as JSON automatically + * or `Uint8Array` instance which represents bytes passed as is. + * @param gas max amount of gas that method call can use + * @param deposit amount of NEAR (in yoctoNEAR) to send together with the call + */ function functionCall(methodName, args, gas, deposit) { - return new Action({ functionCall: new FunctionCall({ methodName, args, gas, deposit }) }); + const anyArgs = args; + const isUint8Array = anyArgs.byteLength !== undefined && anyArgs.byteLength === anyArgs.length; + const serializedArgs = isUint8Array ? args : Buffer.from(JSON.stringify(args)); + return new Action({ functionCall: new FunctionCall({ methodName, args: serializedArgs, gas, deposit }) }); } exports.functionCall = functionCall; function transfer(deposit) { @@ -2631,7 +2650,7 @@ exports.createTransaction = createTransaction; * @param transaction The Transaction object to sign * @param signer The {Signer} object that assists with signing keys * @param accountId The human-readable NEAR account name - * @param networkId The targeted network. (ex. default, devnet, betanet, etc…) + * @param networkId The targeted network. (ex. default, betanet, etc…) */ async function signTransactionObject(transaction, signer, accountId, networkId) { const message = serialize_1.serialize(exports.SCHEMA, transaction); @@ -2657,7 +2676,8 @@ async function signTransaction(...args) { } exports.signTransaction = signTransaction; -},{"./utils/enums":24,"./utils/key_pair":28,"./utils/serialize":31,"js-sha256":61}],24:[function(require,module,exports){ +}).call(this,require("buffer").Buffer) +},{"./utils/enums":24,"./utils/key_pair":29,"./utils/serialize":32,"buffer":42,"js-sha256":62}],24:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Assignable = exports.Enum = void 0; @@ -2685,7 +2705,7 @@ exports.Assignable = Assignable; },{}],25:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypedError = exports.ArgumentTypeError = exports.PositionalArgsError = void 0; +exports.ErrorContext = exports.TypedError = exports.ArgumentTypeError = exports.PositionalArgsError = void 0; class PositionalArgsError extends Error { constructor() { super('Contract method calls expect named arguments wrapped in object, e.g. { argName1: argValue1, argName2: argValue2 }'); @@ -2699,15 +2719,45 @@ class ArgumentTypeError extends Error { } exports.ArgumentTypeError = ArgumentTypeError; class TypedError extends Error { - constructor(message, type) { + constructor(message, type, context) { super(message); this.type = type || 'UntypedError'; + this.context = context; } } exports.TypedError = TypedError; +class ErrorContext { + constructor(transactionHash) { + this.transactionHash = transactionHash; + } +} +exports.ErrorContext = ErrorContext; },{}],26:[function(require,module,exports){ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +async function exponentialBackoff(startWaitTime, retryNumber, waitBackoff, getResult) { + // TODO: jitter? + let waitTime = startWaitTime; + for (let i = 0; i < retryNumber; i++) { + const result = await getResult(); + if (result) { + return result; + } + await sleep(waitTime); + waitTime *= waitBackoff; + i++; + } + return null; +} +exports.default = exponentialBackoff; +// Sleep given number of millis. +function sleep(millis) { + return new Promise(resolve => setTimeout(resolve, millis)); +} + +},{}],27:[function(require,module,exports){ +"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; @@ -2814,7 +2864,7 @@ function formatWithCommas(value) { return value; } -},{"bn.js":37}],27:[function(require,module,exports){ +},{"bn.js":38}],28:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -2856,7 +2906,7 @@ Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () Object.defineProperty(exports, "KeyPair", { enumerable: true, get: function () { return key_pair_1.KeyPair; } }); Object.defineProperty(exports, "KeyPairEd25519", { enumerable: true, get: function () { return key_pair_1.KeyPairEd25519; } }); -},{"./enums":24,"./format":26,"./key_pair":28,"./network":29,"./rpc_errors":30,"./serialize":31,"./web":32}],28:[function(require,module,exports){ +},{"./enums":24,"./format":27,"./key_pair":29,"./network":30,"./rpc_errors":31,"./serialize":32,"./web":33}],29:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -2984,11 +3034,11 @@ class KeyPairEd25519 extends KeyPair { } exports.KeyPairEd25519 = KeyPairEd25519; -},{"./enums":24,"./serialize":31,"tweetnacl":74}],29:[function(require,module,exports){ +},{"./enums":24,"./serialize":32,"tweetnacl":75}],30:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -},{}],30:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -3093,7 +3143,7 @@ function isString(n) { return Object.prototype.toString.call(n) === '[object String]'; } -},{"../generated/rpc_error_schema.json":8,"../generated/rpc_error_types":9,"../res/error_messages.json":21,"mustache":62}],31:[function(require,module,exports){ +},{"../generated/rpc_error_schema.json":8,"../generated/rpc_error_types":9,"../res/error_messages.json":21,"mustache":63}],32:[function(require,module,exports){ (function (global,Buffer){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { @@ -3437,7 +3487,7 @@ function deserialize(schema, classType, buffer) { exports.deserialize = deserialize; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bn.js":37,"bs58":40,"buffer":41,"text-encoding-utf-8":72}],32:[function(require,module,exports){ +},{"bn.js":38,"bs58":41,"buffer":42,"text-encoding-utf-8":73}],33:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -3445,6 +3495,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchJson = void 0; const http_errors_1 = __importDefault(require("http-errors")); +const exponential_backoff_1 = __importDefault(require("./exponential-backoff")); +const providers_1 = require("../providers"); +const START_WAIT_TIME_MS = 1000; +const BACKOFF_MULTIPLIER = 1.5; +const RETRY_NUMBER = 10; // TODO: Move into separate module and exclude node-fetch kludge from browser build let fetch; if (typeof window === 'undefined' || window.name === 'nodejs') { @@ -3478,19 +3533,38 @@ async function fetchJson(connection, json) { else { url = connection.url; } - const response = await fetch(url, { - method: json ? 'POST' : 'GET', - body: json ? json : undefined, - headers: { 'Content-type': 'application/json; charset=utf-8' } + const response = await exponential_backoff_1.default(START_WAIT_TIME_MS, RETRY_NUMBER, BACKOFF_MULTIPLIER, async () => { + try { + const response = await fetch(url, { + method: json ? 'POST' : 'GET', + body: json ? json : undefined, + headers: { 'Content-type': 'application/json; charset=utf-8' } + }); + if (!response.ok) { + if (response.status === 503) { + console.warn(`Retrying HTTP request for ${url} as it's not available now`); + return null; + } + throw http_errors_1.default(response.status, await response.text()); + } + return response; + } + catch (error) { + if (error.toString().includes('FetchError')) { + console.warn(`Retrying HTTP request for ${url} because of error: ${error}`); + return null; + } + throw error; + } }); - if (!response.ok) { - throw http_errors_1.default(response.status, await response.text()); + if (!response) { + throw new providers_1.TypedError(`Exceeded ${RETRY_NUMBER} attempts for ${url}.`, 'RetriesExceeded'); } return await response.json(); } exports.fetchJson = fetchJson; -},{"http":39,"http-errors":57,"https":39,"node-fetch":39}],33:[function(require,module,exports){ +},{"../providers":18,"./exponential-backoff":26,"http":40,"http-errors":58,"https":40,"node-fetch":40}],34:[function(require,module,exports){ 'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -3549,7 +3623,7 @@ function diffEpochValidators(currentValidators, nextValidators) { } exports.diffEpochValidators = diffEpochValidators; -},{"bn.js":37}],34:[function(require,module,exports){ +},{"bn.js":38}],35:[function(require,module,exports){ (function (Buffer){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -3788,7 +3862,7 @@ class ConnectedWalletAccount extends account_1.Account { } }).call(this,require("buffer").Buffer) -},{"./account":2,"./transaction":23,"./utils":27,"./utils/serialize":31,"buffer":41}],35:[function(require,module,exports){ +},{"./account":2,"./transaction":23,"./utils":28,"./utils/serialize":32,"buffer":42}],36:[function(require,module,exports){ 'use strict' // base-x encoding / decoding // Copyright (c) 2018 base-x contributors @@ -3913,7 +3987,7 @@ function base (ALPHABET) { } module.exports = base -},{"safe-buffer":68}],36:[function(require,module,exports){ +},{"safe-buffer":69}],37:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -4067,7 +4141,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],37:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -7605,17 +7679,17 @@ function fromByteArray (uint8) { }; })(typeof module === 'undefined' || module, this); -},{"buffer":38}],38:[function(require,module,exports){ +},{"buffer":39}],39:[function(require,module,exports){ -},{}],39:[function(require,module,exports){ -arguments[4][38][0].apply(exports,arguments) -},{"dup":38}],40:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ +arguments[4][39][0].apply(exports,arguments) +},{"dup":39}],41:[function(require,module,exports){ var basex = require('base-x') var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' module.exports = basex(ALPHABET) -},{"base-x":35}],41:[function(require,module,exports){ +},{"base-x":36}],42:[function(require,module,exports){ (function (Buffer){ /*! * The buffer module from node.js, for the browser. @@ -9396,13 +9470,13 @@ function numberIsNaN (obj) { } }).call(this,require("buffer").Buffer) -},{"base64-js":36,"buffer":41,"ieee754":59}],42:[function(require,module,exports){ +},{"base64-js":37,"buffer":42,"ieee754":60}],43:[function(require,module,exports){ require(".").check("es5"); -},{".":43}],43:[function(require,module,exports){ +},{".":44}],44:[function(require,module,exports){ require("./lib/definitions"); module.exports = require("./lib"); -},{"./lib":46,"./lib/definitions":45}],44:[function(require,module,exports){ +},{"./lib":47,"./lib/definitions":46}],45:[function(require,module,exports){ var CapabilityDetector = function () { this.tests = {}; this.cache = {}; @@ -9432,7 +9506,7 @@ CapabilityDetector.prototype = { }; module.exports = CapabilityDetector; -},{}],45:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ var capability = require("."), define = capability.define, test = capability.test; @@ -9501,7 +9575,7 @@ define("Error.prototype.stack", function () { return e.stack || e.stacktrace; } }); -},{".":46}],46:[function(require,module,exports){ +},{".":47}],47:[function(require,module,exports){ var CapabilityDetector = require("./CapabilityDetector"); var detector = new CapabilityDetector(); @@ -9518,7 +9592,7 @@ capability.check = function (name) { capability.test = capability; module.exports = capability; -},{"./CapabilityDetector":44}],47:[function(require,module,exports){ +},{"./CapabilityDetector":45}],48:[function(require,module,exports){ /*! * depd * Copyright(c) 2015 Douglas Christopher Wilson @@ -9597,9 +9671,9 @@ function wrapproperty (obj, prop, message) { } } -},{}],48:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ module.exports = require("./lib"); -},{"./lib":49}],49:[function(require,module,exports){ +},{"./lib":50}],50:[function(require,module,exports){ require("capability/es5"); var capability = require("capability"); @@ -9613,7 +9687,7 @@ else polyfill = require("./unsupported"); module.exports = polyfill(); -},{"./non-v8/index":53,"./unsupported":55,"./v8":56,"capability":43,"capability/es5":42}],50:[function(require,module,exports){ +},{"./non-v8/index":54,"./unsupported":56,"./v8":57,"capability":44,"capability/es5":43}],51:[function(require,module,exports){ var Class = require("o3").Class, abstractMethod = require("o3").abstractMethod; @@ -9644,7 +9718,7 @@ var Frame = Class(Object, { }); module.exports = Frame; -},{"o3":63}],51:[function(require,module,exports){ +},{"o3":64}],52:[function(require,module,exports){ var Class = require("o3").Class, Frame = require("./Frame"), cache = require("u3").cache; @@ -9683,7 +9757,7 @@ module.exports = { return instance; }) }; -},{"./Frame":50,"o3":63,"u3":75}],52:[function(require,module,exports){ +},{"./Frame":51,"o3":64,"u3":76}],53:[function(require,module,exports){ var Class = require("o3").Class, abstractMethod = require("o3").abstractMethod, eachCombination = require("u3").eachCombination, @@ -9817,7 +9891,7 @@ module.exports = { return instance; }) }; -},{"capability":43,"o3":63,"u3":75}],53:[function(require,module,exports){ +},{"capability":44,"o3":64,"u3":76}],54:[function(require,module,exports){ var FrameStringSource = require("./FrameStringSource"), FrameStringParser = require("./FrameStringParser"), cache = require("u3").cache, @@ -9891,7 +9965,7 @@ module.exports = function () { prepareStackTrace: prepareStackTrace }; }; -},{"../prepareStackTrace":54,"./FrameStringParser":51,"./FrameStringSource":52,"u3":75}],54:[function(require,module,exports){ +},{"../prepareStackTrace":55,"./FrameStringParser":52,"./FrameStringSource":53,"u3":76}],55:[function(require,module,exports){ var prepareStackTrace = function (throwable, frames, warnings) { var string = ""; string += throwable.name || "Error"; @@ -9909,7 +9983,7 @@ var prepareStackTrace = function (throwable, frames, warnings) { }; module.exports = prepareStackTrace; -},{}],55:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ var cache = require("u3").cache, prepareStackTrace = require("./prepareStackTrace"); @@ -9960,7 +10034,7 @@ module.exports = function () { prepareStackTrace: prepareStackTrace }; }; -},{"./prepareStackTrace":54,"u3":75}],56:[function(require,module,exports){ +},{"./prepareStackTrace":55,"u3":76}],57:[function(require,module,exports){ var prepareStackTrace = require("./prepareStackTrace"); module.exports = function () { @@ -9972,7 +10046,7 @@ module.exports = function () { prepareStackTrace: prepareStackTrace }; }; -},{"./prepareStackTrace":54}],57:[function(require,module,exports){ +},{"./prepareStackTrace":55}],58:[function(require,module,exports){ /*! * http-errors * Copyright(c) 2014 Jonathan Ong @@ -10273,9 +10347,9 @@ function toClassName (name) { : name } -},{"depd":58,"inherits":60,"setprototypeof":69,"statuses":71,"toidentifier":73}],58:[function(require,module,exports){ -arguments[4][47][0].apply(exports,arguments) -},{"dup":47}],59:[function(require,module,exports){ +},{"depd":59,"inherits":61,"setprototypeof":70,"statuses":72,"toidentifier":74}],59:[function(require,module,exports){ +arguments[4][48][0].apply(exports,arguments) +},{"dup":48}],60:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -10361,7 +10435,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],60:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -10390,7 +10464,7 @@ if (typeof Object.create === 'function') { } } -},{}],61:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ (function (process,global){ /** * [js-sha256]{@link https://github.com/emn178/js-sha256} @@ -10912,7 +10986,7 @@ if (typeof Object.create === 'function') { })(); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":67}],62:[function(require,module,exports){ +},{"_process":68}],63:[function(require,module,exports){ // This file has been generated from mustache.mjs (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : @@ -11654,11 +11728,11 @@ if (typeof Object.create === 'function') { }))); -},{}],63:[function(require,module,exports){ +},{}],64:[function(require,module,exports){ require("capability/es5"); module.exports = require("./lib"); -},{"./lib":66,"capability/es5":42}],64:[function(require,module,exports){ +},{"./lib":67,"capability/es5":43}],65:[function(require,module,exports){ var Class = function () { var options = Object.create({ Source: Object, @@ -11793,16 +11867,16 @@ Class.newInstance = function () { }; module.exports = Class; -},{}],65:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ module.exports = function () { throw new Error("Not implemented."); }; -},{}],66:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ module.exports = { Class: require("./Class"), abstractMethod: require("./abstractMethod") }; -},{"./Class":64,"./abstractMethod":65}],67:[function(require,module,exports){ +},{"./Class":65,"./abstractMethod":66}],68:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -11988,7 +12062,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],68:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') @@ -12055,7 +12129,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":41}],69:[function(require,module,exports){ +},{"buffer":42}],70:[function(require,module,exports){ 'use strict' /* eslint no-proto: 0 */ module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties) @@ -12074,7 +12148,7 @@ function mixinProperties (obj, proto) { return obj } -},{}],70:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ module.exports={ "100": "Continue", "101": "Switching Protocols", @@ -12142,7 +12216,7 @@ module.exports={ "511": "Network Authentication Required" } -},{}],71:[function(require,module,exports){ +},{}],72:[function(require,module,exports){ /*! * statuses * Copyright(c) 2014 Jonathan Ong @@ -12257,7 +12331,7 @@ function status (code) { return n } -},{"./codes.json":70}],72:[function(require,module,exports){ +},{"./codes.json":71}],73:[function(require,module,exports){ 'use strict'; // This is free and unencumbered software released into the public domain. @@ -12900,7 +12974,7 @@ function UTF8Encoder(options) { exports.TextEncoder = TextEncoder; exports.TextDecoder = TextDecoder; -},{}],73:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ /*! * toidentifier * Copyright(c) 2016 Douglas Christopher Wilson @@ -12932,7 +13006,7 @@ function toIdentifier (str) { .replace(/[^ _0-9a-z]/gi, '') } -},{}],74:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ (function(nacl) { 'use strict'; @@ -15325,9 +15399,9 @@ nacl.setPRNG = function(fn) { })(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); -},{"crypto":38}],75:[function(require,module,exports){ -arguments[4][48][0].apply(exports,arguments) -},{"./lib":78,"dup":48}],76:[function(require,module,exports){ +},{"crypto":39}],76:[function(require,module,exports){ +arguments[4][49][0].apply(exports,arguments) +},{"./lib":79,"dup":49}],77:[function(require,module,exports){ var cache = function (fn) { var called = false, store; @@ -15349,7 +15423,7 @@ var cache = function (fn) { }; module.exports = cache; -},{}],77:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ module.exports = function eachCombination(alternativesByDimension, callback, combination) { if (!combination) combination = []; @@ -15364,12 +15438,12 @@ module.exports = function eachCombination(alternativesByDimension, callback, com else callback.apply(null, combination); }; -},{}],78:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ module.exports = { cache: require("./cache"), eachCombination: require("./eachCombination") }; -},{"./cache":76,"./eachCombination":77}],79:[function(require,module,exports){ +},{"./cache":77,"./eachCombination":78}],80:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -15394,14 +15468,14 @@ if (typeof Object.create === 'function') { } } -},{}],80:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],81:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -15991,4 +16065,4 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":80,"_process":67,"inherits":79}]},{},[1]); +},{"./support/isBuffer":81,"_process":68,"inherits":80}]},{},[1]); diff --git a/dist/near-api-js.min.js b/dist/near-api-js.min.js index 7a7af1e6be..8456a01ea0 100644 --- a/dist/near-api-js.min.js +++ b/dist/near-api-js.min.js @@ -3,27 +3,27 @@ require("error-polyfill"),window.nearApi=require("./lib/browser-index"),window.Buffer=Buffer; }).call(this,require("buffer").Buffer) -},{"./lib/browser-index":4,"buffer":42,"error-polyfill":50}],2:[function(require,module,exports){ +},{"./lib/browser-index":4,"buffer":43,"error-polyfill":51}],2:[function(require,module,exports){ (function (Buffer){ -"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Account=void 0;const bn_js_1=__importDefault(require("bn.js")),transaction_1=require("./transaction"),providers_1=require("./providers"),serialize_1=require("./utils/serialize"),key_pair_1=require("./utils/key_pair"),errors_1=require("./utils/errors"),rpc_errors_1=require("./utils/rpc_errors"),DEFAULT_FUNC_CALL_GAS=new bn_js_1.default("300000000000000"),TX_STATUS_RETRY_NUMBER=10,TX_STATUS_RETRY_WAIT=500,TX_STATUS_RETRY_WAIT_BACKOFF=1.5;function sleep(t){return new Promise(e=>setTimeout(e,t))}class Account{constructor(t,e){this.connection=t,this.accountId=e}get ready(){return this._ready||(this._ready=Promise.resolve(this.fetchState()))}async fetchState(){this._state=await this.connection.provider.query(`account/${this.accountId}`,"")}async state(){return await this.ready,this._state}printLogsAndFailures(t,e){for(const n of e)console.log(`Receipt${n.receiptIds.length>1?"s":""}: ${n.receiptIds.join(", ")}`),this.printLogs(t,n.logs,"\t"),n.failure&&console.warn(`\tFailure [${t}]: ${n.failure}`)}printLogs(t,e,n=""){for(const s of e)console.log(`${n}Log [${t}]: ${s}`)}async retryTxResult(t,e){let n;console.warn(`Retrying transaction ${e}:${serialize_1.base_encode(t)} as it has timed out`);let s=TX_STATUS_RETRY_WAIT;for(let r=0;re.outcome.logs.length||"object"==typeof e.outcome.status&&"object"==typeof e.outcome.status.Failure?t.concat({receiptIds:e.outcome.receipt_ids,logs:e.outcome.logs,failure:void 0!==e.outcome.status.Failure?rpc_errors_1.parseRpcError(e.outcome.status.Failure):null}):t,[]);if(this.printLogsAndFailures(a.transaction.receiverId,o),"object"==typeof i.status&&"object"==typeof i.status.Failure)throw i.status.Failure.error_message&&i.status.Failure.error_type?new providers_1.TypedError(`Transaction ${i.transaction_outcome.id} failed. ${i.status.Failure.error_message}`,i.status.Failure.error_type):rpc_errors_1.parseRpcError(i.status.Failure);return i}async findAccessKey(){const t=await this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);if(!t)return null;try{return await this.connection.provider.query(`access_key/${this.accountId}/${t.toString()}`,"")}catch(t){if(t.message.includes("does not exist while viewing"))return null;throw t}}async createAndDeployContract(t,e,n,s){const r=transaction_1.fullAccessKey();return await this.signAndSendTransaction(t,[transaction_1.createAccount(),transaction_1.transfer(s),transaction_1.addKey(key_pair_1.PublicKey.from(e),r),transaction_1.deployContract(n)]),new Account(this.connection,t)}async sendMoney(t,e){return this.signAndSendTransaction(t,[transaction_1.transfer(e)])}async createAccount(t,e,n){const s=transaction_1.fullAccessKey();return this.signAndSendTransaction(t,[transaction_1.createAccount(),transaction_1.transfer(n),transaction_1.addKey(key_pair_1.PublicKey.from(e),s)])}async deleteAccount(t){return this.signAndSendTransaction(this.accountId,[transaction_1.deleteAccount(t)])}async deployContract(t){return this.signAndSendTransaction(this.accountId,[transaction_1.deployContract(t)])}async functionCall(t,e,n,s,r){return n=n||{},this.validateArgs(n),this.signAndSendTransaction(t,[transaction_1.functionCall(e,Buffer.from(JSON.stringify(n)),s||DEFAULT_FUNC_CALL_GAS,r)])}async addKey(t,e,n,s){let r;return r=null==e||""===e?transaction_1.fullAccessKey():transaction_1.functionCallAccessKey(e,n?[n]:[],s),this.signAndSendTransaction(this.accountId,[transaction_1.addKey(key_pair_1.PublicKey.from(t),r)])}async deleteKey(t){return this.signAndSendTransaction(this.accountId,[transaction_1.deleteKey(key_pair_1.PublicKey.from(t))])}async stake(t,e){return this.signAndSendTransaction(this.accountId,[transaction_1.stake(e,key_pair_1.PublicKey.from(t))])}validateArgs(t){if(Array.isArray(t)||"object"!=typeof t)throw new errors_1.PositionalArgsError}async viewFunction(t,e,n){n=n||{},this.validateArgs(n);const s=await this.connection.provider.query(`call/${t}/${e}`,serialize_1.base_encode(JSON.stringify(n)));return s.logs&&this.printLogs(t,s.logs),s.result&&s.result.length>0&&JSON.parse(Buffer.from(s.result).toString())}async getAccessKeys(){const t=await this.connection.provider.query(`access_key/${this.accountId}`,"");return Array.isArray(t)?t:t.keys}async getAccountDetails(){const t=await this.getAccessKeys(),e={authorizedApps:[],transactions:[]};return t.map(t=>{if(void 0!==t.access_key.permission.FunctionCall){const n=t.access_key.permission.FunctionCall;e.authorizedApps.push({contractId:n.receiver_id,amount:n.allowance,publicKey:t.public_key})}}),e}async getAccountBalance(){const t=await this.connection.provider.experimental_genesisConfig(),e=await this.state(),n=new bn_js_1.default(t.runtime_config.storage_amount_per_byte),s=new bn_js_1.default(e.storage_usage).mul(n),r=new bn_js_1.default(e.locked),a=new bn_js_1.default(e.amount).add(r),i=a.sub(r).sub(s);return{total:a.toString(),stateStaked:s.toString(),staked:r.toString(),available:i.toString()}}}exports.Account=Account; +"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Account=void 0;const bn_js_1=__importDefault(require("bn.js")),transaction_1=require("./transaction"),providers_1=require("./providers"),serialize_1=require("./utils/serialize"),key_pair_1=require("./utils/key_pair"),errors_1=require("./utils/errors"),rpc_errors_1=require("./utils/rpc_errors"),exponential_backoff_1=__importDefault(require("./utils/exponential-backoff")),DEFAULT_FUNC_CALL_GAS=new bn_js_1.default("30000000000000"),TX_NONCE_RETRY_NUMBER=12,TX_STATUS_RETRY_NUMBER=12,TX_STATUS_RETRY_WAIT=500,TX_STATUS_RETRY_WAIT_BACKOFF=1.5;class Account{constructor(e,t){this.accessKeyByPublicKeyCache={},this.connection=e,this.accountId=t}get ready(){return this._ready||(this._ready=Promise.resolve(this.fetchState()))}async fetchState(){this._state=await this.connection.provider.query(`account/${this.accountId}`,"")}async state(){return await this.ready,this._state}printLogsAndFailures(e,t){for(const n of t)console.log(`Receipt${n.receiptIds.length>1?"s":""}: ${n.receiptIds.join(", ")}`),this.printLogs(e,n.logs,"\t"),n.failure&&console.warn(`\tFailure [${e}]: ${n.failure}`)}printLogs(e,t,n=""){for(const r of t)console.log(`${n}Log [${e}]: ${r}`)}async signAndSendTransaction(e,t){let n,r;await this.ready;const s=await exponential_backoff_1.default(TX_STATUS_RETRY_WAIT,TX_NONCE_RETRY_NUMBER,TX_STATUS_RETRY_WAIT_BACKOFF,async()=>{const s=await this.findAccessKey(e,t);if(!s)throw new providers_1.TypedError(`Can not sign transactions for account ${this.accountId}, no matching key pair found in Signer.`,"KeyNotFound");const{publicKey:a,accessKey:i}=s,o=await this.connection.provider.status(),c=++i.nonce;[n,r]=await transaction_1.signTransaction(e,c,t,serialize_1.base_decode(o.sync_info.latest_block_hash),this.connection.signer,this.accountId,this.connection.networkId);try{const t=await exponential_backoff_1.default(TX_STATUS_RETRY_WAIT,TX_STATUS_RETRY_NUMBER,TX_STATUS_RETRY_WAIT_BACKOFF,async()=>{try{return await this.connection.provider.sendTransaction(r)}catch(t){if("TimeoutError"===t.type)return console.warn(`Retrying transaction ${e}:${serialize_1.base_encode(n)} as it has timed out`),null;throw t}});if(!t)throw new providers_1.TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} attempts for transaction ${serialize_1.base_encode(n)}.`,"RetriesExceeded",new providers_1.ErrorContext(serialize_1.base_encode(n)));return t}catch(t){if(t.message.match(/Transaction nonce \d+ must be larger than nonce of the used access key \d+/))return console.warn(`Retrying transaction ${e}:${serialize_1.base_encode(n)} with new nonce.`),delete this.accessKeyByPublicKeyCache[a.toString()],null;throw t.context=new providers_1.ErrorContext(serialize_1.base_encode(n)),t}});if(!s)throw new providers_1.TypedError("nonce retries exceeded for transaction. This usually means there are too many parallel requests with the same access key.","RetriesExceeded");const a=[s.transaction_outcome,...s.receipts_outcome].reduce((e,t)=>t.outcome.logs.length||"object"==typeof t.outcome.status&&"object"==typeof t.outcome.status.Failure?e.concat({receiptIds:t.outcome.receipt_ids,logs:t.outcome.logs,failure:void 0!==t.outcome.status.Failure?rpc_errors_1.parseRpcError(t.outcome.status.Failure):null}):e,[]);if(this.printLogsAndFailures(r.transaction.receiverId,a),"object"==typeof s.status&&"object"==typeof s.status.Failure)throw s.status.Failure.error_message&&s.status.Failure.error_type?new providers_1.TypedError(`Transaction ${s.transaction_outcome.id} failed. ${s.status.Failure.error_message}`,s.status.Failure.error_type):rpc_errors_1.parseRpcError(s.status.Failure);return s}async findAccessKey(e,t){const n=await this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);if(!n)return null;const r=this.accessKeyByPublicKeyCache[n.toString()];if(void 0!==r)return{publicKey:n,accessKey:r};try{const e=await this.connection.provider.query(`access_key/${this.accountId}/${n.toString()}`,"");return this.accessKeyByPublicKeyCache[n.toString()]=e,{publicKey:n,accessKey:e}}catch(e){if(e.message.includes("does not exist while viewing"))return null;throw e}}async createAndDeployContract(e,t,n,r){const s=transaction_1.fullAccessKey();return await this.signAndSendTransaction(e,[transaction_1.createAccount(),transaction_1.transfer(r),transaction_1.addKey(key_pair_1.PublicKey.from(t),s),transaction_1.deployContract(n)]),new Account(this.connection,e)}async sendMoney(e,t){return this.signAndSendTransaction(e,[transaction_1.transfer(t)])}async createAccount(e,t,n){const r=transaction_1.fullAccessKey();return this.signAndSendTransaction(e,[transaction_1.createAccount(),transaction_1.transfer(n),transaction_1.addKey(key_pair_1.PublicKey.from(t),r)])}async deleteAccount(e){return this.signAndSendTransaction(this.accountId,[transaction_1.deleteAccount(e)])}async deployContract(e){return this.signAndSendTransaction(this.accountId,[transaction_1.deployContract(e)])}async functionCall(e,t,n,r,s){return n=n||{},this.validateArgs(n),this.signAndSendTransaction(e,[transaction_1.functionCall(t,n,r||DEFAULT_FUNC_CALL_GAS,s)])}async addKey(e,t,n,r){let s;return s=null==t||""===t?transaction_1.fullAccessKey():transaction_1.functionCallAccessKey(t,n?[n]:[],r),this.signAndSendTransaction(this.accountId,[transaction_1.addKey(key_pair_1.PublicKey.from(e),s)])}async deleteKey(e){return this.signAndSendTransaction(this.accountId,[transaction_1.deleteKey(key_pair_1.PublicKey.from(e))])}async stake(e,t){return this.signAndSendTransaction(this.accountId,[transaction_1.stake(t,key_pair_1.PublicKey.from(e))])}validateArgs(e){if(!(void 0!==e.byteLength&&e.byteLength===e.length)&&(Array.isArray(e)||"object"!=typeof e))throw new errors_1.PositionalArgsError}async viewFunction(e,t,n){n=n||{},this.validateArgs(n);const r=await this.connection.provider.query(`call/${e}/${t}`,serialize_1.base_encode(JSON.stringify(n)));return r.logs&&this.printLogs(e,r.logs),r.result&&r.result.length>0&&JSON.parse(Buffer.from(r.result).toString())}async getAccessKeys(){const e=await this.connection.provider.query(`access_key/${this.accountId}`,"");return Array.isArray(e)?e:e.keys}async getAccountDetails(){const e=await this.getAccessKeys(),t={authorizedApps:[],transactions:[]};return e.map(e=>{if(void 0!==e.access_key.permission.FunctionCall){const n=e.access_key.permission.FunctionCall;t.authorizedApps.push({contractId:n.receiver_id,amount:n.allowance,publicKey:e.public_key})}}),t}async getAccountBalance(){const e=await this.connection.provider.experimental_genesisConfig(),t=await this.state(),n=new bn_js_1.default(e.runtime_config.storage_amount_per_byte),r=new bn_js_1.default(t.storage_usage).mul(n),s=new bn_js_1.default(t.locked),a=new bn_js_1.default(t.amount).add(s),i=a.sub(s).sub(r);return{total:a.toString(),stateStaked:r.toString(),staked:s.toString(),available:i.toString()}}}exports.Account=Account; }).call(this,require("buffer").Buffer) -},{"./providers":18,"./transaction":23,"./utils/errors":25,"./utils/key_pair":28,"./utils/rpc_errors":30,"./utils/serialize":31,"bn.js":37,"buffer":42}],3:[function(require,module,exports){ +},{"./providers":18,"./transaction":23,"./utils/errors":25,"./utils/exponential-backoff":26,"./utils/key_pair":29,"./utils/rpc_errors":31,"./utils/serialize":32,"bn.js":38,"buffer":43}],3:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlAccountCreator=exports.LocalAccountCreator=exports.AccountCreator=void 0;const web_1=require("./utils/web");class AccountCreator{}exports.AccountCreator=AccountCreator;class LocalAccountCreator extends AccountCreator{constructor(t,c){super(),this.masterAccount=t,this.initialBalance=c}async createAccount(t,c){await this.masterAccount.createAccount(t,c,this.initialBalance)}}exports.LocalAccountCreator=LocalAccountCreator;class UrlAccountCreator extends AccountCreator{constructor(t,c){super(),this.connection=t,this.helperUrl=c}async createAccount(t,c){await web_1.fetchJson(`${this.helperUrl}/account`,JSON.stringify({newAccountId:t,newAccountPublicKey:c.toString()}))}}exports.UrlAccountCreator=UrlAccountCreator; -},{"./utils/web":32}],4:[function(require,module,exports){ +},{"./utils/web":33}],4:[function(require,module,exports){ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t},__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.keyStores=__importStar(require("./key_stores/browser-index")),__exportStar(require("./common-index"),exports); },{"./common-index":5,"./key_stores/browser-index":10}],5:[function(require,module,exports){ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WalletConnection=exports.WalletAccount=exports.Near=exports.connect=exports.KeyPair=exports.Signer=exports.InMemorySigner=exports.Contract=exports.Connection=exports.Account=exports.validators=exports.transactions=exports.utils=exports.providers=exports.accountCreator=void 0;const providers=__importStar(require("./providers"));exports.providers=providers;const utils=__importStar(require("./utils"));exports.utils=utils;const transactions=__importStar(require("./transaction"));exports.transactions=transactions;const validators=__importStar(require("./validators"));exports.validators=validators;const account_1=require("./account");Object.defineProperty(exports,"Account",{enumerable:!0,get:function(){return account_1.Account}});const accountCreator=__importStar(require("./account_creator"));exports.accountCreator=accountCreator;const connection_1=require("./connection");Object.defineProperty(exports,"Connection",{enumerable:!0,get:function(){return connection_1.Connection}});const signer_1=require("./signer");Object.defineProperty(exports,"Signer",{enumerable:!0,get:function(){return signer_1.Signer}}),Object.defineProperty(exports,"InMemorySigner",{enumerable:!0,get:function(){return signer_1.InMemorySigner}});const contract_1=require("./contract");Object.defineProperty(exports,"Contract",{enumerable:!0,get:function(){return contract_1.Contract}});const key_pair_1=require("./utils/key_pair");Object.defineProperty(exports,"KeyPair",{enumerable:!0,get:function(){return key_pair_1.KeyPair}});const near_1=require("./near");Object.defineProperty(exports,"connect",{enumerable:!0,get:function(){return near_1.connect}}),Object.defineProperty(exports,"Near",{enumerable:!0,get:function(){return near_1.Near}});const wallet_account_1=require("./wallet-account");Object.defineProperty(exports,"WalletAccount",{enumerable:!0,get:function(){return wallet_account_1.WalletAccount}}),Object.defineProperty(exports,"WalletConnection",{enumerable:!0,get:function(){return wallet_account_1.WalletConnection}}); -},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./near":17,"./providers":18,"./signer":22,"./transaction":23,"./utils":27,"./utils/key_pair":28,"./validators":33,"./wallet-account":34}],6:[function(require,module,exports){ +},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./near":17,"./providers":18,"./signer":22,"./transaction":23,"./utils":28,"./utils/key_pair":29,"./validators":34,"./wallet-account":35}],6:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Connection=void 0;const providers_1=require("./providers"),signer_1=require("./signer");function getProvider(e){switch(e.type){case void 0:return e;case"JsonRpcProvider":return new providers_1.JsonRpcProvider(e.args.url);default:throw new Error(`Unknown provider type ${e.type}`)}}function getSigner(e){switch(e.type){case void 0:return e;case"InMemorySigner":return new signer_1.InMemorySigner(e.keyStore);default:throw new Error(`Unknown signer type ${e.type}`)}}class Connection{constructor(e,r,n){this.networkId=e,this.provider=r,this.signer=n}static fromConfig(e){const r=getProvider(e.provider),n=getSigner(e.signer);return new Connection(e.networkId,r,n)}}exports.Connection=Connection; },{"./providers":18,"./signer":22}],7:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Contract=void 0;const bn_js_1=__importDefault(require("bn.js")),providers_1=require("./providers"),errors_1=require("./utils/errors");function nameFunction(t,r){return{[t]:(...t)=>r(...t)}[t]}class Contract{constructor(t,r,e){this.account=t,this.contractId=r;const{viewMethods:o=[],changeMethods:n=[]}=e;o.forEach(t=>{Object.defineProperty(this,t,{writable:!1,enumerable:!0,value:nameFunction(t,async(r={},...e)=>{if(e.length||"[object Object]"!==Object.prototype.toString.call(r))throw new errors_1.PositionalArgsError;return this.account.viewFunction(this.contractId,t,r)})})}),n.forEach(t=>{Object.defineProperty(this,t,{writable:!1,enumerable:!0,value:nameFunction(t,async(r={},e,o,...n)=>{if(n.length||"[object Object]"!==Object.prototype.toString.call(r))throw new errors_1.PositionalArgsError;validateBNLike({gas:e,amount:o});const i=await this.account.functionCall(this.contractId,t,r,e,o);return providers_1.getTransactionLastResult(i)})})})}}function validateBNLike(t){for(const r of Object.keys(t)){const e=t[r];if(e&&!bn_js_1.default.isBN(e)&&isNaN(e))throw new errors_1.ArgumentTypeError(r,"number, decimal string or BN",e)}}exports.Contract=Contract; -},{"./providers":18,"./utils/errors":25,"bn.js":37}],8:[function(require,module,exports){ +},{"./providers":18,"./utils/errors":25,"bn.js":38}],8:[function(require,module,exports){ module.exports={ "schema": { "BadUTF16": { @@ -700,38 +700,38 @@ module.exports={ },{"./browser_local_storage_key_store":11,"./in_memory_key_store":12,"./keystore":14,"./merge_key_store":15}],11:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BrowserLocalStorageKeyStore=void 0;const keystore_1=require("./keystore"),key_pair_1=require("../utils/key_pair"),LOCAL_STORAGE_KEY_PREFIX="near-api-js:keystore:";class BrowserLocalStorageKeyStore extends keystore_1.KeyStore{constructor(e=window.localStorage,t=LOCAL_STORAGE_KEY_PREFIX){super(),this.localStorage=e,this.prefix=t}async setKey(e,t,r){this.localStorage.setItem(this.storageKeyForSecretKey(e,t),r.toString())}async getKey(e,t){const r=this.localStorage.getItem(this.storageKeyForSecretKey(e,t));return r?key_pair_1.KeyPair.fromString(r):null}async removeKey(e,t){this.localStorage.removeItem(this.storageKeyForSecretKey(e,t))}async clear(){for(const e of this.storageKeys())e.startsWith(this.prefix)&&this.localStorage.removeItem(e)}async getNetworks(){const e=new Set;for(const t of this.storageKeys())if(t.startsWith(this.prefix)){const r=t.substring(this.prefix.length).split(":");e.add(r[1])}return Array.from(e.values())}async getAccounts(e){const t=new Array;for(const r of this.storageKeys())if(r.startsWith(this.prefix)){const s=r.substring(this.prefix.length).split(":");s[1]===e&&t.push(s[0])}return t}storageKeyForSecretKey(e,t){return`${this.prefix}${t}:${e}`}*storageKeys(){for(let e=0;e{const s=t.split(":");e.add(s[1])}),Array.from(e.values())}async getAccounts(e){const t=new Array;return Object.keys(this.keys).forEach(s=>{const r=s.split(":");r[r.length-1]===e&&t.push(r.slice(0,r.length-1).join(":"))}),t}}exports.InMemoryKeyStore=InMemoryKeyStore; -},{"../utils/key_pair":28,"./keystore":14}],13:[function(require,module,exports){ +},{"../utils/key_pair":29,"./keystore":14}],13:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MergeKeyStore=exports.UnencryptedFileSystemKeyStore=exports.BrowserLocalStorageKeyStore=exports.InMemoryKeyStore=exports.KeyStore=void 0;const keystore_1=require("./keystore");Object.defineProperty(exports,"KeyStore",{enumerable:!0,get:function(){return keystore_1.KeyStore}});const in_memory_key_store_1=require("./in_memory_key_store");Object.defineProperty(exports,"InMemoryKeyStore",{enumerable:!0,get:function(){return in_memory_key_store_1.InMemoryKeyStore}});const browser_local_storage_key_store_1=require("./browser_local_storage_key_store");Object.defineProperty(exports,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return browser_local_storage_key_store_1.BrowserLocalStorageKeyStore}});const unencrypted_file_system_keystore_1=require("./unencrypted_file_system_keystore");Object.defineProperty(exports,"UnencryptedFileSystemKeyStore",{enumerable:!0,get:function(){return unencrypted_file_system_keystore_1.UnencryptedFileSystemKeyStore}});const merge_key_store_1=require("./merge_key_store");Object.defineProperty(exports,"MergeKeyStore",{enumerable:!0,get:function(){return merge_key_store_1.MergeKeyStore}}); },{"./browser_local_storage_key_store":11,"./in_memory_key_store":12,"./keystore":14,"./merge_key_store":15,"./unencrypted_file_system_keystore":16}],14:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyStore=void 0;class KeyStore{}exports.KeyStore=KeyStore; },{}],15:[function(require,module,exports){ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MergeKeyStore=void 0;const keystore_1=require("./keystore");class MergeKeyStore extends keystore_1.KeyStore{constructor(e){super(),this.keyStores=e}async setKey(e,t,r){this.keyStores[0].setKey(e,t,r)}async getKey(e,t){for(const r of this.keyStores){const o=await r.getKey(e,t);if(o)return o}return null}async removeKey(e,t){for(const r of this.keyStores)r.removeKey(e,t)}async clear(){for(const e of this.keyStores)e.clear()}async getNetworks(){const e=new Set;for(const t of this.keyStores)for(const r of await t.getNetworks())e.add(r);return Array.from(e)}async getAccounts(e){const t=new Set;for(const r of this.keyStores)for(const o of await r.getAccounts(e))t.add(o);return Array.from(t)}}exports.MergeKeyStore=MergeKeyStore; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MergeKeyStore=void 0;const keystore_1=require("./keystore");class MergeKeyStore extends keystore_1.KeyStore{constructor(e){super(),this.keyStores=e}async setKey(e,t,r){await this.keyStores[0].setKey(e,t,r)}async getKey(e,t){for(const r of this.keyStores){const o=await r.getKey(e,t);if(o)return o}return null}async removeKey(e,t){for(const r of this.keyStores)await r.removeKey(e,t)}async clear(){for(const e of this.keyStores)await e.clear()}async getNetworks(){const e=new Set;for(const t of this.keyStores)for(const r of await t.getNetworks())e.add(r);return Array.from(e)}async getAccounts(e){const t=new Set;for(const r of this.keyStores)for(const o of await r.getAccounts(e))t.add(o);return Array.from(t)}}exports.MergeKeyStore=MergeKeyStore; },{"./keystore":14}],16:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UnencryptedFileSystemKeyStore=exports.readKeyFile=exports.loadJsonFile=void 0;const fs_1=__importDefault(require("fs")),util_1=require("util"),key_pair_1=require("../utils/key_pair"),keystore_1=require("./keystore"),promisify=e=>e?util_1.promisify(e):()=>{throw new Error("Trying to use unimplemented function. `fs` module not available in web build?")},exists=promisify(fs_1.default.exists),readFile=promisify(fs_1.default.readFile),writeFile=promisify(fs_1.default.writeFile),unlink=promisify(fs_1.default.unlink),readdir=promisify(fs_1.default.readdir),mkdir=promisify(fs_1.default.mkdir);async function loadJsonFile(e){const t=await readFile(e);return JSON.parse(t.toString())}async function ensureDir(e){try{await mkdir(e,{recursive:!0})}catch(e){if("EEXIST"!==e.code)throw e}}async function readKeyFile(e){const t=await loadJsonFile(e);let i=t.private_key;return!i&&t.secret_key&&(i=t.secret_key),[t.account_id,key_pair_1.KeyPair.fromString(i)]}exports.loadJsonFile=loadJsonFile,exports.readKeyFile=readKeyFile;class UnencryptedFileSystemKeyStore extends keystore_1.KeyStore{constructor(e){super(),this.keyDir=e}async setKey(e,t,i){await ensureDir(`${this.keyDir}/${e}`);const r={account_id:t,public_key:i.getPublicKey().toString(),private_key:i.toString()};await writeFile(this.getKeyFilePath(e,t),JSON.stringify(r))}async getKey(e,t){if(!await exists(this.getKeyFilePath(e,t)))return null;return(await readKeyFile(this.getKeyFilePath(e,t)))[1]}async removeKey(e,t){await exists(this.getKeyFilePath(e,t))&&await unlink(this.getKeyFilePath(e,t))}async clear(){for(const e of await this.getNetworks())for(const t of await this.getAccounts(e))await this.removeKey(e,t)}getKeyFilePath(e,t){return`${this.keyDir}/${e}/${t}.json`}async getNetworks(){const e=await readdir(this.keyDir),t=new Array;return e.forEach(e=>{t.push(e)}),t}async getAccounts(e){if(!await exists(`${this.keyDir}/${e}`))return[];return(await readdir(`${this.keyDir}/${e}`)).filter(e=>e.endsWith(".json")).map(e=>e.replace(/.json$/,""))}}exports.UnencryptedFileSystemKeyStore=UnencryptedFileSystemKeyStore; -},{"../utils/key_pair":28,"./keystore":14,"fs":39,"util":111}],17:[function(require,module,exports){ +},{"../utils/key_pair":29,"./keystore":14,"fs":40,"util":112}],17:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.connect=exports.Near=void 0;const bn_js_1=__importDefault(require("bn.js")),account_1=require("./account"),connection_1=require("./connection"),contract_1=require("./contract"),unencrypted_file_system_keystore_1=require("./key_stores/unencrypted_file_system_keystore"),account_creator_1=require("./account_creator"),key_stores_1=require("./key_stores");class Near{constructor(e){if(this.config=e,this.connection=connection_1.Connection.fromConfig({networkId:e.networkId,provider:{type:"JsonRpcProvider",args:{url:e.nodeUrl}},signer:e.signer||{type:"InMemorySigner",keyStore:e.keyStore||e.deps.keyStore}}),e.masterAccount){const t=e.initialBalance?new bn_js_1.default(e.initialBalance):new bn_js_1.default("500000000000000000000000000");this.accountCreator=new account_creator_1.LocalAccountCreator(new account_1.Account(this.connection,e.masterAccount),t)}else e.helperUrl?this.accountCreator=new account_creator_1.UrlAccountCreator(this.connection,e.helperUrl):this.accountCreator=null}async account(e){const t=new account_1.Account(this.connection,e);return await t.state(),t}async createAccount(e,t){if(!this.accountCreator)throw new Error("Must specify account creator, either via masterAccount or helperUrl configuration settings.");return await this.accountCreator.createAccount(e,t),new account_1.Account(this.connection,e)}async loadContract(e,t){const n=new account_1.Account(this.connection,t.sender);return new contract_1.Contract(n,e,t)}async sendTokens(e,t,n){console.warn("near.sendTokens is deprecated. Use `yourAccount.sendMoney` instead.");const o=new account_1.Account(this.connection,t);return(await o.sendMoney(n,e)).transaction_outcome.id}}async function connect(e){if(e.keyPath&&e.deps&&e.deps.keyStore)try{const t=await unencrypted_file_system_keystore_1.readKeyFile(e.keyPath);if(t[0]){const n=t[1],o=new key_stores_1.InMemoryKeyStore;await o.setKey(e.networkId,t[0],n),e.masterAccount||(e.masterAccount=t[0]),e.deps.keyStore=new key_stores_1.MergeKeyStore([e.deps.keyStore,o]),console.log(`Loaded master account ${t[0]} key from ${e.keyPath} with public key = ${n.getPublicKey()}`)}}catch(t){console.warn(`Failed to load master account key from ${e.keyPath}: ${t}`)}return new Near(e)}exports.Near=Near,exports.connect=connect; -},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./key_stores":13,"./key_stores/unencrypted_file_system_keystore":16,"bn.js":37}],18:[function(require,module,exports){ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TypedError=exports.getTransactionLastResult=exports.FinalExecutionStatusBasic=exports.JsonRpcProvider=exports.Provider=void 0;const provider_1=require("./provider");Object.defineProperty(exports,"Provider",{enumerable:!0,get:function(){return provider_1.Provider}}),Object.defineProperty(exports,"getTransactionLastResult",{enumerable:!0,get:function(){return provider_1.getTransactionLastResult}}),Object.defineProperty(exports,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return provider_1.FinalExecutionStatusBasic}});const json_rpc_provider_1=require("./json-rpc-provider");Object.defineProperty(exports,"JsonRpcProvider",{enumerable:!0,get:function(){return json_rpc_provider_1.JsonRpcProvider}}),Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return json_rpc_provider_1.TypedError}}); +},{"./account":2,"./account_creator":3,"./connection":6,"./contract":7,"./key_stores":13,"./key_stores/unencrypted_file_system_keystore":16,"bn.js":38}],18:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorContext=exports.TypedError=exports.getTransactionLastResult=exports.FinalExecutionStatusBasic=exports.JsonRpcProvider=exports.Provider=void 0;const provider_1=require("./provider");Object.defineProperty(exports,"Provider",{enumerable:!0,get:function(){return provider_1.Provider}}),Object.defineProperty(exports,"getTransactionLastResult",{enumerable:!0,get:function(){return provider_1.getTransactionLastResult}}),Object.defineProperty(exports,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return provider_1.FinalExecutionStatusBasic}});const json_rpc_provider_1=require("./json-rpc-provider");Object.defineProperty(exports,"JsonRpcProvider",{enumerable:!0,get:function(){return json_rpc_provider_1.JsonRpcProvider}}),Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return json_rpc_provider_1.TypedError}}),Object.defineProperty(exports,"ErrorContext",{enumerable:!0,get:function(){return json_rpc_provider_1.ErrorContext}}); },{"./json-rpc-provider":19,"./provider":20}],19:[function(require,module,exports){ (function (Buffer){ -"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsonRpcProvider=exports.TypedError=void 0;const depd_1=__importDefault(require("depd")),provider_1=require("./provider"),web_1=require("../utils/web"),errors_1=require("../utils/errors");Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return errors_1.TypedError}});const serialize_1=require("../utils/serialize"),rpc_errors_1=require("../utils/rpc_errors");let _nextId=123;class JsonRpcProvider extends provider_1.Provider{constructor(r){super(),this.connection={url:r}}async getNetwork(){return{name:"test",chainId:"test"}}async status(){return this.sendJsonRpc("status",[])}async sendTransaction(r){const e=r.encode();return this.sendJsonRpc("broadcast_tx_commit",[Buffer.from(e).toString("base64")]).then(provider_1.adaptTransactionResult)}async txStatus(r,e){return this.sendJsonRpc("tx",[serialize_1.base_encode(r),e]).then(provider_1.adaptTransactionResult)}async query(r,e){const t=await this.sendJsonRpc("query",[r,e]);if(t&&t.error)throw new Error(`Querying ${r} failed: ${t.error}.\n${JSON.stringify(t,null,2)}`);return t}async block(r){const{finality:e}=r;let{blockId:t}=r;if("object"!=typeof r){depd_1.default("JsonRpcProvider.block(blockId)")("use `block({ blockId })` or `block({ finality })` instead"),t=r}return this.sendJsonRpc("block",{block_id:t,finality:e})}async chunk(r){return this.sendJsonRpc("chunk",[r])}async validators(r){return this.sendJsonRpc("validators",[r])}async experimental_genesisConfig(){return await this.sendJsonRpc("EXPERIMENTAL_genesis_config",[])}async experimental_lightClientProof(r){return depd_1.default("JsonRpcProvider.experimental_lightClientProof(request)")("use `lightClientProof` instead"),await this.lightClientProof(r)}async lightClientProof(r){return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof",r)}async sendJsonRpc(r,e){const t={method:r,params:e,id:_nextId++,jsonrpc:"2.0"},o=await web_1.fetchJson(this.connection,JSON.stringify(t));if(o.error){if("object"==typeof o.error.data)throw"string"==typeof o.error.data.error_message&&"string"==typeof o.error.data.error_type?new errors_1.TypedError(o.error.data.error_message,o.error.data.error_type):rpc_errors_1.parseRpcError(o.error.data);{const r=`[${o.error.code}] ${o.error.message}: ${o.error.data}`;throw"Timeout"===o.error.data?new errors_1.TypedError("send_tx_commit has timed out.","TimeoutError"):new errors_1.TypedError(r)}}return o.result}}exports.JsonRpcProvider=JsonRpcProvider; +"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsonRpcProvider=exports.ErrorContext=exports.TypedError=void 0;const depd_1=__importDefault(require("depd")),provider_1=require("./provider"),web_1=require("../utils/web"),errors_1=require("../utils/errors");Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return errors_1.TypedError}}),Object.defineProperty(exports,"ErrorContext",{enumerable:!0,get:function(){return errors_1.ErrorContext}});const serialize_1=require("../utils/serialize"),rpc_errors_1=require("../utils/rpc_errors");let _nextId=123;class JsonRpcProvider extends provider_1.Provider{constructor(r){super(),this.connection={url:r}}async getNetwork(){return{name:"test",chainId:"test"}}async status(){return this.sendJsonRpc("status",[])}async sendTransaction(r){const e=r.encode();return this.sendJsonRpc("broadcast_tx_commit",[Buffer.from(e).toString("base64")]).then(provider_1.adaptTransactionResult)}async txStatus(r,e){return this.sendJsonRpc("tx",[serialize_1.base_encode(r),e]).then(provider_1.adaptTransactionResult)}async query(r,e){const t=await this.sendJsonRpc("query",[r,e]);if(t&&t.error)throw new Error(`Querying ${r} failed: ${t.error}.\n${JSON.stringify(t,null,2)}`);return t}async block(r){const{finality:e}=r;let{blockId:t}=r;if("object"!=typeof r){depd_1.default("JsonRpcProvider.block(blockId)")("use `block({ blockId })` or `block({ finality })` instead"),t=r}return this.sendJsonRpc("block",{block_id:t,finality:e})}async chunk(r){return this.sendJsonRpc("chunk",[r])}async validators(r){return this.sendJsonRpc("validators",[r])}async experimental_genesisConfig(){return await this.sendJsonRpc("EXPERIMENTAL_genesis_config",[])}async experimental_lightClientProof(r){return depd_1.default("JsonRpcProvider.experimental_lightClientProof(request)")("use `lightClientProof` instead"),await this.lightClientProof(r)}async lightClientProof(r){return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof",r)}async sendJsonRpc(r,e){const t={method:r,params:e,id:_nextId++,jsonrpc:"2.0"},o=await web_1.fetchJson(this.connection,JSON.stringify(t));if(o.error){if("object"==typeof o.error.data)throw"string"==typeof o.error.data.error_message&&"string"==typeof o.error.data.error_type?new errors_1.TypedError(o.error.data.error_message,o.error.data.error_type):rpc_errors_1.parseRpcError(o.error.data);{const r=`[${o.error.code}] ${o.error.message}: ${o.error.data}`;throw"Timeout"===o.error.data?new errors_1.TypedError("send_tx_commit has timed out.","TimeoutError"):new errors_1.TypedError(r)}}return o.result}}exports.JsonRpcProvider=JsonRpcProvider; }).call(this,require("buffer").Buffer) -},{"../utils/errors":25,"../utils/rpc_errors":30,"../utils/serialize":31,"../utils/web":32,"./provider":20,"buffer":42,"depd":49}],20:[function(require,module,exports){ +},{"../utils/errors":25,"../utils/rpc_errors":31,"../utils/serialize":32,"../utils/web":33,"./provider":20,"buffer":43,"depd":50}],20:[function(require,module,exports){ (function (Buffer){ "use strict";var ExecutionStatusBasic,FinalExecutionStatusBasic,IdType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.adaptTransactionResult=exports.getTransactionLastResult=exports.Provider=exports.IdType=exports.FinalExecutionStatusBasic=exports.ExecutionStatusBasic=void 0,function(t){t.Unknown="Unknown",t.Pending="Pending",t.Failure="Failure"}(ExecutionStatusBasic=exports.ExecutionStatusBasic||(exports.ExecutionStatusBasic={})),function(t){t.NotStarted="NotStarted",t.Started="Started",t.Failure="Failure"}(FinalExecutionStatusBasic=exports.FinalExecutionStatusBasic||(exports.FinalExecutionStatusBasic={})),function(t){t.Transaction="transaction",t.Receipt="receipt"}(IdType=exports.IdType||(exports.IdType={}));class Provider{}function getTransactionLastResult(t){if("object"==typeof t.status&&"string"==typeof t.status.SuccessValue){const e=Buffer.from(t.status.SuccessValue,"base64").toString();try{return JSON.parse(e)}catch(t){return e}}return null}function adaptTransactionResult(t){return"receipts"in t&&(t={status:t.status,transaction:null,transaction_outcome:t.transaction,receipts_outcome:t.receipts}),t}exports.Provider=Provider,exports.getTransactionLastResult=getTransactionLastResult,exports.adaptTransactionResult=adaptTransactionResult; }).call(this,require("buffer").Buffer) -},{"buffer":42}],21:[function(require,module,exports){ +},{"buffer":43}],21:[function(require,module,exports){ module.exports={ "GasLimitExceeded": "Exceeded the maximum amount of gas allowed to burn per contract", "MethodEmptyName": "Method name is empty", @@ -776,7 +776,7 @@ module.exports={ "CostOverflow": "Transaction gas or balance cost is too high", "InvalidSignature": "Transaction is not signed with the given public key", "AccessKeyNotFound": "Signer \"{{account_id}}\" doesn't have access key with the given public_key {{public_key}}", - "NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {} for operation costing {}", + "NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {{balance}} for operation costing {{cost}}", "NotEnoughAllowance": "Access Key {account_id}:{public_key} does not have enough balance {{allowance}} for transaction costing {{cost}}", "Expired": "Transaction has expired", "DeleteAccountStaking": "Account {{account_id}} is staking and can not be deleted", @@ -792,8 +792,8 @@ module.exports={ "InvalidChain": "Transaction parent block hash doesn't belong to the current chain", "AccountDoesNotExist": "Can't complete the action because account {{account_id}} doesn't exist", "MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key", - "DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover the rent", - "DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover it's storage", + "DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover the rent", + "DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover it's storage", "InvalidReceiver": "Invalid receiver account ID {{receiver_id}} according to requirements", "DeleteKeyDoesNotExist": "Account {{account_id}} tries to remove an access key that doesn't exist", "Timeout": "Timeout exceeded", @@ -803,177 +803,182 @@ module.exports={ },{}],22:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.InMemorySigner=exports.Signer=void 0;const js_sha256_1=__importDefault(require("js-sha256")),key_pair_1=require("./utils/key_pair");class Signer{}exports.Signer=Signer;class InMemorySigner extends Signer{constructor(e){super(),this.keyStore=e}async createKey(e,r){const t=key_pair_1.KeyPair.fromRandom("ed25519");return await this.keyStore.setKey(r,e,t),t.getPublicKey()}async getPublicKey(e,r){const t=await this.keyStore.getKey(r,e);return null===t?null:t.getPublicKey()}async signMessage(e,r,t){const n=new Uint8Array(js_sha256_1.default.sha256.array(e));if(!r)throw new Error("InMemorySigner requires provided account id");const i=await this.keyStore.getKey(t,r);if(null===i)throw new Error(`Key for ${r} not found in ${t}`);return i.sign(n)}}exports.InMemorySigner=InMemorySigner; -},{"./utils/key_pair":28,"js-sha256":65}],23:[function(require,module,exports){ -"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.signTransaction=exports.createTransaction=exports.SCHEMA=exports.Action=exports.SignedTransaction=exports.Transaction=exports.deleteAccount=exports.deleteKey=exports.addKey=exports.stake=exports.transfer=exports.functionCall=exports.deployContract=exports.createAccount=exports.IAction=exports.functionCallAccessKey=exports.fullAccessKey=exports.AccessKey=exports.AccessKeyPermission=exports.FullAccessPermission=exports.FunctionCallPermission=void 0;const js_sha256_1=__importDefault(require("js-sha256")),enums_1=require("./utils/enums"),serialize_1=require("./utils/serialize"),key_pair_1=require("./utils/key_pair");class FunctionCallPermission extends enums_1.Assignable{}exports.FunctionCallPermission=FunctionCallPermission;class FullAccessPermission extends enums_1.Assignable{}exports.FullAccessPermission=FullAccessPermission;class AccessKeyPermission extends enums_1.Enum{}exports.AccessKeyPermission=AccessKeyPermission;class AccessKey extends enums_1.Assignable{}function fullAccessKey(){return new AccessKey({nonce:0,permission:new AccessKeyPermission({fullAccess:new FullAccessPermission({})})})}function functionCallAccessKey(e,s,n){return new AccessKey({nonce:0,permission:new AccessKeyPermission({functionCall:new FunctionCallPermission({receiverId:e,allowance:n,methodNames:s})})})}exports.AccessKey=AccessKey,exports.fullAccessKey=fullAccessKey,exports.functionCallAccessKey=functionCallAccessKey;class IAction extends enums_1.Assignable{}exports.IAction=IAction;class CreateAccount extends IAction{}class DeployContract extends IAction{}class FunctionCall extends IAction{}class Transfer extends IAction{}class Stake extends IAction{}class AddKey extends IAction{}class DeleteKey extends IAction{}class DeleteAccount extends IAction{}function createAccount(){return new Action({createAccount:new CreateAccount({})})}function deployContract(e){return new Action({deployContract:new DeployContract({code:e})})}function functionCall(e,s,n,t){return new Action({functionCall:new FunctionCall({methodName:e,args:s,gas:n,deposit:t})})}function transfer(e){return new Action({transfer:new Transfer({deposit:e})})}function stake(e,s){return new Action({stake:new Stake({stake:e,publicKey:s})})}function addKey(e,s){return new Action({addKey:new AddKey({publicKey:e,accessKey:s})})}function deleteKey(e){return new Action({deleteKey:new DeleteKey({publicKey:e})})}function deleteAccount(e){return new Action({deleteAccount:new DeleteAccount({beneficiaryId:e})})}exports.createAccount=createAccount,exports.deployContract=deployContract,exports.functionCall=functionCall,exports.transfer=transfer,exports.stake=stake,exports.addKey=addKey,exports.deleteKey=deleteKey,exports.deleteAccount=deleteAccount;class Signature extends enums_1.Assignable{}class Transaction extends enums_1.Assignable{encode(){return serialize_1.serialize(exports.SCHEMA,this)}static decode(e){return serialize_1.deserialize(exports.SCHEMA,Transaction,e)}}exports.Transaction=Transaction;class SignedTransaction extends enums_1.Assignable{encode(){return serialize_1.serialize(exports.SCHEMA,this)}static decode(e){return serialize_1.deserialize(exports.SCHEMA,SignedTransaction,e)}}exports.SignedTransaction=SignedTransaction;class Action extends enums_1.Enum{}function createTransaction(e,s,n,t,c,i){return new Transaction({signerId:e,publicKey:s,nonce:t,receiverId:n,actions:c,blockHash:i})}async function signTransactionObject(e,s,n,t){const c=serialize_1.serialize(exports.SCHEMA,e),i=new Uint8Array(js_sha256_1.default.sha256.array(c)),r=await s.signMessage(c,n,t);return[i,new SignedTransaction({transaction:e,signature:new Signature({keyType:e.publicKey.keyType,data:r.signature})})]}async function signTransaction(...e){if(e[0].constructor===Transaction){const[s,n,t,c]=e;return signTransactionObject(s,n,t,c)}{const[s,n,t,c,i,r,o]=e;return signTransactionObject(createTransaction(r,await i.getPublicKey(r,o),s,n,t,c),i,r,o)}}exports.Action=Action,exports.SCHEMA=new Map([[Signature,{kind:"struct",fields:[["keyType","u8"],["data",[64]]]}],[SignedTransaction,{kind:"struct",fields:[["transaction",Transaction],["signature",Signature]]}],[Transaction,{kind:"struct",fields:[["signerId","string"],["publicKey",key_pair_1.PublicKey],["nonce","u64"],["receiverId","string"],["blockHash",[32]],["actions",[Action]]]}],[key_pair_1.PublicKey,{kind:"struct",fields:[["keyType","u8"],["data",[32]]]}],[AccessKey,{kind:"struct",fields:[["nonce","u64"],["permission",AccessKeyPermission]]}],[AccessKeyPermission,{kind:"enum",field:"enum",values:[["functionCall",FunctionCallPermission],["fullAccess",FullAccessPermission]]}],[FunctionCallPermission,{kind:"struct",fields:[["allowance",{kind:"option",type:"u128"}],["receiverId","string"],["methodNames",["string"]]]}],[FullAccessPermission,{kind:"struct",fields:[]}],[Action,{kind:"enum",field:"enum",values:[["createAccount",CreateAccount],["deployContract",DeployContract],["functionCall",FunctionCall],["transfer",Transfer],["stake",Stake],["addKey",AddKey],["deleteKey",DeleteKey],["deleteAccount",DeleteAccount]]}],[CreateAccount,{kind:"struct",fields:[]}],[DeployContract,{kind:"struct",fields:[["code",["u8"]]]}],[FunctionCall,{kind:"struct",fields:[["methodName","string"],["args",["u8"]],["gas","u64"],["deposit","u128"]]}],[Transfer,{kind:"struct",fields:[["deposit","u128"]]}],[Stake,{kind:"struct",fields:[["stake","u128"],["publicKey",key_pair_1.PublicKey]]}],[AddKey,{kind:"struct",fields:[["publicKey",key_pair_1.PublicKey],["accessKey",AccessKey]]}],[DeleteKey,{kind:"struct",fields:[["publicKey",key_pair_1.PublicKey]]}],[DeleteAccount,{kind:"struct",fields:[["beneficiaryId","string"]]}]]),exports.createTransaction=createTransaction,exports.signTransaction=signTransaction; +},{"./utils/key_pair":29,"js-sha256":66}],23:[function(require,module,exports){ +(function (Buffer){ +"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.signTransaction=exports.createTransaction=exports.SCHEMA=exports.Action=exports.SignedTransaction=exports.Transaction=exports.deleteAccount=exports.deleteKey=exports.addKey=exports.stake=exports.transfer=exports.functionCall=exports.deployContract=exports.createAccount=exports.IAction=exports.functionCallAccessKey=exports.fullAccessKey=exports.AccessKey=exports.AccessKeyPermission=exports.FullAccessPermission=exports.FunctionCallPermission=void 0;const js_sha256_1=__importDefault(require("js-sha256")),enums_1=require("./utils/enums"),serialize_1=require("./utils/serialize"),key_pair_1=require("./utils/key_pair");class FunctionCallPermission extends enums_1.Assignable{}exports.FunctionCallPermission=FunctionCallPermission;class FullAccessPermission extends enums_1.Assignable{}exports.FullAccessPermission=FullAccessPermission;class AccessKeyPermission extends enums_1.Enum{}exports.AccessKeyPermission=AccessKeyPermission;class AccessKey extends enums_1.Assignable{}function fullAccessKey(){return new AccessKey({nonce:0,permission:new AccessKeyPermission({fullAccess:new FullAccessPermission({})})})}function functionCallAccessKey(e,s,n){return new AccessKey({nonce:0,permission:new AccessKeyPermission({functionCall:new FunctionCallPermission({receiverId:e,allowance:n,methodNames:s})})})}exports.AccessKey=AccessKey,exports.fullAccessKey=fullAccessKey,exports.functionCallAccessKey=functionCallAccessKey;class IAction extends enums_1.Assignable{}exports.IAction=IAction;class CreateAccount extends IAction{}class DeployContract extends IAction{}class FunctionCall extends IAction{}class Transfer extends IAction{}class Stake extends IAction{}class AddKey extends IAction{}class DeleteKey extends IAction{}class DeleteAccount extends IAction{}function createAccount(){return new Action({createAccount:new CreateAccount({})})}function deployContract(e){return new Action({deployContract:new DeployContract({code:e})})}function functionCall(e,s,n,t){const c=s,i=void 0!==c.byteLength&&c.byteLength===c.length?s:Buffer.from(JSON.stringify(s));return new Action({functionCall:new FunctionCall({methodName:e,args:i,gas:n,deposit:t})})}function transfer(e){return new Action({transfer:new Transfer({deposit:e})})}function stake(e,s){return new Action({stake:new Stake({stake:e,publicKey:s})})}function addKey(e,s){return new Action({addKey:new AddKey({publicKey:e,accessKey:s})})}function deleteKey(e){return new Action({deleteKey:new DeleteKey({publicKey:e})})}function deleteAccount(e){return new Action({deleteAccount:new DeleteAccount({beneficiaryId:e})})}exports.createAccount=createAccount,exports.deployContract=deployContract,exports.functionCall=functionCall,exports.transfer=transfer,exports.stake=stake,exports.addKey=addKey,exports.deleteKey=deleteKey,exports.deleteAccount=deleteAccount;class Signature extends enums_1.Assignable{}class Transaction extends enums_1.Assignable{encode(){return serialize_1.serialize(exports.SCHEMA,this)}static decode(e){return serialize_1.deserialize(exports.SCHEMA,Transaction,e)}}exports.Transaction=Transaction;class SignedTransaction extends enums_1.Assignable{encode(){return serialize_1.serialize(exports.SCHEMA,this)}static decode(e){return serialize_1.deserialize(exports.SCHEMA,SignedTransaction,e)}}exports.SignedTransaction=SignedTransaction;class Action extends enums_1.Enum{}function createTransaction(e,s,n,t,c,i){return new Transaction({signerId:e,publicKey:s,nonce:t,receiverId:n,actions:c,blockHash:i})}async function signTransactionObject(e,s,n,t){const c=serialize_1.serialize(exports.SCHEMA,e),i=new Uint8Array(js_sha256_1.default.sha256.array(c)),r=await s.signMessage(c,n,t);return[i,new SignedTransaction({transaction:e,signature:new Signature({keyType:e.publicKey.keyType,data:r.signature})})]}async function signTransaction(...e){if(e[0].constructor===Transaction){const[s,n,t,c]=e;return signTransactionObject(s,n,t,c)}{const[s,n,t,c,i,r,o]=e;return signTransactionObject(createTransaction(r,await i.getPublicKey(r,o),s,n,t,c),i,r,o)}}exports.Action=Action,exports.SCHEMA=new Map([[Signature,{kind:"struct",fields:[["keyType","u8"],["data",[64]]]}],[SignedTransaction,{kind:"struct",fields:[["transaction",Transaction],["signature",Signature]]}],[Transaction,{kind:"struct",fields:[["signerId","string"],["publicKey",key_pair_1.PublicKey],["nonce","u64"],["receiverId","string"],["blockHash",[32]],["actions",[Action]]]}],[key_pair_1.PublicKey,{kind:"struct",fields:[["keyType","u8"],["data",[32]]]}],[AccessKey,{kind:"struct",fields:[["nonce","u64"],["permission",AccessKeyPermission]]}],[AccessKeyPermission,{kind:"enum",field:"enum",values:[["functionCall",FunctionCallPermission],["fullAccess",FullAccessPermission]]}],[FunctionCallPermission,{kind:"struct",fields:[["allowance",{kind:"option",type:"u128"}],["receiverId","string"],["methodNames",["string"]]]}],[FullAccessPermission,{kind:"struct",fields:[]}],[Action,{kind:"enum",field:"enum",values:[["createAccount",CreateAccount],["deployContract",DeployContract],["functionCall",FunctionCall],["transfer",Transfer],["stake",Stake],["addKey",AddKey],["deleteKey",DeleteKey],["deleteAccount",DeleteAccount]]}],[CreateAccount,{kind:"struct",fields:[]}],[DeployContract,{kind:"struct",fields:[["code",["u8"]]]}],[FunctionCall,{kind:"struct",fields:[["methodName","string"],["args",["u8"]],["gas","u64"],["deposit","u128"]]}],[Transfer,{kind:"struct",fields:[["deposit","u128"]]}],[Stake,{kind:"struct",fields:[["stake","u128"],["publicKey",key_pair_1.PublicKey]]}],[AddKey,{kind:"struct",fields:[["publicKey",key_pair_1.PublicKey],["accessKey",AccessKey]]}],[DeleteKey,{kind:"struct",fields:[["publicKey",key_pair_1.PublicKey]]}],[DeleteAccount,{kind:"struct",fields:[["beneficiaryId","string"]]}]]),exports.createTransaction=createTransaction,exports.signTransaction=signTransaction; -},{"./utils/enums":24,"./utils/key_pair":28,"./utils/serialize":31,"js-sha256":65}],24:[function(require,module,exports){ +}).call(this,require("buffer").Buffer) +},{"./utils/enums":24,"./utils/key_pair":29,"./utils/serialize":32,"buffer":43,"js-sha256":66}],24:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Assignable=exports.Enum=void 0;class Enum{constructor(e){if(1!==Object.keys(e).length)throw new Error("Enum can only take single value");Object.keys(e).map(s=>{this[s]=e[s],this.enum=s})}}exports.Enum=Enum;class Assignable{constructor(e){Object.keys(e).map(s=>{this[s]=e[s]})}}exports.Assignable=Assignable; },{}],25:[function(require,module,exports){ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TypedError=exports.ArgumentTypeError=exports.PositionalArgsError=void 0;class PositionalArgsError extends Error{constructor(){super("Contract method calls expect named arguments wrapped in object, e.g. { argName1: argValue1, argName2: argValue2 }")}}exports.PositionalArgsError=PositionalArgsError;class ArgumentTypeError extends Error{constructor(r,e,o){super(`Expected ${e} for '${r}' argument, but got '${JSON.stringify(o)}'`)}}exports.ArgumentTypeError=ArgumentTypeError;class TypedError extends Error{constructor(r,e){super(r),this.type=e||"UntypedError"}}exports.TypedError=TypedError; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorContext=exports.TypedError=exports.ArgumentTypeError=exports.PositionalArgsError=void 0;class PositionalArgsError extends Error{constructor(){super("Contract method calls expect named arguments wrapped in object, e.g. { argName1: argValue1, argName2: argValue2 }")}}exports.PositionalArgsError=PositionalArgsError;class ArgumentTypeError extends Error{constructor(r,e,t){super(`Expected ${e} for '${r}' argument, but got '${JSON.stringify(t)}'`)}}exports.ArgumentTypeError=ArgumentTypeError;class TypedError extends Error{constructor(r,e,t){super(r),this.type=e||"UntypedError",this.context=t}}exports.TypedError=TypedError;class ErrorContext{constructor(r){this.transactionHash=r}}exports.ErrorContext=ErrorContext; },{}],26:[function(require,module,exports){ +"use strict";async function exponentialBackoff(e,t,n,o){let r=e;for(let e=0;esetTimeout(t,e))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exponentialBackoff; + +},{}],27:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseNearAmount=exports.formatNearAmount=exports.NEAR_NOMINATION=exports.NEAR_NOMINATION_EXP=void 0;const bn_js_1=__importDefault(require("bn.js"));exports.NEAR_NOMINATION_EXP=24,exports.NEAR_NOMINATION=new bn_js_1.default("10",10).pow(new bn_js_1.default(exports.NEAR_NOMINATION_EXP,10));const ROUNDING_OFFSETS=[],BN10=new bn_js_1.default(10);for(let t=0,e=new bn_js_1.default(5);t0&&r.iadd(ROUNDING_OFFSETS[t])}const N=(t=r.toString()).substring(0,t.length-exports.NEAR_NOMINATION_EXP)||"0",n=t.substring(t.length-exports.NEAR_NOMINATION_EXP).padStart(exports.NEAR_NOMINATION_EXP,"0").substring(0,e);return trimTrailingZeroes(`${formatWithCommas(N)}.${n}`)}function parseNearAmount(t){if(!t)return null;const e=(t=cleanupAmount(t)).split("."),r=e[0],N=e[1]||"";if(e.length>2||N.length>exports.NEAR_NOMINATION_EXP)throw new Error(`Cannot parse '${t}' as NEAR amount`);return trimLeadingZeroes(r+N.padEnd(exports.NEAR_NOMINATION_EXP,"0"))}function cleanupAmount(t){return t.replace(/,/g,"").trim()}function trimTrailingZeroes(t){return t.replace(/\.?0*$/,"")}function trimLeadingZeroes(t){return""===(t=t.replace(/^0+/,""))?"0":t}function formatWithCommas(t){const e=/(-?\d+)(\d{3})/;for(;e.test(t);)t=t.replace(e,"$1,$2");return t}exports.formatNearAmount=formatNearAmount,exports.parseNearAmount=parseNearAmount; -},{"bn.js":37}],27:[function(require,module,exports){ +},{"bn.js":38}],28:[function(require,module,exports){ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t),Object.defineProperty(e,i,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&__createBinding(r,e,t);return __setModuleDefault(r,e),r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.rpc_errors=exports.KeyPairEd25519=exports.KeyPair=exports.PublicKey=exports.format=exports.enums=exports.web=exports.serialize=exports.network=exports.key_pair=void 0;const key_pair=__importStar(require("./key_pair"));exports.key_pair=key_pair;const network=__importStar(require("./network"));exports.network=network;const serialize=__importStar(require("./serialize"));exports.serialize=serialize;const web=__importStar(require("./web"));exports.web=web;const enums=__importStar(require("./enums"));exports.enums=enums;const format=__importStar(require("./format"));exports.format=format;const rpc_errors=__importStar(require("./rpc_errors"));exports.rpc_errors=rpc_errors;const key_pair_1=require("./key_pair");Object.defineProperty(exports,"PublicKey",{enumerable:!0,get:function(){return key_pair_1.PublicKey}}),Object.defineProperty(exports,"KeyPair",{enumerable:!0,get:function(){return key_pair_1.KeyPair}}),Object.defineProperty(exports,"KeyPairEd25519",{enumerable:!0,get:function(){return key_pair_1.KeyPairEd25519}}); -},{"./enums":24,"./format":26,"./key_pair":28,"./network":29,"./rpc_errors":30,"./serialize":31,"./web":32}],28:[function(require,module,exports){ +},{"./enums":24,"./format":27,"./key_pair":29,"./network":30,"./rpc_errors":31,"./serialize":32,"./web":33}],29:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyPairEd25519=exports.KeyPair=exports.PublicKey=exports.KeyType=void 0;const tweetnacl_1=__importDefault(require("tweetnacl")),serialize_1=require("./serialize"),enums_1=require("./enums");var KeyType;function key_type_to_str(e){switch(e){case KeyType.ED25519:return"ed25519";default:throw new Error(`Unknown key type ${e}`)}}function str_to_key_type(e){switch(e.toLowerCase()){case"ed25519":return KeyType.ED25519;default:throw new Error(`Unknown key type ${e}`)}}!function(e){e[e.ED25519=0]="ED25519"}(KeyType=exports.KeyType||(exports.KeyType={}));class PublicKey extends enums_1.Assignable{static from(e){return"string"==typeof e?PublicKey.fromString(e):e}static fromString(e){const t=e.split(":");if(1===t.length)return new PublicKey({keyType:KeyType.ED25519,data:serialize_1.base_decode(t[0])});if(2===t.length)return new PublicKey({keyType:str_to_key_type(t[0]),data:serialize_1.base_decode(t[1])});throw new Error("Invalid encoded key format, must be :")}toString(){return`${key_type_to_str(this.keyType)}:${serialize_1.base_encode(this.data)}`}}exports.PublicKey=PublicKey;class KeyPair{static fromRandom(e){switch(e.toUpperCase()){case"ED25519":return KeyPairEd25519.fromRandom();default:throw new Error(`Unknown curve ${e}`)}}static fromString(e){const t=e.split(":");if(1===t.length)return new KeyPairEd25519(t[0]);if(2!==t.length)throw new Error("Invalid encoded key format, must be :");switch(t[0].toUpperCase()){case"ED25519":return new KeyPairEd25519(t[1]);default:throw new Error(`Unknown curve: ${t[0]}`)}}}exports.KeyPair=KeyPair;class KeyPairEd25519 extends KeyPair{constructor(e){super();const t=tweetnacl_1.default.sign.keyPair.fromSecretKey(serialize_1.base_decode(e));this.publicKey=new PublicKey({keyType:KeyType.ED25519,data:t.publicKey}),this.secretKey=e}static fromRandom(){const e=tweetnacl_1.default.sign.keyPair();return new KeyPairEd25519(serialize_1.base_encode(e.secretKey))}sign(e){return{signature:tweetnacl_1.default.sign.detached(e,serialize_1.base_decode(this.secretKey)),publicKey:this.publicKey}}verify(e,t){return tweetnacl_1.default.sign.detached.verify(e,t,this.publicKey.data)}toString(){return`ed25519:${this.secretKey}`}getPublicKey(){return this.publicKey}}exports.KeyPairEd25519=KeyPairEd25519; -},{"./enums":24,"./serialize":31,"tweetnacl":101}],29:[function(require,module,exports){ +},{"./enums":24,"./serialize":32,"tweetnacl":102}],30:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}); -},{}],30:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(r,e,t,o){void 0===o&&(o=t),Object.defineProperty(r,o,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,o){void 0===o&&(o=t),r[o]=e[t]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),__importStar=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(null!=r)for(var t in r)"default"!==t&&Object.hasOwnProperty.call(r,t)&&__createBinding(e,r,t);return __setModuleDefault(e,r),e},__exportStar=this&&this.__exportStar||function(r,e){for(var t in r)"default"===t||e.hasOwnProperty(t)||__createBinding(e,r,t)},__importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=exports.parseRpcError=void 0;const mustache_1=__importDefault(require("mustache")),rpc_error_schema_json_1=__importDefault(require("../generated/rpc_error_schema.json")),error_messages_json_1=__importDefault(require("../res/error_messages.json")),CLASSMAP=__importStar(require("../generated/rpc_error_types"));function parseRpcError(r){const e={},t=walkSubtype(r,rpc_error_schema_json_1.default.schema,e,""),o=new CLASSMAP[t](formatError(t,e),t);return Object.assign(o,e),o}function formatError(r,e){return"string"==typeof error_messages_json_1.default[r]?mustache_1.default.render(error_messages_json_1.default[r],e):JSON.stringify(e)}function walkSubtype(r,e,t,o){let n,i,s;for(const t in e){if(isString(r[t]))return r[t];if(isObject(r[t]))n=r[t],i=e[t],s=t;else{if(!isObject(r.kind)||!isObject(r.kind[t]))continue;n=r.kind[t],i=e[t],s=t}}if(n&&i){for(const r of Object.keys(i.props))t[r]=n[r];return walkSubtype(n,e,t,s)}return o}function isObject(r){return"[object Object]"===Object.prototype.toString.call(r)}function isString(r){return"[object String]"===Object.prototype.toString.call(r)}__exportStar(require("../generated/rpc_error_types"),exports),exports.parseRpcError=parseRpcError,exports.formatError=formatError; -},{"../generated/rpc_error_schema.json":8,"../generated/rpc_error_types":9,"../res/error_messages.json":21,"mustache":66}],31:[function(require,module,exports){ +},{"../generated/rpc_error_schema.json":8,"../generated/rpc_error_types":9,"../res/error_messages.json":21,"mustache":67}],32:[function(require,module,exports){ (function (global,Buffer){ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t),Object.defineProperty(e,i,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),__decorate=this&&this.__decorate||function(e,r,t,i){var n,o=arguments.length,s=o<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(r,t,s):n(r,t))||s);return o>3&&s&&Object.defineProperty(r,t,s),s},__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&__createBinding(r,e,t);return __setModuleDefault(r,e),r},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.deserialize=exports.serialize=exports.BinaryReader=exports.BinaryWriter=exports.BorshError=exports.base_decode=exports.base_encode=void 0;const bs58_1=__importDefault(require("bs58")),bn_js_1=__importDefault(require("bn.js")),encoding=__importStar(require("text-encoding-utf-8")),TextDecoder="function"!=typeof global.TextDecoder?encoding.TextDecoder:global.TextDecoder,textDecoder=new TextDecoder("utf-8",{fatal:!0});function base_encode(e){return"string"==typeof e&&(e=Buffer.from(e,"utf8")),bs58_1.default.encode(Buffer.from(e))}function base_decode(e){return Buffer.from(bs58_1.default.decode(e))}exports.base_encode=base_encode,exports.base_decode=base_decode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}exports.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer.alloc(INITIAL_LENGTH),this.length=0}maybe_resize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(INITIAL_LENGTH)]))}write_u8(e){this.maybe_resize(),this.buf.writeUInt8(e,this.length),this.length+=1}write_u32(e){this.maybe_resize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}write_u64(e){this.maybe_resize(),this.write_buffer(Buffer.from(new bn_js_1.default(e).toArray("le",8)))}write_u128(e){this.maybe_resize(),this.write_buffer(Buffer.from(new bn_js_1.default(e).toArray("le",16)))}write_buffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(INITIAL_LENGTH)]),this.length+=e.length}write_string(e){this.maybe_resize();const r=Buffer.from(e,"utf8");this.write_u32(r.length),this.write_buffer(r)}write_fixed_array(e){this.write_buffer(Buffer.from(e))}write_array(e,r){this.maybe_resize(),this.write_u32(e.length);for(const t of e)this.maybe_resize(),r(t)}toArray(){return this.buf.subarray(0,this.length)}}function handlingRangeError(e,r,t){const i=t.value;t.value=function(...e){try{return i.apply(this,e)}catch(e){if(e instanceof RangeError){const r=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(r)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw e}}}exports.BinaryWriter=BinaryWriter;class BinaryReader{constructor(e){this.buf=e,this.offset=0}read_u8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}read_u32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}read_u64(){const e=this.read_buffer(8);return new bn_js_1.default(e,"le")}read_u128(){const e=this.read_buffer(16);return new bn_js_1.default(e,"le")}read_buffer(e){if(this.offset+e>this.buf.length)throw new BorshError(`Expected buffer length ${e} isn't within bounds`);const r=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,r}read_string(){const e=this.read_u32(),r=this.read_buffer(e);try{return textDecoder.decode(r)}catch(e){throw new BorshError(`Error decoding UTF-8 string: ${e}`)}}read_fixed_array(e){return new Uint8Array(this.read_buffer(e))}read_array(e){const r=this.read_u32(),t=Array();for(let i=0;i{serializeField(e,r,t,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null===t?n.write_u8(0):(n.write_u8(1),serializeField(e,r,t,i.type,n));break;default:throw new BorshError(`FieldType ${i} unrecognized`)}else serializeStruct(e,t,n)}catch(e){throw e instanceof BorshError&&e.addToFieldPath(r),e}}function serializeStruct(e,r,t){const i=e.get(r.constructor);if(!i)throw new BorshError(`Class ${r.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{serializeField(e,i,r[i],n,t)});else{if("enum"!==i.kind)throw new BorshError(`Unexpected schema kind: ${i.kind} for ${r.constructor.name}`);{const n=r[i.field];for(let o=0;odeserializeField(e,r,t[0],i)):deserializeStruct(e,t,i)}catch(e){throw e instanceof BorshError&&e.addToFieldPath(r),e}}function deserializeStruct(e,r,t){const i=e.get(r);if(!i)throw new BorshError(`Class ${r.name} is missing in schema`);if("struct"===i.kind){const i={};for(const[n,o]of e.get(r).fields)i[n]=deserializeField(e,n,o,t);return new r(i)}if("enum"===i.kind){const n=t.read_u8();if(n>=i.values.length)throw new BorshError(`Enum index: ${n} is out of range`);const[o,s]=i.values[n];return new r({[o]:deserializeField(e,o,s,t)})}throw new BorshError(`Unexpected schema kind: ${i.kind} for ${r.constructor.name}`)}function deserialize(e,r,t){const i=new BinaryReader(t),n=deserializeStruct(e,r,i);if(i.offset{try{const e=await fetch(r,{method:t?"POST":"GET",body:t||void 0,headers:{"Content-type":"application/json; charset=utf-8"}});if(!e.ok){if(503===e.status)return console.warn(`Retrying HTTP request for ${r} as it's not available now`),null;throw http_errors_1.default(e.status,await e.text())}return e}catch(e){if(e.toString().includes("FetchError"))return console.warn(`Retrying HTTP request for ${r} because of error: ${e}`),null;throw e}});if(!o)throw new providers_1.TypedError(`Exceeded ${RETRY_NUMBER} attempts for ${r}.`,"RetriesExceeded");return await o.json()}exports.fetchJson=fetchJson; -},{"http":79,"http-errors":60,"https":62,"node-fetch":39}],33:[function(require,module,exports){ +},{"../providers":18,"./exponential-backoff":26,"http":80,"http-errors":61,"https":63,"node-fetch":40}],34:[function(require,module,exports){ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.diffEpochValidators=exports.findSeatPrice=void 0;const bn_js_1=__importDefault(require("bn.js"));function findSeatPrice(e,t){const a=e.map(e=>new bn_js_1.default(e.stake,10)).sort((e,t)=>e.cmp(t)),n=new bn_js_1.default(t),r=a.reduce((e,t)=>e.add(t));if(r.lt(n))throw new Error("Stakes are below seats");let d=new bn_js_1.default(1),o=r.add(new bn_js_1.default(1));for(;!d.eq(o.sub(new bn_js_1.default(1)));){const e=d.add(o).div(new bn_js_1.default(2));let t=!1,r=new bn_js_1.default(0);for(let o=0;oa.set(e.account_id,e));const n=new Set(t.map(e=>e.account_id));return{newValidators:t.filter(e=>!a.has(e.account_id)),removedValidators:e.filter(e=>!n.has(e.account_id)),changedValidators:t.filter(e=>a.has(e.account_id)&&a.get(e.account_id).stake!=e.stake).map(e=>({current:a.get(e.account_id),next:e}))}}exports.findSeatPrice=findSeatPrice,exports.diffEpochValidators=diffEpochValidators; -},{"bn.js":37}],34:[function(require,module,exports){ +},{"bn.js":38}],35:[function(require,module,exports){ (function (Buffer){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WalletAccount=exports.WalletConnection=void 0;const account_1=require("./account"),transaction_1=require("./transaction"),utils_1=require("./utils"),serialize_1=require("./utils/serialize"),LOGIN_WALLET_URL_SUFFIX="/login/",LOCAL_STORAGE_KEY_SUFFIX="_wallet_auth_key",PENDING_ACCESS_KEY_PREFIX="pending_key";class WalletConnection{constructor(t,e){this._near=t;const a=e+LOCAL_STORAGE_KEY_SUFFIX,n=JSON.parse(window.localStorage.getItem(a));this._networkId=t.config.networkId,this._walletBaseUrl=t.config.walletUrl,e=e||t.config.contractName||"default",this._keyStore=t.connection.signer.keyStore,this._authData=n||{allKeys:[]},this._authDataKey=a,this.isSignedIn()||this._completeSignInWithAccessKey()}isSignedIn(){return!!this._authData.accountId}getAccountId(){return this._authData.accountId||""}async requestSignIn(t,e,a,n){if(this.getAccountId()||await this._keyStore.getKey(this._networkId,this.getAccountId()))return Promise.resolve();const s=new URL(window.location.href),i=new URL(this._walletBaseUrl+LOGIN_WALLET_URL_SUFFIX);i.searchParams.set("title",e),i.searchParams.set("contract_id",t),i.searchParams.set("success_url",a||s.href),i.searchParams.set("failure_url",n||s.href),i.searchParams.set("app_url",s.origin);const c=utils_1.KeyPair.fromRandom("ed25519");i.searchParams.set("public_key",c.getPublicKey().toString()),await this._keyStore.setKey(this._networkId,PENDING_ACCESS_KEY_PREFIX+c.getPublicKey(),c),window.location.assign(i.toString())}async requestSignTransactions(t,e){const a=new URL(window.location.href),n=new URL("sign",this._walletBaseUrl);n.searchParams.set("transactions",t.map(t=>utils_1.serialize.serialize(transaction_1.SCHEMA,t)).map(t=>Buffer.from(t).toString("base64")).join(",")),n.searchParams.set("callbackUrl",e||a.href),window.location.assign(n.toString())}async _completeSignInWithAccessKey(){const t=new URL(window.location.href),e=t.searchParams.get("public_key")||"",a=(t.searchParams.get("all_keys")||"").split(","),n=t.searchParams.get("account_id")||"";n&&e&&(this._authData={accountId:n,allKeys:a},window.localStorage.setItem(this._authDataKey,JSON.stringify(this._authData)),await this._moveKeyFromTempToPermanent(n,e)),t.searchParams.delete("public_key"),t.searchParams.delete("all_keys"),t.searchParams.delete("account_id"),window.history.replaceState({},document.title,t.toString())}async _moveKeyFromTempToPermanent(t,e){const a=await this._keyStore.getKey(this._networkId,PENDING_ACCESS_KEY_PREFIX+e);await this._keyStore.setKey(this._networkId,t,a),await this._keyStore.removeKey(this._networkId,PENDING_ACCESS_KEY_PREFIX+e)}signOut(){this._authData={},window.localStorage.removeItem(this._authDataKey)}account(){return this._connectedAccount||(this._connectedAccount=new ConnectedWalletAccount(this,this._near.connection,this._authData.accountId)),this._connectedAccount}}exports.WalletConnection=WalletConnection,exports.WalletAccount=WalletConnection;class ConnectedWalletAccount extends account_1.Account{constructor(t,e,a){super(e,a),this.walletConnection=t}async signAndSendTransaction(t,e){await this.ready;const a=await this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);let n=await this.accessKeyForTransaction(t,e,a);if(!n)throw new Error(`Cannot find matching key for transaction sent to ${t}`);if(a&&a.toString()===n.public_key)try{return await super.signAndSendTransaction(t,e)}catch(a){if(!a.message.includes("does not have enough balance"))throw a;n=await this.accessKeyForTransaction(t,e)}const s=utils_1.PublicKey.from(n.public_key),i=n.access_key.nonce+1,c=await this.connection.provider.status(),o=serialize_1.base_decode(c.sync_info.latest_block_hash),r=transaction_1.createTransaction(this.accountId,s,t,i,e,o);return await this.walletConnection.requestSignTransactions([r],window.location.href),new Promise((t,e)=>{setTimeout(()=>{e(new Error("Failed to redirect to sign transaction"))},1e3)})}async accessKeyMatchesTransaction(t,e,a){const{access_key:{permission:n}}=t;if("FullAccess"===n)return!0;if(n.FunctionCall){const{receiver_id:t,method_names:s}=n.FunctionCall;if(t===e){if(1!==a.length)return!1;const[{functionCall:t}]=a;return t&&(!t.deposit||"0"===t.deposit.toString())&&(0===s.length||s.includes(t.methodName))}}return!1}async accessKeyForTransaction(t,e,a){const n=await this.getAccessKeys();if(a){const s=n.find(t=>t.public_key===a.toString());if(s&&await this.accessKeyMatchesTransaction(s,t,e))return s}const s=this.walletConnection._authData.allKeys;for(const a of n)if(-1!==s.indexOf(a.public_key)&&await this.accessKeyMatchesTransaction(a,t,e))return a;return null}} }).call(this,require("buffer").Buffer) -},{"./account":2,"./transaction":23,"./utils":27,"./utils/serialize":31,"buffer":42}],35:[function(require,module,exports){ +},{"./account":2,"./transaction":23,"./utils":28,"./utils/serialize":32,"buffer":43}],36:[function(require,module,exports){ "use strict";var _Buffer=require("safe-buffer").Buffer;function base(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),o=0;o>>0,u=new Uint8Array(a);r[o];){var c=e[r.charCodeAt(o)];if(255===c)return;for(var l=0,v=a-1;(0!==c||l>>0,u[v]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");t=l,o++}if(" "!==r[o]){for(var w=a-t;w!==a&&0===u[w];)w++;var g=_Buffer.allocUnsafe(f+(a-w));g.fill(0,0,f);for(var s=f;w!==a;)g[s++]=u[w++];return g}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=_Buffer.from(e)),!_Buffer.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var o=0,f=0,t=0,a=e.length;t!==a&&0===e[t];)t++,o++;for(var h=(a-t)*u+1>>>0,c=new Uint8Array(h);t!==a;){for(var l=e[t],v=0,w=h-1;(0!==l||v>>0,c[w]=l%n>>>0,l=l/n>>>0;if(0!==l)throw new Error("Non-zero carry");f=v,t++}for(var g=h-f;g!==h&&0===c[g];)g++;for(var s=i.repeat(o);g0)throw new Error("Invalid string. Length must be a multiple of 4");var e=o.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function byteLength(o){var r=getLens(o),e=r[0],t=r[1];return 3*(e+t)/4-t}function _byteLength(o,r,e){return 3*(r+e)/4-e}function toByteArray(o){var r,e,t=getLens(o),n=t[0],u=t[1],p=new Arr(_byteLength(o,n,u)),a=0,h=u>0?n-4:n;for(e=0;e>16&255,p[a++]=r>>8&255,p[a++]=255&r;return 2===u&&(r=revLookup[o.charCodeAt(e)]<<2|revLookup[o.charCodeAt(e+1)]>>4,p[a++]=255&r),1===u&&(r=revLookup[o.charCodeAt(e)]<<10|revLookup[o.charCodeAt(e+1)]<<4|revLookup[o.charCodeAt(e+2)]>>2,p[a++]=r>>8&255,p[a++]=255&r),p}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,n=[],u=r;up?p:u+16383));return 1===t?(r=o[e-1],n.push(lookup[r>>2]+lookup[r<<4&63]+"==")):2===t&&(r=(o[e-2]<<8)+o[e-1],n.push(lookup[r>>10]+lookup[r>>4&63]+lookup[r<<2&63]+"=")),n.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63; -},{}],37:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ !function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,n){for(var h=0,e=Math.min(t.length,n),o=0,s=i;s=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:a,o|=u}return r(!(240&o),"Invalid character in "+t),h}function s(t,i,n,h){for(var e=0,o=0,s=Math.min(t.length,n),u=i;u=49?a-49+10:a>=17?a-17+10:a,r(a>=0&&o"}h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if("number"==typeof t)return this._initNumber(t,i,n);if("object"==typeof t)return this._initArray(t,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var h=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&h++,16===i?this._parseHex(t,h):this._parseBase(t,i,h),"-"===t[0]&&(this.negative=1),this._strip(),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initNumber=function(t,i,n){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initArray=function(t,i,n){if(r("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 h=0;h=0;h-=3)o=t[h]|t[h-1]<<8|t[h-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===n)for(h=0,e=0;h>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this._strip()},h.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)h=o(t,r,r+6),this.words[n]|=h<>>26-e&4194303,(e+=24)>=26&&(e-=26,n++);r+6!==i&&(h=o(t,i,r+6),this.words[n]|=h<>>26-e&4194303),this._strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var n=0,h=1;h<=67108863;h*=i)n++;n--,h=h/i|0;for(var e=t.length-r,o=e%n,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?h.prototype[Symbol.for("nodejs.util.inspect.custom")]=a:h.prototype.inspect=a;var l=["","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"],m=[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],f=[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];h.prototype.toString=function(t,i){var n;if(i=0|i||1,16===(t=t||10)||"hex"===t){n="";for(var h=0,e=0,o=0;o>>24-h&16777215)||o!==this.length-1?l[6-u.length]+u+n:u+n,(h+=2)>=26&&(h-=26,o--)}for(0!==e&&(n=e.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var a=m[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modrn(d).toString(t);n=(p=p.idivn(d)).isZero()?M+n:l[a-M.length]+M+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},h.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16,2)},e&&(h.prototype.toBuffer=function(t,i){return this.toArrayLike(e,t,i)}),h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)};function d(t,i,r){r.negative=i.negative^t.negative;var n=t.length+i.length|0;r.length=n,n=n-1|0;var h=0|t.words[0],e=0|i.words[0],o=h*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(h=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r._strip()}h.prototype.toArrayLike=function(t,i,n){this._strip();var h=this.byteLength(),e=n||Math.max(1,h);r(h<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0");var o=function(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,e);return this["_toArrayLike"+("le"===i?"LE":"BE")](o,h),o},h.prototype._toArrayLikeLE=function(t,i){for(var r=0,n=0,h=0,e=0;h>8&255),r>16&255),6===e?(r>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===e?(r>=0&&(t[r--]=o>>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),n=t%26;this._expand(i),n>0&&i--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-n),this._strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var n=t/26|0,h=t%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var h=0,e=0;e>>26;for(;0!==h&&e>>26;if(this.length=r.length,0!==h)this.words[this.length]=h,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,h=this.cmp(t);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(r=this,n=t):(r=t,n=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,S=0|o[5],x=8191&S,q=S>>>13,B=0|o[6],R=8191&B,Z=B>>>13,L=0|o[7],N=8191&L,I=L>>>13,E=0|o[8],z=8191&E,T=E>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,U=P>>>13,C=0|s[1],D=8191&C,H=C>>>13,J=0|s[2],G=8191&J,Q=J>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,nt=it>>>13,ht=0|s[6],et=8191&ht,ot=ht>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(n=Math.imul(m,F))|0)+((8191&(h=(h=Math.imul(m,U))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,U))+(h>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,F),h=(h=Math.imul(p,U))+Math.imul(M,F)|0,e=Math.imul(M,U);var gt=(a+(n=n+Math.imul(m,D)|0)|0)+((8191&(h=(h=h+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((e=e+Math.imul(f,H)|0)+(h>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),h=(h=Math.imul(g,U))+Math.imul(c,F)|0,e=Math.imul(c,U),n=n+Math.imul(p,D)|0,h=(h=h+Math.imul(p,H)|0)+Math.imul(M,D)|0,e=e+Math.imul(M,H)|0;var ct=(a+(n=n+Math.imul(m,G)|0)|0)+((8191&(h=(h=h+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(h>>>13)|0)+(ct>>>26)|0,ct&=67108863,n=Math.imul(y,F),h=(h=Math.imul(y,U))+Math.imul(b,F)|0,e=Math.imul(b,U),n=n+Math.imul(g,D)|0,h=(h=h+Math.imul(g,H)|0)+Math.imul(c,D)|0,e=e+Math.imul(c,H)|0,n=n+Math.imul(p,G)|0,h=(h=h+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(n=n+Math.imul(m,W)|0)|0)+((8191&(h=(h=h+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(h>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),h=(h=Math.imul(k,U))+Math.imul(A,F)|0,e=Math.imul(A,U),n=n+Math.imul(y,D)|0,h=(h=h+Math.imul(y,H)|0)+Math.imul(b,D)|0,e=e+Math.imul(b,H)|0,n=n+Math.imul(g,G)|0,h=(h=h+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,n=n+Math.imul(p,W)|0,h=(h=h+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(n=n+Math.imul(m,$)|0)|0)+((8191&(h=(h=h+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,F),h=(h=Math.imul(x,U))+Math.imul(q,F)|0,e=Math.imul(q,U),n=n+Math.imul(k,D)|0,h=(h=h+Math.imul(k,H)|0)+Math.imul(A,D)|0,e=e+Math.imul(A,H)|0,n=n+Math.imul(y,G)|0,h=(h=h+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,n=n+Math.imul(g,W)|0,h=(h=h+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,n=n+Math.imul(p,$)|0,h=(h=h+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(n=n+Math.imul(m,rt)|0)|0)+((8191&(h=(h=h+Math.imul(m,nt)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,nt)|0)+(h>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,F),h=(h=Math.imul(R,U))+Math.imul(Z,F)|0,e=Math.imul(Z,U),n=n+Math.imul(x,D)|0,h=(h=h+Math.imul(x,H)|0)+Math.imul(q,D)|0,e=e+Math.imul(q,H)|0,n=n+Math.imul(k,G)|0,h=(h=h+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,n=n+Math.imul(y,W)|0,h=(h=h+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,n=n+Math.imul(g,$)|0,h=(h=h+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,n=n+Math.imul(p,rt)|0,h=(h=h+Math.imul(p,nt)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,nt)|0;var _t=(a+(n=n+Math.imul(m,et)|0)|0)+((8191&(h=(h=h+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(N,F),h=(h=Math.imul(N,U))+Math.imul(I,F)|0,e=Math.imul(I,U),n=n+Math.imul(R,D)|0,h=(h=h+Math.imul(R,H)|0)+Math.imul(Z,D)|0,e=e+Math.imul(Z,H)|0,n=n+Math.imul(x,G)|0,h=(h=h+Math.imul(x,Q)|0)+Math.imul(q,G)|0,e=e+Math.imul(q,Q)|0,n=n+Math.imul(k,W)|0,h=(h=h+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,n=n+Math.imul(y,$)|0,h=(h=h+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,h=(h=h+Math.imul(g,nt)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,nt)|0,n=n+Math.imul(p,et)|0,h=(h=h+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(n=n+Math.imul(m,ut)|0)|0)+((8191&(h=(h=h+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(z,F),h=(h=Math.imul(z,U))+Math.imul(T,F)|0,e=Math.imul(T,U),n=n+Math.imul(N,D)|0,h=(h=h+Math.imul(N,H)|0)+Math.imul(I,D)|0,e=e+Math.imul(I,H)|0,n=n+Math.imul(R,G)|0,h=(h=h+Math.imul(R,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,n=n+Math.imul(x,W)|0,h=(h=h+Math.imul(x,X)|0)+Math.imul(q,W)|0,e=e+Math.imul(q,X)|0,n=n+Math.imul(k,$)|0,h=(h=h+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,h=(h=h+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,nt)|0,n=n+Math.imul(g,et)|0,h=(h=h+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,n=n+Math.imul(p,ut)|0,h=(h=h+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(h=(h=h+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(h>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,F),h=(h=Math.imul(j,U))+Math.imul(K,F)|0,e=Math.imul(K,U),n=n+Math.imul(z,D)|0,h=(h=h+Math.imul(z,H)|0)+Math.imul(T,D)|0,e=e+Math.imul(T,H)|0,n=n+Math.imul(N,G)|0,h=(h=h+Math.imul(N,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,n=n+Math.imul(R,W)|0,h=(h=h+Math.imul(R,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,n=n+Math.imul(x,$)|0,h=(h=h+Math.imul(x,tt)|0)+Math.imul(q,$)|0,e=e+Math.imul(q,tt)|0,n=n+Math.imul(k,rt)|0,h=(h=h+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,nt)|0,n=n+Math.imul(y,et)|0,h=(h=h+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,n=n+Math.imul(g,ut)|0,h=(h=h+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,n=n+Math.imul(p,mt)|0,h=(h=h+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var St=(a+(n=n+Math.imul(m,pt)|0)|0)+((8191&(h=(h=h+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,D),h=(h=Math.imul(j,H))+Math.imul(K,D)|0,e=Math.imul(K,H),n=n+Math.imul(z,G)|0,h=(h=h+Math.imul(z,Q)|0)+Math.imul(T,G)|0,e=e+Math.imul(T,Q)|0,n=n+Math.imul(N,W)|0,h=(h=h+Math.imul(N,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,n=n+Math.imul(R,$)|0,h=(h=h+Math.imul(R,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,n=n+Math.imul(x,rt)|0,h=(h=h+Math.imul(x,nt)|0)+Math.imul(q,rt)|0,e=e+Math.imul(q,nt)|0,n=n+Math.imul(k,et)|0,h=(h=h+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,n=n+Math.imul(y,ut)|0,h=(h=h+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,n=n+Math.imul(g,mt)|0,h=(h=h+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var xt=(a+(n=n+Math.imul(p,pt)|0)|0)+((8191&(h=(h=h+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(h>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,G),h=(h=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),n=n+Math.imul(z,W)|0,h=(h=h+Math.imul(z,X)|0)+Math.imul(T,W)|0,e=e+Math.imul(T,X)|0,n=n+Math.imul(N,$)|0,h=(h=h+Math.imul(N,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,h=(h=h+Math.imul(R,nt)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,nt)|0,n=n+Math.imul(x,et)|0,h=(h=h+Math.imul(x,ot)|0)+Math.imul(q,et)|0,e=e+Math.imul(q,ot)|0,n=n+Math.imul(k,ut)|0,h=(h=h+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,n=n+Math.imul(y,mt)|0,h=(h=h+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var qt=(a+(n=n+Math.imul(g,pt)|0)|0)+((8191&(h=(h=h+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(h>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(j,W),h=(h=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),n=n+Math.imul(z,$)|0,h=(h=h+Math.imul(z,tt)|0)+Math.imul(T,$)|0,e=e+Math.imul(T,tt)|0,n=n+Math.imul(N,rt)|0,h=(h=h+Math.imul(N,nt)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,nt)|0,n=n+Math.imul(R,et)|0,h=(h=h+Math.imul(R,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,n=n+Math.imul(x,ut)|0,h=(h=h+Math.imul(x,at)|0)+Math.imul(q,ut)|0,e=e+Math.imul(q,at)|0,n=n+Math.imul(k,mt)|0,h=(h=h+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var Bt=(a+(n=n+Math.imul(y,pt)|0)|0)+((8191&(h=(h=h+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(h>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),h=(h=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),n=n+Math.imul(z,rt)|0,h=(h=h+Math.imul(z,nt)|0)+Math.imul(T,rt)|0,e=e+Math.imul(T,nt)|0,n=n+Math.imul(N,et)|0,h=(h=h+Math.imul(N,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,n=n+Math.imul(R,ut)|0,h=(h=h+Math.imul(R,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,n=n+Math.imul(x,mt)|0,h=(h=h+Math.imul(x,ft)|0)+Math.imul(q,mt)|0,e=e+Math.imul(q,ft)|0;var Rt=(a+(n=n+Math.imul(k,pt)|0)|0)+((8191&(h=(h=h+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(h>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),h=(h=Math.imul(j,nt))+Math.imul(K,rt)|0,e=Math.imul(K,nt),n=n+Math.imul(z,et)|0,h=(h=h+Math.imul(z,ot)|0)+Math.imul(T,et)|0,e=e+Math.imul(T,ot)|0,n=n+Math.imul(N,ut)|0,h=(h=h+Math.imul(N,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,n=n+Math.imul(R,mt)|0,h=(h=h+Math.imul(R,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Zt=(a+(n=n+Math.imul(x,pt)|0)|0)+((8191&(h=(h=h+Math.imul(x,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(h>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(j,et),h=(h=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),n=n+Math.imul(z,ut)|0,h=(h=h+Math.imul(z,at)|0)+Math.imul(T,ut)|0,e=e+Math.imul(T,at)|0,n=n+Math.imul(N,mt)|0,h=(h=h+Math.imul(N,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Lt=(a+(n=n+Math.imul(R,pt)|0)|0)+((8191&(h=(h=h+Math.imul(R,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,ut),h=(h=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),n=n+Math.imul(z,mt)|0,h=(h=h+Math.imul(z,ft)|0)+Math.imul(T,mt)|0,e=e+Math.imul(T,ft)|0;var Nt=(a+(n=n+Math.imul(N,pt)|0)|0)+((8191&(h=(h=h+Math.imul(N,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(h>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,mt),h=(h=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(n=n+Math.imul(z,pt)|0)|0)+((8191&(h=(h=h+Math.imul(z,Mt)|0)+Math.imul(T,pt)|0))<<13)|0;a=((e=e+Math.imul(T,Mt)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863;var Et=(a+(n=Math.imul(j,pt))|0)+((8191&(h=(h=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(h>>>13)|0)+(Et>>>26)|0,Et&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=St,u[10]=xt,u[11]=qt,u[12]=Bt,u[13]=Rt,u[14]=Zt,u[15]=Lt,u[16]=Nt,u[17]=It,u[18]=Et,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,h=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,n=o,o=h}return 0!==n?r.words[e]=n:r.length--,r._strip()}function v(t,i,r){return M(t,i,r)}function g(t,i){this.x=t,this.y=i}Math.imul||(p=d),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,i):r<63?d(this,t,i):r<1024?M(this,t,i):v(this,t,i)},g.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,i,r,n,h,e){for(var o=0;o>>=1)h++;return 1<>>=13,n[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,n+=e/67108864|0,n+=o>>>26,this.words[h]=67108863&o}return 0!==n&&(this.words[h]=n,this.length++),i?this.ineg():this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>h&1}return i}(t);if(0===i.length)return new h(1);for(var r=this,n=0;n=0);var i,n=t%26,h=(t-n)/26,e=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(i=0;i>>26-n}o&&(this.words[i]=o,this.length++)}if(0!==h){for(i=this.length-1;i>=0;i--)this.words[i+h]=this.words[i];for(i=0;i=0),h=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=h);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(t,i,n){return r(0===this.negative),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26,h=1<=0);var i=t%26,n=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var h=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(r("number"==typeof t),r(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 i=0;i>26)-(u/67108864|0),this.words[h+n]=67108863&e}for(;h>26,this.words[h+n]=67108863&e;if(0===s)return this._strip();for(r(-1===s),s=0,h=0;h>26,this.words[h]=67108863&e;return this.negative=1,this._strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),n.iushln(r),o=0|e.words[e.length-1]);var s,u=n.length-e.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|n.words[e.length+m])+(0|n.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(e,f,m);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(e,1,m),n.isZero()||(n.negative^=1);s&&(s.words[m]=f)}return s&&s._strip(),n._strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},h.prototype.divmod=function(t,i,n){return r(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modrn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,n=t.ushrn(1),h=t.andln(1),e=r.cmp(n);return e<0||1===h&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modrn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,h=0,e=this.length-1;e>=0;e--)h=(n*h+(0|this.words[e]))%t;return i?-h:h},h.prototype.modn=function(t){return this.modrn(t)},h.prototype.idivn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=0,h=this.length-1;h>=0;h--){var e=(0|this.words[h])+67108864*n;this.words[h]=e/t|0,n=e%t}return this._strip(),i?this.ineg():this},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++a;for(var l=n.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(n.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),e.isub(s),o.isub(u)):(n.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:n.iushln(a)}},h.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new h(1),s=new h(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(n.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(n.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(n)>=0?(i.isub(n),o.isub(s)):(n.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var h=i.cmp(r);if(h<0){var e=i;i=r,r=e}else if(0===h||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,n=(t-i)/26,h=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var h=0|this.words[0];i=h===t?0:ht.length)return 1;if(this.length=0;r--){var n=0|this.words[r],h=0|t.words[r];if(n!==h){nh&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new A(t)},h.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function w(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(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 h(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,i){t.iushrn(this.n,0,i)},w.prototype.imulK=function(t){return t.imul(this.k)},n(y,w),y.prototype.split=function(t,i){for(var r=Math.min(t.length,9),n=0;n>>22,h=e}h>>>=22,t.words[n-10]=h,0===h&&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 i=0,r=0;r>>=26,t.words[r]=h,i=n}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(c[t])return c[t];var i;if("k256"===t)i=new y;else if("p224"===t)i=new b;else if("p192"===t)i=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new k}return c[t]=i,i},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},A.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},A.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===n&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},A.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},A.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new S(t)},n(S,A),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},S.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(n).iushrn(this.shift),e=h;return h.cmp(this.m)>=0?e=h.isub(this.m):h.cmpn(0)<0&&(e=h.iadd(this.m)),e._forceRed(this)},S.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":38}],38:[function(require,module,exports){ - -},{}],39:[function(require,module,exports){ +},{"buffer":39}],39:[function(require,module,exports){ },{}],40:[function(require,module,exports){ + +},{}],41:[function(require,module,exports){ (function (global){ !function(e){var o="object"==typeof exports&&exports&&!exports.nodeType&&exports,n="object"==typeof module&&module&&!module.nodeType&&module,t="object"==typeof global&&global;t.global!==t&&t.window!==t&&t.self!==t||(e=t);var r,u,i=2147483647,f=36,c=1,l=26,s=38,d=700,p=72,a=128,h="-",v=/^xn--/,g=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=f-c,y=Math.floor,C=String.fromCharCode;function m(e){throw new RangeError(x[e])}function j(e,o){for(var n=e.length,t=[];n--;)t[n]=o(e[n]);return t}function A(e,o){var n=e.split("@"),t="";return n.length>1&&(t=n[0]+"@",e=n[1]),t+j((e=e.replace(w,".")).split("."),o).join(".")}function I(e){for(var o,n,t=[],r=0,u=e.length;r=55296&&o<=56319&&r65535&&(o+=C((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=C(e)}).join("")}function F(e,o){return e+22+75*(e<26)-((0!=o)<<5)}function O(e,o,n){var t=0;for(e=n?y(e/d):e>>1,e+=y(e/o);e>b*l>>1;t+=f)e=y(e/b);return y(t+(b+1)*e/(e+s))}function S(e){var o,n,t,r,u,s,d,v,g,w,x,b=[],C=e.length,j=0,A=a,I=p;for((n=e.lastIndexOf(h))<0&&(n=0),t=0;t=128&&m("not-basic"),b.push(e.charCodeAt(t));for(r=n>0?n+1:0;r=C&&m("invalid-input"),((v=(x=e.charCodeAt(r++))-48<10?x-22:x-65<26?x-65:x-97<26?x-97:f)>=f||v>y((i-j)/s))&&m("overflow"),j+=v*s,!(v<(g=d<=I?c:d>=I+l?l:d-I));d+=f)s>y(i/(w=f-g))&&m("overflow"),s*=w;I=O(j-u,o=b.length+1,0==u),y(j/o)>i-A&&m("overflow"),A+=y(j/o),j%=o,b.splice(j++,0,A)}return E(b)}function T(e){var o,n,t,r,u,s,d,v,g,w,x,b,j,A,E,S=[];for(b=(e=I(e)).length,o=a,n=0,u=p,s=0;s=o&&xy((i-n)/(j=t+1))&&m("overflow"),n+=(d-o)*j,o=d,s=0;si&&m("overflow"),x==o){for(v=n,g=f;!(v<(w=g<=u?c:g>=u+l?l:g-u));g+=f)E=v-w,A=f-w,S.push(C(F(w+E%A,0))),v=y(E/A);S.push(C(F(v,0))),u=O(n,j,t==r),n=0,++t}++n,++o}return S.join("")}if(r={version:"1.4.1",ucs2:{decode:I,encode:E},decode:S,encode:T,toASCII:function(e){return A(e,function(e){return g.test(e)?"xn--"+T(e):e})},toUnicode:function(e){return A(e,function(e){return v.test(e)?S(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return r});else if(o&&n)if(module.exports==o)n.exports=r;else for(u in r)r.hasOwnProperty(u)&&(o[u]=r[u]);else e.punycode=r}(this); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],41:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ var basex=require("base-x"),ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";module.exports=basex(ALPHABET); -},{"base-x":35}],42:[function(require,module,exports){ +},{"base-x":36}],43:[function(require,module,exports){ (function (Buffer){ "use strict";var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function createBuffer(e){if(e>K_MAX_LENGTH)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=Buffer.prototype,t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return fromString(e,t);if(ArrayBuffer.isView(e))return fromArrayLike(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return Buffer.from(n,t,r);var f=fromObject(e);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function alloc(e,t,r){return assertSize(e),e<=0?createBuffer(e):void 0!==t?"string"==typeof r?createBuffer(e).fill(t,r):createBuffer(e).fill(t):createBuffer(e)}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromString(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),n=createBuffer(r),f=n.write(e,t);return f!==r&&(n=n.slice(0,f)),n}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),n=0;n=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function SlowBuffer(e){return+e!=e&&(e=0),Buffer.alloc(+e)}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var f=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(f)return n?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),f=!0}}function slowToString(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function swap(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function bidirectionalIndexOf(e,t,r,n,f){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=f?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(f)return-1;r=e.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,n)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,n,f);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,n,f){var i,o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(f){var h=-1;for(i=r;iu&&(r=u-s),i=r;i>=0;i--){for(var c=!0,l=0;lf&&(n=f):n=f;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(f+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(i=e[f+1]))&&(s=(31&a)<<6|63&i)>127&&(h=s);break;case 3:i=e[f+1],o=e[f+2],128==(192&i)&&128==(192&o)&&(s=(15&a)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=e[f+1],o=e[f+2],u=e[f+3],128==(192&i)&&128==(192&o)&&128==(192&u)&&(s=(15&a)<<18|(63&i)<<12|(63&o)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),f+=c}return decodeCodePointsArray(n)}exports.kMaxLength=K_MAX_LENGTH,Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(e,t,r){return from(e,t,r)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(e,t,r){return alloc(e,t,r)},Buffer.allocUnsafe=function(e){return allocUnsafe(e)},Buffer.allocUnsafeSlow=function(e){return allocUnsafe(e)},Buffer.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==Buffer.prototype},Buffer.compare=function(e,t){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),!Buffer.isBuffer(e)||!Buffer.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,f=0,i=Math.min(r,n);ft&&(e+=" ... "),""},Buffer.prototype.compare=function(e,t,r,n,f){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),t<0||r>e.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&t>=r)return 0;if(n>=f)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(f>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),u=Math.min(i,o),s=this.slice(n,f),a=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":return asciiWrite(this,e,t,r);case"latin1":case"binary":return latin1Write(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var f="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,n,f,i){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>f||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,n,f,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(e,t,r,n,23,4),r+4}function writeDouble(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(e,t,r,n,52,8),r+8}Buffer.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e+--t],f=1;t>0&&(f*=256);)n+=this[e+--t]*f;return n},Buffer.prototype.readUInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUInt16LE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUInt16BE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i=(f*=128)&&(n-=Math.pow(2,8*t)),n},Buffer.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=t,f=1,i=this[e+--n];n>0&&(f*=256);)i+=this[e+--n]*f;return i>=(f*=128)&&(i-=Math.pow(2,8*t)),i},Buffer.prototype.readInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!1,52,8)},Buffer.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=r-1,i=1;for(this[t+f]=255&e;--f>=0&&(i*=256);)this[t+f]=e/i&255;return t+r},Buffer.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},Buffer.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},Buffer.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function(e,t,r,n){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return f},Buffer.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var f=e.charCodeAt(0);("utf8"===n&&f<128||"latin1"===n)&&(e=f)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!f){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(t-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(e){for(var t=[],r=0;r>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(e){return base64.toByteArray(base64clean(e))}function blitBuffer(e,t,r,n){for(var f=0;f=t.length||f>=e.length);++f)t[f+r]=e[f];return f}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e} }).call(this,require("buffer").Buffer) -},{"base64-js":36,"buffer":42,"ieee754":63}],43:[function(require,module,exports){ +},{"base64-js":37,"buffer":43,"ieee754":64}],44:[function(require,module,exports){ module.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}; -},{}],44:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ require(".").check("es5"); -},{".":45}],45:[function(require,module,exports){ +},{".":46}],46:[function(require,module,exports){ require("./lib/definitions"),module.exports=require("./lib"); -},{"./lib":48,"./lib/definitions":47}],46:[function(require,module,exports){ +},{"./lib":49,"./lib/definitions":48}],47:[function(require,module,exports){ var CapabilityDetector=function(){this.tests={},this.cache={}};CapabilityDetector.prototype={constructor:CapabilityDetector,define:function(t,i){if("string"!=typeof t||!(i instanceof Function))throw new Error("Invalid capability definition.");if(this.tests[t])throw new Error('Duplicated capability definition by "'+t+'".');this.tests[t]=i},check:function(t){if(!this.test(t))throw new Error('The current environment does not support "'+t+'", therefore we cannot continue.')},test:function(t){if(void 0!==this.cache[t])return this.cache[t];if(!this.tests[t])throw new Error('Unknown capability with name "'+t+'".');var i=this.tests[t];return this.cache[t]=!!i(),this.cache[t]}},module.exports=CapabilityDetector; -},{}],47:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ var capability=require("."),define=capability.define,test=capability.test;define("strict mode",function(){return void 0===this}),define("arguments.callee.caller",function(){try{return function(){return arguments.callee.caller}()===arguments.callee}catch(e){return!1}}),define("es5",function(){return test("Array.prototype.forEach")&&test("Array.prototype.map")&&test("Function.prototype.bind")&&test("Object.create")&&test("Object.defineProperties")&&test("Object.defineProperty")&&test("Object.prototype.hasOwnProperty")}),define("Array.prototype.forEach",function(){return Array.prototype.forEach}),define("Array.prototype.map",function(){return Array.prototype.map}),define("Function.prototype.bind",function(){return Function.prototype.bind}),define("Object.create",function(){return Object.create}),define("Object.defineProperties",function(){return Object.defineProperties}),define("Object.defineProperty",function(){return Object.defineProperty}),define("Object.prototype.hasOwnProperty",function(){return Object.prototype.hasOwnProperty}),define("Error.captureStackTrace",function(){return Error.captureStackTrace}),define("Error.prototype.stack",function(){try{throw new Error}catch(e){return e.stack||e.stacktrace}}); -},{".":48}],48:[function(require,module,exports){ +},{".":49}],49:[function(require,module,exports){ var CapabilityDetector=require("./CapabilityDetector"),detector=new CapabilityDetector,capability=function(t){return detector.test(t)};capability.define=function(t,e){detector.define(t,e)},capability.check=function(t){detector.check(t)},capability.test=capability,module.exports=capability; -},{"./CapabilityDetector":46}],49:[function(require,module,exports){ +},{"./CapabilityDetector":47}],50:[function(require,module,exports){ "use strict";function depd(r){if(!r)throw new TypeError("argument namespace is required");function e(r){}return e._file=void 0,e._ignored=!0,e._namespace=r,e._traced=!1,e._warned=Object.create(null),e.function=wrapfunction,e.property=wrapproperty,e}function wrapfunction(r,e){if("function"!=typeof r)throw new TypeError("argument fn must be a function");return r}function wrapproperty(r,e,t){if(!r||"object"!=typeof r&&"function"!=typeof r)throw new TypeError("argument obj must be object");var o=Object.getOwnPropertyDescriptor(r,e);if(!o)throw new TypeError("must call property on owner object");if(!o.configurable)throw new TypeError("property must be configurable")}module.exports=depd; -},{}],50:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ module.exports=require("./lib"); -},{"./lib":51}],51:[function(require,module,exports){ +},{"./lib":52}],52:[function(require,module,exports){ require("capability/es5");var polyfill,capability=require("capability");polyfill=capability("Error.captureStackTrace")?require("./v8"):capability("Error.prototype.stack")?require("./non-v8/index"):require("./unsupported"),module.exports=polyfill(); -},{"./non-v8/index":55,"./unsupported":57,"./v8":58,"capability":45,"capability/es5":44}],52:[function(require,module,exports){ +},{"./non-v8/index":56,"./unsupported":58,"./v8":59,"capability":46,"capability/es5":45}],53:[function(require,module,exports){ var Class=require("o3").Class,abstractMethod=require("o3").abstractMethod,Frame=Class(Object,{prototype:{init:Class.prototype.merge,frameString:void 0,toString:function(){return this.frameString},functionValue:void 0,getThis:abstractMethod,getTypeName:abstractMethod,getFunction:function(){return this.functionValue},getFunctionName:abstractMethod,getMethodName:abstractMethod,getFileName:abstractMethod,getLineNumber:abstractMethod,getColumnNumber:abstractMethod,getEvalOrigin:abstractMethod,isTopLevel:abstractMethod,isEval:abstractMethod,isNative:abstractMethod,isConstructor:abstractMethod}});module.exports=Frame; -},{"o3":67}],53:[function(require,module,exports){ +},{"o3":68}],54:[function(require,module,exports){ var Class=require("o3").Class,Frame=require("./Frame"),cache=require("u3").cache,FrameStringParser=Class(Object,{prototype:{stackParser:null,frameParser:null,locationParsers:null,constructor:function(e){Class.prototype.merge.call(this,e)},getFrames:function(e,r){for(var t=[],a=0,n=e.length;a0&&o.length>i){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else o=s[t]=n,++e._eventsCount;return e}function onceWrapper(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(n=o[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:emitNone(n,u,this);break;case 2:emitOne(n,u,this,arguments[1]);break;case 3:emitTwo(n,u,this,arguments[1],arguments[2]);break;case 4:emitThree(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,o||t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=objectCreate(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=objectCreate(null):delete n[e]),this;if(0===arguments.length){var i,s=objectKeys(n);for(r=0;r=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}; -},{}],60:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ "use strict";var deprecate=require("depd")("http-errors"),setPrototypeOf=require("setprototypeof"),statuses=require("statuses"),inherits=require("inherits"),toIdentifier=require("toidentifier");function codeClass(r){return Number(String(r).charAt(0)+"00")}function createError(){for(var r,e,t=500,o={},s=0;s=600)&&deprecate("non-error status code; use only 4xx or 5xx status codes"),("number"!=typeof t||!statuses[t]&&(t<400||t>=600))&&(t=500);var n=createError[t]||createError[codeClass(t)];for(var u in r||(r=n?new n(e):new Error(e||statuses[t]),Error.captureStackTrace(r,createError)),n&&r instanceof n&&r.status===t||(r.expose=t<500,r.status=r.statusCode=t),o)"status"!==u&&"statusCode"!==u&&(r[u]=o[u]);return r}function createHttpErrorConstructor(){function r(){throw new TypeError("cannot construct abstract class")}return inherits(r,Error),r}function createClientErrorConstructor(r,e,t){var o=toClassName(e);function s(r){var e=null!=r?r:statuses[t],a=new Error(e);return Error.captureStackTrace(a,s),setPrototypeOf(a,s.prototype),Object.defineProperty(a,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(a,"name",{enumerable:!1,configurable:!0,value:o,writable:!0}),a}return inherits(s,r),nameFunc(s,o),s.prototype.status=t,s.prototype.statusCode=t,s.prototype.expose=!0,s}function createIsHttpErrorFunction(r){return function(e){return!(!e||"object"!=typeof e)&&(e instanceof r||e instanceof Error&&"boolean"==typeof e.expose&&"number"==typeof e.statusCode&&e.status===e.statusCode)}}function createServerErrorConstructor(r,e,t){var o=toClassName(e);function s(r){var e=null!=r?r:statuses[t],a=new Error(e);return Error.captureStackTrace(a,s),setPrototypeOf(a,s.prototype),Object.defineProperty(a,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(a,"name",{enumerable:!1,configurable:!0,value:o,writable:!0}),a}return inherits(s,r),nameFunc(s,o),s.prototype.status=t,s.prototype.statusCode=t,s.prototype.expose=!1,s}function nameFunc(r,e){var t=Object.getOwnPropertyDescriptor(r,"name");t&&t.configurable&&(t.value=e,Object.defineProperty(r,"name",t))}function populateConstructorExports(r,e,t){e.forEach(function(e){var o,s=toIdentifier(statuses[e]);switch(codeClass(e)){case 400:o=createClientErrorConstructor(t,s,e);break;case 500:o=createServerErrorConstructor(t,s,e)}o&&(r[e]=o,r[s]=o)}),r["I'mateapot"]=deprecate.function(r.ImATeapot,'"I\'mateapot"; use "ImATeapot" instead')}function toClassName(r){return"Error"!==r.substr(-5)?r+"Error":r}module.exports=createError,module.exports.HttpError=createHttpErrorConstructor(),module.exports.isHttpError=createIsHttpErrorFunction(module.exports.HttpError),populateConstructorExports(module.exports,statuses.codes,module.exports.HttpError); -},{"depd":61,"inherits":64,"setprototypeof":76,"statuses":78,"toidentifier":100}],61:[function(require,module,exports){ +},{"depd":62,"inherits":65,"setprototypeof":77,"statuses":79,"toidentifier":101}],62:[function(require,module,exports){ "use strict";function depd(r){if(!r)throw new TypeError("argument namespace is required");function e(r){}return e._file=void 0,e._ignored=!0,e._namespace=r,e._traced=!1,e._warned=Object.create(null),e.function=wrapfunction,e.property=wrapproperty,e}function wrapfunction(r,e){if("function"!=typeof r)throw new TypeError("argument fn must be a function");return r}function wrapproperty(r,e,t){if(!r||"object"!=typeof r&&"function"!=typeof r)throw new TypeError("argument obj must be object");var o=Object.getOwnPropertyDescriptor(r,e);if(!o)throw new TypeError("must call property on owner object");if(!o.configurable)throw new TypeError("property must be configurable")}module.exports=depd; -},{}],62:[function(require,module,exports){ +},{}],63:[function(require,module,exports){ var http=require("http"),url=require("url"),https=module.exports;for(var key in http)http.hasOwnProperty(key)&&(https[key]=http[key]);function validateParams(t){if("string"==typeof t&&(t=url.parse(t)),t.protocol||(t.protocol="https:"),"https:"!==t.protocol)throw new Error('Protocol "'+t.protocol+'" not supported. Expected "https:"');return t}https.request=function(t,r){return t=validateParams(t),http.request.call(this,t,r)},https.get=function(t,r){return t=validateParams(t),http.get.call(this,t,r)}; -},{"http":79,"url":106}],63:[function(require,module,exports){ +},{"http":80,"url":107}],64:[function(require,module,exports){ exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; -},{}],64:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ "function"==typeof Object.create?module.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(t,e){if(e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}}; -},{}],65:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ (function (process,global){ !function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD="function"==typeof define&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,h){return function(r){return new Sha256(h,!0).update(r)[t]()}},createMethod=function(t){var h=createOutputMethod("hex",t);NODE_JS&&(h=nodeWrap(h,t)),h.create=function(){return new Sha256(t)},h.update=function(t){return h.create().update(t)};for(var r=0;r>6,o[H++]=128|63&i):i<55296||i>=57344?(o[H++]=224|i>>12,o[H++]=128|i>>6&63,o[H++]=128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++e)),o[H++]=240|i>>18,o[H++]=128|i>>12&63,o[H++]=128|i>>6&63,o[H++]=128|63&i);t=o}else{if("object"!==s)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(h,!0).update(t).array());var n=[],S=[];for(e=0;e<64;++e){var c=t[e]||0;n[e]=92^c,S[e]=54^c}Sha256.call(this,h,r),this.update(S),this.oKeyPad=n,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var h,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);h=!0}for(var e,s,i=0,o=t.length,a=this.blocks;i>2]|=t[i]<>2]|=e<>2]|=(192|e>>6)<>2]|=(128|63&e)<=57344?(a[s>>2]|=(224|e>>12)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<>2]|=(240|e>>18)<>2]|=(128|e>>12&63)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,h=this.lastByteIndex;t[16]=this.block,t[h>>2]|=EXTRA[3&h],this.block=t[16],h>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,h,r,e,s,i,o,a,H,n=this.h0,S=this.h1,c=this.h2,f=this.h3,A=this.h4,R=this.h5,u=this.h6,_=this.h7,E=this.blocks;for(t=16;t<64;++t)h=((s=E[t-15])>>>7|s<<25)^(s>>>18|s<<14)^s>>>3,r=((s=E[t-2])>>>17|s<<15)^(s>>>19|s<<13)^s>>>10,E[t]=E[t-16]+h+E[t-7]+r<<0;for(H=S&c,t=0;t<64;t+=4)this.first?(this.is224?(i=300032,_=(s=E[0]-1413257819)-150054599<<0,f=s+24177077<<0):(i=704751109,_=(s=E[0]-210244248)-1521486534<<0,f=s+143694565<<0),this.first=!1):(h=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),e=(i=n&S)^n&c^H,_=f+(s=_+(r=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&R^~A&u)+K[t]+E[t])<<0,f=s+(h+e)<<0),h=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),e=(o=f&n)^f&S^i,u=c+(s=u+(r=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&A^~_&R)+K[t+1]+E[t+1])<<0,h=((c=s+(h+e)<<0)>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),e=(a=c&f)^c&n^o,R=S+(s=R+(r=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&_^~u&A)+K[t+2]+E[t+2])<<0,h=((S=s+(h+e)<<0)>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10),e=(H=S&c)^S&f^a,A=n+(s=A+(r=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&u^~R&_)+K[t+3]+E[t+3])<<0,n=s+(h+e)<<0;this.h0=this.h0+n<<0,this.h1=this.h1+S<<0,this.h2=this.h2+c<<0,this.h3=this.h3+f<<0,this.h4=this.h4+A<<0,this.h5=this.h5+R<<0,this.h6=this.h6+u<<0,this.h7=this.h7+_<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,h=this.h1,r=this.h2,e=this.h3,s=this.h4,i=this.h5,o=this.h6,a=this.h7,H=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[h>>28&15]+HEX_CHARS[h>>24&15]+HEX_CHARS[h>>20&15]+HEX_CHARS[h>>16&15]+HEX_CHARS[h>>12&15]+HEX_CHARS[h>>8&15]+HEX_CHARS[h>>4&15]+HEX_CHARS[15&h]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o];return this.is224||(H+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]),H},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,h=this.h1,r=this.h2,e=this.h3,s=this.h4,i=this.h5,o=this.h6,a=this.h7,H=[t>>24&255,t>>16&255,t>>8&255,255&t,h>>24&255,h>>16&255,h>>8&255,255&h,r>>24&255,r>>16&255,r>>8&255,255&r,e>>24&255,e>>16&255,e>>8&255,255&e,s>>24&255,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o];return this.is224||H.push(a>>24&255,a>>16&255,a>>8&255,255&a),H},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),h=new DataView(t);return h.setUint32(0,this.h0),h.setUint32(4,this.h1),h.setUint32(8,this.h2),h.setUint32(12,this.h3),h.setUint32(16,this.h4),h.setUint32(20,this.h5),h.setUint32(24,this.h6),this.is224||h.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))}(); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":71}],66:[function(require,module,exports){ +},{"_process":72}],67:[function(require,module,exports){ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Mustache=t()}(this,function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var o=RegExp.prototype.test;var a=/\S/;function s(e){return!function(e,t){return o.call(e,t)}(a,e)}var c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};var u=/\s*/,p=/\s+/,l=/\s*=/,h=/\s*\}/,f=/#|\^|\/|>|\{|&|=|!/;function d(e){this.string=e,this.tail=e,this.pos=0}function v(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function g(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}d.prototype.eos=function(){return""===this.tail},d.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},d.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},v.prototype.push=function(e){return new v(e,this)},v.prototype.lookup=function(e){var t,r,o,a=this.cache;if(a.hasOwnProperty(e))t=a[e];else{for(var s,c,u,p=this,l=!1;p;){if(e.indexOf(".")>0)for(s=p.view,c=e.split("."),u=0;null!=s&&u0?i[i.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],i=0,o=e.length;i"===a?s=this.renderPartial(o,t,n,i):"&"===a?s=this.unescapedValue(o,t):"name"===a?s=this.escapedValue(o,t):"text"===a&&(s=this.rawValue(o)),void 0!==s&&(c+=s);return c},g.prototype.renderSection=function(e,r,i,o){var a=this,s="",c=r.lookup(e[1]);if(c){if(t(c))for(var u=0,p=c.length;u0||!n)&&(i[o]=r+i[o]);return i.join("\n")},g.prototype.renderPartial=function(e,t,r,i){if(r){var o=n(r)?r(e[1]):r[e[1]];if(null!=o){var a=e[6],s=e[5],c=e[4],u=o;return 0==s&&c&&(u=this.indentPartial(o,c,a)),this.renderTokens(this.parse(u,i),t,r,u,i)}}},g.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},g.prototype.escapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return y.escape(n)},g.prototype.rawValue=function(e){return e[1]};var y={name:"mustache.js",version:"4.0.1",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){w.templateCache=e},get templateCache(){return w.templateCache}},w=new g;return y.clearCache=function(){return w.clearCache()},y.parse=function(e,t){return w.parse(e,t)},y.render=function(e,n,r,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(t(o=e)?"array":typeof o)+'" was given as the first argument for mustache#render(template, view, partials)');var o;return w.render(e,n,r,i)},y.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return c[e]})},y.Scanner=d,y.Context=v,y.Writer=g,y}); -},{}],67:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ require("capability/es5"),module.exports=require("./lib"); -},{"./lib":70,"capability/es5":44}],68:[function(require,module,exports){ +},{"./lib":71,"capability/es5":45}],69:[function(require,module,exports){ var Class=function(){var t=Object.create({Source:Object,config:{},buildArgs:[]});function o(o){var r="config";if(o instanceof Function)r="Source";else if(o instanceof Array)r="buildArgs";else{if(!(o instanceof Object))throw new Error("Invalid configuration option.");r="config"}if(t.hasOwnProperty(r))throw new Error("Duplicated configuration option: "+r+".");t[r]=o}for(var r=0,e=arguments.length;r1)for(var r=1;r0&&p>s&&(p=s);for(var y=0;y=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)}; -},{}],73:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ "use strict";var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?map(r[n],function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;ne._pos){var t=s.substr(e._pos);if("x-user-defined"===e._charset){for(var a=Buffer.alloc(t.length),o=0;oe._pos&&(e.push(Buffer.from(new Uint8Array(n.result.slice(e._pos)))),e._pos=n.result.byteLength)},n.onload=function(){e.push(null)},n.readAsArrayBuffer(s)}e._xhr.readyState===rStates.DONE&&"ms-stream"!==e._mode&&e.push(null)}; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":80,"_process":71,"buffer":42,"inherits":64,"readable-stream":97}],83:[function(require,module,exports){ +},{"./capability":81,"_process":72,"buffer":43,"inherits":65,"readable-stream":98}],84:[function(require,module,exports){ "use strict";function _inheritsLoose(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}var codes={};function createErrorType(e,r,t){t||(t=Error);var n=function(e){function t(t,n,o){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,o))||this}return _inheritsLoose(t,e),t}(t);n.prototype.name=t.name,n.prototype.code=e,codes[e]=n}function oneOf(e,r){if(Array.isArray(e)){var t=e.length;return e=e.map(function(e){return String(e)}),t>2?"one of ".concat(r," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(r," ").concat(e[0]," or ").concat(e[1]):"of ".concat(r," ").concat(e[0])}return"of ".concat(r," ").concat(String(e))}function startsWith(e,r,t){return e.substr(!t||t<0?0:+t,r.length)===r}function endsWith(e,r,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-r.length,t)===r}function includes(e,r,t){return"number"!=typeof t&&(t=0),!(t+r.length>e.length)&&-1!==e.indexOf(r,t)}createErrorType("ERR_INVALID_OPT_VALUE",function(e,r){return'The value "'+r+'" is invalid for option "'+e+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(e,r,t){var n,o;if("string"==typeof r&&startsWith(r,"not ")?(n="must not be",r=r.replace(/^not /,"")):n="must be",endsWith(e," argument"))o="The ".concat(e," ").concat(n," ").concat(oneOf(r,"type"));else{var c=includes(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(oneOf(r,"type"))}return o+=". Received type ".concat(typeof t)},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),module.exports.codes=codes; -},{}],84:[function(require,module,exports){ +},{}],85:[function(require,module,exports){ (function (process){ "use strict";var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=Duplex;var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");require("inherits")(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0)if("string"==typeof t||d.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),a)d.endEmitted?errorOrDestroy(e,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(e,d,t,!0);else if(d.ended)errorOrDestroy(e,new ERR_STREAM_PUSH_AFTER_EOF);else{if(d.destroyed)return!1;d.reading=!1,d.decoder&&!r?(t=d.decoder.write(t),d.objectMode||0!==t.length?addChunk(e,d,t,!1):maybeReadMore(e,d)):addChunk(e,d,t,!1)}else a||(d.reading=!1,maybeReadMore(e,d));return!d.ended&&(d.length=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function onEofChunk(e,t){if(debug("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}}function emitReadable(e){var t=e._readableState;debug("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;debug("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){debug("readable nexttick read 0"),e.read(0)}function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(resume_,e,t))}function resume_(e,t){debug("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(debug("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;debug("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(debug("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return debug("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return debug("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,debug("pipe count=%d opts=%j",a.pipesCount,t);var n=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?d:f;function i(t,n){debug("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,debug("cleanup"),e.removeListener("close",b),e.removeListener("finish",p),e.removeListener("drain",o),e.removeListener("error",u),e.removeListener("unpipe",i),r.removeListener("end",d),r.removeListener("end",f),r.removeListener("data",l),s=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||o())}function d(){debug("onend"),e.end()}a.endEmitted?process.nextTick(n):r.once("end",n),e.on("unpipe",i);var o=pipeOnDrain(r);e.on("drain",o);var s=!1;function l(t){debug("ondata");var n=e.write(t);debug("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!s&&(debug("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function u(t){debug("onerror",t),f(),e.removeListener("error",u),0===EElistenerCount(e,"error")&&errorOrDestroy(e,t)}function b(){e.removeListener("finish",p),f()}function p(){debug("onfinish"),e.removeListener("close",b),f()}function f(){debug("unpipe"),r.unpipe(e)}return r.on("data",l),prependListener(e,"error",u),e.once("close",b),e.once("finish",p),e.emit("pipe",r),a.flowing||(debug("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,debug("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||process.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=Stream.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=Stream.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(debug("resume"),e.flowing=!e.readableListening,resume(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",function(){if(debug("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){(debug("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))}),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var i=0;i-1))throw new ERR_UNKNOWN_ENCODING(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||endWritable(this,i,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(e,t){t(e)}; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":83,"./_stream_duplex":84,"./internal/streams/destroy":91,"./internal/streams/state":95,"./internal/streams/stream":96,"_process":71,"buffer":42,"inherits":64,"util-deprecate":108}],89:[function(require,module,exports){ +},{"../errors":84,"./_stream_duplex":85,"./internal/streams/destroy":92,"./internal/streams/state":96,"./internal/streams/stream":97,"_process":72,"buffer":43,"inherits":65,"util-deprecate":109}],90:[function(require,module,exports){ (function (process){ "use strict";var _Object$setPrototypeO;function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var finished=require("./end-of-stream"),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[kLastResolve];if(null!==t){var r=e[kStream].read();null!==r&&(e[kLastPromise]=null,e[kLastResolve]=null,e[kLastReject]=null,t(createIterResult(r,!1)))}}function onReadable(e){process.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,o){e.then(function(){t[kEnded]?r(createIterResult(void 0,!0)):t[kHandlePromise](r,o)},o)}}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_defineProperty(_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var e=this,t=this[kError];if(null!==t)return Promise.reject(t);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(t,r){process.nextTick(function(){e[kError]?r(e[kError]):t(createIterResult(void 0,!0))})});var r,o=this[kLastPromise];if(o)r=new Promise(wrapForNext(o,this));else{var n=this[kStream].read();if(null!==n)return Promise.resolve(createIterResult(n,!1));r=new Promise(this[kHandlePromise])}return this[kLastPromise]=r,r}},Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var e=this;return new Promise(function(t,r){e[kStream].destroy(null,function(e){e?r(e):t(createIterResult(void 0,!0))})})}),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=function(e){var t,r=Object.create(ReadableStreamAsyncIteratorPrototype,(_defineProperty(t={},kStream,{value:e,writable:!0}),_defineProperty(t,kLastResolve,{value:null,writable:!0}),_defineProperty(t,kLastReject,{value:null,writable:!0}),_defineProperty(t,kError,{value:null,writable:!0}),_defineProperty(t,kEnded,{value:e._readableState.endEmitted,writable:!0}),_defineProperty(t,kHandlePromise,{value:function(e,t){var o=r[kStream].read();o?(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,e(createIterResult(o,!1))):(r[kLastResolve]=e,r[kLastReject]=t)},writable:!0}),t));return r[kLastPromise]=null,finished(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[kLastReject];return null!==t&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,t(e)),void(r[kError]=e)}var o=r[kLastResolve];null!==o&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,o(createIterResult(void 0,!0))),r[kEnded]=!0}),e.on("readable",onReadable.bind(null,r)),r};module.exports=createReadableStreamAsyncIterator; }).call(this,require('_process')) -},{"./end-of-stream":92,"_process":71}],90:[function(require,module,exports){ +},{"./end-of-stream":93,"_process":72}],91:[function(require,module,exports){ "use strict";function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return Buffer.alloc(0);for(var t=Buffer.allocUnsafe(e>>>0),n=this.head,r=0;n;)copyBuffer(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return ea.length?a.length:e;if(i===a.length?r+=a:r+=a.slice(0,e),0===(e-=i)){i===a.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=a.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=Buffer.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var a=n.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),0===(e-=i)){i===a.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(i));break}++r}return this.length-=r,t}},{key:custom,value:function(e,t){return inspect(this,_objectSpread({},t,{depth:0,customInspect:!1}))}}]),e}(); -},{"buffer":42,"util":38}],91:[function(require,module,exports){ +},{"buffer":43,"util":39}],92:[function(require,module,exports){ (function (process){ "use strict";function destroy(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,t)):process.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?r._writableState?r._writableState.errorEmitted?process.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,r,t)):process.nextTick(emitErrorAndCloseNT,r,t):e?(process.nextTick(emitCloseNT,r),e(t)):process.nextTick(emitCloseNT,r)}),this)}function emitErrorAndCloseNT(t,e){emitErrorNT(t,e),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(t,e){t.emit("error",e)}function errorOrDestroy(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}; }).call(this,require('_process')) -},{"_process":71}],92:[function(require,module,exports){ +},{"_process":72}],93:[function(require,module,exports){ "use strict";var ERR_STREAM_PREMATURE_CLOSE=require("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function once(e){var r=!1;return function(){if(!r){r=!0;for(var t=arguments.length,n=new Array(t),o=0;o0,function(e){o||(o=e),e&&i.forEach(call),u||(i.forEach(call),t(o))})});return r.reduce(pipe)}module.exports=pipeline; -},{"../../../errors":83,"./end-of-stream":92}],95:[function(require,module,exports){ +},{"../../../errors":84,"./end-of-stream":93}],96:[function(require,module,exports){ "use strict";var ERR_INVALID_OPT_VALUE=require("../../../errors").codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(r,e,t){return null!=r.highWaterMark?r.highWaterMark:e?r[t]:null}function getHighWaterMark(r,e,t,a){var i=highWaterMarkFrom(e,a,t);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new ERR_INVALID_OPT_VALUE(a?t:"highWaterMark",i);return Math.floor(i)}return r.objectMode?16:16384}module.exports={getHighWaterMark:getHighWaterMark}; -},{"../../../errors":83}],96:[function(require,module,exports){ +},{"../../../errors":84}],97:[function(require,module,exports){ module.exports=require("events").EventEmitter; -},{"events":59}],97:[function(require,module,exports){ +},{"events":60}],98:[function(require,module,exports){ exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"),exports.finished=require("./lib/internal/streams/end-of-stream.js"),exports.pipeline=require("./lib/internal/streams/pipeline.js"); -},{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88,"./lib/internal/streams/end-of-stream.js":92,"./lib/internal/streams/pipeline.js":94}],98:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":85,"./lib/_stream_passthrough.js":86,"./lib/_stream_readable.js":87,"./lib/_stream_transform.js":88,"./lib/_stream_writable.js":89,"./lib/internal/streams/end-of-stream.js":93,"./lib/internal/streams/pipeline.js":95}],99:[function(require,module,exports){ "use strict";var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function normalizeEncoding(t){var e=_normalizeEncoding(t);if("string"!=typeof e&&(Buffer.isEncoding===isEncoding||!isEncoding(t)))throw new Error("Unknown encoding: "+t);return e||t}function StringDecoder(t){var e;switch(this.encoding=normalizeEncoding(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,e=4;break;case"utf8":this.fillLast=utf8FillLast,e=4;break;case"base64":this.text=base64Text,this.end=base64End,e=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(e)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8CheckIncomplete(t,e,s){var i=e.length-1;if(i=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function utf8CheckExtraBytes(t,e,s){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,"�"}}function utf8FillLast(t){var e=this.lastTotal-this.lastNeed,s=utf8CheckExtraBytes(this,t,e);return void 0!==s?s: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 utf8Text(t,e){var s=utf8CheckIncomplete(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var i=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function utf8End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function utf16Text(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var i=s.charCodeAt(s.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],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function utf16End(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function base64Text(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?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-s))}function base64End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(t===n-1)i.push(65533);else{var s=e.charCodeAt(t+1);if(56320<=s&&s<=57343){var a=1023&o,f=1023&s;i.push(65536+(a<<10)+f),t+=1}else i.push(65533)}t+=1}return i}function codePointsToString(e){for(var r="",n=0;n>10),56320+(1023&t)))}return r}var end_of_stream=-1;function Stream(e){this.tokens=[].slice.call(e)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.unshift(r.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var r=e;r.length;)this.tokens.push(r.shift());else this.tokens.push(e)}};var finished=-1;function decoderError(e,r){if(e)throw TypeError("Decoder error");return r||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder(e,r){if(!(this instanceof TextDecoder))return new TextDecoder(e,r);if((e=void 0!==e?String(e).toLowerCase():DEFAULT_ENCODING)!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");r=ToDictionary(r),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(r.fatal),this._ignoreBOM=Boolean(r.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function TextEncoder(e,r){if(!(this instanceof TextEncoder))return new TextEncoder(e,r);if((e=void 0!==e?String(e).toLowerCase():DEFAULT_ENCODING)!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");r=ToDictionary(r),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(r.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function UTF8Decoder(e){var r=e.fatal,n=0,t=0,i=0,o=128,s=191;this.handler=function(e,a){if(a===end_of_stream&&0!==i)return i=0,decoderError(r);if(a===end_of_stream)return finished;if(0===i){if(inRange(a,0,127))return a;if(inRange(a,194,223))i=1,n=a-192;else if(inRange(a,224,239))224===a&&(o=160),237===a&&(s=159),i=2,n=a-224;else{if(!inRange(a,240,244))return decoderError(r);240===a&&(o=144),244===a&&(s=143),i=3,n=a-240}return n<<=6*i,null}if(!inRange(a,o,s))return n=i=t=0,o=128,s=191,e.prepend(a),decoderError(r);if(o=128,s=191,n+=a-128<<6*(i-(t+=1)),t!==i)return null;var f=n;return n=i=t=0,f}}function UTF8Encoder(e){e.fatal;this.handler=function(e,r){if(r===end_of_stream)return finished;if(inRange(r,0,127))return r;var n,t;inRange(r,128,2047)?(n=1,t=192):inRange(r,2048,65535)?(n=2,t=224):inRange(r,65536,1114111)&&(n=3,t=240);for(var i=[(r>>6*n)+t];n>0;){var o=r>>6*(n-1);i.push(128|63&o),n-=1}return i}}TextDecoder.prototype={decode:function(e,r){var n;n="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),r=ToDictionary(r),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(r.stream);for(var t,i=new Stream(n),o=[];!i.endOfStream()&&(t=this._decoder.handler(i,i.read()))!==finished;)null!==t&&(Array.isArray(t)?o.push.apply(o,t):o.push(t));if(!this._streaming){do{if((t=this._decoder.handler(i,i.read()))===finished)break;null!==t&&(Array.isArray(t)?o.push.apply(o,t):o.push(t))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),codePointsToString(o)}},TextEncoder.prototype={encode:function(e,r){e=e?String(e):"",r=ToDictionary(r),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=Boolean(r.stream);for(var n,t=[],i=new Stream(stringToCodePoints(e));!i.endOfStream()&&(n=this._encoder.handler(i,i.read()))!==finished;)Array.isArray(n)?t.push.apply(t,n):t.push(n);if(!this._streaming){for(;(n=this._encoder.handler(i,i.read()))!==finished;)Array.isArray(n)?t.push.apply(t,n):t.push(n);this._encoder=null}return new Uint8Array(t)}},exports.TextEncoder=TextEncoder,exports.TextDecoder=TextDecoder; -},{}],100:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ function toIdentifier(e){return e.split(" ").map(function(e){return e.slice(0,1).toUpperCase()+e.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}module.exports=toIdentifier; -},{}],101:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ !function(r){"use strict";var t=function(r){var t,n=new Float64Array(16);if(r)for(t=0;t>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function w(r,t,n,e,o){var i,h=0;for(i=0;i>>8)-1}function v(r,t,n,e){return w(r,t,n,e,16)}function p(r,t,n,e){return w(r,t,n,e,32)}function b(r,t,n,e){!function(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,v=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,A=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,U=i,d=h,E=a,x=f,M=s,m=u,B=c,S=y,k=l,K=w,Y=v,L=p,T=b,z=g,R=A,P=_,N=0;N<20;N+=2)U^=(o=(T^=(o=(k^=(o=(M^=(o=U+T|0)<<7|o>>>25)+U|0)<<9|o>>>23)+M|0)<<13|o>>>19)+k|0)<<18|o>>>14,m^=(o=(d^=(o=(z^=(o=(K^=(o=m+d|0)<<7|o>>>25)+m|0)<<9|o>>>23)+K|0)<<13|o>>>19)+z|0)<<18|o>>>14,Y^=(o=(B^=(o=(E^=(o=(R^=(o=Y+B|0)<<7|o>>>25)+Y|0)<<9|o>>>23)+R|0)<<13|o>>>19)+E|0)<<18|o>>>14,P^=(o=(L^=(o=(S^=(o=(x^=(o=P+L|0)<<7|o>>>25)+P|0)<<9|o>>>23)+x|0)<<13|o>>>19)+S|0)<<18|o>>>14,U^=(o=(x^=(o=(E^=(o=(d^=(o=U+x|0)<<7|o>>>25)+U|0)<<9|o>>>23)+d|0)<<13|o>>>19)+E|0)<<18|o>>>14,m^=(o=(M^=(o=(S^=(o=(B^=(o=m+M|0)<<7|o>>>25)+m|0)<<9|o>>>23)+B|0)<<13|o>>>19)+S|0)<<18|o>>>14,Y^=(o=(K^=(o=(k^=(o=(L^=(o=Y+K|0)<<7|o>>>25)+Y|0)<<9|o>>>23)+L|0)<<13|o>>>19)+k|0)<<18|o>>>14,P^=(o=(R^=(o=(z^=(o=(T^=(o=P+R|0)<<7|o>>>25)+P|0)<<9|o>>>23)+T|0)<<13|o>>>19)+z|0)<<18|o>>>14;U=U+i|0,d=d+h|0,E=E+a|0,x=x+f|0,M=M+s|0,m=m+u|0,B=B+c|0,S=S+y|0,k=k+l|0,K=K+w|0,Y=Y+v|0,L=L+p|0,T=T+b|0,z=z+g|0,R=R+A|0,P=P+_|0,r[0]=U>>>0&255,r[1]=U>>>8&255,r[2]=U>>>16&255,r[3]=U>>>24&255,r[4]=d>>>0&255,r[5]=d>>>8&255,r[6]=d>>>16&255,r[7]=d>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=M>>>0&255,r[17]=M>>>8&255,r[18]=M>>>16&255,r[19]=M>>>24&255,r[20]=m>>>0&255,r[21]=m>>>8&255,r[22]=m>>>16&255,r[23]=m>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=S>>>0&255,r[29]=S>>>8&255,r[30]=S>>>16&255,r[31]=S>>>24&255,r[32]=k>>>0&255,r[33]=k>>>8&255,r[34]=k>>>16&255,r[35]=k>>>24&255,r[36]=K>>>0&255,r[37]=K>>>8&255,r[38]=K>>>16&255,r[39]=K>>>24&255,r[40]=Y>>>0&255,r[41]=Y>>>8&255,r[42]=Y>>>16&255,r[43]=Y>>>24&255,r[44]=L>>>0&255,r[45]=L>>>8&255,r[46]=L>>>16&255,r[47]=L>>>24&255,r[48]=T>>>0&255,r[49]=T>>>8&255,r[50]=T>>>16&255,r[51]=T>>>24&255,r[52]=z>>>0&255,r[53]=z>>>8&255,r[54]=z>>>16&255,r[55]=z>>>24&255,r[56]=R>>>0&255,r[57]=R>>>8&255,r[58]=R>>>16&255,r[59]=R>>>24&255,r[60]=P>>>0&255,r[61]=P>>>8&255,r[62]=P>>>16&255,r[63]=P>>>24&255}(r,t,n,e)}function g(r,t,n,e){!function(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,v=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,A=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,U=0;U<20;U+=2)i^=(o=(b^=(o=(l^=(o=(s^=(o=i+b|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+l|0)<<18|o>>>14,u^=(o=(h^=(o=(g^=(o=(w^=(o=u+h|0)<<7|o>>>25)+u|0)<<9|o>>>23)+w|0)<<13|o>>>19)+g|0)<<18|o>>>14,v^=(o=(c^=(o=(a^=(o=(A^=(o=v+c|0)<<7|o>>>25)+v|0)<<9|o>>>23)+A|0)<<13|o>>>19)+a|0)<<18|o>>>14,_^=(o=(p^=(o=(y^=(o=(f^=(o=_+p|0)<<7|o>>>25)+_|0)<<9|o>>>23)+f|0)<<13|o>>>19)+y|0)<<18|o>>>14,i^=(o=(f^=(o=(a^=(o=(h^=(o=i+f|0)<<7|o>>>25)+i|0)<<9|o>>>23)+h|0)<<13|o>>>19)+a|0)<<18|o>>>14,u^=(o=(s^=(o=(y^=(o=(c^=(o=u+s|0)<<7|o>>>25)+u|0)<<9|o>>>23)+c|0)<<13|o>>>19)+y|0)<<18|o>>>14,v^=(o=(w^=(o=(l^=(o=(p^=(o=v+w|0)<<7|o>>>25)+v|0)<<9|o>>>23)+p|0)<<13|o>>>19)+l|0)<<18|o>>>14,_^=(o=(A^=(o=(g^=(o=(b^=(o=_+A|0)<<7|o>>>25)+_|0)<<9|o>>>23)+b|0)<<13|o>>>19)+g|0)<<18|o>>>14;r[0]=i>>>0&255,r[1]=i>>>8&255,r[2]=i>>>16&255,r[3]=i>>>24&255,r[4]=u>>>0&255,r[5]=u>>>8&255,r[6]=u>>>16&255,r[7]=u>>>24&255,r[8]=v>>>0&255,r[9]=v>>>8&255,r[10]=v>>>16&255,r[11]=v>>>24&255,r[12]=_>>>0&255,r[13]=_>>>8&255,r[14]=_>>>16&255,r[15]=_>>>24&255,r[16]=c>>>0&255,r[17]=c>>>8&255,r[18]=c>>>16&255,r[19]=c>>>24&255,r[20]=y>>>0&255,r[21]=y>>>8&255,r[22]=y>>>16&255,r[23]=y>>>24&255,r[24]=l>>>0&255,r[25]=l>>>8&255,r[26]=l>>>16&255,r[27]=l>>>24&255,r[28]=w>>>0&255,r[29]=w>>>8&255,r[30]=w>>>16&255,r[31]=w>>>24&255}(r,t,n,e)}var A=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(r,t,n,e,o,i,h){var a,f,s=new Uint8Array(16),u=new Uint8Array(64);for(f=0;f<16;f++)s[f]=0;for(f=0;f<8;f++)s[f]=i[f];for(;o>=64;){for(b(u,s,h,A),f=0;f<64;f++)r[t+f]=n[e+f]^u[f];for(a=1,f=8;f<16;f++)a=a+(255&s[f])|0,s[f]=255&a,a>>>=8;o-=64,t+=64,e+=64}if(o>0)for(b(u,s,h,A),f=0;f=64;){for(b(f,a,o,A),h=0;h<64;h++)r[t+h]=f[h];for(i=1,h=8;h<16;h++)i=i+(255&a[h])|0,a[h]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(b(f,a,o,A),h=0;h>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),o=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|o<<9),i=255&r[8]|(255&r[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(i>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};function M(r,t,n,e,o,i){var h=new x(i);return h.update(n,e,o),h.finish(r,t),0}function m(r,t,n,e,o,i){var h=new Uint8Array(16);return M(h,0,n,e,o,i),v(r,t,h,0)}function B(r,t,n,e,o){var i;if(n<32)return-1;for(E(r,0,t,0,n,e,o),M(r,16,r,32,n-32,r),i=0;i<16;i++)r[i]=0;return 0}function S(r,t,n,e,o){var i,h=new Uint8Array(32);if(n<32)return-1;if(d(h,0,32,e,o),0!==m(t,16,t,32,n-32,h))return-1;for(E(r,0,t,0,n,e,o),i=0;i<32;i++)r[i]=0;return 0}function k(r,t){var n;for(n=0;n<16;n++)r[n]=0|t[n]}function K(r){var t,n,e=1;for(t=0;t<16;t++)n=r[t]+e+65535,e=Math.floor(n/65536),r[t]=n-65536*e;r[0]+=e-1+37*(e-1)}function Y(r,t,n){for(var e,o=~(n-1),i=0;i<16;i++)e=o&(r[i]^t[i]),r[i]^=e,t[i]^=e}function L(r,n){var e,o,i,h=t(),a=t();for(e=0;e<16;e++)a[e]=n[e];for(K(a),K(a),K(a),o=0;o<2;o++){for(h[0]=a[0]-65517,e=1;e<15;e++)h[e]=a[e]-65535-(h[e-1]>>16&1),h[e-1]&=65535;h[15]=a[15]-32767-(h[14]>>16&1),i=h[15]>>16&1,h[14]&=65535,Y(a,h,1-i)}for(e=0;e<16;e++)r[2*e]=255&a[e],r[2*e+1]=a[e]>>8}function T(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return L(n,r),L(e,t),p(n,0,e,0)}function z(r){var t=new Uint8Array(32);return L(t,r),1&t[0]}function R(r,t){var n;for(n=0;n<16;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function P(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]+n[e]}function N(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]-n[e]}function O(r,t,n){var e,o,i=0,h=0,a=0,f=0,s=0,u=0,c=0,y=0,l=0,w=0,v=0,p=0,b=0,g=0,A=0,_=0,U=0,d=0,E=0,x=0,M=0,m=0,B=0,S=0,k=0,K=0,Y=0,L=0,T=0,z=0,R=0,P=n[0],N=n[1],O=n[2],C=n[3],F=n[4],I=n[5],Z=n[6],G=n[7],q=n[8],D=n[9],V=n[10],X=n[11],j=n[12],H=n[13],J=n[14],Q=n[15];i+=(e=t[0])*P,h+=e*N,a+=e*O,f+=e*C,s+=e*F,u+=e*I,c+=e*Z,y+=e*G,l+=e*q,w+=e*D,v+=e*V,p+=e*X,b+=e*j,g+=e*H,A+=e*J,_+=e*Q,h+=(e=t[1])*P,a+=e*N,f+=e*O,s+=e*C,u+=e*F,c+=e*I,y+=e*Z,l+=e*G,w+=e*q,v+=e*D,p+=e*V,b+=e*X,g+=e*j,A+=e*H,_+=e*J,U+=e*Q,a+=(e=t[2])*P,f+=e*N,s+=e*O,u+=e*C,c+=e*F,y+=e*I,l+=e*Z,w+=e*G,v+=e*q,p+=e*D,b+=e*V,g+=e*X,A+=e*j,_+=e*H,U+=e*J,d+=e*Q,f+=(e=t[3])*P,s+=e*N,u+=e*O,c+=e*C,y+=e*F,l+=e*I,w+=e*Z,v+=e*G,p+=e*q,b+=e*D,g+=e*V,A+=e*X,_+=e*j,U+=e*H,d+=e*J,E+=e*Q,s+=(e=t[4])*P,u+=e*N,c+=e*O,y+=e*C,l+=e*F,w+=e*I,v+=e*Z,p+=e*G,b+=e*q,g+=e*D,A+=e*V,_+=e*X,U+=e*j,d+=e*H,E+=e*J,x+=e*Q,u+=(e=t[5])*P,c+=e*N,y+=e*O,l+=e*C,w+=e*F,v+=e*I,p+=e*Z,b+=e*G,g+=e*q,A+=e*D,_+=e*V,U+=e*X,d+=e*j,E+=e*H,x+=e*J,M+=e*Q,c+=(e=t[6])*P,y+=e*N,l+=e*O,w+=e*C,v+=e*F,p+=e*I,b+=e*Z,g+=e*G,A+=e*q,_+=e*D,U+=e*V,d+=e*X,E+=e*j,x+=e*H,M+=e*J,m+=e*Q,y+=(e=t[7])*P,l+=e*N,w+=e*O,v+=e*C,p+=e*F,b+=e*I,g+=e*Z,A+=e*G,_+=e*q,U+=e*D,d+=e*V,E+=e*X,x+=e*j,M+=e*H,m+=e*J,B+=e*Q,l+=(e=t[8])*P,w+=e*N,v+=e*O,p+=e*C,b+=e*F,g+=e*I,A+=e*Z,_+=e*G,U+=e*q,d+=e*D,E+=e*V,x+=e*X,M+=e*j,m+=e*H,B+=e*J,S+=e*Q,w+=(e=t[9])*P,v+=e*N,p+=e*O,b+=e*C,g+=e*F,A+=e*I,_+=e*Z,U+=e*G,d+=e*q,E+=e*D,x+=e*V,M+=e*X,m+=e*j,B+=e*H,S+=e*J,k+=e*Q,v+=(e=t[10])*P,p+=e*N,b+=e*O,g+=e*C,A+=e*F,_+=e*I,U+=e*Z,d+=e*G,E+=e*q,x+=e*D,M+=e*V,m+=e*X,B+=e*j,S+=e*H,k+=e*J,K+=e*Q,p+=(e=t[11])*P,b+=e*N,g+=e*O,A+=e*C,_+=e*F,U+=e*I,d+=e*Z,E+=e*G,x+=e*q,M+=e*D,m+=e*V,B+=e*X,S+=e*j,k+=e*H,K+=e*J,Y+=e*Q,b+=(e=t[12])*P,g+=e*N,A+=e*O,_+=e*C,U+=e*F,d+=e*I,E+=e*Z,x+=e*G,M+=e*q,m+=e*D,B+=e*V,S+=e*X,k+=e*j,K+=e*H,Y+=e*J,L+=e*Q,g+=(e=t[13])*P,A+=e*N,_+=e*O,U+=e*C,d+=e*F,E+=e*I,x+=e*Z,M+=e*G,m+=e*q,B+=e*D,S+=e*V,k+=e*X,K+=e*j,Y+=e*H,L+=e*J,T+=e*Q,A+=(e=t[14])*P,_+=e*N,U+=e*O,d+=e*C,E+=e*F,x+=e*I,M+=e*Z,m+=e*G,B+=e*q,S+=e*D,k+=e*V,K+=e*X,Y+=e*j,L+=e*H,T+=e*J,z+=e*Q,_+=(e=t[15])*P,h+=38*(d+=e*O),a+=38*(E+=e*C),f+=38*(x+=e*F),s+=38*(M+=e*I),u+=38*(m+=e*Z),c+=38*(B+=e*G),y+=38*(S+=e*q),l+=38*(k+=e*D),w+=38*(K+=e*V),v+=38*(Y+=e*X),p+=38*(L+=e*j),b+=38*(T+=e*H),g+=38*(z+=e*J),A+=38*(R+=e*Q),i=(e=(i+=38*(U+=e*N))+(o=1)+65535)-65536*(o=Math.floor(e/65536)),h=(e=h+o+65535)-65536*(o=Math.floor(e/65536)),a=(e=a+o+65535)-65536*(o=Math.floor(e/65536)),f=(e=f+o+65535)-65536*(o=Math.floor(e/65536)),s=(e=s+o+65535)-65536*(o=Math.floor(e/65536)),u=(e=u+o+65535)-65536*(o=Math.floor(e/65536)),c=(e=c+o+65535)-65536*(o=Math.floor(e/65536)),y=(e=y+o+65535)-65536*(o=Math.floor(e/65536)),l=(e=l+o+65535)-65536*(o=Math.floor(e/65536)),w=(e=w+o+65535)-65536*(o=Math.floor(e/65536)),v=(e=v+o+65535)-65536*(o=Math.floor(e/65536)),p=(e=p+o+65535)-65536*(o=Math.floor(e/65536)),b=(e=b+o+65535)-65536*(o=Math.floor(e/65536)),g=(e=g+o+65535)-65536*(o=Math.floor(e/65536)),A=(e=A+o+65535)-65536*(o=Math.floor(e/65536)),_=(e=_+o+65535)-65536*(o=Math.floor(e/65536)),i=(e=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(e/65536)),h=(e=h+o+65535)-65536*(o=Math.floor(e/65536)),a=(e=a+o+65535)-65536*(o=Math.floor(e/65536)),f=(e=f+o+65535)-65536*(o=Math.floor(e/65536)),s=(e=s+o+65535)-65536*(o=Math.floor(e/65536)),u=(e=u+o+65535)-65536*(o=Math.floor(e/65536)),c=(e=c+o+65535)-65536*(o=Math.floor(e/65536)),y=(e=y+o+65535)-65536*(o=Math.floor(e/65536)),l=(e=l+o+65535)-65536*(o=Math.floor(e/65536)),w=(e=w+o+65535)-65536*(o=Math.floor(e/65536)),v=(e=v+o+65535)-65536*(o=Math.floor(e/65536)),p=(e=p+o+65535)-65536*(o=Math.floor(e/65536)),b=(e=b+o+65535)-65536*(o=Math.floor(e/65536)),g=(e=g+o+65535)-65536*(o=Math.floor(e/65536)),A=(e=A+o+65535)-65536*(o=Math.floor(e/65536)),_=(e=_+o+65535)-65536*(o=Math.floor(e/65536)),i+=o-1+37*(o-1),r[0]=i,r[1]=h,r[2]=a,r[3]=f,r[4]=s,r[5]=u,r[6]=c,r[7]=y,r[8]=l,r[9]=w,r[10]=v,r[11]=p,r[12]=b,r[13]=g,r[14]=A,r[15]=_}function C(r,t){O(r,t,t)}function F(r,n){var e,o=t();for(e=0;e<16;e++)o[e]=n[e];for(e=253;e>=0;e--)C(o,o),2!==e&&4!==e&&O(o,o,n);for(e=0;e<16;e++)r[e]=o[e]}function I(r,n){var e,o=t();for(e=0;e<16;e++)o[e]=n[e];for(e=250;e>=0;e--)C(o,o),1!==e&&O(o,o,n);for(e=0;e<16;e++)r[e]=o[e]}function Z(r,n,e){var o,i,h=new Uint8Array(32),f=new Float64Array(80),s=t(),u=t(),c=t(),y=t(),l=t(),w=t();for(i=0;i<31;i++)h[i]=n[i];for(h[31]=127&n[31]|64,h[0]&=248,R(f,e),i=0;i<16;i++)u[i]=f[i],y[i]=s[i]=c[i]=0;for(s[0]=y[0]=1,i=254;i>=0;--i)Y(s,u,o=h[i>>>3]>>>(7&i)&1),Y(c,y,o),P(l,s,c),N(s,s,c),P(c,u,y),N(u,u,y),C(y,l),C(w,s),O(s,c,s),O(c,u,l),P(l,s,c),N(s,s,c),C(u,s),N(c,y,w),O(s,c,a),P(s,s,y),O(c,c,s),O(s,y,w),O(y,u,f),C(u,l),Y(s,u,o),Y(c,y,o);for(i=0;i<16;i++)f[i+16]=s[i],f[i+32]=c[i],f[i+48]=u[i],f[i+64]=y[i];var v=f.subarray(32),p=f.subarray(16);return F(v,v),O(p,p,v),L(r,p),0}function G(r,t){return Z(r,t,o)}function q(r,t){return n(t,32),G(r,t)}function D(r,t,n){var o=new Uint8Array(32);return Z(o,n,t),g(r,e,o,A)}x.prototype.blocks=function(r,t,n){for(var e,o,i,h,a,f,s,u,c,y,l,w,v,p,b,g,A,_,U,d=this.fin?0:2048,E=this.h[0],x=this.h[1],M=this.h[2],m=this.h[3],B=this.h[4],S=this.h[5],k=this.h[6],K=this.h[7],Y=this.h[8],L=this.h[9],T=this.r[0],z=this.r[1],R=this.r[2],P=this.r[3],N=this.r[4],O=this.r[5],C=this.r[6],F=this.r[7],I=this.r[8],Z=this.r[9];n>=16;)y=c=0,y+=(E+=8191&(e=255&r[t+0]|(255&r[t+1])<<8))*T,y+=(x+=8191&(e>>>13|(o=255&r[t+2]|(255&r[t+3])<<8)<<3))*(5*Z),y+=(M+=8191&(o>>>10|(i=255&r[t+4]|(255&r[t+5])<<8)<<6))*(5*I),y+=(m+=8191&(i>>>7|(h=255&r[t+6]|(255&r[t+7])<<8)<<9))*(5*F),c=(y+=(B+=8191&(h>>>4|(a=255&r[t+8]|(255&r[t+9])<<8)<<12))*(5*C))>>>13,y&=8191,y+=(S+=a>>>1&8191)*(5*O),y+=(k+=8191&(a>>>14|(f=255&r[t+10]|(255&r[t+11])<<8)<<2))*(5*N),y+=(K+=8191&(f>>>11|(s=255&r[t+12]|(255&r[t+13])<<8)<<5))*(5*P),y+=(Y+=8191&(s>>>8|(u=255&r[t+14]|(255&r[t+15])<<8)<<8))*(5*R),l=c+=(y+=(L+=u>>>5|d)*(5*z))>>>13,l+=E*z,l+=x*T,l+=M*(5*Z),l+=m*(5*I),c=(l+=B*(5*F))>>>13,l&=8191,l+=S*(5*C),l+=k*(5*O),l+=K*(5*N),l+=Y*(5*P),c+=(l+=L*(5*R))>>>13,l&=8191,w=c,w+=E*R,w+=x*z,w+=M*T,w+=m*(5*Z),c=(w+=B*(5*I))>>>13,w&=8191,w+=S*(5*F),w+=k*(5*C),w+=K*(5*O),w+=Y*(5*N),v=c+=(w+=L*(5*P))>>>13,v+=E*P,v+=x*R,v+=M*z,v+=m*T,c=(v+=B*(5*Z))>>>13,v&=8191,v+=S*(5*I),v+=k*(5*F),v+=K*(5*C),v+=Y*(5*O),p=c+=(v+=L*(5*N))>>>13,p+=E*N,p+=x*P,p+=M*R,p+=m*z,c=(p+=B*T)>>>13,p&=8191,p+=S*(5*Z),p+=k*(5*I),p+=K*(5*F),p+=Y*(5*C),b=c+=(p+=L*(5*O))>>>13,b+=E*O,b+=x*N,b+=M*P,b+=m*R,c=(b+=B*z)>>>13,b&=8191,b+=S*T,b+=k*(5*Z),b+=K*(5*I),b+=Y*(5*F),g=c+=(b+=L*(5*C))>>>13,g+=E*C,g+=x*O,g+=M*N,g+=m*P,c=(g+=B*R)>>>13,g&=8191,g+=S*z,g+=k*T,g+=K*(5*Z),g+=Y*(5*I),A=c+=(g+=L*(5*F))>>>13,A+=E*F,A+=x*C,A+=M*O,A+=m*N,c=(A+=B*P)>>>13,A&=8191,A+=S*R,A+=k*z,A+=K*T,A+=Y*(5*Z),_=c+=(A+=L*(5*I))>>>13,_+=E*I,_+=x*F,_+=M*C,_+=m*O,c=(_+=B*N)>>>13,_&=8191,_+=S*P,_+=k*R,_+=K*z,_+=Y*T,U=c+=(_+=L*(5*Z))>>>13,U+=E*Z,U+=x*I,U+=M*F,U+=m*C,c=(U+=B*O)>>>13,U&=8191,U+=S*N,U+=k*P,U+=K*R,U+=Y*z,E=y=8191&(c=(c=((c+=(U+=L*T)>>>13)<<2)+c|0)+(y&=8191)|0),x=l+=c>>>=13,M=w&=8191,m=v&=8191,B=p&=8191,S=b&=8191,k=g&=8191,K=A&=8191,Y=_&=8191,L=U&=8191,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=M,this.h[3]=m,this.h[4]=B,this.h[5]=S,this.h[6]=k,this.h[7]=K,this.h[8]=Y,this.h[9]=L},x.prototype.finish=function(r,t){var n,e,o,i,h=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,i=1;i<10;i++)h[i]=this.h[i]+n,n=h[i]>>>13,h[i]&=8191;for(h[9]-=8192,e=(1^n)-1,i=0;i<10;i++)h[i]&=e;for(e=~e,i=0;i<10;i++)this.h[i]=this.h[i]&e|h[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},x.prototype.update=function(r,t,n){var e,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),e=0;e=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;e=128;){for(d=0;d<16;d++)E=8*d+H,K[d]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],Y[d]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(d=0;d<80;d++)if(o=L,i=T,h=z,a=R,f=P,s=N,u=O,C,y=F,l=I,w=Z,v=G,p=q,b=D,g=V,X,m=65535&(M=X),B=M>>>16,S=65535&(x=C),k=x>>>16,m+=65535&(M=(q>>>14|P<<18)^(q>>>18|P<<14)^(P>>>9|q<<23)),B+=M>>>16,S+=65535&(x=(P>>>14|q<<18)^(P>>>18|q<<14)^(q>>>9|P<<23)),k+=x>>>16,m+=65535&(M=q&D^~q&V),B+=M>>>16,S+=65535&(x=P&N^~P&O),k+=x>>>16,x=j[2*d],m+=65535&(M=j[2*d+1]),B+=M>>>16,S+=65535&x,k+=x>>>16,x=K[d%16],B+=(M=Y[d%16])>>>16,S+=65535&x,k+=x>>>16,S+=(B+=(m+=65535&M)>>>16)>>>16,m=65535&(M=U=65535&m|B<<16),B=M>>>16,S=65535&(x=_=65535&S|(k+=S>>>16)<<16),k=x>>>16,m+=65535&(M=(F>>>28|L<<4)^(L>>>2|F<<30)^(L>>>7|F<<25)),B+=M>>>16,S+=65535&(x=(L>>>28|F<<4)^(F>>>2|L<<30)^(F>>>7|L<<25)),k+=x>>>16,B+=(M=F&I^F&Z^I&Z)>>>16,S+=65535&(x=L&T^L&z^T&z),k+=x>>>16,c=65535&(S+=(B+=(m+=65535&M)>>>16)>>>16)|(k+=S>>>16)<<16,A=65535&m|B<<16,m=65535&(M=v),B=M>>>16,S=65535&(x=a),k=x>>>16,B+=(M=U)>>>16,S+=65535&(x=_),k+=x>>>16,T=o,z=i,R=h,P=a=65535&(S+=(B+=(m+=65535&M)>>>16)>>>16)|(k+=S>>>16)<<16,N=f,O=s,C=u,L=c,I=y,Z=l,G=w,q=v=65535&m|B<<16,D=p,V=b,X=g,F=A,d%16==15)for(E=0;E<16;E++)x=K[E],m=65535&(M=Y[E]),B=M>>>16,S=65535&x,k=x>>>16,x=K[(E+9)%16],m+=65535&(M=Y[(E+9)%16]),B+=M>>>16,S+=65535&x,k+=x>>>16,_=K[(E+1)%16],m+=65535&(M=((U=Y[(E+1)%16])>>>1|_<<31)^(U>>>8|_<<24)^(U>>>7|_<<25)),B+=M>>>16,S+=65535&(x=(_>>>1|U<<31)^(_>>>8|U<<24)^_>>>7),k+=x>>>16,_=K[(E+14)%16],B+=(M=((U=Y[(E+14)%16])>>>19|_<<13)^(_>>>29|U<<3)^(U>>>6|_<<26))>>>16,S+=65535&(x=(_>>>19|U<<13)^(U>>>29|_<<3)^_>>>6),k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,K[E]=65535&S|k<<16,Y[E]=65535&m|B<<16;m=65535&(M=F),B=M>>>16,S=65535&(x=L),k=x>>>16,x=r[0],B+=(M=t[0])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[0]=L=65535&S|k<<16,t[0]=F=65535&m|B<<16,m=65535&(M=I),B=M>>>16,S=65535&(x=T),k=x>>>16,x=r[1],B+=(M=t[1])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[1]=T=65535&S|k<<16,t[1]=I=65535&m|B<<16,m=65535&(M=Z),B=M>>>16,S=65535&(x=z),k=x>>>16,x=r[2],B+=(M=t[2])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[2]=z=65535&S|k<<16,t[2]=Z=65535&m|B<<16,m=65535&(M=G),B=M>>>16,S=65535&(x=R),k=x>>>16,x=r[3],B+=(M=t[3])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[3]=R=65535&S|k<<16,t[3]=G=65535&m|B<<16,m=65535&(M=q),B=M>>>16,S=65535&(x=P),k=x>>>16,x=r[4],B+=(M=t[4])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[4]=P=65535&S|k<<16,t[4]=q=65535&m|B<<16,m=65535&(M=D),B=M>>>16,S=65535&(x=N),k=x>>>16,x=r[5],B+=(M=t[5])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[5]=N=65535&S|k<<16,t[5]=D=65535&m|B<<16,m=65535&(M=V),B=M>>>16,S=65535&(x=O),k=x>>>16,x=r[6],B+=(M=t[6])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[6]=O=65535&S|k<<16,t[6]=V=65535&m|B<<16,m=65535&(M=X),B=M>>>16,S=65535&(x=C),k=x>>>16,x=r[7],B+=(M=t[7])>>>16,S+=65535&x,k+=x>>>16,k+=(S+=(B+=(m+=65535&M)>>>16)>>>16)>>>16,r[7]=C=65535&S|k<<16,t[7]=X=65535&m|B<<16,H+=128,e-=128}return e}function J(r,t,n){var e,o=new Int32Array(8),i=new Int32Array(8),h=new Uint8Array(256),a=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,H(o,i,t,n),n%=128,e=0;e=0;--o)W(r,t,e=n[o/8|0]>>(7&o)&1),Q(t,r),Q(r,r),W(r,t,e)}function tr(r,n){var e=[t(),t(),t(),t()];k(e[0],u),k(e[1],c),k(e[2],h),O(e[3],u,c),rr(r,e,n)}function nr(r,e,o){var i,h=new Uint8Array(64),a=[t(),t(),t(),t()];for(o||n(e,32),J(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64,tr(a,h),$(r,a),i=0;i<32;i++)e[i+32]=r[i];return 0}var er=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function or(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;o>4)*er[o],n=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=n*er[o];for(e=0;e<32;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function ir(r){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=r[t];for(t=0;t<64;t++)r[t]=0;or(r,n)}function hr(r,n,e,o){var i,h,a=new Uint8Array(64),f=new Uint8Array(64),s=new Uint8Array(64),u=new Float64Array(64),c=[t(),t(),t(),t()];J(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64;var y=e+64;for(i=0;i>7&&N(r[0],i,r[0]),O(r[3],r[0],r[1]),0)}(l,o))return-1;for(a=0;a=0},r.sign.keyPair=function(){var r=new Uint8Array(32),t=new Uint8Array(64);return nr(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(wr(r),64!==r.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");function urlParse(t,s,e){if(t&&util.isObject(t)&&t instanceof Url)return t;var h=new Url;return h.parse(t,s,e),h}function urlFormat(t){return util.isString(t)&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)}function urlResolve(t,s){return urlParse(t,!1,!0).resolve(s)}function urlResolveObject(t,s){return t?urlParse(t,!1,!0).resolveObject(s):s}Url.prototype.parse=function(t,s,e){if(!util.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t.indexOf("?"),r=-1!==h&&h127?b+="x":b+=d[q];if(!b.match(hostnamePartPattern)){var j=y.slice(0,m),x=y.slice(m+1),U=d.match(hostnamePartStart);U&&(j.push(U[1]),x.unshift(U[2])),x.length&&(o="/"+x.join(".")+o),this.hostname=j.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=punycode.toASCII(this.hostname));var C=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+C,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!unsafeProtocol[l])for(m=0,P=autoEscape.length;m0)&&e.host.split("@"))&&(e.auth=U.shift(),e.host=e.hostname=U.shift());return e.search=t.search,e.query=t.query,util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!d.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var q=d.slice(-1)[0],O=(e.host||t.host||d.length>1)&&("."===q||".."===q)||""===q,j=0,x=d.length;x>=0;x--)"."===(q=d[x])?d.splice(x,1):".."===q?(d.splice(x,1),j++):j&&(d.splice(x,1),j--);if(!y&&!P)for(;j--;j)d.unshift("..");!y||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),O&&"/"!==d.join("/").substr(-1)&&d.push("");var U,C=""===d[0]||d[0]&&"/"===d[0].charAt(0);b&&(e.hostname=e.host=C?"":d.length?d.shift():"",(U=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=U.shift(),e.host=e.hostname=U.shift()));return(y=y||e.host&&d.length)&&!C&&d.unshift(""),d.length?e.pathname=d.join("/"):(e.pathname=null,e.path=null),util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},Url.prototype.parseHost=function(){var t=this.host,s=portPattern.exec(t);s&&(":"!==(s=s[0])&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)}; -},{"./util":107,"punycode":40,"querystring":74}],107:[function(require,module,exports){ +},{"./util":108,"punycode":41,"querystring":75}],108:[function(require,module,exports){ "use strict";module.exports={isString:function(n){return"string"==typeof n},isObject:function(n){return"object"==typeof n&&null!==n},isNull:function(n){return null===n},isNullOrUndefined:function(n){return null==n}}; -},{}],108:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ (function (global){ function deprecate(r,e){if(config("noDeprecation"))return r;var o=!1;return function(){if(!o){if(config("throwDeprecation"))throw new Error(e);config("traceDeprecation")?console.trace(e):console.warn(e),o=!0}return r.apply(this,arguments)}}function config(r){try{if(!global.localStorage)return!1}catch(r){return!1}var e=global.localStorage[r];return null!=e&&"true"===String(e).toLowerCase()}module.exports=deprecate; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],109:[function(require,module,exports){ +},{}],110:[function(require,module,exports){ "function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; -},{}],110:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8}; -},{}],111:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ (function (process,global){ var formatRegExp=/%[sdj%]/g;exports.format=function(e){if(!isString(e)){for(var r=[],t=0;t=i)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c,a="",l=!1,p=["{","}"];(isArray(r)&&(l=!0,p=["[","]"]),isFunction(r))&&(a=" [Function"+(r.name?": "+r.name:"")+"]");return isRegExp(r)&&(a=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(a=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(a=" "+formatError(r)),0!==o.length||l&&0!=r.length?t<0?isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=l?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,l)}),e.seen.pop(),reduceToSingleString(c,a,p)):p[0]+a+p[1]}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;s-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n")):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){return e.reduce(function(e,r){return 0,r.indexOf("\n")>=0&&0,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}exports.debuglog=function(e){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),!debugs[e])if(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)){var r=process.pid;debugs[e]=function(){var t=exports.format.apply(exports,arguments);console.error("%s %d: %s",e,r,t)}}else debugs[e]=function(){};return debugs[e]},exports.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(e,r){if(!r||!isObject(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":110,"_process":71,"inherits":109}],112:[function(require,module,exports){ +},{"./support/isBuffer":111,"_process":72,"inherits":110}],113:[function(require,module,exports){ module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){for(var r={},e=0;e