From 99146b674a63ea61b9dbcfcd64074e3ab03c05ed Mon Sep 17 00:00:00 2001 From: Christian Lundkvist Date: Wed, 1 Nov 2017 17:24:06 -0400 Subject: [PATCH] Update dist files --- dist/lightwallet.js | 1062 +++++++++++++++++++-------------------- dist/lightwallet.min.js | 72 +-- 2 files changed, 562 insertions(+), 572 deletions(-) diff --git a/dist/lightwallet.js b/dist/lightwallet.js index 7b60b5cd..5b452bad 100644 --- a/dist/lightwallet.js +++ b/dist/lightwallet.js @@ -173,7 +173,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"buffer":150,"ethereumjs-util":237,"tweetnacl":348}],3:[function(require,module,exports){ +},{"buffer":149,"ethereumjs-util":236,"tweetnacl":348}],3:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -666,7 +666,7 @@ KeyStore.prototype.signTransaction = function (txParams, callback) { module.exports = KeyStore; }).call(this,require("buffer").Buffer) -},{"./encryption":2,"./signing":4,"bitcore-lib":26,"bitcore-mnemonic":88,"buffer":150,"crypto-js":184,"elliptic":220,"ethereumjs-tx":236,"scrypt-async":314,"tweetnacl":348}],4:[function(require,module,exports){ +},{"./encryption":2,"./signing":4,"bitcore-lib":26,"bitcore-mnemonic":88,"buffer":149,"crypto-js":183,"elliptic":219,"ethereumjs-tx":235,"scrypt-async":314,"tweetnacl":348}],4:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -746,7 +746,7 @@ var concatSig = function concatSig(signature) { module.exports.concatSig = concatSig; }).call(this,require("buffer").Buffer) -},{"buffer":150,"ethereumjs-tx":236,"ethereumjs-util":237}],5:[function(require,module,exports){ +},{"buffer":149,"ethereumjs-tx":235,"ethereumjs-util":236}],5:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -767,11 +767,21 @@ function add0x(input) { } } +function strip0x(input) { + if (typeof input !== 'string') { + return input; + } else if (input.length >= 2 && input.slice(0, 2) === '0x') { + return input.slice(2); + } else { + return input; + } +} + function _encodeFunctionTxData(functionName, types, args) { var fullName = functionName + '(' + types.join() + ')'; var signature = CryptoJS.SHA3(fullName, { outputLength: 256 }).toString(CryptoJS.enc.Hex).slice(0, 8); - var dataHex = signature + coder.encodeParams(types, args); + var dataHex = '0x' + signature + coder.encodeParams(types, args); // When updating to web3 1.0.0, replace by // var dataHex = coder.encodeFunctionSignature(fullName) + coder.encodeParameters(types, args).replace('0x','') @@ -807,15 +817,15 @@ function functionTx(abi, functionName, args, txObject) { txObjectCopy.data = add0x(txData); txObjectCopy.value = add0x(txObject.value); - return new Transaction(txObjectCopy).serialize().toString('hex'); + return '0x' + new Transaction(txObjectCopy).serialize().toString('hex'); } function createdContractAddress(fromAddress, nonce) { - var rlpEncodedHex = rlp.encode([new Buffer(fromAddress, 'hex'), nonce]).toString('hex'); + var rlpEncodedHex = rlp.encode([new Buffer(strip0x(fromAddress), 'hex'), nonce]).toString('hex'); var rlpEncodedWordArray = CryptoJS.enc.Hex.parse(rlpEncodedHex); var hash = CryptoJS.SHA3(rlpEncodedWordArray, { outputLength: 256 }).toString(CryptoJS.enc.Hex); - return hash.slice(24); + return '0x' + hash.slice(24); } function createContractTx(fromAddress, txObject) { @@ -832,7 +842,7 @@ function createContractTx(fromAddress, txObject) { var contractAddress = createdContractAddress(fromAddress, txObject.nonce); var tx = new Transaction(txObjectCopy); - return { tx: tx.serialize().toString('hex'), addr: contractAddress }; + return { tx: '0x' + tx.serialize().toString('hex'), addr: contractAddress }; } function valueTx(txObject) { @@ -847,7 +857,7 @@ function valueTx(txObject) { var tx = new Transaction(txObjectCopy); - return tx.serialize().toString('hex'); + return '0x' + tx.serialize().toString('hex'); } module.exports = { @@ -860,7 +870,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"buffer":150,"crypto-js":184,"ethereumjs-tx":236,"rlp":312,"web3/lib/solidity/coder":360}],6:[function(require,module,exports){ +},{"buffer":149,"crypto-js":183,"ethereumjs-tx":235,"rlp":312,"web3/lib/solidity/coder":360}],6:[function(require,module,exports){ 'use strict'; var CryptoJS = require('crypto-js'); @@ -951,7 +961,7 @@ var upgradeOldSerialized = function upgradeOldSerialized(oldSerialized, password module.exports.upgradeOldSerialized = upgradeOldSerialized; -},{"./keystore":3,"bitcore-lib":26,"bitcore-mnemonic":88,"crypto-js":184,"elliptic":220,"ethereumjs-tx":236,"scrypt-async":314,"tweetnacl":348}],7:[function(require,module,exports){ +},{"./keystore":3,"bitcore-lib":26,"bitcore-mnemonic":88,"crypto-js":183,"elliptic":219,"ethereumjs-tx":235,"scrypt-async":314,"tweetnacl":348}],7:[function(require,module,exports){ 'use strict'; var asn1 = exports; @@ -1023,7 +1033,7 @@ Entity.prototype.encode = function encode(data, enc, /* internal */reporter) { return this._getEncoder(enc).encode(data, reporter); }; -},{"../asn1":7,"inherits":258,"vm":356}],9:[function(require,module,exports){ +},{"../asn1":7,"inherits":257,"vm":356}],9:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -1131,7 +1141,7 @@ EncoderBuffer.prototype.join = function join(out, offset) { return out; }; -},{"../base":10,"buffer":150,"inherits":258}],10:[function(require,module,exports){ +},{"../base":10,"buffer":149,"inherits":257}],10:[function(require,module,exports){ 'use strict'; var base = exports; @@ -1670,7 +1680,7 @@ Node.prototype._isPrintstr = function isPrintstr(str) { ); }; -},{"../base":10,"minimalistic-assert":273}],12:[function(require,module,exports){ +},{"../base":10,"minimalistic-assert":272}],12:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -1790,7 +1800,7 @@ ReporterError.prototype.rethrow = function rethrow(msg) { return this; }; -},{"inherits":258}],13:[function(require,module,exports){ +},{"inherits":257}],13:[function(require,module,exports){ 'use strict'; var constants = require('../constants'); @@ -2136,7 +2146,7 @@ function derDecodeLen(buf, primitive, fail) { return len; } -},{"../../asn1":7,"inherits":258}],16:[function(require,module,exports){ +},{"../../asn1":7,"inherits":257}],16:[function(require,module,exports){ 'use strict'; var decoders = exports; @@ -2192,7 +2202,7 @@ PEMDecoder.prototype.decode = function decode(data, options) { return DERDecoder.prototype.decode.call(this, input, options); }; -},{"./der":15,"buffer":150,"inherits":258}],18:[function(require,module,exports){ +},{"./der":15,"buffer":149,"inherits":257}],18:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -2437,7 +2447,7 @@ function encodeTag(tag, primitive, cls, reporter) { return res; } -},{"../../asn1":7,"buffer":150,"inherits":258}],19:[function(require,module,exports){ +},{"../../asn1":7,"buffer":149,"inherits":257}],19:[function(require,module,exports){ 'use strict'; var encoders = exports; @@ -2470,7 +2480,7 @@ PEMEncoder.prototype.encode = function encode(data, options) { return out.join('\n'); }; -},{"./der":18,"inherits":258}],21:[function(require,module,exports){ +},{"./der":18,"inherits":257}],21:[function(require,module,exports){ (function (global){ 'use strict'; @@ -5841,7 +5851,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } })(undefined); -},{"crypto":175}],25:[function(require,module,exports){ +},{"crypto":174}],25:[function(require,module,exports){ 'use strict'; // Reference https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki @@ -6029,7 +6039,7 @@ bitcore.deps._ = require('lodash'); bitcore.Transaction.sighash = require('./lib/transaction/sighash'); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./lib/address":27,"./lib/block":30,"./lib/block/blockheader":29,"./lib/block/merkleblock":31,"./lib/crypto/bn":32,"./lib/crypto/ecdsa":33,"./lib/crypto/hash":34,"./lib/crypto/point":35,"./lib/crypto/random":36,"./lib/crypto/signature":37,"./lib/encoding/base58":38,"./lib/encoding/base58check":39,"./lib/encoding/bufferreader":40,"./lib/encoding/bufferwriter":41,"./lib/encoding/varint":42,"./lib/errors":43,"./lib/hdprivatekey.js":45,"./lib/hdpublickey.js":46,"./lib/networks":47,"./lib/opcode":48,"./lib/privatekey":49,"./lib/publickey":50,"./lib/script":51,"./lib/transaction":54,"./lib/transaction/sighash":62,"./lib/unit":66,"./lib/uri":67,"./lib/util/buffer":68,"./lib/util/js":69,"./lib/util/preconditions":70,"./package.json":87,"bn.js":99,"bs58":147,"buffer":150,"elliptic":71,"lodash":269}],27:[function(require,module,exports){ +},{"./lib/address":27,"./lib/block":30,"./lib/block/blockheader":29,"./lib/block/merkleblock":31,"./lib/crypto/bn":32,"./lib/crypto/ecdsa":33,"./lib/crypto/hash":34,"./lib/crypto/point":35,"./lib/crypto/random":36,"./lib/crypto/signature":37,"./lib/encoding/base58":38,"./lib/encoding/base58check":39,"./lib/encoding/bufferreader":40,"./lib/encoding/bufferwriter":41,"./lib/encoding/varint":42,"./lib/errors":43,"./lib/hdprivatekey.js":45,"./lib/hdpublickey.js":46,"./lib/networks":47,"./lib/opcode":48,"./lib/privatekey":49,"./lib/publickey":50,"./lib/script":51,"./lib/transaction":54,"./lib/transaction/sighash":62,"./lib/unit":66,"./lib/uri":67,"./lib/util/buffer":68,"./lib/util/js":69,"./lib/util/preconditions":70,"./package.json":87,"bn.js":99,"bs58":146,"buffer":149,"elliptic":71,"lodash":268}],27:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -6532,7 +6542,7 @@ module.exports = Address; var Script = require('./script'); }).call(this,require("buffer").Buffer) -},{"./crypto/hash":34,"./encoding/base58check":39,"./errors":43,"./networks":47,"./publickey":50,"./script":51,"./util/js":69,"./util/preconditions":70,"buffer":150,"lodash":269}],28:[function(require,module,exports){ +},{"./crypto/hash":34,"./encoding/base58check":39,"./errors":43,"./networks":47,"./publickey":50,"./script":51,"./util/js":69,"./util/preconditions":70,"buffer":149,"lodash":268}],28:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -6817,7 +6827,7 @@ Block.Values = { module.exports = Block; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../transaction":54,"../util/buffer":68,"../util/preconditions":70,"./blockheader":29,"buffer":150,"lodash":269}],29:[function(require,module,exports){ +},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../transaction":54,"../util/buffer":68,"../util/preconditions":70,"./blockheader":29,"buffer":149,"lodash":268}],29:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -7114,7 +7124,7 @@ BlockHeader.Constants = { module.exports = BlockHeader; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":150,"lodash":269}],30:[function(require,module,exports){ +},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":149,"lodash":268}],30:[function(require,module,exports){ 'use strict'; module.exports = require('./block'); @@ -7438,7 +7448,7 @@ MerkleBlock.fromObject = function fromObject(obj) { module.exports = MerkleBlock; }).call(this,require("buffer").Buffer) -},{"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../transaction":54,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./blockheader":29,"buffer":150,"lodash":269}],32:[function(require,module,exports){ +},{"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../transaction":54,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./blockheader":29,"buffer":149,"lodash":268}],32:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -7643,7 +7653,7 @@ BN.pad = function (buf, natlen, size) { module.exports = BN; }).call(this,require("buffer").Buffer) -},{"../util/preconditions":70,"bn.js":99,"buffer":150,"lodash":269}],33:[function(require,module,exports){ +},{"../util/preconditions":70,"bn.js":99,"buffer":149,"lodash":268}],33:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -7941,7 +7951,7 @@ ECDSA.verify = function (hashbuf, sig, pubkey, endian) { module.exports = ECDSA; }).call(this,require("buffer").Buffer) -},{"../publickey":50,"../util/buffer":68,"../util/preconditions":70,"./bn":32,"./hash":34,"./point":35,"./random":36,"./signature":37,"buffer":150,"lodash":269}],34:[function(require,module,exports){ +},{"../publickey":50,"../util/buffer":68,"../util/preconditions":70,"./bn":32,"./hash":34,"./point":35,"./random":36,"./signature":37,"buffer":149,"lodash":268}],34:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8030,7 +8040,7 @@ Hash.sha512hmac = function (data, key) { }; }).call(this,require("buffer").Buffer) -},{"../util/buffer":68,"../util/preconditions":70,"buffer":150,"crypto":175}],35:[function(require,module,exports){ +},{"../util/buffer":68,"../util/preconditions":70,"buffer":149,"crypto":174}],35:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8182,7 +8192,7 @@ Point.pointToCompressed = function pointToCompressed(point) { module.exports = Point; }).call(this,require("buffer").Buffer) -},{"../util/buffer":68,"./bn":32,"buffer":150,"elliptic":71}],36:[function(require,module,exports){ +},{"../util/buffer":68,"./bn":32,"buffer":149,"elliptic":71}],36:[function(require,module,exports){ (function (process,Buffer){ 'use strict'; @@ -8234,7 +8244,7 @@ Random.getPseudoRandomBuffer = function (size) { module.exports = Random; }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":145,"buffer":150,"crypto":175}],37:[function(require,module,exports){ +},{"_process":285,"buffer":149,"crypto":174}],37:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8547,7 +8557,7 @@ Signature.SIGHASH_ANYONECANPAY = 0x80; module.exports = Signature; }).call(this,require("buffer").Buffer) -},{"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./bn":32,"buffer":150,"lodash":269}],38:[function(require,module,exports){ +},{"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./bn":32,"buffer":149,"lodash":268}],38:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8623,7 +8633,7 @@ Base58.prototype.toString = function () { module.exports = Base58; }).call(this,require("buffer").Buffer) -},{"bs58":147,"buffer":150,"lodash":269}],39:[function(require,module,exports){ +},{"bs58":146,"buffer":149,"lodash":268}],39:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8717,7 +8727,7 @@ Base58Check.prototype.toString = function () { module.exports = Base58Check; }).call(this,require("buffer").Buffer) -},{"../crypto/hash":34,"./base58":38,"buffer":150,"lodash":269}],40:[function(require,module,exports){ +},{"../crypto/hash":34,"./base58":38,"buffer":149,"lodash":268}],40:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -8918,7 +8928,7 @@ BufferReader.prototype.readReverse = function (len) { module.exports = BufferReader; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"../util/buffer":68,"../util/preconditions":70,"buffer":150,"lodash":269}],41:[function(require,module,exports){ +},{"../crypto/bn":32,"../util/buffer":68,"../util/preconditions":70,"buffer":149,"lodash":268}],41:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -9069,7 +9079,7 @@ BufferWriter.varintBufBN = function (bn) { module.exports = BufferWriter; }).call(this,require("buffer").Buffer) -},{"../util/buffer":68,"assert":21,"buffer":150}],42:[function(require,module,exports){ +},{"../util/buffer":68,"assert":21,"buffer":149}],42:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -9144,7 +9154,7 @@ Varint.prototype.toNumber = function () { module.exports = Varint; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"./bufferreader":40,"./bufferwriter":41,"buffer":150}],43:[function(require,module,exports){ +},{"../crypto/bn":32,"./bufferreader":40,"./bufferwriter":41,"buffer":149}],43:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -9202,7 +9212,7 @@ module.exports.extend = function (spec) { return traverseNode(bitcore.Error, spec); }; -},{"./spec":44,"lodash":269}],44:[function(require,module,exports){ +},{"./spec":44,"lodash":268}],44:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -10028,7 +10038,7 @@ assert(HDPrivateKey.ChecksumEnd === HDPrivateKey.SerializedByteSize); module.exports = HDPrivateKey; }).call(this,require("buffer").Buffer) -},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./crypto/random":36,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdpublickey":46,"./networks":47,"./privatekey":49,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"assert":21,"buffer":150,"lodash":269}],46:[function(require,module,exports){ +},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./crypto/random":36,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdpublickey":46,"./networks":47,"./privatekey":49,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"assert":21,"buffer":149,"lodash":268}],46:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -10522,7 +10532,7 @@ assert(HDPublicKey.ChecksumEnd === HDPublicKey.SerializedByteSize); module.exports = HDPublicKey; }).call(this,require("buffer").Buffer) -},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdprivatekey":45,"./networks":47,"./publickey":50,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"assert":21,"buffer":150,"lodash":269}],47:[function(require,module,exports){ +},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdprivatekey":45,"./networks":47,"./publickey":50,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"assert":21,"buffer":149,"lodash":268}],47:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -10781,7 +10791,7 @@ module.exports = { disableRegtest: disableRegtest }; -},{"./util/buffer":68,"./util/js":69,"lodash":269}],48:[function(require,module,exports){ +},{"./util/buffer":68,"./util/js":69,"lodash":268}],48:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -11034,7 +11044,7 @@ Opcode.prototype.inspect = function () { module.exports = Opcode; }).call(this,require("buffer").Buffer) -},{"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"buffer":150,"lodash":269}],49:[function(require,module,exports){ +},{"./util/buffer":68,"./util/js":69,"./util/preconditions":70,"buffer":149,"lodash":268}],49:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -11434,7 +11444,7 @@ PrivateKey.prototype.inspect = function () { module.exports = PrivateKey; }).call(this,require("buffer").Buffer) -},{"./address":27,"./crypto/bn":32,"./crypto/point":35,"./crypto/random":36,"./encoding/base58check":39,"./networks":47,"./publickey":50,"./util/js":69,"./util/preconditions":70,"buffer":150,"lodash":269}],50:[function(require,module,exports){ +},{"./address":27,"./crypto/bn":32,"./crypto/point":35,"./crypto/random":36,"./encoding/base58check":39,"./networks":47,"./publickey":50,"./util/js":69,"./util/preconditions":70,"buffer":149,"lodash":268}],50:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -11829,7 +11839,7 @@ PublicKey.prototype.inspect = function () { module.exports = PublicKey; }).call(this,require("buffer").Buffer) -},{"./address":27,"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./networks":47,"./privatekey":49,"./util/js":69,"./util/preconditions":70,"buffer":150,"lodash":269}],51:[function(require,module,exports){ +},{"./address":27,"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./networks":47,"./privatekey":49,"./util/js":69,"./util/preconditions":70,"buffer":149,"lodash":268}],51:[function(require,module,exports){ 'use strict'; module.exports = require('./script'); @@ -13080,7 +13090,7 @@ Interpreter.prototype.step = function () { }; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../opcode":48,"../publickey":50,"../transaction":54,"./script":53,"buffer":150,"lodash":269}],53:[function(require,module,exports){ +},{"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../opcode":48,"../publickey":50,"../transaction":54,"./script":53,"buffer":149,"lodash":268}],53:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -14122,7 +14132,7 @@ Script.prototype.getSignatureOperationsCount = function (accurate) { module.exports = Script; }).call(this,require("buffer").Buffer) -},{"../address":27,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../networks":47,"../opcode":48,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":150,"lodash":269}],54:[function(require,module,exports){ +},{"../address":27,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../networks":47,"../opcode":48,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":149,"lodash":268}],54:[function(require,module,exports){ 'use strict'; module.exports = require('./transaction'); @@ -14329,7 +14339,7 @@ Input.prototype._estimateSize = function () { module.exports = Input; -},{"../../encoding/bufferwriter":41,"../../errors":43,"../../script":51,"../../util/buffer":68,"../../util/js":69,"../../util/preconditions":70,"../output":61,"../sighash":62,"buffer":150,"lodash":269}],57:[function(require,module,exports){ +},{"../../encoding/bufferwriter":41,"../../errors":43,"../../script":51,"../../util/buffer":68,"../../util/js":69,"../../util/preconditions":70,"../output":61,"../sighash":62,"buffer":149,"lodash":268}],57:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -14523,7 +14533,7 @@ MultiSigInput.prototype._estimateSize = function () { module.exports = MultiSigInput; -},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"../transaction":64,"./input":56,"inherits":258,"lodash":269}],58:[function(require,module,exports){ +},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"../transaction":64,"./input":56,"inherits":257,"lodash":268}],58:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -14676,7 +14686,7 @@ MultiSigScriptHashInput.prototype._estimateSize = function () { module.exports = MultiSigScriptHashInput; -},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":258,"lodash":269}],59:[function(require,module,exports){ +},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":257,"lodash":268}],59:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -14764,7 +14774,7 @@ PublicKeyInput.prototype._estimateSize = function () { module.exports = PublicKeyInput; -},{"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":258}],60:[function(require,module,exports){ +},{"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":257}],60:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -14857,7 +14867,7 @@ PublicKeyHashInput.prototype._estimateSize = function () { module.exports = PublicKeyHashInput; -},{"../../crypto/hash":34,"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":258}],61:[function(require,module,exports){ +},{"../../crypto/hash":34,"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,"inherits":257}],61:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -15020,7 +15030,7 @@ Output.prototype.toBufferWriter = function (writer) { module.exports = Output; -},{"../crypto/bn":32,"../encoding/bufferwriter":41,"../errors":43,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":150,"lodash":269}],62:[function(require,module,exports){ +},{"../crypto/bn":32,"../encoding/bufferwriter":41,"../errors":43,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":149,"lodash":268}],62:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -15155,7 +15165,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":32,"../crypto/ecdsa":33,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../script":51,"../util/preconditions":70,"./input":55,"./output":61,"./transaction":64,"buffer":150,"lodash":269}],63:[function(require,module,exports){ +},{"../crypto/bn":32,"../crypto/ecdsa":33,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../script":51,"../util/preconditions":70,"./input":55,"./output":61,"./transaction":64,"buffer":149,"lodash":268}],63:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -15243,7 +15253,7 @@ TransactionSignature.fromObject = function (object) { module.exports = TransactionSignature; }).call(this,require("buffer").Buffer) -},{"../crypto/signature":37,"../errors":43,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":150,"inherits":258,"lodash":269}],64:[function(require,module,exports){ +},{"../crypto/signature":37,"../errors":43,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"buffer":149,"inherits":257,"lodash":268}],64:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -16443,7 +16453,7 @@ Transaction.prototype.enableRBF = function () { module.exports = Transaction; }).call(this,require("buffer").Buffer) -},{"../address":27,"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../privatekey":49,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./input":55,"./output":61,"./sighash":62,"./unspentoutput":65,"buffer":150,"buffer-compare":148,"lodash":269}],65:[function(require,module,exports){ +},{"../address":27,"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../privatekey":49,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./input":55,"./output":61,"./sighash":62,"./unspentoutput":65,"buffer":149,"buffer-compare":147,"lodash":268}],65:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -16542,7 +16552,7 @@ UnspentOutput.prototype.toObject = UnspentOutput.prototype.toJSON = function toO module.exports = UnspentOutput; -},{"../address":27,"../script":51,"../unit":66,"../util/js":69,"../util/preconditions":70,"lodash":269}],66:[function(require,module,exports){ +},{"../address":27,"../script":51,"../unit":66,"../util/js":69,"../util/preconditions":70,"lodash":268}],66:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -16784,7 +16794,7 @@ Unit.prototype.inspect = function () { module.exports = Unit; -},{"./errors":43,"./util/preconditions":70,"lodash":269}],67:[function(require,module,exports){ +},{"./errors":43,"./util/preconditions":70,"lodash":268}],67:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -17011,7 +17021,7 @@ URI.prototype.inspect = function () { module.exports = URI; -},{"./address":27,"./unit":66,"lodash":269,"url":350}],68:[function(require,module,exports){ +},{"./address":27,"./unit":66,"lodash":268,"url":350}],68:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -17192,7 +17202,7 @@ module.exports.NULL_HASH = module.exports.fill(new Buffer(32), 0); module.exports.EMPTY_BUFFER = new Buffer(0); }).call(this,require("buffer").Buffer) -},{"./js":69,"./preconditions":70,"assert":21,"buffer":150}],69:[function(require,module,exports){ +},{"./js":69,"./preconditions":70,"assert":21,"buffer":149}],69:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -17278,7 +17288,7 @@ module.exports = { } }; -},{"lodash":269}],70:[function(require,module,exports){ +},{"lodash":268}],70:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -17316,7 +17326,7 @@ module.exports = { } }; -},{"../errors":43,"buffer":150,"lodash":269}],71:[function(require,module,exports){ +},{"../errors":43,"buffer":149,"lodash":268}],71:[function(require,module,exports){ 'use strict'; var elliptic = exports; @@ -18051,7 +18061,7 @@ Point.prototype.eqXToP = function eqXToP(x) { Point.prototype.toP = Point.prototype.normalize; Point.prototype.mixedAdd = Point.prototype.add; -},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":258}],74:[function(require,module,exports){ +},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":257}],74:[function(require,module,exports){ 'use strict'; var curve = exports; @@ -18238,7 +18248,7 @@ Point.prototype.getX = function getX() { return this.x.fromRed(); }; -},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":258}],76:[function(require,module,exports){ +},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":257}],76:[function(require,module,exports){ 'use strict'; var curve = require('../curve'); @@ -19103,7 +19113,7 @@ JPoint.prototype.isInfinity = function isInfinity() { return this.z.cmpn(0) === 0; }; -},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":258}],77:[function(require,module,exports){ +},{"../../elliptic":71,"../curve":74,"bn.js":99,"inherits":257}],77:[function(require,module,exports){ 'use strict'; var curves = exports; @@ -19261,7 +19271,7 @@ defineCurve('secp256k1', { g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre] }); -},{"../elliptic":71,"./precomputed/secp256k1":84,"hash.js":242}],78:[function(require,module,exports){ +},{"../elliptic":71,"./precomputed/secp256k1":84,"hash.js":241}],78:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -19479,7 +19489,7 @@ EC.prototype.getKeyRecoveryParam = function (e, signature, Q, enc) { throw new Error('Unable to find valid recovery factor'); }; -},{"../../elliptic":71,"./key":79,"./signature":80,"bn.js":99,"hmac-drbg":255}],79:[function(require,module,exports){ +},{"../../elliptic":71,"./key":79,"./signature":80,"bn.js":99,"hmac-drbg":254}],79:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -19833,7 +19843,7 @@ EDDSA.prototype.isPoint = function isPoint(val) { return val instanceof this.pointClass; }; -},{"../../elliptic":71,"./key":82,"./signature":83,"hash.js":242}],82:[function(require,module,exports){ +},{"../../elliptic":71,"./key":82,"./signature":83,"hash.js":241}],82:[function(require,module,exports){ 'use strict'; var elliptic = require('../../elliptic'); @@ -20109,15 +20119,9 @@ function intFromLE(bytes) { } utils.intFromLE = intFromLE; -},{"bn.js":99,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],86:[function(require,module,exports){ +},{"bn.js":99,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],86:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "elliptic@6.4.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_from": "elliptic@6.4.0", + "_from": "elliptic@=6.4.0", "_id": "elliptic@6.4.0", "_inBundle": false, "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", @@ -20126,19 +20130,20 @@ module.exports={ "_requested": { "type": "version", "registry": true, - "raw": "elliptic@6.4.0", + "raw": "elliptic@=6.4.0", "name": "elliptic", "escapedName": "elliptic", - "rawSpec": "6.4.0", + "rawSpec": "=6.4.0", "saveSpec": null, - "fetchSpec": "6.4.0" + "fetchSpec": "=6.4.0" }, "_requiredBy": [ "/bitcore-lib" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_spec": "6.4.0", - "_where": "/home/chris/dev/eth-lightwallet", + "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", + "_spec": "elliptic@=6.4.0", + "_where": "/home/chris/dev/eth-lightwallet/node_modules/bitcore-lib", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -20146,6 +20151,7 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -20155,6 +20161,7 @@ module.exports={ "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -20202,13 +20209,7 @@ module.exports={ },{}],87:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "bitcore-lib@0.15.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_from": "bitcore-lib@0.15.0", + "_from": "bitcore-lib@^0.15.0", "_id": "bitcore-lib@0.15.0", "_inBundle": false, "_integrity": "sha512-AeXLWhiivF6CDFzrABZHT4jJrflyylDWTi32o30rF92HW9msfuKpjzrHtFKYGa9w0kNVv5HABQjCB3OEav4PhQ==", @@ -20223,21 +20224,22 @@ module.exports={ "minimalistic-crypto-utils": "1.0.1" }, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "bitcore-lib@0.15.0", + "raw": "bitcore-lib@^0.15.0", "name": "bitcore-lib", "escapedName": "bitcore-lib", - "rawSpec": "0.15.0", + "rawSpec": "^0.15.0", "saveSpec": null, - "fetchSpec": "0.15.0" + "fetchSpec": "^0.15.0" }, "_requiredBy": [ "/bitcore-mnemonic" ], "_resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-0.15.0.tgz", - "_spec": "0.15.0", - "_where": "/home/chris/dev/eth-lightwallet", + "_shasum": "f924be13869f2aab7e04aeec5642ad3359b6cec2", + "_spec": "bitcore-lib@^0.15.0", + "_where": "/home/chris/dev/eth-lightwallet/node_modules/bitcore-mnemonic", "author": { "name": "BitPay", "email": "dev@bitpay.com" @@ -20248,6 +20250,7 @@ module.exports={ "bugs": { "url": "https://github.com/bitpay/bitcore-lib/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "=4.11.8", "bs58": "=4.0.1", @@ -20256,6 +20259,7 @@ module.exports={ "inherits": "=2.0.1", "lodash": "=4.17.4" }, + "deprecated": false, "description": "A pure and powerful JavaScript Bitcoin library.", "devDependencies": { "bitcore-build": "git+https://github.com/bitpay/bitcore-build.git#d4e8b2b2f1e2c065c3a807dcb6a6250f61d67ab3", @@ -20619,7 +20623,7 @@ Mnemonic.bitcore = bitcore; module.exports = Mnemonic; }).call(this,require("buffer").Buffer) -},{"./errors":89,"./pbkdf2":91,"./words":95,"bitcore-lib":26,"buffer":150,"unorm":349}],91:[function(require,module,exports){ +},{"./errors":89,"./pbkdf2":91,"./words":95,"bitcore-lib":26,"buffer":149,"unorm":349}],91:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -20694,7 +20698,7 @@ function pbkdf2(key, salt, iterations, dkLen) { module.exports = pbkdf2; }).call(this,require("buffer").Buffer) -},{"buffer":150,"crypto":175}],92:[function(require,module,exports){ +},{"buffer":149,"crypto":174}],92:[function(require,module,exports){ 'use strict'; var chinese = ['的', '一', '是', '在', '不', '了', '有', '和', '人', '这', '中', '大', '为', '上', '个', '国', '我', '以', '要', '他', '时', '来', '用', '们', '生', '到', '作', '地', '于', '出', '就', '分', '对', '成', '会', '可', '主', '发', '年', '动', '同', '工', '也', '能', '下', '过', '子', '说', '产', '种', '面', '而', '方', '后', '多', '定', '行', '学', '法', '所', '民', '得', '经', '十', '三', '之', '进', '着', '等', '部', '度', '家', '电', '力', '里', '如', '水', '化', '高', '自', '二', '理', '起', '小', '物', '现', '实', '加', '量', '都', '两', '体', '制', '机', '当', '使', '点', '从', '业', '本', '去', '把', '性', '好', '应', '开', '它', '合', '还', '因', '由', '其', '些', '然', '前', '外', '天', '政', '四', '日', '那', '社', '义', '事', '平', '形', '相', '全', '表', '间', '样', '与', '关', '各', '重', '新', '线', '内', '数', '正', '心', '反', '你', '明', '看', '原', '又', '么', '利', '比', '或', '但', '质', '气', '第', '向', '道', '命', '此', '变', '条', '只', '没', '结', '解', '问', '意', '建', '月', '公', '无', '系', '军', '很', '情', '者', '最', '立', '代', '想', '已', '通', '并', '提', '直', '题', '党', '程', '展', '五', '果', '料', '象', '员', '革', '位', '入', '常', '文', '总', '次', '品', '式', '活', '设', '及', '管', '特', '件', '长', '求', '老', '头', '基', '资', '边', '流', '路', '级', '少', '图', '山', '统', '接', '知', '较', '将', '组', '见', '计', '别', '她', '手', '角', '期', '根', '论', '运', '农', '指', '几', '九', '区', '强', '放', '决', '西', '被', '干', '做', '必', '战', '先', '回', '则', '任', '取', '据', '处', '队', '南', '给', '色', '光', '门', '即', '保', '治', '北', '造', '百', '规', '热', '领', '七', '海', '口', '东', '导', '器', '压', '志', '世', '金', '增', '争', '济', '阶', '油', '思', '术', '极', '交', '受', '联', '什', '认', '六', '共', '权', '收', '证', '改', '清', '美', '再', '采', '转', '更', '单', '风', '切', '打', '白', '教', '速', '花', '带', '安', '场', '身', '车', '例', '真', '务', '具', '万', '每', '目', '至', '达', '走', '积', '示', '议', '声', '报', '斗', '完', '类', '八', '离', '华', '名', '确', '才', '科', '张', '信', '马', '节', '话', '米', '整', '空', '元', '况', '今', '集', '温', '传', '土', '许', '步', '群', '广', '石', '记', '需', '段', '研', '界', '拉', '林', '律', '叫', '且', '究', '观', '越', '织', '装', '影', '算', '低', '持', '音', '众', '书', '布', '复', '容', '儿', '须', '际', '商', '非', '验', '连', '断', '深', '难', '近', '矿', '千', '周', '委', '素', '技', '备', '半', '办', '青', '省', '列', '习', '响', '约', '支', '般', '史', '感', '劳', '便', '团', '往', '酸', '历', '市', '克', '何', '除', '消', '构', '府', '称', '太', '准', '精', '值', '号', '率', '族', '维', '划', '选', '标', '写', '存', '候', '毛', '亲', '快', '效', '斯', '院', '查', '江', '型', '眼', '王', '按', '格', '养', '易', '置', '派', '层', '片', '始', '却', '专', '状', '育', '厂', '京', '识', '适', '属', '圆', '包', '火', '住', '调', '满', '县', '局', '照', '参', '红', '细', '引', '听', '该', '铁', '价', '严', '首', '底', '液', '官', '德', '随', '病', '苏', '失', '尔', '死', '讲', '配', '女', '黄', '推', '显', '谈', '罪', '神', '艺', '呢', '席', '含', '企', '望', '密', '批', '营', '项', '防', '举', '球', '英', '氧', '势', '告', '李', '台', '落', '木', '帮', '轮', '破', '亚', '师', '围', '注', '远', '字', '材', '排', '供', '河', '态', '封', '另', '施', '减', '树', '溶', '怎', '止', '案', '言', '士', '均', '武', '固', '叶', '鱼', '波', '视', '仅', '费', '紧', '爱', '左', '章', '早', '朝', '害', '续', '轻', '服', '试', '食', '充', '兵', '源', '判', '护', '司', '足', '某', '练', '差', '致', '板', '田', '降', '黑', '犯', '负', '击', '范', '继', '兴', '似', '余', '坚', '曲', '输', '修', '故', '城', '夫', '够', '送', '笔', '船', '占', '右', '财', '吃', '富', '春', '职', '觉', '汉', '画', '功', '巴', '跟', '虽', '杂', '飞', '检', '吸', '助', '升', '阳', '互', '初', '创', '抗', '考', '投', '坏', '策', '古', '径', '换', '未', '跑', '留', '钢', '曾', '端', '责', '站', '简', '述', '钱', '副', '尽', '帝', '射', '草', '冲', '承', '独', '令', '限', '阿', '宣', '环', '双', '请', '超', '微', '让', '控', '州', '良', '轴', '找', '否', '纪', '益', '依', '优', '顶', '础', '载', '倒', '房', '突', '坐', '粉', '敌', '略', '客', '袁', '冷', '胜', '绝', '析', '块', '剂', '测', '丝', '协', '诉', '念', '陈', '仍', '罗', '盐', '友', '洋', '错', '苦', '夜', '刑', '移', '频', '逐', '靠', '混', '母', '短', '皮', '终', '聚', '汽', '村', '云', '哪', '既', '距', '卫', '停', '烈', '央', '察', '烧', '迅', '境', '若', '印', '洲', '刻', '括', '激', '孔', '搞', '甚', '室', '待', '核', '校', '散', '侵', '吧', '甲', '游', '久', '菜', '味', '旧', '模', '湖', '货', '损', '预', '阻', '毫', '普', '稳', '乙', '妈', '植', '息', '扩', '银', '语', '挥', '酒', '守', '拿', '序', '纸', '医', '缺', '雨', '吗', '针', '刘', '啊', '急', '唱', '误', '训', '愿', '审', '附', '获', '茶', '鲜', '粮', '斤', '孩', '脱', '硫', '肥', '善', '龙', '演', '父', '渐', '血', '欢', '械', '掌', '歌', '沙', '刚', '攻', '谓', '盾', '讨', '晚', '粒', '乱', '燃', '矛', '乎', '杀', '药', '宁', '鲁', '贵', '钟', '煤', '读', '班', '伯', '香', '介', '迫', '句', '丰', '培', '握', '兰', '担', '弦', '蛋', '沉', '假', '穿', '执', '答', '乐', '谁', '顺', '烟', '缩', '征', '脸', '喜', '松', '脚', '困', '异', '免', '背', '星', '福', '买', '染', '井', '概', '慢', '怕', '磁', '倍', '祖', '皇', '促', '静', '补', '评', '翻', '肉', '践', '尼', '衣', '宽', '扬', '棉', '希', '伤', '操', '垂', '秋', '宜', '氢', '套', '督', '振', '架', '亮', '末', '宪', '庆', '编', '牛', '触', '映', '雷', '销', '诗', '座', '居', '抓', '裂', '胞', '呼', '娘', '景', '威', '绿', '晶', '厚', '盟', '衡', '鸡', '孙', '延', '危', '胶', '屋', '乡', '临', '陆', '顾', '掉', '呀', '灯', '岁', '措', '束', '耐', '剧', '玉', '赵', '跳', '哥', '季', '课', '凯', '胡', '额', '款', '绍', '卷', '齐', '伟', '蒸', '殖', '永', '宗', '苗', '川', '炉', '岩', '弱', '零', '杨', '奏', '沿', '露', '杆', '探', '滑', '镇', '饭', '浓', '航', '怀', '赶', '库', '夺', '伊', '灵', '税', '途', '灭', '赛', '归', '召', '鼓', '播', '盘', '裁', '险', '康', '唯', '录', '菌', '纯', '借', '糖', '盖', '横', '符', '私', '努', '堂', '域', '枪', '润', '幅', '哈', '竟', '熟', '虫', '泽', '脑', '壤', '碳', '欧', '遍', '侧', '寨', '敢', '彻', '虑', '斜', '薄', '庭', '纳', '弹', '饲', '伸', '折', '麦', '湿', '暗', '荷', '瓦', '塞', '床', '筑', '恶', '户', '访', '塔', '奇', '透', '梁', '刀', '旋', '迹', '卡', '氯', '遇', '份', '毒', '泥', '退', '洗', '摆', '灰', '彩', '卖', '耗', '夏', '择', '忙', '铜', '献', '硬', '予', '繁', '圈', '雪', '函', '亦', '抽', '篇', '阵', '阴', '丁', '尺', '追', '堆', '雄', '迎', '泛', '爸', '楼', '避', '谋', '吨', '野', '猪', '旗', '累', '偏', '典', '馆', '索', '秦', '脂', '潮', '爷', '豆', '忽', '托', '惊', '塑', '遗', '愈', '朱', '替', '纤', '粗', '倾', '尚', '痛', '楚', '谢', '奋', '购', '磨', '君', '池', '旁', '碎', '骨', '监', '捕', '弟', '暴', '割', '贯', '殊', '释', '词', '亡', '壁', '顿', '宝', '午', '尘', '闻', '揭', '炮', '残', '冬', '桥', '妇', '警', '综', '招', '吴', '付', '浮', '遭', '徐', '您', '摇', '谷', '赞', '箱', '隔', '订', '男', '吹', '园', '纷', '唐', '败', '宋', '玻', '巨', '耕', '坦', '荣', '闭', '湾', '键', '凡', '驻', '锅', '救', '恩', '剥', '凝', '碱', '齿', '截', '炼', '麻', '纺', '禁', '废', '盛', '版', '缓', '净', '睛', '昌', '婚', '涉', '筒', '嘴', '插', '岸', '朗', '庄', '街', '藏', '姑', '贸', '腐', '奴', '啦', '惯', '乘', '伙', '恢', '匀', '纱', '扎', '辩', '耳', '彪', '臣', '亿', '璃', '抵', '脉', '秀', '萨', '俄', '网', '舞', '店', '喷', '纵', '寸', '汗', '挂', '洪', '贺', '闪', '柬', '爆', '烯', '津', '稻', '墙', '软', '勇', '像', '滚', '厘', '蒙', '芳', '肯', '坡', '柱', '荡', '腿', '仪', '旅', '尾', '轧', '冰', '贡', '登', '黎', '削', '钻', '勒', '逃', '障', '氨', '郭', '峰', '币', '港', '伏', '轨', '亩', '毕', '擦', '莫', '刺', '浪', '秘', '援', '株', '健', '售', '股', '岛', '甘', '泡', '睡', '童', '铸', '汤', '阀', '休', '汇', '舍', '牧', '绕', '炸', '哲', '磷', '绩', '朋', '淡', '尖', '启', '陷', '柴', '呈', '徒', '颜', '泪', '稍', '忘', '泵', '蓝', '拖', '洞', '授', '镜', '辛', '壮', '锋', '贫', '虚', '弯', '摩', '泰', '幼', '廷', '尊', '窗', '纲', '弄', '隶', '疑', '氏', '宫', '姐', '震', '瑞', '怪', '尤', '琴', '循', '描', '膜', '违', '夹', '腰', '缘', '珠', '穷', '森', '枝', '竹', '沟', '催', '绳', '忆', '邦', '剩', '幸', '浆', '栏', '拥', '牙', '贮', '礼', '滤', '钠', '纹', '罢', '拍', '咱', '喊', '袖', '埃', '勤', '罚', '焦', '潜', '伍', '墨', '欲', '缝', '姓', '刊', '饱', '仿', '奖', '铝', '鬼', '丽', '跨', '默', '挖', '链', '扫', '喝', '袋', '炭', '污', '幕', '诸', '弧', '励', '梅', '奶', '洁', '灾', '舟', '鉴', '苯', '讼', '抱', '毁', '懂', '寒', '智', '埔', '寄', '届', '跃', '渡', '挑', '丹', '艰', '贝', '碰', '拔', '爹', '戴', '码', '梦', '芽', '熔', '赤', '渔', '哭', '敬', '颗', '奔', '铅', '仲', '虎', '稀', '妹', '乏', '珍', '申', '桌', '遵', '允', '隆', '螺', '仓', '魏', '锐', '晓', '氮', '兼', '隐', '碍', '赫', '拨', '忠', '肃', '缸', '牵', '抢', '博', '巧', '壳', '兄', '杜', '讯', '诚', '碧', '祥', '柯', '页', '巡', '矩', '悲', '灌', '龄', '伦', '票', '寻', '桂', '铺', '圣', '恐', '恰', '郑', '趣', '抬', '荒', '腾', '贴', '柔', '滴', '猛', '阔', '辆', '妻', '填', '撤', '储', '签', '闹', '扰', '紫', '砂', '递', '戏', '吊', '陶', '伐', '喂', '疗', '瓶', '婆', '抚', '臂', '摸', '忍', '虾', '蜡', '邻', '胸', '巩', '挤', '偶', '弃', '槽', '劲', '乳', '邓', '吉', '仁', '烂', '砖', '租', '乌', '舰', '伴', '瓜', '浅', '丙', '暂', '燥', '橡', '柳', '迷', '暖', '牌', '秧', '胆', '详', '簧', '踏', '瓷', '谱', '呆', '宾', '糊', '洛', '辉', '愤', '竞', '隙', '怒', '粘', '乃', '绪', '肩', '籍', '敏', '涂', '熙', '皆', '侦', '悬', '掘', '享', '纠', '醒', '狂', '锁', '淀', '恨', '牲', '霸', '爬', '赏', '逆', '玩', '陵', '祝', '秒', '浙', '貌', '役', '彼', '悉', '鸭', '趋', '凤', '晨', '畜', '辈', '秩', '卵', '署', '梯', '炎', '滩', '棋', '驱', '筛', '峡', '冒', '啥', '寿', '译', '浸', '泉', '帽', '迟', '硅', '疆', '贷', '漏', '稿', '冠', '嫩', '胁', '芯', '牢', '叛', '蚀', '奥', '鸣', '岭', '羊', '凭', '串', '塘', '绘', '酵', '融', '盆', '锡', '庙', '筹', '冻', '辅', '摄', '袭', '筋', '拒', '僚', '旱', '钾', '鸟', '漆', '沈', '眉', '疏', '添', '棒', '穗', '硝', '韩', '逼', '扭', '侨', '凉', '挺', '碗', '栽', '炒', '杯', '患', '馏', '劝', '豪', '辽', '勃', '鸿', '旦', '吏', '拜', '狗', '埋', '辊', '掩', '饮', '搬', '骂', '辞', '勾', '扣', '估', '蒋', '绒', '雾', '丈', '朵', '姆', '拟', '宇', '辑', '陕', '雕', '偿', '蓄', '崇', '剪', '倡', '厅', '咬', '驶', '薯', '刷', '斥', '番', '赋', '奉', '佛', '浇', '漫', '曼', '扇', '钙', '桃', '扶', '仔', '返', '俗', '亏', '腔', '鞋', '棱', '覆', '框', '悄', '叔', '撞', '骗', '勘', '旺', '沸', '孤', '吐', '孟', '渠', '屈', '疾', '妙', '惜', '仰', '狠', '胀', '谐', '抛', '霉', '桑', '岗', '嘛', '衰', '盗', '渗', '脏', '赖', '涌', '甜', '曹', '阅', '肌', '哩', '厉', '烃', '纬', '毅', '昨', '伪', '症', '煮', '叹', '钉', '搭', '茎', '笼', '酷', '偷', '弓', '锥', '恒', '杰', '坑', '鼻', '翼', '纶', '叙', '狱', '逮', '罐', '络', '棚', '抑', '膨', '蔬', '寺', '骤', '穆', '冶', '枯', '册', '尸', '凸', '绅', '坯', '牺', '焰', '轰', '欣', '晋', '瘦', '御', '锭', '锦', '丧', '旬', '锻', '垄', '搜', '扑', '邀', '亭', '酯', '迈', '舒', '脆', '酶', '闲', '忧', '酚', '顽', '羽', '涨', '卸', '仗', '陪', '辟', '惩', '杭', '姚', '肚', '捉', '飘', '漂', '昆', '欺', '吾', '郎', '烷', '汁', '呵', '饰', '萧', '雅', '邮', '迁', '燕', '撒', '姻', '赴', '宴', '烦', '债', '帐', '斑', '铃', '旨', '醇', '董', '饼', '雏', '姿', '拌', '傅', '腹', '妥', '揉', '贤', '拆', '歪', '葡', '胺', '丢', '浩', '徽', '昂', '垫', '挡', '览', '贪', '慰', '缴', '汪', '慌', '冯', '诺', '姜', '谊', '凶', '劣', '诬', '耀', '昏', '躺', '盈', '骑', '乔', '溪', '丛', '卢', '抹', '闷', '咨', '刮', '驾', '缆', '悟', '摘', '铒', '掷', '颇', '幻', '柄', '惠', '惨', '佳', '仇', '腊', '窝', '涤', '剑', '瞧', '堡', '泼', '葱', '罩', '霍', '捞', '胎', '苍', '滨', '俩', '捅', '湘', '砍', '霞', '邵', '萄', '疯', '淮', '遂', '熊', '粪', '烘', '宿', '档', '戈', '驳', '嫂', '裕', '徙', '箭', '捐', '肠', '撑', '晒', '辨', '殿', '莲', '摊', '搅', '酱', '屏', '疫', '哀', '蔡', '堵', '沫', '皱', '畅', '叠', '阁', '莱', '敲', '辖', '钩', '痕', '坝', '巷', '饿', '祸', '丘', '玄', '溜', '曰', '逻', '彭', '尝', '卿', '妨', '艇', '吞', '韦', '怨', '矮', '歇']; @@ -24525,7 +24529,7 @@ StreamCipher.prototype.setAAD = function setAAD(buf) { module.exports = StreamCipher; -},{"./aes":102,"./ghash":107,"./incr32":108,"buffer-xor":149,"cipher-base":151,"inherits":258,"safe-buffer":313}],104:[function(require,module,exports){ +},{"./aes":102,"./ghash":107,"./incr32":108,"buffer-xor":148,"cipher-base":150,"inherits":257,"safe-buffer":313}],104:[function(require,module,exports){ 'use strict'; var ciphers = require('./encrypter'); @@ -24667,7 +24671,7 @@ function createDecipher(suite, password) { exports.createDecipher = createDecipher; exports.createDecipheriv = createDecipheriv; -},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":151,"evp_bytestokey":240,"inherits":258,"safe-buffer":313}],106:[function(require,module,exports){ +},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":150,"evp_bytestokey":239,"inherits":257,"safe-buffer":313}],106:[function(require,module,exports){ 'use strict'; var MODES = require('./modes'); @@ -24785,7 +24789,7 @@ function createCipher(suite, password) { exports.createCipheriv = createCipheriv; exports.createCipher = createCipher; -},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":151,"evp_bytestokey":240,"inherits":258,"safe-buffer":313}],107:[function(require,module,exports){ +},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":150,"evp_bytestokey":239,"inherits":257,"safe-buffer":313}],107:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -24913,7 +24917,7 @@ exports.decrypt = function (self, block) { return xor(out, pad); }; -},{"buffer-xor":149}],110:[function(require,module,exports){ +},{"buffer-xor":148}],110:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -24950,7 +24954,7 @@ exports.encrypt = function (self, data, decrypt) { return out; }; -},{"buffer-xor":149,"safe-buffer":313}],111:[function(require,module,exports){ +},{"buffer-xor":148,"safe-buffer":313}],111:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -25053,7 +25057,7 @@ exports.encrypt = function (self, chunk) { return xor(chunk, pad); }; -},{"../incr32":108,"buffer-xor":149,"safe-buffer":313}],114:[function(require,module,exports){ +},{"../incr32":108,"buffer-xor":148,"safe-buffer":313}],114:[function(require,module,exports){ "use strict"; exports.encrypt = function (self, block) { @@ -25301,7 +25305,7 @@ exports.encrypt = function (self, chunk) { }; }).call(this,require("buffer").Buffer) -},{"buffer":150,"buffer-xor":149}],118:[function(require,module,exports){ +},{"buffer":149,"buffer-xor":148}],118:[function(require,module,exports){ 'use strict'; var aes = require('./aes'); @@ -25332,7 +25336,7 @@ StreamCipher.prototype._final = function () { module.exports = StreamCipher; -},{"./aes":102,"cipher-base":151,"inherits":258,"safe-buffer":313}],119:[function(require,module,exports){ +},{"./aes":102,"cipher-base":150,"inherits":257,"safe-buffer":313}],119:[function(require,module,exports){ 'use strict'; var ebtk = require('evp_bytestokey'); @@ -25409,7 +25413,7 @@ function getCiphers() { } exports.listCiphers = exports.getCiphers = getCiphers; -},{"browserify-aes/browser":104,"browserify-aes/modes":115,"browserify-des":120,"browserify-des/modes":121,"evp_bytestokey":240}],120:[function(require,module,exports){ +},{"browserify-aes/browser":104,"browserify-aes/modes":115,"browserify-des":120,"browserify-des/modes":121,"evp_bytestokey":239}],120:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -25458,7 +25462,7 @@ DES.prototype._final = function () { }; }).call(this,require("buffer").Buffer) -},{"buffer":150,"cipher-base":151,"des.js":210,"inherits":258}],121:[function(require,module,exports){ +},{"buffer":149,"cipher-base":150,"des.js":209,"inherits":257}],121:[function(require,module,exports){ 'use strict'; exports['des-ecb'] = { @@ -25531,7 +25535,7 @@ function getr(priv) { } }).call(this,require("buffer").Buffer) -},{"bn.js":99,"buffer":150,"randombytes":296}],123:[function(require,module,exports){ +},{"bn.js":99,"buffer":149,"randombytes":296}],123:[function(require,module,exports){ 'use strict'; module.exports = require('./browser/algorithms.json'); @@ -25797,7 +25801,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"./algorithms.json":124,"./sign":127,"./verify":128,"buffer":150,"create-hash":170,"inherits":258,"stream":345}],127:[function(require,module,exports){ +},{"./algorithms.json":124,"./sign":127,"./verify":128,"buffer":149,"create-hash":169,"inherits":257,"stream":345}],127:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -25949,7 +25953,7 @@ module.exports.getKey = getKey; module.exports.makeKey = makeKey; }).call(this,require("buffer").Buffer) -},{"./curves.json":125,"bn.js":99,"browserify-rsa":122,"buffer":150,"create-hmac":173,"elliptic":129,"parse-asn1":279}],128:[function(require,module,exports){ +},{"./curves.json":125,"bn.js":99,"browserify-rsa":122,"buffer":149,"create-hmac":172,"elliptic":129,"parse-asn1":278}],128:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -26034,29 +26038,29 @@ function checkValue(b, q) { module.exports = verify; }).call(this,require("buffer").Buffer) -},{"./curves.json":125,"bn.js":99,"buffer":150,"elliptic":129,"parse-asn1":279}],129:[function(require,module,exports){ +},{"./curves.json":125,"bn.js":99,"buffer":149,"elliptic":129,"parse-asn1":278}],129:[function(require,module,exports){ arguments[4][71][0].apply(exports,arguments) },{"../package.json":144,"./elliptic/curve":132,"./elliptic/curves":135,"./elliptic/ec":136,"./elliptic/eddsa":139,"./elliptic/utils":143,"brorand":100,"dup":71}],130:[function(require,module,exports){ arguments[4][72][0].apply(exports,arguments) },{"../../elliptic":129,"bn.js":99,"dup":72}],131:[function(require,module,exports){ arguments[4][73][0].apply(exports,arguments) -},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":73,"inherits":258}],132:[function(require,module,exports){ +},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":73,"inherits":257}],132:[function(require,module,exports){ arguments[4][74][0].apply(exports,arguments) },{"./base":130,"./edwards":131,"./mont":133,"./short":134,"dup":74}],133:[function(require,module,exports){ arguments[4][75][0].apply(exports,arguments) -},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":75,"inherits":258}],134:[function(require,module,exports){ +},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":75,"inherits":257}],134:[function(require,module,exports){ arguments[4][76][0].apply(exports,arguments) -},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":76,"inherits":258}],135:[function(require,module,exports){ +},{"../../elliptic":129,"../curve":132,"bn.js":99,"dup":76,"inherits":257}],135:[function(require,module,exports){ arguments[4][77][0].apply(exports,arguments) -},{"../elliptic":129,"./precomputed/secp256k1":142,"dup":77,"hash.js":242}],136:[function(require,module,exports){ +},{"../elliptic":129,"./precomputed/secp256k1":142,"dup":77,"hash.js":241}],136:[function(require,module,exports){ arguments[4][78][0].apply(exports,arguments) -},{"../../elliptic":129,"./key":137,"./signature":138,"bn.js":99,"dup":78,"hmac-drbg":255}],137:[function(require,module,exports){ +},{"../../elliptic":129,"./key":137,"./signature":138,"bn.js":99,"dup":78,"hmac-drbg":254}],137:[function(require,module,exports){ arguments[4][79][0].apply(exports,arguments) },{"../../elliptic":129,"bn.js":99,"dup":79}],138:[function(require,module,exports){ arguments[4][80][0].apply(exports,arguments) },{"../../elliptic":129,"bn.js":99,"dup":80}],139:[function(require,module,exports){ arguments[4][81][0].apply(exports,arguments) -},{"../../elliptic":129,"./key":140,"./signature":141,"dup":81,"hash.js":242}],140:[function(require,module,exports){ +},{"../../elliptic":129,"./key":140,"./signature":141,"dup":81,"hash.js":241}],140:[function(require,module,exports){ arguments[4][82][0].apply(exports,arguments) },{"../../elliptic":129,"dup":82}],141:[function(require,module,exports){ arguments[4][83][0].apply(exports,arguments) @@ -26064,37 +26068,31 @@ arguments[4][83][0].apply(exports,arguments) arguments[4][84][0].apply(exports,arguments) },{"dup":84}],143:[function(require,module,exports){ arguments[4][85][0].apply(exports,arguments) -},{"bn.js":99,"dup":85,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],144:[function(require,module,exports){ +},{"bn.js":99,"dup":85,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],144:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "elliptic@6.4.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_development": true, - "_from": "elliptic@6.4.0", + "_from": "elliptic@^6.0.0", "_id": "elliptic@6.4.0", "_inBundle": false, "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "_location": "/browserify-sign/elliptic", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "elliptic@6.4.0", + "raw": "elliptic@^6.0.0", "name": "elliptic", "escapedName": "elliptic", - "rawSpec": "6.4.0", + "rawSpec": "^6.0.0", "saveSpec": null, - "fetchSpec": "6.4.0" + "fetchSpec": "^6.0.0" }, "_requiredBy": [ "/browserify-sign" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_spec": "6.4.0", - "_where": "/home/chris/dev/eth-lightwallet", + "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", + "_spec": "elliptic@^6.0.0", + "_where": "/home/chris/dev/eth-lightwallet/node_modules/browserify-sign", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -26102,6 +26100,7 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -26111,6 +26110,7 @@ module.exports={ "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -26159,195 +26159,6 @@ module.exports={ },{}],145:[function(require,module,exports){ 'use strict'; -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -})(); -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while (len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { - return []; -}; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { - return '/'; -}; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function () { - return 0; -}; - -},{}],146:[function(require,module,exports){ -'use strict'; - // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -26566,7 +26377,7 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"buffer":150}],147:[function(require,module,exports){ +},{"buffer":149}],146:[function(require,module,exports){ 'use strict'; var basex = require('base-x'); @@ -26574,7 +26385,7 @@ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; module.exports = basex(ALPHABET); -},{"base-x":22}],148:[function(require,module,exports){ +},{"base-x":22}],147:[function(require,module,exports){ 'use strict'; module.exports = function (a, b) { @@ -26602,7 +26413,7 @@ module.exports = function (a, b) { return 0; }; -},{}],149:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -26618,7 +26429,7 @@ module.exports = function xor(a, b) { }; }).call(this,require("buffer").Buffer) -},{"buffer":150}],150:[function(require,module,exports){ +},{"buffer":149}],149:[function(require,module,exports){ (function (global){ /*! * The buffer module from node.js, for the browser. @@ -28359,7 +28170,7 @@ function isnan(val) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":23,"ieee754":256,"isarray":261}],151:[function(require,module,exports){ +},{"base64-js":23,"ieee754":255,"isarray":260}],150:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -28462,7 +28273,7 @@ CipherBase.prototype._toString = function (value, enc, fin) { module.exports = CipherBase; -},{"inherits":258,"safe-buffer":313,"stream":345,"string_decoder":146}],152:[function(require,module,exports){ +},{"inherits":257,"safe-buffer":313,"stream":345,"string_decoder":145}],151:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -28573,7 +28384,7 @@ function objectToString(o) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":259}],153:[function(require,module,exports){ +},{"../../is-buffer/index.js":258}],152:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -28701,67 +28512,61 @@ function formatReturnValue(bn, enc, len) { } }).call(this,require("buffer").Buffer) -},{"bn.js":99,"buffer":150,"elliptic":154}],154:[function(require,module,exports){ +},{"bn.js":99,"buffer":149,"elliptic":153}],153:[function(require,module,exports){ arguments[4][71][0].apply(exports,arguments) -},{"../package.json":169,"./elliptic/curve":157,"./elliptic/curves":160,"./elliptic/ec":161,"./elliptic/eddsa":164,"./elliptic/utils":168,"brorand":100,"dup":71}],155:[function(require,module,exports){ +},{"../package.json":168,"./elliptic/curve":156,"./elliptic/curves":159,"./elliptic/ec":160,"./elliptic/eddsa":163,"./elliptic/utils":167,"brorand":100,"dup":71}],154:[function(require,module,exports){ arguments[4][72][0].apply(exports,arguments) -},{"../../elliptic":154,"bn.js":99,"dup":72}],156:[function(require,module,exports){ +},{"../../elliptic":153,"bn.js":99,"dup":72}],155:[function(require,module,exports){ arguments[4][73][0].apply(exports,arguments) -},{"../../elliptic":154,"../curve":157,"bn.js":99,"dup":73,"inherits":258}],157:[function(require,module,exports){ +},{"../../elliptic":153,"../curve":156,"bn.js":99,"dup":73,"inherits":257}],156:[function(require,module,exports){ arguments[4][74][0].apply(exports,arguments) -},{"./base":155,"./edwards":156,"./mont":158,"./short":159,"dup":74}],158:[function(require,module,exports){ +},{"./base":154,"./edwards":155,"./mont":157,"./short":158,"dup":74}],157:[function(require,module,exports){ arguments[4][75][0].apply(exports,arguments) -},{"../../elliptic":154,"../curve":157,"bn.js":99,"dup":75,"inherits":258}],159:[function(require,module,exports){ +},{"../../elliptic":153,"../curve":156,"bn.js":99,"dup":75,"inherits":257}],158:[function(require,module,exports){ arguments[4][76][0].apply(exports,arguments) -},{"../../elliptic":154,"../curve":157,"bn.js":99,"dup":76,"inherits":258}],160:[function(require,module,exports){ +},{"../../elliptic":153,"../curve":156,"bn.js":99,"dup":76,"inherits":257}],159:[function(require,module,exports){ arguments[4][77][0].apply(exports,arguments) -},{"../elliptic":154,"./precomputed/secp256k1":167,"dup":77,"hash.js":242}],161:[function(require,module,exports){ +},{"../elliptic":153,"./precomputed/secp256k1":166,"dup":77,"hash.js":241}],160:[function(require,module,exports){ arguments[4][78][0].apply(exports,arguments) -},{"../../elliptic":154,"./key":162,"./signature":163,"bn.js":99,"dup":78,"hmac-drbg":255}],162:[function(require,module,exports){ +},{"../../elliptic":153,"./key":161,"./signature":162,"bn.js":99,"dup":78,"hmac-drbg":254}],161:[function(require,module,exports){ arguments[4][79][0].apply(exports,arguments) -},{"../../elliptic":154,"bn.js":99,"dup":79}],163:[function(require,module,exports){ +},{"../../elliptic":153,"bn.js":99,"dup":79}],162:[function(require,module,exports){ arguments[4][80][0].apply(exports,arguments) -},{"../../elliptic":154,"bn.js":99,"dup":80}],164:[function(require,module,exports){ +},{"../../elliptic":153,"bn.js":99,"dup":80}],163:[function(require,module,exports){ arguments[4][81][0].apply(exports,arguments) -},{"../../elliptic":154,"./key":165,"./signature":166,"dup":81,"hash.js":242}],165:[function(require,module,exports){ +},{"../../elliptic":153,"./key":164,"./signature":165,"dup":81,"hash.js":241}],164:[function(require,module,exports){ arguments[4][82][0].apply(exports,arguments) -},{"../../elliptic":154,"dup":82}],166:[function(require,module,exports){ +},{"../../elliptic":153,"dup":82}],165:[function(require,module,exports){ arguments[4][83][0].apply(exports,arguments) -},{"../../elliptic":154,"bn.js":99,"dup":83}],167:[function(require,module,exports){ +},{"../../elliptic":153,"bn.js":99,"dup":83}],166:[function(require,module,exports){ arguments[4][84][0].apply(exports,arguments) -},{"dup":84}],168:[function(require,module,exports){ +},{"dup":84}],167:[function(require,module,exports){ arguments[4][85][0].apply(exports,arguments) -},{"bn.js":99,"dup":85,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],169:[function(require,module,exports){ +},{"bn.js":99,"dup":85,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],168:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "elliptic@6.4.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_development": true, - "_from": "elliptic@6.4.0", + "_from": "elliptic@^6.0.0", "_id": "elliptic@6.4.0", "_inBundle": false, "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "_location": "/create-ecdh/elliptic", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "elliptic@6.4.0", + "raw": "elliptic@^6.0.0", "name": "elliptic", "escapedName": "elliptic", - "rawSpec": "6.4.0", + "rawSpec": "^6.0.0", "saveSpec": null, - "fetchSpec": "6.4.0" + "fetchSpec": "^6.0.0" }, "_requiredBy": [ "/create-ecdh" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_spec": "6.4.0", - "_where": "/home/chris/dev/eth-lightwallet", + "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", + "_spec": "elliptic@^6.0.0", + "_where": "/home/chris/dev/eth-lightwallet/node_modules/create-ecdh", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -28769,6 +28574,7 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -28778,6 +28584,7 @@ module.exports={ "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -28823,7 +28630,7 @@ module.exports={ "version": "6.4.0" } -},{}],170:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -28880,7 +28687,7 @@ module.exports = function createHash(alg) { }; }).call(this,require("buffer").Buffer) -},{"./md5":172,"buffer":150,"cipher-base":151,"inherits":258,"ripemd160":311,"sha.js":338}],171:[function(require,module,exports){ +},{"./md5":171,"buffer":149,"cipher-base":150,"inherits":257,"ripemd160":311,"sha.js":338}],170:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -28915,7 +28722,7 @@ module.exports = function hash(buf, fn) { }; }).call(this,require("buffer").Buffer) -},{"buffer":150}],172:[function(require,module,exports){ +},{"buffer":149}],171:[function(require,module,exports){ 'use strict'; /* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message @@ -29068,7 +28875,7 @@ module.exports = function md5(buf) { return makeHash(buf, core_md5); }; -},{"./make-hash":171}],173:[function(require,module,exports){ +},{"./make-hash":170}],172:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -29133,7 +28940,7 @@ module.exports = function createHmac(alg, key) { return new Hmac(alg, key); }; -},{"./legacy":174,"cipher-base":151,"create-hash/md5":172,"inherits":258,"ripemd160":311,"safe-buffer":313,"sha.js":338}],174:[function(require,module,exports){ +},{"./legacy":173,"cipher-base":150,"create-hash/md5":171,"inherits":257,"ripemd160":311,"safe-buffer":313,"sha.js":338}],173:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -29182,7 +28989,7 @@ Hmac.prototype._final = function () { }; module.exports = Hmac; -},{"cipher-base":151,"inherits":258,"safe-buffer":313}],175:[function(require,module,exports){ +},{"cipher-base":150,"inherits":257,"safe-buffer":313}],174:[function(require,module,exports){ 'use strict'; exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes'); @@ -29272,7 +29079,7 @@ exports.constants = { 'POINT_CONVERSION_HYBRID': 6 }; -},{"browserify-cipher":119,"browserify-sign":126,"browserify-sign/algos":123,"create-ecdh":153,"create-hash":170,"create-hmac":173,"diffie-hellman":216,"pbkdf2":280,"public-encrypt":286,"randombytes":296}],176:[function(require,module,exports){ +},{"browserify-cipher":119,"browserify-sign":126,"browserify-sign/algos":123,"create-ecdh":152,"create-hash":169,"create-hmac":172,"diffie-hellman":215,"pbkdf2":279,"public-encrypt":286,"randombytes":296}],175:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -29505,7 +29312,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.AES; }); -},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],177:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],176:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -30382,7 +30189,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }(); }); -},{"./core":178}],178:[function(require,module,exports){ +},{"./core":177}],177:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31142,7 +30949,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS; }); -},{}],179:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31278,7 +31085,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.enc.Base64; }); -},{"./core":178}],180:[function(require,module,exports){ +},{"./core":177}],179:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31429,7 +31236,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.enc.Utf16; }); -},{"./core":178}],181:[function(require,module,exports){ +},{"./core":177}],180:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31563,7 +31370,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.EvpKDF; }); -},{"./core":178,"./hmac":183,"./sha1":202}],182:[function(require,module,exports){ +},{"./core":177,"./hmac":182,"./sha1":201}],181:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31631,7 +31438,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.format.Hex; }); -},{"./cipher-core":177,"./core":178}],183:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],182:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31776,7 +31583,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol })(); }); -},{"./core":178}],184:[function(require,module,exports){ +},{"./core":177}],183:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31797,7 +31604,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS; }); -},{"./aes":176,"./cipher-core":177,"./core":178,"./enc-base64":179,"./enc-utf16":180,"./evpkdf":181,"./format-hex":182,"./hmac":183,"./lib-typedarrays":185,"./md5":186,"./mode-cfb":187,"./mode-ctr":189,"./mode-ctr-gladman":188,"./mode-ecb":190,"./mode-ofb":191,"./pad-ansix923":192,"./pad-iso10126":193,"./pad-iso97971":194,"./pad-nopadding":195,"./pad-zeropadding":196,"./pbkdf2":197,"./rabbit":199,"./rabbit-legacy":198,"./rc4":200,"./ripemd160":201,"./sha1":202,"./sha224":203,"./sha256":204,"./sha3":205,"./sha384":206,"./sha512":207,"./tripledes":208,"./x64-core":209}],185:[function(require,module,exports){ +},{"./aes":175,"./cipher-core":176,"./core":177,"./enc-base64":178,"./enc-utf16":179,"./evpkdf":180,"./format-hex":181,"./hmac":182,"./lib-typedarrays":184,"./md5":185,"./mode-cfb":186,"./mode-ctr":188,"./mode-ctr-gladman":187,"./mode-ecb":189,"./mode-ofb":190,"./pad-ansix923":191,"./pad-iso10126":192,"./pad-iso97971":193,"./pad-nopadding":194,"./pad-zeropadding":195,"./pbkdf2":196,"./rabbit":198,"./rabbit-legacy":197,"./rc4":199,"./ripemd160":200,"./sha1":201,"./sha224":202,"./sha256":203,"./sha3":204,"./sha384":205,"./sha512":206,"./tripledes":207,"./x64-core":208}],184:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -31866,7 +31673,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.lib.WordArray; }); -},{"./core":178}],186:[function(require,module,exports){ +},{"./core":177}],185:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32123,7 +31930,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.MD5; }); -},{"./core":178}],187:[function(require,module,exports){ +},{"./core":177}],186:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32203,7 +32010,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.mode.CFB; }); -},{"./cipher-core":177,"./core":178}],188:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],187:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32307,7 +32114,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.mode.CTRGladman; }); -},{"./cipher-core":177,"./core":178}],189:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],188:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32367,7 +32174,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.mode.CTR; }); -},{"./cipher-core":177,"./core":178}],190:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],189:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32409,7 +32216,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.mode.ECB; }); -},{"./cipher-core":177,"./core":178}],191:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],190:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32465,7 +32272,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.mode.OFB; }); -},{"./cipher-core":177,"./core":178}],192:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],191:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32516,7 +32323,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.pad.Ansix923; }); -},{"./cipher-core":177,"./core":178}],193:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],192:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32561,7 +32368,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.pad.Iso10126; }); -},{"./cipher-core":177,"./core":178}],194:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],193:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32603,7 +32410,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.pad.Iso97971; }); -},{"./cipher-core":177,"./core":178}],195:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],194:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32633,7 +32440,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.pad.NoPadding; }); -},{"./cipher-core":177,"./core":178}],196:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],195:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32680,7 +32487,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.pad.ZeroPadding; }); -},{"./cipher-core":177,"./core":178}],197:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177}],196:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -32827,7 +32634,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.PBKDF2; }); -},{"./core":178,"./hmac":183,"./sha1":202}],198:[function(require,module,exports){ +},{"./core":177,"./hmac":182,"./sha1":201}],197:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33008,7 +32815,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.RabbitLegacy; }); -},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],199:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],198:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33190,7 +32997,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.Rabbit; }); -},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],200:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],199:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33331,7 +33138,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.RC4; }); -},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],201:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],200:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33568,7 +33375,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.RIPEMD160; }); -},{"./core":178}],202:[function(require,module,exports){ +},{"./core":177}],201:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33716,7 +33523,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA1; }); -},{"./core":178}],203:[function(require,module,exports){ +},{"./core":177}],202:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33795,7 +33602,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA224; }); -},{"./core":178,"./sha256":204}],204:[function(require,module,exports){ +},{"./core":177,"./sha256":203}],203:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -33992,7 +33799,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA256; }); -},{"./core":178}],205:[function(require,module,exports){ +},{"./core":177}],204:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -34307,7 +34114,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA3; }); -},{"./core":178,"./x64-core":209}],206:[function(require,module,exports){ +},{"./core":177,"./x64-core":208}],205:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -34387,7 +34194,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA384; }); -},{"./core":178,"./sha512":207,"./x64-core":209}],207:[function(require,module,exports){ +},{"./core":177,"./sha512":206,"./x64-core":208}],206:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -34666,7 +34473,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.SHA512; }); -},{"./core":178,"./x64-core":209}],208:[function(require,module,exports){ +},{"./core":177,"./x64-core":208}],207:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -35409,7 +35216,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS.TripleDES; }); -},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],209:[function(require,module,exports){ +},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],208:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -35715,7 +35522,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return CryptoJS; }); -},{"./core":178}],210:[function(require,module,exports){ +},{"./core":177}],209:[function(require,module,exports){ 'use strict'; exports.utils = require('./des/utils'); @@ -35724,7 +35531,7 @@ exports.DES = require('./des/des'); exports.CBC = require('./des/cbc'); exports.EDE = require('./des/ede'); -},{"./des/cbc":211,"./des/cipher":212,"./des/des":213,"./des/ede":214,"./des/utils":215}],211:[function(require,module,exports){ +},{"./des/cbc":210,"./des/cipher":211,"./des/des":212,"./des/ede":213,"./des/utils":214}],210:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -35792,7 +35599,7 @@ proto._update = function _update(inp, inOff, out, outOff) { } }; -},{"inherits":258,"minimalistic-assert":273}],212:[function(require,module,exports){ +},{"inherits":257,"minimalistic-assert":272}],211:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -35919,7 +35726,7 @@ Cipher.prototype._finalDecrypt = function _finalDecrypt() { return this._unpad(out); }; -},{"minimalistic-assert":273}],213:[function(require,module,exports){ +},{"minimalistic-assert":272}],212:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -36056,7 +35863,7 @@ DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { utils.rip(l, r, out, off); }; -},{"../des":210,"inherits":258,"minimalistic-assert":273}],214:[function(require,module,exports){ +},{"../des":209,"inherits":257,"minimalistic-assert":272}],213:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -36105,7 +35912,7 @@ EDE.prototype._update = function _update(inp, inOff, out, outOff) { EDE.prototype._pad = DES.prototype._pad; EDE.prototype._unpad = DES.prototype._unpad; -},{"../des":210,"inherits":258,"minimalistic-assert":273}],215:[function(require,module,exports){ +},{"../des":209,"inherits":257,"minimalistic-assert":272}],214:[function(require,module,exports){ 'use strict'; exports.readUInt32BE = function readUInt32BE(bytes, off) { @@ -36311,7 +36118,7 @@ exports.padSplit = function padSplit(num, size, group) { }return out.join(' '); }; -},{}],216:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -36359,7 +36166,7 @@ exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffi exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman; }).call(this,require("buffer").Buffer) -},{"./lib/dh":217,"./lib/generatePrime":218,"./lib/primes.json":219,"buffer":150}],217:[function(require,module,exports){ +},{"./lib/dh":216,"./lib/generatePrime":217,"./lib/primes.json":218,"buffer":149}],216:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -36526,7 +36333,7 @@ function formatReturnValue(bn, enc) { } }).call(this,require("buffer").Buffer) -},{"./generatePrime":218,"bn.js":99,"buffer":150,"miller-rabin":272,"randombytes":296}],218:[function(require,module,exports){ +},{"./generatePrime":217,"bn.js":99,"buffer":149,"miller-rabin":271,"randombytes":296}],217:[function(require,module,exports){ 'use strict'; var randomBytes = require('randombytes'); @@ -36627,7 +36434,7 @@ function findPrime(bits, gen) { } } -},{"bn.js":99,"miller-rabin":272,"randombytes":296}],219:[function(require,module,exports){ +},{"bn.js":99,"miller-rabin":271,"randombytes":296}],218:[function(require,module,exports){ module.exports={ "modp1": { "gen": "02", @@ -36662,7 +36469,7 @@ module.exports={ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } } -},{}],220:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ 'use strict'; var elliptic = exports; @@ -36677,7 +36484,7 @@ elliptic.curves = require('./elliptic/curves'); // Protocols elliptic.ec = require('./elliptic/ec'); -},{"../package.json":234,"./elliptic/curve":223,"./elliptic/curves":226,"./elliptic/ec":227,"./elliptic/hmac-drbg":230,"./elliptic/utils":232,"brorand":100}],221:[function(require,module,exports){ +},{"../package.json":233,"./elliptic/curve":222,"./elliptic/curves":225,"./elliptic/ec":226,"./elliptic/hmac-drbg":229,"./elliptic/utils":231,"brorand":100}],220:[function(require,module,exports){ 'use strict'; var bn = require('bn.js'); @@ -36961,7 +36768,7 @@ BasePoint.prototype.dblp = function dblp(k) { }return r; }; -},{"../../elliptic":220,"bn.js":233}],222:[function(require,module,exports){ +},{"../../elliptic":219,"bn.js":232}],221:[function(require,module,exports){ 'use strict'; var curve = require('../curve'); @@ -37299,9 +37106,9 @@ Point.prototype.getY = function getY() { Point.prototype.toP = Point.prototype.normalize; Point.prototype.mixedAdd = Point.prototype.add; -},{"../../elliptic":220,"../curve":223,"bn.js":233,"inherits":258}],223:[function(require,module,exports){ +},{"../../elliptic":219,"../curve":222,"bn.js":232,"inherits":257}],222:[function(require,module,exports){ arguments[4][74][0].apply(exports,arguments) -},{"./base":221,"./edwards":222,"./mont":224,"./short":225,"dup":74}],224:[function(require,module,exports){ +},{"./base":220,"./edwards":221,"./mont":223,"./short":224,"dup":74}],223:[function(require,module,exports){ 'use strict'; var curve = require('../curve'); @@ -37459,7 +37266,7 @@ Point.prototype.getX = function getX() { return this.x.fromRed(); }; -},{"../curve":223,"bn.js":233,"inherits":258}],225:[function(require,module,exports){ +},{"../curve":222,"bn.js":232,"inherits":257}],224:[function(require,module,exports){ 'use strict'; var curve = require('../curve'); @@ -38300,7 +38107,7 @@ JPoint.prototype.isInfinity = function isInfinity() { return this.z.cmpn(0) === 0; }; -},{"../../elliptic":220,"../curve":223,"bn.js":233,"inherits":258}],226:[function(require,module,exports){ +},{"../../elliptic":219,"../curve":222,"bn.js":232,"inherits":257}],225:[function(require,module,exports){ 'use strict'; var curves = exports; @@ -38434,7 +38241,7 @@ defineCurve('secp256k1', { g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre] }); -},{"../elliptic":220,"./precomputed/secp256k1":231,"hash.js":242}],227:[function(require,module,exports){ +},{"../elliptic":219,"./precomputed/secp256k1":230,"hash.js":241}],226:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -38624,7 +38431,7 @@ EC.prototype.getKeyRecoveryParam = function (e, signature, Q, enc) { throw new Error('Unable to find valid recovery factor'); }; -},{"../../elliptic":220,"./key":228,"./signature":229,"bn.js":233}],228:[function(require,module,exports){ +},{"../../elliptic":219,"./key":227,"./signature":228,"bn.js":232}],227:[function(require,module,exports){ 'use strict'; var bn = require('bn.js'); @@ -38757,7 +38564,7 @@ KeyPair.prototype.inspect = function inspect() { return ''; }; -},{"../../elliptic":220,"bn.js":233}],229:[function(require,module,exports){ +},{"../../elliptic":219,"bn.js":232}],228:[function(require,module,exports){ 'use strict'; var bn = require('bn.js'); @@ -38815,7 +38622,7 @@ Signature.prototype.toDER = function toDER(enc) { return utils.encode(res, enc); }; -},{"../../elliptic":220,"bn.js":233}],230:[function(require,module,exports){ +},{"../../elliptic":219,"bn.js":232}],229:[function(require,module,exports){ 'use strict'; var hash = require('hash.js'); @@ -38919,9 +38726,9 @@ HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { return utils.encode(res, enc); }; -},{"../elliptic":220,"hash.js":242}],231:[function(require,module,exports){ +},{"../elliptic":219,"hash.js":241}],230:[function(require,module,exports){ arguments[4][84][0].apply(exports,arguments) -},{"dup":84}],232:[function(require,module,exports){ +},{"dup":84}],231:[function(require,module,exports){ 'use strict'; var utils = exports; @@ -39045,7 +38852,7 @@ function getJSF(k1, k2) { } utils.getJSF = getJSF; -},{}],233:[function(require,module,exports){ +},{}],232:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -41130,35 +40937,30 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; })(typeof module === 'undefined' || module, undefined); -},{}],234:[function(require,module,exports){ +},{}],233:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "elliptic@3.1.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_from": "elliptic@3.1.0", + "_from": "elliptic@^3.1.0", "_id": "elliptic@3.1.0", "_inBundle": false, "_integrity": "sha1-whaC73YnabVqdCAWCRBdoR1fYMw=", "_location": "/elliptic", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "elliptic@3.1.0", + "raw": "elliptic@^3.1.0", "name": "elliptic", "escapedName": "elliptic", - "rawSpec": "3.1.0", + "rawSpec": "^3.1.0", "saveSpec": null, - "fetchSpec": "3.1.0" + "fetchSpec": "^3.1.0" }, "_requiredBy": [ "/" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz", - "_spec": "3.1.0", + "_shasum": "c21682ef762769b56a74201609105da11d5f60cc", + "_spec": "elliptic@^3.1.0", "_where": "/home/chris/dev/eth-lightwallet", "author": { "name": "Fedor Indutny", @@ -41167,12 +40969,14 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^2.0.3", "brorand": "^1.0.1", "hash.js": "^1.0.0", "inherits": "^2.0.1" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "browserify": "^3.44.2", @@ -41201,7 +41005,7 @@ module.exports={ "version": "3.1.0" } -},{}],235:[function(require,module,exports){ +},{}],234:[function(require,module,exports){ module.exports={ "genesisGasLimit": { "v": 5000, @@ -41438,7 +41242,7 @@ module.exports={ } } -},{}],236:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -41760,7 +41564,7 @@ var Transaction = function () { module.exports = Transaction; }).call(this,require("buffer").Buffer) -},{"buffer":150,"ethereum-common/params.json":235,"ethereumjs-util":237}],237:[function(require,module,exports){ +},{"buffer":149,"ethereum-common/params.json":234,"ethereumjs-util":236}],236:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -42437,7 +42241,7 @@ exports.defineProperties = function (self, fields, data) { }; }).call(this,require("buffer").Buffer) -},{"assert":21,"bn.js":99,"buffer":150,"create-hash":170,"ethjs-util":238,"keccak":262,"rlp":312,"secp256k1":315}],238:[function(require,module,exports){ +},{"assert":21,"bn.js":99,"buffer":149,"create-hash":169,"ethjs-util":237,"keccak":261,"rlp":312,"secp256k1":315}],237:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -42663,7 +42467,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"buffer":150,"is-hex-prefixed":260,"strip-hex-prefix":347}],239:[function(require,module,exports){ +},{"buffer":149,"is-hex-prefixed":259,"strip-hex-prefix":347}],238:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -42938,7 +42742,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],240:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -42987,7 +42791,7 @@ function EVP_BytesToKey(password, salt, keyBits, ivLen) { module.exports = EVP_BytesToKey; -},{"md5.js":270,"safe-buffer":313}],241:[function(require,module,exports){ +},{"md5.js":269,"safe-buffer":313}],240:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -43076,7 +42880,7 @@ HashBase.prototype._digest = function () { module.exports = HashBase; }).call(this,require("buffer").Buffer) -},{"buffer":150,"inherits":258,"stream":345}],242:[function(require,module,exports){ +},{"buffer":149,"inherits":257,"stream":345}],241:[function(require,module,exports){ 'use strict'; var hash = exports; @@ -43095,7 +42899,7 @@ hash.sha384 = hash.sha.sha384; hash.sha512 = hash.sha.sha512; hash.ripemd160 = hash.ripemd.ripemd160; -},{"./hash/common":243,"./hash/hmac":244,"./hash/ripemd":245,"./hash/sha":246,"./hash/utils":253}],243:[function(require,module,exports){ +},{"./hash/common":242,"./hash/hmac":243,"./hash/ripemd":244,"./hash/sha":245,"./hash/utils":252}],242:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); @@ -43185,7 +42989,7 @@ BlockHash.prototype._pad = function pad() { return res; }; -},{"./utils":253,"minimalistic-assert":273}],244:[function(require,module,exports){ +},{"./utils":252,"minimalistic-assert":272}],243:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); @@ -43231,7 +43035,7 @@ Hmac.prototype.digest = function digest(enc) { return this.outer.digest(enc); }; -},{"./utils":253,"minimalistic-assert":273}],245:[function(require,module,exports){ +},{"./utils":252,"minimalistic-assert":272}],244:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); @@ -43316,7 +43120,7 @@ var s = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11 var sh = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]; -},{"./common":243,"./utils":253}],246:[function(require,module,exports){ +},{"./common":242,"./utils":252}],245:[function(require,module,exports){ 'use strict'; exports.sha1 = require('./sha/1'); @@ -43325,7 +43129,7 @@ exports.sha256 = require('./sha/256'); exports.sha384 = require('./sha/384'); exports.sha512 = require('./sha/512'); -},{"./sha/1":247,"./sha/224":248,"./sha/256":249,"./sha/384":250,"./sha/512":251}],247:[function(require,module,exports){ +},{"./sha/1":246,"./sha/224":247,"./sha/256":248,"./sha/384":249,"./sha/512":250}],246:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43390,7 +43194,7 @@ SHA1.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big'); }; -},{"../common":243,"../utils":253,"./common":252}],248:[function(require,module,exports){ +},{"../common":242,"../utils":252,"./common":251}],247:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43415,7 +43219,7 @@ SHA224.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h.slice(0, 7), 'big');else return utils.split32(this.h.slice(0, 7), 'big'); }; -},{"../utils":253,"./256":249}],249:[function(require,module,exports){ +},{"../utils":252,"./256":248}],248:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43497,7 +43301,7 @@ SHA256.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big'); }; -},{"../common":243,"../utils":253,"./common":252,"minimalistic-assert":273}],250:[function(require,module,exports){ +},{"../common":242,"../utils":252,"./common":251,"minimalistic-assert":272}],249:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43522,7 +43326,7 @@ SHA384.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h.slice(0, 12), 'big');else return utils.split32(this.h.slice(0, 12), 'big'); }; -},{"../utils":253,"./512":251}],251:[function(require,module,exports){ +},{"../utils":252,"./512":250}],250:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43771,7 +43575,7 @@ function g1_512_lo(xh, xl) { return r; } -},{"../common":243,"../utils":253,"minimalistic-assert":273}],252:[function(require,module,exports){ +},{"../common":242,"../utils":252,"minimalistic-assert":272}],251:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -43819,7 +43623,7 @@ function g1_256(x) { } exports.g1_256 = g1_256; -},{"../utils":253}],253:[function(require,module,exports){ +},{"../utils":252}],252:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -44045,7 +43849,7 @@ function shr64_lo(ah, al, num) { } exports.shr64_lo = shr64_lo; -},{"inherits":254,"minimalistic-assert":273}],254:[function(require,module,exports){ +},{"inherits":253,"minimalistic-assert":272}],253:[function(require,module,exports){ 'use strict'; if (typeof Object.create === 'function') { @@ -44072,7 +43876,7 @@ if (typeof Object.create === 'function') { }; } -},{}],255:[function(require,module,exports){ +},{}],254:[function(require,module,exports){ 'use strict'; var hash = require('hash.js'); @@ -44175,7 +43979,7 @@ HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { return utils.encode(res, enc); }; -},{"hash.js":242,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],256:[function(require,module,exports){ +},{"hash.js":241,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],255:[function(require,module,exports){ "use strict"; exports.read = function (buffer, offset, isLE, mLen, nBytes) { @@ -44263,7 +44067,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128; }; -},{}],257:[function(require,module,exports){ +},{}],256:[function(require,module,exports){ "use strict"; var indexOf = [].indexOf; @@ -44276,9 +44080,9 @@ module.exports = function (arr, obj) { return -1; }; -},{}],258:[function(require,module,exports){ -arguments[4][254][0].apply(exports,arguments) -},{"dup":254}],259:[function(require,module,exports){ +},{}],257:[function(require,module,exports){ +arguments[4][253][0].apply(exports,arguments) +},{"dup":253}],258:[function(require,module,exports){ 'use strict'; /*! @@ -44303,7 +44107,7 @@ function isSlowBuffer(obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)); } -},{}],260:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -44322,7 +44126,7 @@ module.exports = function isHexPrefixed(str) { return str.slice(0, 2) === '0x'; }; -},{}],261:[function(require,module,exports){ +},{}],260:[function(require,module,exports){ 'use strict'; var toString = {}.toString; @@ -44331,12 +44135,12 @@ module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],262:[function(require,module,exports){ +},{}],261:[function(require,module,exports){ 'use strict'; module.exports = require('./lib/api')(require('./lib/keccak')); -},{"./lib/api":263,"./lib/keccak":267}],263:[function(require,module,exports){ +},{"./lib/api":262,"./lib/keccak":266}],262:[function(require,module,exports){ 'use strict'; var createKeccak = require('./keccak'); @@ -44378,7 +44182,7 @@ module.exports = function (KeccakState) { }; }; -},{"./keccak":264,"./shake":265}],264:[function(require,module,exports){ +},{"./keccak":263,"./shake":264}],263:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -44465,7 +44269,7 @@ module.exports = function (KeccakState) { return Keccak; }; -},{"inherits":268,"safe-buffer":313,"stream":345}],265:[function(require,module,exports){ +},{"inherits":267,"safe-buffer":313,"stream":345}],264:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -44543,7 +44347,7 @@ module.exports = function (KeccakState) { return Shake; }; -},{"inherits":268,"safe-buffer":313,"stream":345}],266:[function(require,module,exports){ +},{"inherits":267,"safe-buffer":313,"stream":345}],265:[function(require,module,exports){ 'use strict'; var P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; @@ -44733,7 +44537,7 @@ exports.p1600 = function (s) { } }; -},{}],267:[function(require,module,exports){ +},{}],266:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -44802,9 +44606,9 @@ Keccak.prototype.copy = function (dest) { module.exports = Keccak; -},{"./keccak-state-unroll":266,"safe-buffer":313}],268:[function(require,module,exports){ -arguments[4][254][0].apply(exports,arguments) -},{"dup":254}],269:[function(require,module,exports){ +},{"./keccak-state-unroll":265,"safe-buffer":313}],267:[function(require,module,exports){ +arguments[4][253][0].apply(exports,arguments) +},{"dup":253}],268:[function(require,module,exports){ (function (global){ 'use strict';var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};/** * @license @@ -54253,7 +54057,7 @@ freeExports._=_;}else{// Export to the global object. root._=_;}}).call(undefined); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],270:[function(require,module,exports){ +},{}],269:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -54403,7 +54207,7 @@ function fnI(a, b, c, d, m, k, s) { module.exports = MD5; }).call(this,require("buffer").Buffer) -},{"buffer":150,"hash-base":271,"inherits":258}],271:[function(require,module,exports){ +},{"buffer":149,"hash-base":270,"inherits":257}],270:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -54502,7 +54306,7 @@ HashBase.prototype._digest = function () { module.exports = HashBase; -},{"inherits":258,"safe-buffer":313,"stream":345}],272:[function(require,module,exports){ +},{"inherits":257,"safe-buffer":313,"stream":345}],271:[function(require,module,exports){ 'use strict'; var bn = require('bn.js'); @@ -54610,7 +54414,7 @@ MillerRabin.prototype.getDivisor = function getDivisor(n, k) { return false; }; -},{"bn.js":99,"brorand":100}],273:[function(require,module,exports){ +},{"bn.js":99,"brorand":100}],272:[function(require,module,exports){ 'use strict'; module.exports = assert; @@ -54623,7 +54427,7 @@ assert.equal = function assertEqual(l, r, msg) { if (l != r) throw new Error(msg || 'Assertion failed: ' + l + ' != ' + r); }; -},{}],274:[function(require,module,exports){ +},{}],273:[function(require,module,exports){ 'use strict'; var utils = exports; @@ -54672,7 +54476,7 @@ utils.encode = function encode(arr, enc) { if (enc === 'hex') return toHex(arr);else return arr; }; -},{}],275:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.2": "aes-128-cbc", "2.16.840.1.101.3.4.1.3": "aes-128-ofb", @@ -54686,7 +54490,7 @@ module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.43": "aes-256-ofb", "2.16.840.1.101.3.4.1.44": "aes-256-cfb" } -},{}],276:[function(require,module,exports){ +},{}],275:[function(require,module,exports){ // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js // Fedor, you are amazing. 'use strict'; @@ -54748,7 +54552,7 @@ exports.signature = asn1.define('signature', function () { this.seq().obj(this.key('r').int(), this.key('s').int()); }); -},{"./certificate":277,"asn1.js":7}],277:[function(require,module,exports){ +},{"./certificate":276,"asn1.js":7}],276:[function(require,module,exports){ // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js // thanks to @Rantanen @@ -54807,7 +54611,7 @@ var X509Certificate = asn.define('X509Certificate', function () { module.exports = X509Certificate; -},{"asn1.js":7}],278:[function(require,module,exports){ +},{"asn1.js":7}],277:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -54843,7 +54647,7 @@ module.exports = function (okey, password) { }; }).call(this,require("buffer").Buffer) -},{"browserify-aes":104,"buffer":150,"evp_bytestokey":240}],279:[function(require,module,exports){ +},{"browserify-aes":104,"buffer":149,"evp_bytestokey":239}],278:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -54960,14 +54764,14 @@ function decrypt(data, password) { } }).call(this,require("buffer").Buffer) -},{"./aesid.json":275,"./asn1":276,"./fixProc":278,"browserify-aes":104,"buffer":150,"pbkdf2":280}],280:[function(require,module,exports){ +},{"./aesid.json":274,"./asn1":275,"./fixProc":277,"browserify-aes":104,"buffer":149,"pbkdf2":279}],279:[function(require,module,exports){ 'use strict'; exports.pbkdf2 = require('./lib/async'); exports.pbkdf2Sync = require('./lib/sync'); -},{"./lib/async":281,"./lib/sync":284}],281:[function(require,module,exports){ +},{"./lib/async":280,"./lib/sync":283}],280:[function(require,module,exports){ (function (process,global){ 'use strict'; @@ -55068,7 +54872,7 @@ module.exports = function (password, salt, iterations, keylen, digest, callback) }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./default-encoding":282,"./precondition":283,"./sync":284,"_process":145,"safe-buffer":313}],282:[function(require,module,exports){ +},{"./default-encoding":281,"./precondition":282,"./sync":283,"_process":285,"safe-buffer":313}],281:[function(require,module,exports){ (function (process){ 'use strict'; @@ -55084,7 +54888,7 @@ if (process.browser) { module.exports = defaultEncoding; }).call(this,require('_process')) -},{"_process":145}],283:[function(require,module,exports){ +},{"_process":285}],282:[function(require,module,exports){ 'use strict'; var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs @@ -55107,7 +54911,7 @@ module.exports = function (iterations, keylen) { } }; -},{}],284:[function(require,module,exports){ +},{}],283:[function(require,module,exports){ 'use strict'; var md5 = require('create-hash/md5'); @@ -55214,7 +55018,7 @@ function pbkdf2(password, salt, iterations, keylen, digest) { module.exports = pbkdf2; -},{"./default-encoding":282,"./precondition":283,"create-hash/md5":172,"ripemd160":311,"safe-buffer":313,"sha.js":338}],285:[function(require,module,exports){ +},{"./default-encoding":281,"./precondition":282,"create-hash/md5":171,"ripemd160":311,"safe-buffer":313,"sha.js":338}],284:[function(require,module,exports){ (function (process){ 'use strict'; @@ -55259,7 +55063,196 @@ function nextTick(fn, arg1, arg2, arg3) { } }).call(this,require('_process')) -},{"_process":145}],286:[function(require,module,exports){ +},{"_process":285}],285:[function(require,module,exports){ +'use strict'; + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +})(); +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { + return []; +}; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { + return '/'; +}; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function () { + return 0; +}; + +},{}],286:[function(require,module,exports){ 'use strict'; exports.publicEncrypt = require('./publicEncrypt'); @@ -55296,7 +55289,7 @@ function i2ops(c) { } }).call(this,require("buffer").Buffer) -},{"buffer":150,"create-hash":170}],288:[function(require,module,exports){ +},{"buffer":149,"create-hash":169}],288:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -55410,7 +55403,7 @@ function compare(a, b) { } }).call(this,require("buffer").Buffer) -},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,"buffer":150,"create-hash":170,"parse-asn1":279}],289:[function(require,module,exports){ +},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,"buffer":149,"create-hash":169,"parse-asn1":278}],289:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -55511,7 +55504,7 @@ function nonZero(len, crypto) { } }).call(this,require("buffer").Buffer) -},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,"buffer":150,"create-hash":170,"parse-asn1":279,"randombytes":296}],290:[function(require,module,exports){ +},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,"buffer":149,"create-hash":169,"parse-asn1":278,"randombytes":296}],290:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -55523,7 +55516,7 @@ function withPublic(paddedMsg, key) { module.exports = withPublic; }).call(this,require("buffer").Buffer) -},{"bn.js":99,"buffer":150}],291:[function(require,module,exports){ +},{"bn.js":99,"buffer":149}],291:[function(require,module,exports){ "use strict"; module.exports = function xor(a, b) { @@ -56294,7 +56287,7 @@ function randomBytes(size, cb) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":145,"safe-buffer":313}],297:[function(require,module,exports){ +},{"_process":285,"safe-buffer":313}],297:[function(require,module,exports){ 'use strict'; module.exports = require('./lib/_stream_duplex.js'); @@ -56425,7 +56418,7 @@ function forEach(xs, f) { } } -},{"./_stream_readable":300,"./_stream_writable":302,"core-util-is":152,"inherits":306,"process-nextick-args":285}],299:[function(require,module,exports){ +},{"./_stream_readable":300,"./_stream_writable":302,"core-util-is":151,"inherits":306,"process-nextick-args":284}],299:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -56474,7 +56467,7 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":301,"core-util-is":152,"inherits":306}],300:[function(require,module,exports){ +},{"./_stream_transform":301,"core-util-is":151,"inherits":306}],300:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -57485,7 +57478,7 @@ function indexOf(xs, x) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":298,"./internal/streams/BufferList":303,"./internal/streams/destroy":304,"./internal/streams/stream":305,"_process":145,"core-util-is":152,"events":239,"inherits":306,"isarray":261,"process-nextick-args":285,"safe-buffer":313,"string_decoder/":346,"util":101}],301:[function(require,module,exports){ +},{"./_stream_duplex":298,"./internal/streams/BufferList":303,"./internal/streams/destroy":304,"./internal/streams/stream":305,"_process":285,"core-util-is":151,"events":238,"inherits":306,"isarray":260,"process-nextick-args":284,"safe-buffer":313,"string_decoder/":346,"util":101}],301:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -57701,7 +57694,7 @@ function done(stream, er, data) { return stream.push(null); } -},{"./_stream_duplex":298,"core-util-is":152,"inherits":306}],302:[function(require,module,exports){ +},{"./_stream_duplex":298,"core-util-is":151,"inherits":306}],302:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -58369,7 +58362,7 @@ Writable.prototype._destroy = function (err, cb) { }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":298,"./internal/streams/destroy":304,"./internal/streams/stream":305,"_process":145,"core-util-is":152,"inherits":306,"process-nextick-args":285,"safe-buffer":313,"util-deprecate":353}],303:[function(require,module,exports){ +},{"./_stream_duplex":298,"./internal/streams/destroy":304,"./internal/streams/stream":305,"_process":285,"core-util-is":151,"inherits":306,"process-nextick-args":284,"safe-buffer":313,"util-deprecate":353}],303:[function(require,module,exports){ 'use strict'; /**/ @@ -58523,14 +58516,14 @@ module.exports = { undestroy: undestroy }; -},{"process-nextick-args":285}],305:[function(require,module,exports){ +},{"process-nextick-args":284}],305:[function(require,module,exports){ 'use strict'; module.exports = require('events').EventEmitter; -},{"events":239}],306:[function(require,module,exports){ -arguments[4][254][0].apply(exports,arguments) -},{"dup":254}],307:[function(require,module,exports){ +},{"events":238}],306:[function(require,module,exports){ +arguments[4][253][0].apply(exports,arguments) +},{"dup":253}],307:[function(require,module,exports){ 'use strict'; module.exports = require('./readable').PassThrough; @@ -58852,7 +58845,7 @@ function fn5(a, b, c, d, e, m, k, s) { module.exports = RIPEMD160; }).call(this,require("buffer").Buffer) -},{"buffer":150,"hash-base":241,"inherits":258}],312:[function(require,module,exports){ +},{"buffer":149,"hash-base":240,"inherits":257}],312:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -59087,7 +59080,7 @@ function toBuffer(v) { } }).call(this,require("buffer").Buffer) -},{"assert":21,"buffer":150}],313:[function(require,module,exports){ +},{"assert":21,"buffer":149}],313:[function(require,module,exports){ 'use strict'; /* eslint-disable node/no-deprecated-api */ @@ -59153,7 +59146,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size); }; -},{"buffer":150}],314:[function(require,module,exports){ +},{"buffer":149}],314:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -59755,7 +59748,7 @@ exports.isNumberInInterval = function (number, x, y, message) { }; }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":259}],317:[function(require,module,exports){ +},{"../../is-buffer/index.js":258}],317:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -60169,7 +60162,7 @@ exports.ecdhUnsafe = function (publicKey, privateKey, compressed) { return Buffer.from(pair.pub.mul(scalar).encode(true, compressed)); }; -},{"../messages.json":320,"bn.js":99,"create-hash":170,"elliptic":321,"safe-buffer":313}],319:[function(require,module,exports){ +},{"../messages.json":320,"bn.js":99,"create-hash":169,"elliptic":321,"safe-buffer":313}],319:[function(require,module,exports){ 'use strict'; var assert = require('./assert'); @@ -60447,23 +60440,23 @@ arguments[4][71][0].apply(exports,arguments) arguments[4][72][0].apply(exports,arguments) },{"../../elliptic":321,"bn.js":99,"dup":72}],323:[function(require,module,exports){ arguments[4][73][0].apply(exports,arguments) -},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":73,"inherits":258}],324:[function(require,module,exports){ +},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":73,"inherits":257}],324:[function(require,module,exports){ arguments[4][74][0].apply(exports,arguments) },{"./base":322,"./edwards":323,"./mont":325,"./short":326,"dup":74}],325:[function(require,module,exports){ arguments[4][75][0].apply(exports,arguments) -},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":75,"inherits":258}],326:[function(require,module,exports){ +},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":75,"inherits":257}],326:[function(require,module,exports){ arguments[4][76][0].apply(exports,arguments) -},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":76,"inherits":258}],327:[function(require,module,exports){ +},{"../../elliptic":321,"../curve":324,"bn.js":99,"dup":76,"inherits":257}],327:[function(require,module,exports){ arguments[4][77][0].apply(exports,arguments) -},{"../elliptic":321,"./precomputed/secp256k1":334,"dup":77,"hash.js":242}],328:[function(require,module,exports){ +},{"../elliptic":321,"./precomputed/secp256k1":334,"dup":77,"hash.js":241}],328:[function(require,module,exports){ arguments[4][78][0].apply(exports,arguments) -},{"../../elliptic":321,"./key":329,"./signature":330,"bn.js":99,"dup":78,"hmac-drbg":255}],329:[function(require,module,exports){ +},{"../../elliptic":321,"./key":329,"./signature":330,"bn.js":99,"dup":78,"hmac-drbg":254}],329:[function(require,module,exports){ arguments[4][79][0].apply(exports,arguments) },{"../../elliptic":321,"bn.js":99,"dup":79}],330:[function(require,module,exports){ arguments[4][80][0].apply(exports,arguments) },{"../../elliptic":321,"bn.js":99,"dup":80}],331:[function(require,module,exports){ arguments[4][81][0].apply(exports,arguments) -},{"../../elliptic":321,"./key":332,"./signature":333,"dup":81,"hash.js":242}],332:[function(require,module,exports){ +},{"../../elliptic":321,"./key":332,"./signature":333,"dup":81,"hash.js":241}],332:[function(require,module,exports){ arguments[4][82][0].apply(exports,arguments) },{"../../elliptic":321,"dup":82}],333:[function(require,module,exports){ arguments[4][83][0].apply(exports,arguments) @@ -60471,36 +60464,31 @@ arguments[4][83][0].apply(exports,arguments) arguments[4][84][0].apply(exports,arguments) },{"dup":84}],335:[function(require,module,exports){ arguments[4][85][0].apply(exports,arguments) -},{"bn.js":99,"dup":85,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],336:[function(require,module,exports){ +},{"bn.js":99,"dup":85,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],336:[function(require,module,exports){ module.exports={ - "_args": [ - [ - "elliptic@6.4.0", - "/home/chris/dev/eth-lightwallet" - ] - ], - "_from": "elliptic@6.4.0", + "_from": "elliptic@^6.2.3", "_id": "elliptic@6.4.0", "_inBundle": false, "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "_location": "/secp256k1/elliptic", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "elliptic@6.4.0", + "raw": "elliptic@^6.2.3", "name": "elliptic", "escapedName": "elliptic", - "rawSpec": "6.4.0", + "rawSpec": "^6.2.3", "saveSpec": null, - "fetchSpec": "6.4.0" + "fetchSpec": "^6.2.3" }, "_requiredBy": [ "/secp256k1" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_spec": "6.4.0", - "_where": "/home/chris/dev/eth-lightwallet", + "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", + "_spec": "elliptic@^6.2.3", + "_where": "/home/chris/dev/eth-lightwallet/node_modules/secp256k1", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -60508,6 +60496,7 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -60517,6 +60506,7 @@ module.exports={ "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -60763,7 +60753,7 @@ Sha.prototype._hash = function () { module.exports = Sha; -},{"./hash":337,"inherits":258,"safe-buffer":313}],340:[function(require,module,exports){ +},{"./hash":337,"inherits":257,"safe-buffer":313}],340:[function(require,module,exports){ 'use strict'; /* @@ -60865,7 +60855,7 @@ Sha1.prototype._hash = function () { module.exports = Sha1; -},{"./hash":337,"inherits":258,"safe-buffer":313}],341:[function(require,module,exports){ +},{"./hash":337,"inherits":257,"safe-buffer":313}],341:[function(require,module,exports){ 'use strict'; /** @@ -60922,7 +60912,7 @@ Sha224.prototype._hash = function () { module.exports = Sha224; -},{"./hash":337,"./sha256":342,"inherits":258,"safe-buffer":313}],342:[function(require,module,exports){ +},{"./hash":337,"./sha256":342,"inherits":257,"safe-buffer":313}],342:[function(require,module,exports){ 'use strict'; /** @@ -61045,7 +61035,7 @@ Sha256.prototype._hash = function () { module.exports = Sha256; -},{"./hash":337,"inherits":258,"safe-buffer":313}],343:[function(require,module,exports){ +},{"./hash":337,"inherits":257,"safe-buffer":313}],343:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -61106,7 +61096,7 @@ Sha384.prototype._hash = function () { module.exports = Sha384; -},{"./hash":337,"./sha512":344,"inherits":258,"safe-buffer":313}],344:[function(require,module,exports){ +},{"./hash":337,"./sha512":344,"inherits":257,"safe-buffer":313}],344:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -61329,7 +61319,7 @@ Sha512.prototype._hash = function () { module.exports = Sha512; -},{"./hash":337,"inherits":258,"safe-buffer":313}],345:[function(require,module,exports){ +},{"./hash":337,"inherits":257,"safe-buffer":313}],345:[function(require,module,exports){ 'use strict'; // Copyright Joyent, Inc. and other Node contributors. @@ -61457,7 +61447,7 @@ Stream.prototype.pipe = function (dest, options) { return dest; }; -},{"events":239,"inherits":258,"readable-stream/duplex.js":297,"readable-stream/passthrough.js":307,"readable-stream/readable.js":308,"readable-stream/transform.js":309,"readable-stream/writable.js":310}],346:[function(require,module,exports){ +},{"events":238,"inherits":257,"readable-stream/duplex.js":297,"readable-stream/passthrough.js":307,"readable-stream/readable.js":308,"readable-stream/transform.js":309,"readable-stream/writable.js":310}],346:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -61749,7 +61739,7 @@ module.exports = function stripHexPrefix(str) { return isHexPrefixed(str) ? str.slice(2) : str; }; -},{"is-hex-prefixed":260}],348:[function(require,module,exports){ +},{"is-hex-prefixed":259}],348:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -66368,7 +66358,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":354,"_process":145,"inherits":258}],356:[function(require,module,exports){ +},{"./support/isBuffer":354,"_process":285,"inherits":257}],356:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -66508,7 +66498,7 @@ exports.createContext = Script.createContext = function (context) { return copy; }; -},{"indexof":257}],357:[function(require,module,exports){ +},{"indexof":256}],357:[function(require,module,exports){ 'use strict'; var f = require('./formatters'); @@ -67784,7 +67774,7 @@ module.exports = function (value, options) { }).toString(); }; -},{"crypto-js":184,"crypto-js/sha3":205}],372:[function(require,module,exports){ +},{"crypto-js":183,"crypto-js/sha3":204}],372:[function(require,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; diff --git a/dist/lightwallet.min.js b/dist/lightwallet.min.js index 1900264e..98c331b3 100644 --- a/dist/lightwallet.min.js +++ b/dist/lightwallet.min.js @@ -1,46 +1,46 @@ -!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.lightwallet=f()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o=2&&"0x"===input.slice(0,2)?input.slice(2):input}function add0x(input){return"string"!=typeof input?input:input.length<2||"0x"!==input.slice(0,2)?"0x"+input:input}function leftPadString(stringToPad,padChar,length){for(var repreatedPadChar="",i=0;i0},KeyStore._encryptString=encryptString,KeyStore._decryptString=function(encryptedStr,pwDerivedKey){var secretbox=nacl.util.decodeBase64(encryptedStr.encStr),nonce=nacl.util.decodeBase64(encryptedStr.nonce),decryptedStr=nacl.secretbox.open(secretbox,nonce,pwDerivedKey);if(void 0===decryptedStr)throw new Error("Decryption failed!");return nacl.util.encodeUTF8(decryptedStr)},KeyStore._encryptKey=function(privKey,pwDerivedKey){var privKeyArray=nacl_decodeHex(privKey),nonce=nacl.randomBytes(nacl.secretbox.nonceLength),encKey=nacl.secretbox(privKeyArray,nonce,pwDerivedKey);return encKey={key:nacl.util.encodeBase64(encKey),nonce:nacl.util.encodeBase64(nonce)}},KeyStore._decryptKey=function(encryptedKey,pwDerivedKey){var secretbox=nacl.util.decodeBase64(encryptedKey.key),nonce=nacl.util.decodeBase64(encryptedKey.nonce),decryptedKey=nacl.secretbox.open(secretbox,nonce,pwDerivedKey);if(void 0===decryptedKey)throw new Error("Decryption failed!");return nacl_encodeHex(decryptedKey)},KeyStore._computeAddressFromPrivKey=function(privKey){var keyPair=ec.genKeyPair();keyPair._importPrivate(privKey,"hex");var pubKey=keyPair.getPublic(!1,"hex").slice(2),pubKeyWordArray=CryptoJS.enc.Hex.parse(pubKey);return CryptoJS.SHA3(pubKeyWordArray,{outputLength:256}).toString(CryptoJS.enc.Hex).slice(24)},KeyStore._computePubkeyFromPrivKey=function(privKey,curve){if("curve25519"!==curve)throw new Error('KeyStore._computePubkeyFromPrivKey: Only "curve25519" supported.');var privKeyBase64=new Buffer(privKey,"hex").toString("base64"),privKeyUInt8Array=nacl.util.decodeBase64(privKeyBase64),pubKey=nacl.box.keyPair.fromSecretKey(privKeyUInt8Array).publicKey,pubKeyBase64=nacl.util.encodeBase64(pubKey);return new Buffer(pubKeyBase64,"base64").toString("hex")},KeyStore.prototype._generatePrivKeys=function(pwDerivedKey,n){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");var hdRoot=KeyStore._decryptString(this.encHdRootPriv,pwDerivedKey);if(0===hdRoot.length)throw new Error("Provided password derived key is wrong");for(var keys=[],i=0;i32)throw new Error("Private key larger than 32 bytes. Aborting!");var encPrivKey=KeyStore._encryptKey(privkeyHex,pwDerivedKey);keys[i]={privKey:privkeyHex,encPrivKey:encPrivKey}}return keys},KeyStore._concatAndSha256=function(entropyBuf0,entropyBuf1){var totalEnt=Buffer.concat([entropyBuf0,entropyBuf1]);if(totalEnt.length!==entropyBuf0.length+entropyBuf1.length)throw new Error("generateRandomSeed: Logic error! Concatenation of entropy sources failed.");return Hash.sha256(totalEnt)},KeyStore.generateRandomSeed=function(extraEntropy){var seed="";if(void 0===extraEntropy)seed=new Mnemonic(Mnemonic.Words.ENGLISH);else{if("string"!=typeof extraEntropy)throw new Error("generateRandomSeed: extraEntropy is set but not a string.");var entBuf=new Buffer(extraEntropy),randBuf=Random.getRandomBuffer(32),hashedEnt=this._concatAndSha256(randBuf,entBuf).slice(0,16);seed=new Mnemonic(hashedEnt,Mnemonic.Words.ENGLISH)}return seed.toString()},KeyStore.isSeedValid=function(seed){return Mnemonic.isValid(seed,Mnemonic.Words.ENGLISH)},KeyStore.deserialize=function(keystore){var jsonKS=JSON.parse(keystore);if(void 0===jsonKS.version||3!==jsonKS.version)throw new Error("Old version of serialized keystore. Please use KeyStore.upgradeOldSerialized() to convert it to the latest version.");var keystoreX=new KeyStore;return keystoreX.salt=jsonKS.salt,keystoreX.hdPathString=jsonKS.hdPathString,keystoreX.encSeed=jsonKS.encSeed,keystoreX.encHdRootPriv=jsonKS.encHdRootPriv,keystoreX.version=jsonKS.version,keystoreX.hdIndex=jsonKS.hdIndex,keystoreX.encPrivKeys=jsonKS.encPrivKeys,keystoreX.addresses=jsonKS.addresses,keystoreX},KeyStore.deriveKeyFromPasswordAndSalt=function(password,salt,callback){callback||"function"!=typeof salt?salt||"function"!=typeof callback||(salt="lightwalletSalt"):(callback=salt,salt="lightwalletSalt");scrypt(password,salt,14,8,32,200,function(derKey){var err=null,ui8arr=null;try{ui8arr=new Uint8Array(derKey)}catch(e){err=e}callback(err,ui8arr)},null)},KeyStore.prototype.serialize=function(){var jsonKS={encSeed:this.encSeed,encHdRootPriv:this.encHdRootPriv,addresses:this.addresses,encPrivKeys:this.encPrivKeys,hdPathString:this.hdPathString,salt:this.salt,hdIndex:this.hdIndex,version:this.version};return JSON.stringify(jsonKS)},KeyStore.prototype.getAddresses=function(){return this.addresses.map(function(addr){return add0x(addr)})},KeyStore.prototype.getSeed=function(pwDerivedKey){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");return KeyStore._decryptString(this.encSeed,pwDerivedKey).trim()},KeyStore.prototype.exportPrivateKey=function(address,pwDerivedKey){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");var address=strip0x(address);if(void 0===this.encPrivKeys[address])throw new Error("KeyStore.exportPrivateKey: Address not found in KeyStore");var encPrivKey=this.encPrivKeys[address];return KeyStore._decryptKey(encPrivKey,pwDerivedKey)},KeyStore.prototype.generateNewAddress=function(pwDerivedKey,n){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");if(!this.encSeed)throw new Error("KeyStore.generateNewAddress: No seed set");n=n||1;for(var keys=this._generatePrivKeys(pwDerivedKey,n),i=0;i>6],primitive=0==(32&tag);if(31==(31&tag)){var oct=tag;for(tag=0;128==(128&oct);){if(oct=buf.readUInt8(fail),buf.isError(oct))return oct;tag<<=7,tag|=127&oct}}else tag&=31;return{cls:cls,primitive:primitive,tag:tag,tagStr:der.tag[tag]}}function derDecodeLen(buf,primitive,fail){var len=buf.readUInt8(fail);if(buf.isError(len))return len;if(!primitive&&128===len)return null;if(0==(128&len))return len;var num=127&len;if(num>4)return buf.error("length octect is too long");len=0;for(var i=0;i=31?reporter.error("Multi-octet tag encoding unsupported"):(primitive||(res|=32),res|=der.tagClassByName[cls||"universal"]<<6)}var inherits=require("inherits"),Buffer=require("buffer").Buffer,asn1=require("../../asn1"),base=asn1.base,der=asn1.constants.der;module.exports=DEREncoder,DEREncoder.prototype.encode=function(data,reporter){return this.tree._encode(data,reporter).join()},inherits(DERNode,base.Node),DERNode.prototype._encodeComposite=function(tag,primitive,cls,content){var encodedTag=encodeTag(tag,primitive,cls,this.reporter);if(content.length<128){var header=new Buffer(2);return header[0]=encodedTag,header[1]=content.length,this._createEncoderBuffer([header,content])}for(var lenOctets=1,i=content.length;i>=256;i>>=8)lenOctets++;var header=new Buffer(2+lenOctets);header[0]=encodedTag,header[1]=128|lenOctets;for(var i=1+lenOctets,j=content.length;j>0;i--,j>>=8)header[i]=255&j;return this._createEncoderBuffer([header,content])},DERNode.prototype._encodeStr=function(str,tag){if("bitstr"===tag)return this._createEncoderBuffer([0|str.unused,str.data]);if("bmpstr"===tag){for(var buf=new Buffer(2*str.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");id.splice(0,2,40*id[0]+id[1])}for(var size=0,i=0;i=128;ident>>=7)size++}for(var objid=new Buffer(size),offset=objid.length-1,i=id.length-1;i>=0;i--){var ident=id[i];for(objid[offset--]=127&ident;(ident>>=7)>0;)objid[offset--]=128|127&ident}return this._createEncoderBuffer(objid)},DERNode.prototype._encodeTime=function(time,tag){var str,date=new Date(time);return"gentime"===tag?str=[two(date.getFullYear()),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join(""):"utctime"===tag?str=[two(date.getFullYear()%100),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+tag+" time is not supported yet"),this._encodeStr(str,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(num,values){if("string"==typeof num){if(!values)return this.reporter.error("String int or enum given, but no values map");if(!values.hasOwnProperty(num))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(num));num=values[num]}if("number"!=typeof num&&!Buffer.isBuffer(num)){var numArray=num.toArray();!num.sign&&128&numArray[0]&&numArray.unshift(0),num=new Buffer(numArray)}if(Buffer.isBuffer(num)){var size=num.length;0===num.length&&size++;var out=new Buffer(size);return num.copy(out),0===num.length&&(out[0]=0),this._createEncoderBuffer(out)}if(num<128)return this._createEncoderBuffer(num);if(num<256)return this._createEncoderBuffer([0,num]);for(var size=1,i=num;i>=256;i>>=8)size++;for(var out=new Array(size),i=out.length-1;i>=0;i--)out[i]=255&num,num>>=8;return 128&out[0]&&out.unshift(0),this._createEncoderBuffer(new Buffer(out))},DERNode.prototype._encodeBool=function(value){return this._createEncoderBuffer(value?255:0)},DERNode.prototype._use=function(entity,obj){return"function"==typeof entity&&(entity=entity(obj)),entity._getEncoder("der").tree},DERNode.prototype._skipDefault=function(dataBuffer,reporter,parent){var i,state=this._baseState;if(null===state.default)return!1;var data=dataBuffer.join();if(void 0===state.defaultBuffer&&(state.defaultBuffer=this._encodeValue(state.default,reporter,parent).join()),data.length!==state.defaultBuffer.length)return!1;for(i=0;i=0;i--)if(ka[i]!==kb[i])return!1;for(i=ka.length-1;i>=0;i--)if(key=ka[i],!_deepEqual(a[key],b[key],strict,actualVisitedObjects))return!1;return!0}function notDeepStrictEqual(actual,expected,message){_deepEqual(actual,expected,!0)&&fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(actual,expected){if(!actual||!expected)return!1;if("[object RegExp]"==Object.prototype.toString.call(expected))return expected.test(actual);try{if(actual instanceof expected)return!0}catch(e){}return!Error.isPrototypeOf(expected)&&!0===expected.call({},actual)}function _tryBlock(block){var error;try{block()}catch(e){error=e}return error}function _throws(shouldThrow,block,expected,message){var actual;if("function"!=typeof block)throw new TypeError('"block" argument must be a function');"string"==typeof expected&&(message=expected,expected=null),actual=_tryBlock(block),message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!actual&&fail(actual,expected,"Missing expected exception"+message);var userProvidedMessage="string"==typeof message,isUnwantedException=!shouldThrow&&util.isError(actual),isUnexpectedException=!shouldThrow&&actual&&!expected;if((isUnwantedException&&userProvidedMessage&&expectedException(actual,expected)||isUnexpectedException)&&fail(actual,expected,"Got unwanted exception"+message),shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual)throw actual}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},util=require("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames=function(){return"foo"===function(){}.name}(),assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=getName(stackStartFunction),idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(actual,expected,message){_deepEqual(actual,expected,!0)||fail(actual,expected,message,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert.throws=function(block,error,message){_throws(!0,block,error,message)},assert.doesNotThrow=function(block,error,message){_throws(!1,block,error,message)},assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":355}],22:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;module.exports=function(ALPHABET){function encode(source){if(0===source.length)return"";for(var digits=[0],i=0;i0;)digits.push(carry%BASE),carry=carry/BASE|0}for(var string="",k=0;0===source[k]&&k=0;--q)string+=ALPHABET[digits[q]];return string}function decodeUnsafe(string){if(0===string.length)return Buffer.allocUnsafe(0);for(var bytes=[0],i=0;i>=8;for(;carry>0;)bytes.push(255&carry),carry>>=8}for(var k=0;string[k]===LEADER&&k0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===b64[len-2]?2:"="===b64[len-1]?1:0}function byteLength(b64){return 3*b64.length/4-placeHoldersCount(b64)}function toByteArray(b64){var i,l,tmp,placeHolders,arr,len=b64.length;placeHolders=placeHoldersCount(b64),arr=new Arr(3*len/4-placeHolders),l=placeHolders>0?len-4:len;var L=0;for(i=0;i>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;return 2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]}function encodeChunk(uint8,start,end){for(var tmp,output=[],i=start;ilen2?len2:i+16383));return 1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="="),parts.push(output),parts.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i15&&raise(id,tooManyDigits,n),num=!1):x.s=45===str.charCodeAt(0)?(str=str.slice(1),-1):1,str=convertBase(str,10,b,x.s)}else{if(n instanceof BigNumber)return x.s=n.s,x.e=n.e,x.c=(n=n.c)?n.slice():n,void(id=0);if((num="number"==typeof n)&&0*n==0){if(x.s=1/n<0?(n=-n,-1):1,n===~~n){for(e=0,i=n;i>=10;i/=10,e++);return x.e=e,x.c=[n],void(id=0)}str=n+""}else{if(!isNumeric.test(str=n+""))return parseNumeric(x,str,num);x.s=45===str.charCodeAt(0)?(str=str.slice(1),-1):1}}for((e=str.indexOf("."))>-1&&(str=str.replace(".","")),(i=str.search(/e/i))>0?(e<0&&(e=i),e+=+str.slice(i+1),str=str.substring(0,i)):e<0&&(e=str.length),i=0;48===str.charCodeAt(i);i++);for(len=str.length;48===str.charCodeAt(--len););if(str=str.slice(i,len+1))if(len=str.length,num&&ERRORS&&len>15&&raise(id,tooManyDigits,x.s*n),(e=e-i-1)>MAX_EXP)x.c=x.e=null;else if(e=0&&(k=POW_PRECISION,POW_PRECISION=0,str=str.replace(".",""),y=new BigNumber(baseIn),x=y.pow(str.length-i),POW_PRECISION=k,y.c=toBaseOut(toFixedPoint(coeffToString(x.c),x.e),10,baseOut),y.e=y.c.length),xc=toBaseOut(str,baseIn,baseOut),e=k=xc.length;0==xc[--k];xc.pop());if(!xc[0])return"0";if(i<0?--e:(x.c=xc,x.e=e,x.s=sign,x=div(x,y,dp,rm,baseOut),xc=x.c,r=x.r,e=x.e),d=e+dp+1,i=xc[d],k=baseOut/2,r=r||d<0||null!=xc[d+1],r=rm<4?(null!=i||r)&&(0==rm||rm==(x.s<0?3:2)):i>k||i==k&&(4==rm||r||6==rm&&1&xc[d-1]||rm==(x.s<0?8:7)),d<1||!xc[0])str=r?toFixedPoint("1",-dp):"0";else{if(xc.length=d,r)for(--baseOut;++xc[--d]>baseOut;)xc[d]=0,d||(++e,xc.unshift(1));for(k=xc.length;!xc[--k];);for(i=0,str="";i<=k;str+=ALPHABET.charAt(xc[i++]));str=toFixedPoint(str,e)}return str}function format(n,i,rm,caller){var c0,e,ne,len,str;if(rm=null!=rm&&isValidInt(rm,0,8,caller,roundingMode)?0|rm:ROUNDING_MODE,!n.c)return n.toString();if(c0=n.c[0],ne=n.e,null==i)str=coeffToString(n.c),str=19==caller||24==caller&&ne<=TO_EXP_NEG?toExponential(str,ne):toFixedPoint(str,ne);else if(n=round(new BigNumber(n),i,rm),e=n.e,str=coeffToString(n.c),len=str.length,19==caller||24==caller&&(i<=e||e<=TO_EXP_NEG)){for(;lenlen){if(--i>0)for(str+=".";i--;str+="0");}else if((i+=e-len)>0)for(e+1==len&&(str+=".");i--;str+="0");return n.s<0&&c0?"-"+str:str}function maxOrMin(args,method){var m,n,i=0;for(isArray(args[0])&&(args=args[0]),m=new BigNumber(args[0]);++imax||n!=truncate(n))&&raise(caller,(name||"decimal places")+(nmax?" out of range":" not an integer"),n),!0}function normalise(n,c,e){for(var i=1,j=c.length;!c[--j];c.pop());for(j=c[0];j>=10;j/=10,i++);return(e=i+e*LOG_BASE-1)>MAX_EXP?n.c=n.e=null:e=10;k/=10,d++);if((i=sd-d)<0)i+=LOG_BASE,j=sd,n=xc[ni=0],rd=n/pows10[d-j-1]%10|0;else if((ni=mathceil((i+1)/LOG_BASE))>=xc.length){if(!r)break out;for(;xc.length<=ni;xc.push(0));n=rd=0,d=1,i%=LOG_BASE,j=i-LOG_BASE+1}else{for(n=k=xc[ni],d=1;k>=10;k/=10,d++);i%=LOG_BASE,j=i-LOG_BASE+d,rd=j<0?0:n/pows10[d-j-1]%10|0}if(r=r||sd<0||null!=xc[ni+1]||(j<0?n:n%pows10[d-j-1]),r=rm<4?(rd||r)&&(0==rm||rm==(x.s<0?3:2)):rd>5||5==rd&&(4==rm||r||6==rm&&(i>0?j>0?n/pows10[d-j]:0:xc[ni-1])%10&1||rm==(x.s<0?8:7)),sd<1||!xc[0])return xc.length=0,r?(sd-=x.e+1,xc[0]=pows10[sd%LOG_BASE],x.e=-sd||0):xc[0]=x.e=0,x;if(0==i?(xc.length=ni,k=1,ni--):(xc.length=ni+1,k=pows10[LOG_BASE-i],xc[ni]=j>0?mathfloor(n/pows10[d-j]%pows10[j])*k:0),r)for(;;){if(0==ni){for(i=1,j=xc[0];j>=10;j/=10,i++);for(j=xc[0]+=k,k=1;j>=10;j/=10,k++);i!=k&&(x.e++,xc[0]==BASE&&(xc[0]=1));break}if(xc[ni]+=k,xc[ni]!=BASE)break;xc[ni--]=0,k=1}for(i=xc.length;0===xc[--i];xc.pop());}x.e>MAX_EXP?x.c=x.e=null:x.ei)return null!=(v=a[i++])};return has(p="DECIMAL_PLACES")&&isValidInt(v,0,MAX,2,p)&&(DECIMAL_PLACES=0|v),r[p]=DECIMAL_PLACES,has(p="ROUNDING_MODE")&&isValidInt(v,0,8,2,p)&&(ROUNDING_MODE=0|v),r[p]=ROUNDING_MODE,has(p="EXPONENTIAL_AT")&&(isArray(v)?isValidInt(v[0],-MAX,0,2,p)&&isValidInt(v[1],0,MAX,2,p)&&(TO_EXP_NEG=0|v[0],TO_EXP_POS=0|v[1]):isValidInt(v,-MAX,MAX,2,p)&&(TO_EXP_NEG=-(TO_EXP_POS=0|(v<0?-v:v)))),r[p]=[TO_EXP_NEG,TO_EXP_POS],has(p="RANGE")&&(isArray(v)?isValidInt(v[0],-MAX,-1,2,p)&&isValidInt(v[1],1,MAX,2,p)&&(MIN_EXP=0|v[0],MAX_EXP=0|v[1]):isValidInt(v,-MAX,MAX,2,p)&&(0|v?MIN_EXP=-(MAX_EXP=0|(v<0?-v:v)):ERRORS&&raise(2,p+" cannot be zero",v))),r[p]=[MIN_EXP,MAX_EXP],has(p="ERRORS")&&(v===!!v||1===v||0===v?(id=0,isValidInt=(ERRORS=!!v)?intValidatorWithErrors:intValidatorNoErrors):ERRORS&&raise(2,p+notBool,v)),r[p]=ERRORS,has(p="CRYPTO")&&(v===!!v||1===v||0===v?(CRYPTO=!(!v||!crypto||"object"!=(void 0===crypto?"undefined":_typeof(crypto))),v&&!CRYPTO&&ERRORS&&raise(2,"crypto unavailable",crypto)):ERRORS&&raise(2,p+notBool,v)),r[p]=CRYPTO,has(p="MODULO_MODE")&&isValidInt(v,0,9,2,p)&&(MODULO_MODE=0|v),r[p]=MODULO_MODE,has(p="POW_PRECISION")&&isValidInt(v,0,MAX,2,p)&&(POW_PRECISION=0|v),r[p]=POW_PRECISION,has(p="FORMAT")&&("object"==(void 0===v?"undefined":_typeof(v))?FORMAT=v:ERRORS&&raise(2,p+" not an object",v)),r[p]=FORMAT,r},BigNumber.max=function(){return maxOrMin(arguments,P.lt)},BigNumber.min=function(){return maxOrMin(arguments,P.gt)},BigNumber.random=function(){var random53bitInt=9007199254740992*Math.random()&2097151?function(){return mathfloor(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(dp){var a,b,e,k,v,i=0,c=[],rand=new BigNumber(ONE);if(dp=null!=dp&&isValidInt(dp,0,MAX,14)?0|dp:DECIMAL_PLACES,k=mathceil(dp/LOG_BASE),CRYPTO)if(crypto&&crypto.getRandomValues){for(a=crypto.getRandomValues(new Uint32Array(k*=2));i>>11),v>=9e15?(b=crypto.getRandomValues(new Uint32Array(2)),a[i]=b[0],a[i+1]=b[1]):(c.push(v%1e14),i+=2);i=k/2}else if(crypto&&crypto.randomBytes){for(a=crypto.randomBytes(k*=7);i=9e15?crypto.randomBytes(7).copy(a,i):(c.push(v%1e14),i+=7);i=k/7}else ERRORS&&raise(14,"crypto unavailable",crypto);if(!i)for(;i=10;v/=10,i++);ibL?1:-1;else for(i=cmp=0;ib[i]?1:-1;break}return cmp}function subtract(a,b,aL,base){for(var i=0;aL--;)a[aL]-=i,i=a[aL]1;a.shift());}return function(x,y,dp,rm,base){var cmp,e,i,more,n,prod,prodL,q,qc,rem,remL,rem0,xi,xL,yc0,yL,yz,s=x.s==y.s?1:-1,xc=x.c,yc=y.c;if(!(xc&&xc[0]&&yc&&yc[0]))return new BigNumber(x.s&&y.s&&(xc?!yc||xc[0]!=yc[0]:yc)?xc&&0==xc[0]||!yc?0*s:s/0:NaN);for(q=new BigNumber(s),qc=q.c=[],e=x.e-y.e,s=dp+e+1,base||(base=BASE,e=bitFloor(x.e/LOG_BASE)-bitFloor(y.e/LOG_BASE),s=s/LOG_BASE|0),i=0;yc[i]==(xc[i]||0);i++);if(yc[i]>(xc[i]||0)&&e--,s<0)qc.push(1),more=!0;else{for(xL=xc.length,yL=yc.length,i=0,s+=2,n=mathfloor(base/(yc[0]+1)),n>1&&(yc=multiply(yc,n,base),xc=multiply(xc,n,base),yL=yc.length,xL=xc.length),xi=yL,rem=xc.slice(0,yL),remL=rem.length;remL=base/2&&yc0++;do{if(n=0,(cmp=compare(yc,rem,yL,remL))<0){if(rem0=rem[0],yL!=remL&&(rem0=rem0*base+(rem[1]||0)),(n=mathfloor(rem0/yc0))>1)for(n>=base&&(n=base-1),prod=multiply(yc,n,base),prodL=prod.length,remL=rem.length;1==compare(prod,rem,prodL,remL);)n--,subtract(prod,yL=10;s/=10,i++);round(q,dp+(q.e=i+e*LOG_BASE-1)+1,rm,more)}else q.e=e,q.r=+more;return q}}(),parseNumeric=function(){var basePrefix=/^(-?)0([xbo])/i,dotAfter=/^([^.]+)\.$/,dotBefore=/^\.([^.]+)$/,isInfinityOrNaN=/^-?(Infinity|NaN)$/,whitespaceOrPlus=/^\s*\+|^\s+|\s+$/g;return function(x,str,num,b){var base,s=num?str:str.replace(whitespaceOrPlus,"");if(isInfinityOrNaN.test(s))x.s=isNaN(s)?null:s<0?-1:1;else{if(!num&&(s=s.replace(basePrefix,function(m,p1,p2){return base="x"==(p2=p2.toLowerCase())?16:"b"==p2?2:8,b&&b!=base?m:p1}),b&&(base=b,s=s.replace(dotAfter,"$1").replace(dotBefore,"0.$1")),str!=s))return new BigNumber(s,base);ERRORS&&raise(id,"not a"+(b?" base "+b:"")+" number",str),x.s=null}x.c=x.e=null,id=0}}(),P.absoluteValue=P.abs=function(){var x=new BigNumber(this);return x.s<0&&(x.s=1),x},P.ceil=function(){return round(new BigNumber(this),this.e+1,2)},P.comparedTo=P.cmp=function(y,b){return id=1,compare(this,new BigNumber(y,b))},P.decimalPlaces=P.dp=function(){var n,v,c=this.c;if(!c)return null;if(n=((v=c.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,v=c[v])for(;v%10==0;v/=10,n--);return n<0&&(n=0),n},P.dividedBy=P.div=function(y,b){return id=3,div(this,new BigNumber(y,b),DECIMAL_PLACES,ROUNDING_MODE)},P.dividedToIntegerBy=P.divToInt=function(y,b){return id=4,div(this,new BigNumber(y,b),0,1)},P.equals=P.eq=function(y,b){return id=5,0===compare(this,new BigNumber(y,b))},P.floor=function(){return round(new BigNumber(this),this.e+1,3)},P.greaterThan=P.gt=function(y,b){return id=6,compare(this,new BigNumber(y,b))>0},P.greaterThanOrEqualTo=P.gte=function(y,b){return id=7,1===(b=compare(this,new BigNumber(y,b)))||0===b},P.isFinite=function(){return!!this.c},P.isInteger=P.isInt=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.lessThan=P.lt=function(y,b){return id=8,compare(this,new BigNumber(y,b))<0},P.lessThanOrEqualTo=P.lte=function(y,b){return id=9,-1===(b=compare(this,new BigNumber(y,b)))||0===b},P.minus=P.sub=function(y,b){var i,j,t,xLTy,x=this,a=x.s;if(id=10,y=new BigNumber(y,b),b=y.s,!a||!b)return new BigNumber(NaN);if(a!=b)return y.s=-b,x.plus(y);var xe=x.e/LOG_BASE,ye=y.e/LOG_BASE,xc=x.c,yc=y.c;if(!xe||!ye){if(!xc||!yc)return xc?(y.s=-b,y):new BigNumber(yc?x:NaN);if(!xc[0]||!yc[0])return yc[0]?(y.s=-b,y):new BigNumber(xc[0]?x:3==ROUNDING_MODE?-0:0)}if(xe=bitFloor(xe),ye=bitFloor(ye),xc=xc.slice(),a=xe-ye){for((xLTy=a<0)?(a=-a,t=xc):(ye=xe,t=yc),t.reverse(),b=a;b--;t.push(0));t.reverse()}else for(j=(xLTy=(a=xc.length)<(b=yc.length))?a:b,a=b=0;b0)for(;b--;xc[i++]=0);for(b=BASE-1;j>a;){if(xc[--j]0?(ye=xe,t=yc):(a=-a,t=xc),t.reverse();a--;t.push(0));t.reverse()}for(a=xc.length,b=yc.length,a-b<0&&(t=yc,yc=xc,xc=t,b=a),a=0;b;)a=(xc[--b]=xc[b]+yc[b]+a)/BASE|0,xc[b]%=BASE;return a&&(xc.unshift(a),++ye),normalise(y,xc,ye)},P.precision=P.sd=function(z){var n,v,x=this,c=x.c;if(null!=z&&z!==!!z&&1!==z&&0!==z&&(ERRORS&&raise(13,"argument"+notBool,z),z!=!!z&&(z=null)),!c)return null;if(v=c.length-1,n=v*LOG_BASE+1,v=c[v]){for(;v%10==0;v/=10,n--);for(v=c[0];v>=10;v/=10,n++);}return z&&x.e+1>n&&(n=x.e+1),n},P.round=function(dp,rm){var n=new BigNumber(this);return(null==dp||isValidInt(dp,0,MAX,15))&&round(n,~~dp+this.e+1,null!=rm&&isValidInt(rm,0,8,15,roundingMode)?0|rm:ROUNDING_MODE),n},P.shift=function(k){var n=this;return isValidInt(k,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,16,"argument")?n.times("1e"+truncate(k)):new BigNumber(n.c&&n.c[0]&&(k<-MAX_SAFE_INTEGER||k>MAX_SAFE_INTEGER)?n.s*(k<0?0:1/0):n)},P.squareRoot=P.sqrt=function(){var m,n,r,rep,t,x=this,c=x.c,s=x.s,e=x.e,dp=DECIMAL_PLACES+4,half=new BigNumber("0.5");if(1!==s||!c||!c[0])return new BigNumber(!s||s<0&&(!c||c[0])?NaN:c?x:1/0);if(s=Math.sqrt(+x),0==s||s==1/0?(n=coeffToString(c),(n.length+e)%2==0&&(n+="0"),s=Math.sqrt(n),e=bitFloor((e+1)/2)-(e<0||e%2),s==1/0?n="1e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new BigNumber(n)):r=new BigNumber(s+""),r.c[0])for(e=r.e,s=e+dp,s<3&&(s=0);;)if(t=r,r=half.times(t.plus(div(x,t,dp,1))),coeffToString(t.c).slice(0,s)===(n=coeffToString(r.c)).slice(0,s)){if(r.e=0;){for(c=0,ylo=yc[i]%sqrtBase,yhi=yc[i]/sqrtBase|0,k=xcL,j=i+k;j>i;)xlo=xc[--k]%sqrtBase,xhi=xc[k]/sqrtBase|0,m=yhi*xlo+xhi*ylo,xlo=ylo*xlo+m%sqrtBase*sqrtBase+zc[j]+c,c=(xlo/base|0)+(m/sqrtBase|0)+yhi*xhi,zc[j--]=xlo%base;zc[j]=c}return c?++e:zc.shift(),normalise(y,zc,e)},P.toDigits=function(sd,rm){var n=new BigNumber(this);return sd=null!=sd&&isValidInt(sd,1,MAX,18,"precision")?0|sd:null,rm=null!=rm&&isValidInt(rm,0,8,18,roundingMode)?0|rm:ROUNDING_MODE,sd?round(n,sd,rm):n},P.toExponential=function(dp,rm){return format(this,null!=dp&&isValidInt(dp,0,MAX,19)?1+~~dp:null,rm,19)},P.toFixed=function(dp,rm){return format(this,null!=dp&&isValidInt(dp,0,MAX,20)?~~dp+this.e+1:null,rm,20)},P.toFormat=function(dp,rm){var str=format(this,null!=dp&&isValidInt(dp,0,MAX,21)?~~dp+this.e+1:null,rm,21);if(this.c){var i,arr=str.split("."),g1=+FORMAT.groupSize,g2=+FORMAT.secondaryGroupSize,groupSeparator=FORMAT.groupSeparator,intPart=arr[0],fractionPart=arr[1],isNeg=this.s<0,intDigits=isNeg?intPart.slice(1):intPart,len=intDigits.length;if(g2&&(i=g1,g1=g2,g2=i,len-=i),g1>0&&len>0){for(i=len%g1||g1,intPart=intDigits.substr(0,i);i0&&(intPart+=groupSeparator+intDigits.slice(i)),isNeg&&(intPart="-"+intPart)}str=fractionPart?intPart+FORMAT.decimalSeparator+((g2=+FORMAT.fractionGroupSize)?fractionPart.replace(new RegExp("\\d{"+g2+"}\\B","g"),"$&"+FORMAT.fractionGroupSeparator):fractionPart):intPart}return str},P.toFraction=function(md){var arr,d0,d2,e,exp,n,n0,q,s,k=ERRORS,x=this,xc=x.c,d=new BigNumber(ONE),n1=d0=new BigNumber(ONE),d1=n0=new BigNumber(ONE);if(null!=md&&(ERRORS=!1,n=new BigNumber(md),ERRORS=k,(k=n.isInt())&&!n.lt(ONE)||(ERRORS&&raise(22,"max denominator "+(k?"out of range":"not an integer"),md),md=!k&&n.c&&round(n,n.e+1,1).gte(ONE)?n:null)),!xc)return x.toString();for(s=coeffToString(xc),e=d.e=s.length-x.e-1,d.c[0]=POWS_TEN[(exp=e%LOG_BASE)<0?LOG_BASE+exp:exp],md=!md||n.cmp(d)>0?e>0?d:n1:n,exp=MAX_EXP,MAX_EXP=1/0,n=new BigNumber(s),n0.c[0]=0;q=div(n,d,0,1),d2=d0.plus(q.times(d1)),1!=d2.cmp(md);)d0=d1,d1=d2,n1=n0.plus(q.times(d2=n1)),n0=d2,d=n.minus(q.times(d2=d)),n=d2;return d2=div(md.minus(d0),d1,0,1),n0=n0.plus(d2.times(n1)),d0=d0.plus(d2.times(d1)),n0.s=n1.s=x.s,e*=2,arr=div(n1,d1,e,ROUNDING_MODE).minus(x).abs().cmp(div(n0,d0,e,ROUNDING_MODE).minus(x).abs())<1?[n1.toString(),d1.toString()]:[n0.toString(),d0.toString()],MAX_EXP=exp,arr},P.toNumber=function(){var x=this;return+x||(x.s?0*x.s:NaN)},P.toPower=P.pow=function(n){var k,y,i=mathfloor(n<0?-n:+n),x=this;if(!isValidInt(n,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,23,"exponent")&&(!isFinite(n)||i>MAX_SAFE_INTEGER&&(n/=0)||parseFloat(n)!=n&&!(n=NaN)))return new BigNumber(Math.pow(+x,n));for(k=POW_PRECISION?mathceil(POW_PRECISION/LOG_BASE+2):0,y=new BigNumber(ONE);;){if(i%2){if(y=y.times(x),!y.c)break;k&&y.c.length>k&&(y.c.length=k)}if(!(i=mathfloor(i/2)))break;x=x.times(x),k&&x.c&&x.c.length>k&&(x.c.length=k)}return n<0&&(y=ONE.div(y)),k?round(y,POW_PRECISION,ROUNDING_MODE):y},P.toPrecision=function(sd,rm){return format(this,null!=sd&&isValidInt(sd,1,MAX,24,"precision")?0|sd:null,rm,24)},P.toString=function(b){var str,n=this,s=n.s,e=n.e;return null===e?s?(str="Infinity",s<0&&(str="-"+str)):str="NaN":(str=coeffToString(n.c),str=null!=b&&isValidInt(b,2,64,25,"base")?convertBase(toFixedPoint(str,e),0|b,10,s):e<=TO_EXP_NEG||e>=TO_EXP_POS?toExponential(str,e):toFixedPoint(str,e),s<0&&n.c[0]&&(str="-"+str)),str},P.truncated=P.trunc=function(){return round(new BigNumber(this),this.e+1,1)},P.valueOf=P.toJSON=function(){return this.toString()},null!=configObj&&BigNumber.config(configObj),BigNumber}function bitFloor(n){var i=0|n;return n>0||n===i?i:i-1}function coeffToString(a){for(var s,z,i=1,j=a.length,r=a[0]+"";il^a?1:-1;for(j=(k=xc.length)<(l=yc.length)?k:l,i=0;iyc[i]^a?1:-1;return k==l?0:k>l^a?1:-1}function intValidatorNoErrors(n,min,max){return(n=truncate(n))>=min&&n<=max}function isArray(obj){return"[object Array]"==Object.prototype.toString.call(obj)}function toBaseOut(str,baseIn,baseOut){for(var j,arrL,arr=[0],i=0,len=str.length;ibaseOut-1&&(null==arr[j+1]&&(arr[j+1]=0),arr[j+1]+=arr[j]/baseOut|0,arr[j]%=baseOut)}return arr.reverse()}function toExponential(str,e){return(str.length>1?str.charAt(0)+"."+str.slice(1):str)+(e<0?"e":"e+")+e}function toFixedPoint(str,e){var len,z;if(e<0){for(z="0.";++e;z+="0");str=z+str}else if(len=str.length,++e>len){for(z="0",e-=len;--e;z+="0");str+=z}else e72)return!1;if(48!==buffer[0])return!1;if(buffer[1]!==buffer.length-2)return!1;if(2!==buffer[2])return!1;var lenR=buffer[3];if(0===lenR)return!1;if(5+lenR>=buffer.length)return!1;if(2!==buffer[4+lenR])return!1;var lenS=buffer[5+lenR];return 0!==lenS&&(6+lenR+lenS===buffer.length&&(!(128&buffer[4])&&(!(lenR>1&&0===buffer[4]&&!(128&buffer[5]))&&(!(128&buffer[lenR+6])&&!(lenS>1&&0===buffer[lenR+6]&&!(128&buffer[lenR+7]))))))}function decode(buffer){if(buffer.length<8)throw new Error("DER sequence length is too short");if(buffer.length>72)throw new Error("DER sequence length is too long");if(48!==buffer[0])throw new Error("Expected DER sequence");if(buffer[1]!==buffer.length-2)throw new Error("DER sequence length is invalid");if(2!==buffer[2])throw new Error("Expected DER integer");var lenR=buffer[3];if(0===lenR)throw new Error("R length is zero");if(5+lenR>=buffer.length)throw new Error("R length is too long");if(2!==buffer[4+lenR])throw new Error("Expected DER integer (2)");var lenS=buffer[5+lenR];if(0===lenS)throw new Error("S length is zero");if(6+lenR+lenS!==buffer.length)throw new Error("S length is invalid");if(128&buffer[4])throw new Error("R value is negative");if(lenR>1&&0===buffer[4]&&!(128&buffer[5]))throw new Error("R value excessively padded");if(128&buffer[lenR+6])throw new Error("S value is negative");if(lenS>1&&0===buffer[lenR+6]&&!(128&buffer[lenR+7]))throw new Error("S value excessively padded");return{r:buffer.slice(4,4+lenR),s:buffer.slice(6+lenR)}}function encode(r,s){var lenR=r.length,lenS=s.length;if(0===lenR)throw new Error("R length is zero");if(0===lenS)throw new Error("S length is zero");if(lenR>33)throw new Error("R length is too long");if(lenS>33)throw new Error("S length is too long");if(128&r[0])throw new Error("R value is negative");if(128&s[0])throw new Error("S value is negative");if(lenR>1&&0===r[0]&&!(128&r[1]))throw new Error("R value excessively padded");if(lenS>1&&0===s[0]&&!(128&s[1]))throw new Error("S value excessively padded");var signature=Buffer.allocUnsafe(6+lenR+lenS);return signature[0]=48,signature[1]=signature.length-2,signature[2]=2,signature[3]=r.length,r.copy(signature,4),signature[4+lenR]=2,signature[5+lenR]=s.length,s.copy(signature,6+lenR),signature}var Buffer=require("safe-buffer").Buffer;module.exports={check:check,decode:decode,encode:encode}},{"safe-buffer":313}],26:[function(require,module,exports){(function(global,Buffer){"use strict";var bitcore=module.exports;bitcore.version="v"+require("./package.json").version,bitcore.versionGuard=function(version){if(void 0!==version){throw new Error("More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.")}},bitcore.versionGuard(global._bitcore),global._bitcore=bitcore.version,bitcore.crypto={},bitcore.crypto.BN=require("./lib/crypto/bn"),bitcore.crypto.ECDSA=require("./lib/crypto/ecdsa"),bitcore.crypto.Hash=require("./lib/crypto/hash"),bitcore.crypto.Random=require("./lib/crypto/random"),bitcore.crypto.Point=require("./lib/crypto/point"),bitcore.crypto.Signature=require("./lib/crypto/signature"),bitcore.encoding={},bitcore.encoding.Base58=require("./lib/encoding/base58"),bitcore.encoding.Base58Check=require("./lib/encoding/base58check"),bitcore.encoding.BufferReader=require("./lib/encoding/bufferreader"),bitcore.encoding.BufferWriter=require("./lib/encoding/bufferwriter"),bitcore.encoding.Varint=require("./lib/encoding/varint"),bitcore.util={},bitcore.util.buffer=require("./lib/util/buffer"),bitcore.util.js=require("./lib/util/js"),bitcore.util.preconditions=require("./lib/util/preconditions"),bitcore.errors=require("./lib/errors"),bitcore.Address=require("./lib/address"),bitcore.Block=require("./lib/block"),bitcore.MerkleBlock=require("./lib/block/merkleblock"),bitcore.BlockHeader=require("./lib/block/blockheader"),bitcore.HDPrivateKey=require("./lib/hdprivatekey.js"),bitcore.HDPublicKey=require("./lib/hdpublickey.js"),bitcore.Networks=require("./lib/networks"),bitcore.Opcode=require("./lib/opcode"),bitcore.PrivateKey=require("./lib/privatekey"),bitcore.PublicKey=require("./lib/publickey"),bitcore.Script=require("./lib/script"),bitcore.Transaction=require("./lib/transaction"),bitcore.URI=require("./lib/uri"),bitcore.Unit=require("./lib/unit"),bitcore.deps={},bitcore.deps.bnjs=require("bn.js"),bitcore.deps.bs58=require("bs58"),bitcore.deps.Buffer=Buffer,bitcore.deps.elliptic=require("elliptic"),bitcore.deps._=require("lodash"),bitcore.Transaction.sighash=require("./lib/transaction/sighash")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"./lib/address":27,"./lib/block":30,"./lib/block/blockheader":29,"./lib/block/merkleblock":31,"./lib/crypto/bn":32,"./lib/crypto/ecdsa":33,"./lib/crypto/hash":34,"./lib/crypto/point":35,"./lib/crypto/random":36,"./lib/crypto/signature":37,"./lib/encoding/base58":38,"./lib/encoding/base58check":39,"./lib/encoding/bufferreader":40,"./lib/encoding/bufferwriter":41,"./lib/encoding/varint":42,"./lib/errors":43,"./lib/hdprivatekey.js":45,"./lib/hdpublickey.js":46,"./lib/networks":47,"./lib/opcode":48,"./lib/privatekey":49,"./lib/publickey":50,"./lib/script":51,"./lib/transaction":54,"./lib/transaction/sighash":62,"./lib/unit":66,"./lib/uri":67,"./lib/util/buffer":68,"./lib/util/js":69,"./lib/util/preconditions":70,"./package.json":87,"bn.js":99,bs58:147,buffer:150,elliptic:71,lodash:269}],27:[function(require,module,exports){(function(Buffer){"use strict";function Address(data,network,type){if(!(this instanceof Address))return new Address(data,network,type);if(_.isArray(data)&&_.isNumber(network))return Address.createMultisig(data,network,type);if(data instanceof Address)return data;if($.checkArgument(data,"First argument is required, please include address data.","guide/address.html"),network&&!Networks.get(network))throw new TypeError('Second argument must be "livenet" or "testnet".');if(type&&type!==Address.PayToPublicKeyHash&&type!==Address.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var info=this._classifyArguments(data,network,type);return info.network=info.network||Networks.get(network)||Networks.defaultNetwork,info.type=info.type||type||Address.PayToPublicKeyHash,JSUtil.defineImmutable(this,{hashBuffer:info.hashBuffer,network:info.network,type:info.type}),this}var _=require("lodash"),$=require("./util/preconditions"),errors=require("./errors"),Base58Check=require("./encoding/base58check"),Networks=require("./networks"),Hash=require("./crypto/hash"),JSUtil=require("./util/js"),PublicKey=require("./publickey");Address.prototype._classifyArguments=function(data,network,type){ -if((data instanceof Buffer||data instanceof Uint8Array)&&20===data.length)return Address._transformHash(data);if((data instanceof Buffer||data instanceof Uint8Array)&&21===data.length)return Address._transformBuffer(data,network,type);if(data instanceof PublicKey)return Address._transformPublicKey(data);if(data instanceof Script)return Address._transformScript(data,network);if("string"==typeof data)return Address._transformString(data,network,type);if(_.isObject(data))return Address._transformObject(data);throw new TypeError("First argument is an unrecognized data format.")},Address.PayToPublicKeyHash="pubkeyhash",Address.PayToScriptHash="scripthash",Address._transformHash=function(hash){var info={};if(!(hash instanceof Buffer||hash instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==hash.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return info.hashBuffer=hash,info},Address._transformObject=function(data){return $.checkArgument(data.hash||data.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),$.checkArgument(data.type,"Must provide a `type` property"),{hashBuffer:data.hash?new Buffer(data.hash,"hex"):data.hashBuffer,network:Networks.get(data.network)||Networks.defaultNetwork,type:data.type}},Address._classifyFromVersion=function(buffer){var version={},pubkeyhashNetwork=Networks.get(buffer[0],"pubkeyhash"),scripthashNetwork=Networks.get(buffer[0],"scripthash");return pubkeyhashNetwork?(version.network=pubkeyhashNetwork,version.type=Address.PayToPublicKeyHash):scripthashNetwork&&(version.network=scripthashNetwork,version.type=Address.PayToScriptHash),version},Address._transformBuffer=function(buffer,network,type){var info={};if(!(buffer instanceof Buffer||buffer instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==buffer.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var networkObj=Networks.get(network),bufferVersion=Address._classifyFromVersion(buffer);if(network&&!networkObj)throw new TypeError("Unknown network");if(!bufferVersion.network||networkObj&&networkObj!==bufferVersion.network)throw new TypeError("Address has mismatched network type.");if(!bufferVersion.type||type&&type!==bufferVersion.type)throw new TypeError("Address has mismatched type.");return info.hashBuffer=buffer.slice(1),info.network=bufferVersion.network,info.type=bufferVersion.type,info},Address._transformPublicKey=function(pubkey){var info={};if(!(pubkey instanceof PublicKey))throw new TypeError("Address must be an instance of PublicKey.");return info.hashBuffer=Hash.sha256ripemd160(pubkey.toBuffer()),info.type=Address.PayToPublicKeyHash,info},Address._transformScript=function(script,network){$.checkArgument(script instanceof Script,"script must be a Script instance");var info=script.getAddressInfo(network);if(!info)throw new errors.Script.CantDeriveAddress(script);return info},Address.createMultisig=function(publicKeys,threshold,network){return network=network||publicKeys[0].network||Networks.defaultNetwork,Address.payingTo(Script.buildMultisigOut(publicKeys,threshold),network)},Address._transformString=function(data,network,type){if("string"!=typeof data)throw new TypeError("data parameter supplied is not a string.");data=data.trim();var addressBuffer=Base58Check.decode(data);return Address._transformBuffer(addressBuffer,network,type)},Address.fromPublicKey=function(data,network){var info=Address._transformPublicKey(data);return network=network||Networks.defaultNetwork,new Address(info.hashBuffer,network,info.type)},Address.fromPublicKeyHash=function(hash,network){return new Address(Address._transformHash(hash).hashBuffer,network,Address.PayToPublicKeyHash)},Address.fromScriptHash=function(hash,network){return $.checkArgument(hash,"hash parameter is required"),new Address(Address._transformHash(hash).hashBuffer,network,Address.PayToScriptHash)},Address.payingTo=function(script,network){return $.checkArgument(script,"script is required"),$.checkArgument(script instanceof Script,"script must be instance of Script"),Address.fromScriptHash(Hash.sha256ripemd160(script.toBuffer()),network)},Address.fromScript=function(script,network){$.checkArgument(script instanceof Script,"script must be a Script instance");var info=Address._transformScript(script,network);return new Address(info.hashBuffer,network,info.type)},Address.fromBuffer=function(buffer,network,type){var info=Address._transformBuffer(buffer,network,type);return new Address(info.hashBuffer,info.network,info.type)},Address.fromString=function(str,network,type){var info=Address._transformString(str,network,type);return new Address(info.hashBuffer,info.network,info.type)},Address.fromObject=function(obj){return $.checkState(JSUtil.isHexa(obj.hash),'Unexpected hash property, "'+obj.hash+'", expected to be hex.'),new Address(new Buffer(obj.hash,"hex"),obj.network,obj.type)},Address.getValidationError=function(data,network,type){var error;try{new Address(data,network,type)}catch(e){error=e}return error},Address.isValid=function(data,network,type){return!Address.getValidationError(data,network,type)},Address.prototype.isPayToPublicKeyHash=function(){return this.type===Address.PayToPublicKeyHash},Address.prototype.isPayToScriptHash=function(){return this.type===Address.PayToScriptHash},Address.prototype.toBuffer=function(){var version=new Buffer([this.network[this.type]]);return Buffer.concat([version,this.hashBuffer])},Address.prototype.toObject=Address.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},Address.prototype.toString=function(){return Base58Check.encode(this.toBuffer())},Address.prototype.inspect=function(){return""},module.exports=Address;var Script=require("./script")}).call(this,require("buffer").Buffer)},{"./crypto/hash":34,"./encoding/base58check":39,"./errors":43,"./networks":47,"./publickey":50,"./script":51,"./util/js":69,"./util/preconditions":70,buffer:150,lodash:269}],28:[function(require,module,exports){(function(Buffer){"use strict";function Block(arg){return this instanceof Block?(_.extend(this,Block._from(arg)),this):new Block(arg)}var _=require("lodash"),BlockHeader=require("./blockheader"),BN=require("../crypto/bn"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Transaction=require("../transaction"),$=require("../util/preconditions");Block.MAX_BLOCK_SIZE=1e6,Block._from=function(arg){var info={};if(BufferUtil.isBuffer(arg))info=Block._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for Block");info=Block._fromObject(arg)}return info},Block._fromObject=function(data){var transactions=[];return data.transactions.forEach(function(tx){tx instanceof Transaction?transactions.push(tx):transactions.push(Transaction().fromObject(tx))}),{header:BlockHeader.fromObject(data.header),transactions:transactions}},Block.fromObject=function(obj){return new Block(Block._fromObject(obj))},Block._fromBufferReader=function(br){var info={};$.checkState(!br.finished(),"No block data received"),info.header=BlockHeader.fromBufferReader(br);var transactions=br.readVarintNum();info.transactions=[];for(var i=0;i1;size=Math.floor((size+1)/2)){for(var i=0;i"},Block.Values={START_OF_BLOCK:8,NULL_HASH:new Buffer("0000000000000000000000000000000000000000000000000000000000000000","hex")},module.exports=Block}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../transaction":54,"../util/buffer":68,"../util/preconditions":70,"./blockheader":29,buffer:150,lodash:269}],29:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),BN=require("../crypto/bn"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),$=(require("../util/js"),require("../util/preconditions")),BlockHeader=function BlockHeader(arg){if(!(this instanceof BlockHeader))return new BlockHeader(arg);var info=BlockHeader._from(arg);return this.version=info.version,this.prevHash=info.prevHash,this.merkleRoot=info.merkleRoot,this.time=info.time,this.timestamp=info.time,this.bits=info.bits,this.nonce=info.nonce,info.hash&&$.checkState(this.hash===info.hash,"Argument object hash property does not match block hash."),this};BlockHeader._from=function(arg){var info={};if(BufferUtil.isBuffer(arg))info=BlockHeader._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for BlockHeader");info=BlockHeader._fromObject(arg)}return info},BlockHeader._fromObject=function(data){$.checkArgument(data,"data is required");var prevHash=data.prevHash,merkleRoot=data.merkleRoot;return _.isString(data.prevHash)&&(prevHash=BufferUtil.reverse(new Buffer(data.prevHash,"hex"))),_.isString(data.merkleRoot)&&(merkleRoot=BufferUtil.reverse(new Buffer(data.merkleRoot,"hex"))),{hash:data.hash,version:data.version,prevHash:prevHash,merkleRoot:merkleRoot,time:data.time,timestamp:data.time,bits:data.bits,nonce:data.nonce}},BlockHeader.fromObject=function(obj){var info=BlockHeader._fromObject(obj);return new BlockHeader(info)},BlockHeader.fromRawBlock=function(data){BufferUtil.isBuffer(data)||(data=new Buffer(data,"binary"));var br=BufferReader(data);br.pos=BlockHeader.Constants.START_OF_HEADER;var info=BlockHeader._fromBufferReader(br);return new BlockHeader(info)},BlockHeader.fromBuffer=function(buf){var info=BlockHeader._fromBufferReader(BufferReader(buf));return new BlockHeader(info)},BlockHeader.fromString=function(str){var buf=new Buffer(str,"hex");return BlockHeader.fromBuffer(buf)},BlockHeader._fromBufferReader=function(br){var info={};return info.version=br.readInt32LE(),info.prevHash=br.read(32),info.merkleRoot=br.read(32),info.time=br.readUInt32LE(),info.bits=br.readUInt32LE(),info.nonce=br.readUInt32LE(),info},BlockHeader.fromBufferReader=function(br){var info=BlockHeader._fromBufferReader(br);return new BlockHeader(info)},BlockHeader.prototype.toObject=BlockHeader.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:BufferUtil.reverse(this.prevHash).toString("hex"),merkleRoot:BufferUtil.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},BlockHeader.prototype.toBuffer=function(){return this.toBufferWriter().concat()},BlockHeader.prototype.toString=function(){return this.toBuffer().toString("hex")},BlockHeader.prototype.toBufferWriter=function(bw){return bw||(bw=new BufferWriter),bw.writeInt32LE(this.version),bw.write(this.prevHash),bw.write(this.merkleRoot),bw.writeUInt32LE(this.time),bw.writeUInt32LE(this.bits),bw.writeUInt32LE(this.nonce),bw},BlockHeader.prototype.getTargetDifficulty=function(bits){bits=bits||this.bits;for(var target=new BN(16777215&bits),mov=8*((bits>>>24)-3);mov-- >0;)target=target.mul(new BN(2));return target},BlockHeader.prototype.getDifficulty=function(){var difficulty1TargetBN=this.getTargetDifficulty(486604799).mul(new BN(Math.pow(10,8))),currentTargetBN=this.getTargetDifficulty(),difficultyString=difficulty1TargetBN.div(currentTargetBN).toString(10),decimalPos=difficultyString.length-8;return difficultyString=difficultyString.slice(0,decimalPos)+"."+difficultyString.slice(decimalPos),parseFloat(difficultyString)},BlockHeader.prototype._getHash=function(){var buf=this.toBuffer();return Hash.sha256sha256(buf)};var idProperty={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=BufferReader(this._getHash()).readReverse().toString("hex")),this._id},set:_.noop};Object.defineProperty(BlockHeader.prototype,"id",idProperty),Object.defineProperty(BlockHeader.prototype,"hash",idProperty),BlockHeader.prototype.validTimestamp=function(){var currentTime=Math.round((new Date).getTime()/1e3);return!(this.time>currentTime+BlockHeader.Constants.MAX_TIME_OFFSET)},BlockHeader.prototype.validProofOfWork=function(){var pow=new BN(this.id,"hex"),target=this.getTargetDifficulty();return!(pow.cmp(target)>0)},BlockHeader.prototype.inspect=function(){return""},BlockHeader.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new BN("10000000000000000000000000000000000000000000000000000000000000000","hex")},module.exports=BlockHeader}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:150,lodash:269}],30:[function(require,module,exports){"use strict";module.exports=require("./block"),module.exports.BlockHeader=require("./blockheader"),module.exports.MerkleBlock=require("./merkleblock")},{"./block":28,"./blockheader":29,"./merkleblock":31}],31:[function(require,module,exports){(function(Buffer){"use strict";function MerkleBlock(arg){if(!(this instanceof MerkleBlock))return new MerkleBlock(arg);var info={};if(BufferUtil.isBuffer(arg))info=MerkleBlock._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for MerkleBlock");var header;header=arg.header instanceof BlockHeader?arg.header:BlockHeader.fromObject(arg.header),info={header:header,numTransactions:arg.numTransactions,hashes:arg.hashes,flags:arg.flags}}return _.extend(this,info),this._flagBitsUsed=0,this._hashesUsed=0,this}var _=require("lodash"),BlockHeader=require("./blockheader"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Transaction=(require("../util/js"),require("../transaction")),errors=require("../errors"),$=require("../util/preconditions");MerkleBlock.fromBuffer=function(buf){return MerkleBlock.fromBufferReader(BufferReader(buf))},MerkleBlock.fromBufferReader=function(br){return new MerkleBlock(MerkleBlock._fromBufferReader(br))},MerkleBlock.prototype.toBuffer=function(){return this.toBufferWriter().concat()},MerkleBlock.prototype.toBufferWriter=function(bw){bw||(bw=new BufferWriter),bw.write(this.header.toBuffer()),bw.writeUInt32LE(this.numTransactions),bw.writeVarintNum(this.hashes.length);for(var i=0;ithis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new errors.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length8*this.flags.length)return null;var isParentOfMatch=this.flags[opts.flagBitsUsed>>3]>>>(7&opts.flagBitsUsed++)&1;if(0!==depth&&isParentOfMatch){var left=this._traverseMerkleTree(depth-1,2*pos,opts),right=left;return 2*pos+1=this.hashes.length)return null;var hash=this.hashes[opts.hashesUsed++];return 0===depth&&isParentOfMatch&&opts.txs.push(hash),new Buffer(hash,"hex")},MerkleBlock.prototype._calcTreeWidth=function(height){return this.numTransactions+(1<>height},MerkleBlock.prototype._calcTreeHeight=function(){for(var height=0;this._calcTreeWidth(height)>1;)height++;return height},MerkleBlock.prototype.hasTransaction=function(tx){$.checkArgument(!_.isUndefined(tx),"tx cannot be undefined"),$.checkArgument(tx instanceof Transaction||"string"==typeof tx,'Invalid tx given, tx must be a "string" or "Transaction"');var hash=tx;tx instanceof Transaction&&(hash=BufferUtil.reverse(new Buffer(tx.id,"hex")).toString("hex"));var txs=[],height=this._calcTreeHeight();return this._traverseMerkleTree(height,0,{txs:txs}),-1!==txs.indexOf(hash)},MerkleBlock._fromBufferReader=function(br){$.checkState(!br.finished(),"No merkleblock data received");var info={};info.header=BlockHeader.fromBufferReader(br),info.numTransactions=br.readUInt32LE();var numHashes=br.readVarintNum();info.hashes=[];for(var i=0;iopts.size?buf=BN.trim(buf,natlen):natlen0&&0==(127&buf[buf.length-1])&&(buf.length<=1||0==(128&buf[buf.length-2])))throw new Error("non-minimally encoded script number");return BN.fromSM(buf,{endian:"little"})},BN.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},BN.prototype.gt=function(b){return this.cmp(b)>0},BN.prototype.gte=function(b){return this.cmp(b)>=0},BN.prototype.lt=function(b){return this.cmp(b)<0},BN.trim=function(buf,natlen){return buf.slice(natlen-buf.length,buf.length)},BN.pad=function(buf,natlen,size){for(var rbuf=new Buffer(size),i=0;i>1,n=Point.getN(),G=Point.getG(),x=isSecondKey?r.add(n):r,R=Point.fromX(isYOdd,x);if(!R.mul(n).isInfinity())throw new Error("nR is not a valid curve point");var eNeg=e.neg().umod(n),rInv=r.invm(n),Q=R.mul(s).add(G.mul(eNeg)).mul(rInv);return PublicKey.fromPoint(Q,this.sig.compressed)},ECDSA.prototype.sigError=function(){if(!BufferUtil.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var r=this.sig.r,s=this.sig.s;if(!(r.gt(BN.Zero)&&r.lt(Point.getN())&&s.gt(BN.Zero)&&s.lt(Point.getN())))return"r and s not in range";var e=BN.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),n=Point.getN(),sinv=s.invm(n),u1=sinv.mul(e).umod(n),u2=sinv.mul(r).umod(n),p=Point.getG().mulAdd(u1,this.pubkey.point,u2);return p.isInfinity()?"p is infinity":0!==p.getX().umod(n).cmp(r)&&"Invalid signature"},ECDSA.toLowS=function(s){return s.gt(BN.fromBuffer(new Buffer("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(s=Point.getN().sub(s)),s},ECDSA.prototype._findSignature=function(d,e){var k,Q,r,s,N=Point.getN(),G=Point.getG(),badrs=0;do{(!this.k||badrs>0)&&this.deterministicK(badrs),badrs++,k=this.k,Q=G.mul(k),r=Q.x.umod(N),s=k.invm(N).mul(e.add(d.mul(r))).umod(N)}while(r.cmp(BN.Zero)<=0||s.cmp(BN.Zero)<=0);return s=ECDSA.toLowS(s),{s:s,r:r}},ECDSA.prototype.sign=function(){var hashbuf=this.hashbuf,privkey=this.privkey,d=privkey.bn;$.checkState(hashbuf&&privkey&&d,new Error("invalid parameters")),$.checkState(BufferUtil.isBuffer(hashbuf)&&32===hashbuf.length,new Error("hashbuf must be a 32 byte buffer"));var e=BN.fromBuffer(hashbuf,this.endian?{endian:this.endian}:void 0),obj=this._findSignature(d,e);return obj.compressed=this.pubkey.compressed,this.sig=new Signature(obj),this},ECDSA.prototype.signRandomK=function(){return this.randomK(),this.sign()},ECDSA.prototype.toString=function(){var obj={};return this.hashbuf&&(obj.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(obj.privkey=this.privkey.toString()),this.pubkey&&(obj.pubkey=this.pubkey.toString()),this.sig&&(obj.sig=this.sig.toString()),this.k&&(obj.k=this.k.toString()),JSON.stringify(obj)},ECDSA.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},ECDSA.sign=function(hashbuf,privkey,endian){return ECDSA().set({hashbuf:hashbuf,endian:endian,privkey:privkey}).sign().sig},ECDSA.verify=function(hashbuf,sig,pubkey,endian){return ECDSA().set({hashbuf:hashbuf,endian:endian,sig:sig,pubkey:pubkey}).verify().verified},module.exports=ECDSA}).call(this,require("buffer").Buffer)},{"../publickey":50,"../util/buffer":68,"../util/preconditions":70,"./bn":32,"./hash":34,"./point":35,"./random":36,"./signature":37,buffer:150,lodash:269}],34:[function(require,module,exports){(function(Buffer){"use strict";var crypto=require("crypto"),BufferUtil=require("../util/buffer"),$=require("../util/preconditions"),Hash=module.exports;Hash.sha1=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha1").update(buf).digest()},Hash.sha1.blocksize=512,Hash.sha256=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha256").update(buf).digest()},Hash.sha256.blocksize=512,Hash.sha256sha256=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),Hash.sha256(Hash.sha256(buf))},Hash.ripemd160=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("ripemd160").update(buf).digest()},Hash.sha256ripemd160=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),Hash.ripemd160(Hash.sha256(buf))},Hash.sha512=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha512").update(buf).digest()},Hash.sha512.blocksize=1024,Hash.hmac=function(hashf,data,key){$.checkArgument(BufferUtil.isBuffer(data)),$.checkArgument(BufferUtil.isBuffer(key)),$.checkArgument(hashf.blocksize);var blocksize=hashf.blocksize/8;if(key.length>blocksize)key=hashf(key);else if(key>>=8)}return b},module.exports=Random}).call(this,require("_process"),require("buffer").Buffer)},{_process:145,buffer:150,crypto:175}],37:[function(require,module,exports){(function(Buffer){"use strict";var BN=require("./bn"),_=require("lodash"),$=require("../util/preconditions"),BufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),Signature=function Signature(r,s){if(!(this instanceof Signature))return new Signature(r,s);if(r instanceof BN)this.set({r:r,s:s});else if(r){var obj=r;this.set(obj)}};Signature.prototype.set=function(obj){return this.r=obj.r||this.r||void 0,this.s=obj.s||this.s||void 0,this.i=void 0!==obj.i?obj.i:this.i,this.compressed=void 0!==obj.compressed?obj.compressed:this.compressed,this.nhashtype=obj.nhashtype||this.nhashtype||void 0,this},Signature.fromCompact=function(buf){$.checkArgument(BufferUtil.isBuffer(buf),"Argument is expected to be a Buffer");var sig=new Signature,compressed=!0,i=buf.slice(0,1)[0]-27-4;i<0&&(compressed=!1,i+=4);var b2=buf.slice(1,33),b3=buf.slice(33,65);return $.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),$.checkArgument(32===b2.length,new Error("r must be 32 bytes")),$.checkArgument(32===b3.length,new Error("s must be 32 bytes")),sig.compressed=compressed,sig.i=i,sig.r=BN.fromBuffer(b2),sig.s=BN.fromBuffer(b3),sig},Signature.fromDER=Signature.fromBuffer=function(buf,strict){var obj=Signature.parseDER(buf,strict),sig=new Signature;return sig.r=obj.r,sig.s=obj.s,sig},Signature.fromTxFormat=function(buf){var nhashtype=buf.readUInt8(buf.length-1),derbuf=buf.slice(0,buf.length-1),sig=new Signature.fromDER(derbuf,!1);return sig.nhashtype=nhashtype,sig},Signature.fromString=function(str){var buf=new Buffer(str,"hex");return Signature.fromDER(buf)},Signature.parseDER=function(buf,strict){$.checkArgument(BufferUtil.isBuffer(buf),new Error("DER formatted signature should be a buffer")),_.isUndefined(strict)&&(strict=!0);var header=buf[0];$.checkArgument(48===header,new Error("Header byte should be 0x30"));var length=buf[1],buflength=buf.slice(2).length;$.checkArgument(!strict||length===buflength,new Error("Length byte should length of what follows")),length=length73)return!1;if(48!==buf[0])return!1;if(buf[1]!==buf.length-3)return!1;var nLenR=buf[3];if(5+nLenR>=buf.length)return!1;var nLenS=buf[5+nLenR];if(nLenR+nLenS+7!==buf.length)return!1;var R=buf.slice(4);if(2!==buf[2])return!1;if(0===nLenR)return!1;if(128&R[0])return!1;if(nLenR>1&&0===R[0]&&!(128&R[1]))return!1;var S=buf.slice(6+nLenR);return 2===buf[6+nLenR-2]&&(0!==nLenS&&(!(128&S[0])&&!(nLenS>1&&0===S[0]&&!(128&S[1]))))},Signature.prototype.hasLowS=function(){return!this.s.lt(new BN(1))&&!this.s.gt(new BN("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},Signature.prototype.hasDefinedHashtype=function(){if(!JSUtil.isNaturalNumber(this.nhashtype))return!1;var temp=this.nhashtype&~Signature.SIGHASH_ANYONECANPAY;return!(tempSignature.SIGHASH_SINGLE)},Signature.prototype.toTxFormat=function(){var derbuf=this.toDER(),buf=new Buffer(1);return buf.writeUInt8(this.nhashtype,0),Buffer.concat([derbuf,buf])},Signature.SIGHASH_ALL=1,Signature.SIGHASH_NONE=2,Signature.SIGHASH_SINGLE=3,Signature.SIGHASH_ANYONECANPAY=128,module.exports=Signature}).call(this,require("buffer").Buffer)},{"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./bn":32,buffer:150,lodash:269}],38:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),bs58=require("bs58"),buffer=require("buffer"),ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),Base58=function Base58(obj){if(!(this instanceof Base58))return new Base58(obj);if(Buffer.isBuffer(obj)){var buf=obj;this.fromBuffer(buf)}else if("string"==typeof obj){var str=obj;this.fromString(str)}else obj&&this.set(obj)};Base58.validCharacters=function(chars){return buffer.Buffer.isBuffer(chars)&&(chars=chars.toString()),_.every(_.map(chars,function(char){return _.includes(ALPHABET,char)}))},Base58.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this},Base58.encode=function(buf){if(!buffer.Buffer.isBuffer(buf))throw new Error("Input should be a buffer");return bs58.encode(buf)},Base58.decode=function(str){if("string"!=typeof str)throw new Error("Input should be a string");return new Buffer(bs58.decode(str))},Base58.prototype.fromBuffer=function(buf){return this.buf=buf,this},Base58.prototype.fromString=function(str){var buf=Base58.decode(str);return this.buf=buf,this},Base58.prototype.toBuffer=function(){return this.buf},Base58.prototype.toString=function(){return Base58.encode(this.buf)},module.exports=Base58}).call(this,require("buffer").Buffer)},{bs58:147,buffer:150,lodash:269}],39:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),Base58=require("./base58"),buffer=require("buffer"),sha256sha256=require("../crypto/hash").sha256sha256,Base58Check=function Base58Check(obj){if(!(this instanceof Base58Check))return new Base58Check(obj);if(Buffer.isBuffer(obj)){var buf=obj;this.fromBuffer(buf)}else if("string"==typeof obj){var str=obj;this.fromString(str)}else obj&&this.set(obj)};Base58Check.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this},Base58Check.validChecksum=function(data,checksum){return _.isString(data)&&(data=new buffer.Buffer(Base58.decode(data))),_.isString(checksum)&&(checksum=new buffer.Buffer(Base58.decode(checksum))),checksum||(checksum=data.slice(-4),data=data.slice(0,-4)),Base58Check.checksum(data).toString("hex")===checksum.toString("hex")},Base58Check.decode=function(s){if("string"!=typeof s)throw new Error("Input must be a string");var buf=new Buffer(Base58.decode(s));if(buf.length<4)throw new Error("Input string too short");var data=buf.slice(0,-4),csum=buf.slice(-4),hash=sha256sha256(data),hash4=hash.slice(0,4);if(csum.toString("hex")!==hash4.toString("hex"))throw new Error("Checksum mismatch");return data},Base58Check.checksum=function(buffer){return sha256sha256(buffer).slice(0,4)},Base58Check.encode=function(buf){if(!Buffer.isBuffer(buf))throw new Error("Input must be a buffer");var checkedBuf=new Buffer(buf.length+4),hash=Base58Check.checksum(buf);return buf.copy(checkedBuf),hash.copy(checkedBuf,buf.length),Base58.encode(checkedBuf)},Base58Check.prototype.fromBuffer=function(buf){return this.buf=buf,this},Base58Check.prototype.fromString=function(str){var buf=Base58Check.decode(str);return this.buf=buf,this},Base58Check.prototype.toBuffer=function(){return this.buf},Base58Check.prototype.toString=function(){return Base58Check.encode(this.buf)},module.exports=Base58Check}).call(this,require("buffer").Buffer)},{"../crypto/hash":34,"./base58":38,buffer:150,lodash:269}],40:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),$=require("../util/preconditions"),BufferUtil=require("../util/buffer"),BN=require("../crypto/bn"),BufferReader=function BufferReader(buf){if(!(this instanceof BufferReader))return new BufferReader(buf);if(!_.isUndefined(buf))if(Buffer.isBuffer(buf))this.set({buf:buf});else if(_.isString(buf))this.set({buf:new Buffer(buf,"hex")});else{if(!_.isObject(buf))throw new TypeError("Unrecognized argument for BufferReader");var obj=buf;this.set(obj)}};BufferReader.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this.pos=obj.pos||this.pos||0,this},BufferReader.prototype.eof=function(){return this.pos>=this.buf.length},BufferReader.prototype.finished=BufferReader.prototype.eof,BufferReader.prototype.read=function(len){$.checkArgument(!_.isUndefined(len),"Must specify a length");var buf=this.buf.slice(this.pos,this.pos+len);return this.pos=this.pos+len,buf},BufferReader.prototype.readAll=function(){var buf=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,buf},BufferReader.prototype.readUInt8=function(){var val=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,val},BufferReader.prototype.readUInt16BE=function(){var val=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,val},BufferReader.prototype.readUInt16LE=function(){var val=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,val},BufferReader.prototype.readUInt32BE=function(){var val=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readUInt32LE=function(){var val=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readInt32LE=function(){var val=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readUInt64BEBN=function(){var buf=this.buf.slice(this.pos,this.pos+8),bn=BN.fromBuffer(buf);return this.pos=this.pos+8,bn},BufferReader.prototype.readUInt64LEBN=function(){var bn,second=this.buf.readUInt32LE(this.pos),first=this.buf.readUInt32LE(this.pos+4),combined=4294967296*first+second;if(combined<=9007199254740991)bn=new BN(combined);else{var data=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);bn=new BN(data,10,"le")}return this.pos=this.pos+8,bn},BufferReader.prototype.readVarintNum=function(){var first=this.readUInt8();switch(first){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var bn=this.readUInt64LEBN(),n=bn.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return first}},BufferReader.prototype.readVarLengthBuffer=function(){var len=this.readVarintNum(),buf=this.read(len);return $.checkState(buf.length===len,"Invalid length while reading varlength buffer. Expected to read: "+len+" and read "+buf.length),buf},BufferReader.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},BufferReader.prototype.readVarintBN=function(){var first=this.readUInt8();switch(first){case 253:return new BN(this.readUInt16LE());case 254:return new BN(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new BN(first)}},BufferReader.prototype.reverse=function(){for(var buf=new Buffer(this.buf.length),i=0;i=0&&arg=HDPrivateKey.Hardened||hardened,index64)throw new hdErrors.InvalidEntropyArgument.TooMuchEntropy(hexa);var hash=Hash.sha512hmac(hexa,new buffer.Buffer("Bitcoin seed"));return new HDPrivateKey({network:Network.get(network)||Network.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:hash.slice(0,32),chainCode:hash.slice(32,64)})},HDPrivateKey.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var HDPublicKey=require("./hdpublickey");this._hdPublicKey=new HDPublicKey(this)}},HDPrivateKey.prototype._buildFromBuffers=function(arg){HDPrivateKey._validateBufferArguments(arg),JSUtil.defineImmutable(this,{_buffers:arg});var sequence=[arg.version,arg.depth,arg.parentFingerPrint,arg.childIndex,arg.chainCode,BufferUtil.emptyBuffer(1),arg.privateKey],concat=buffer.Buffer.concat(sequence);if(arg.checksum&&arg.checksum.length){ -if(arg.checksum.toString()!==Base58Check.checksum(concat).toString())throw new errors.InvalidB58Checksum(concat)}else arg.checksum=Base58Check.checksum(concat);var xprivkey,network=Network.get(BufferUtil.integerFromBuffer(arg.version));xprivkey=Base58Check.encode(buffer.Buffer.concat(sequence)),arg.xprivkey=new Buffer(xprivkey);var privateKey=new PrivateKey(BN.fromBuffer(arg.privateKey),network),publicKey=privateKey.toPublicKey(),size=HDPrivateKey.ParentFingerPrintSize,fingerPrint=Hash.sha256ripemd160(publicKey.toBuffer()).slice(0,size);return JSUtil.defineImmutable(this,{xprivkey:xprivkey,network:network,depth:BufferUtil.integerFromSingleByteBuffer(arg.depth),privateKey:privateKey,publicKey:publicKey,fingerPrint:fingerPrint}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},HDPrivateKey._validateBufferArguments=function(arg){var checkBuffer=function(name,size){var buff=arg[name];assert(BufferUtil.isBuffer(buff),name+" argument is not a buffer"),assert(buff.length===size,name+" has not the expected size: found "+buff.length+", expected "+size)};checkBuffer("version",HDPrivateKey.VersionSize),checkBuffer("depth",HDPrivateKey.DepthSize),checkBuffer("parentFingerPrint",HDPrivateKey.ParentFingerPrintSize),checkBuffer("childIndex",HDPrivateKey.ChildIndexSize),checkBuffer("chainCode",HDPrivateKey.ChainCodeSize),checkBuffer("privateKey",HDPrivateKey.PrivateKeySize),arg.checksum&&arg.checksum.length&&checkBuffer("checksum",HDPrivateKey.CheckSumSize)},HDPrivateKey.prototype.toString=function(){return this.xprivkey},HDPrivateKey.prototype.inspect=function(){return""},HDPrivateKey.prototype.toObject=HDPrivateKey.prototype.toJSON=function(){return{network:Network.get(BufferUtil.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:BufferUtil.integerFromBuffer(this.fingerPrint),parentFingerPrint:BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:BufferUtil.integerFromBuffer(this._buffers.childIndex),chainCode:BufferUtil.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:BufferUtil.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},HDPrivateKey.fromBuffer=function(arg){return new HDPrivateKey(arg.toString())},HDPrivateKey.prototype.toBuffer=function(){return BufferUtil.copy(this._buffers.xprivkey)},HDPrivateKey.DefaultDepth=0,HDPrivateKey.DefaultFingerprint=0,HDPrivateKey.DefaultChildIndex=0,HDPrivateKey.Hardened=2147483648,HDPrivateKey.MaxIndex=2*HDPrivateKey.Hardened,HDPrivateKey.RootElementAlias=["m","M","m'","M'"],HDPrivateKey.VersionSize=4,HDPrivateKey.DepthSize=1,HDPrivateKey.ParentFingerPrintSize=4,HDPrivateKey.ChildIndexSize=4,HDPrivateKey.ChainCodeSize=32,HDPrivateKey.PrivateKeySize=32,HDPrivateKey.CheckSumSize=4,HDPrivateKey.DataLength=78,HDPrivateKey.SerializedByteSize=82,HDPrivateKey.VersionStart=0,HDPrivateKey.VersionEnd=HDPrivateKey.VersionStart+HDPrivateKey.VersionSize,HDPrivateKey.DepthStart=HDPrivateKey.VersionEnd,HDPrivateKey.DepthEnd=HDPrivateKey.DepthStart+HDPrivateKey.DepthSize,HDPrivateKey.ParentFingerPrintStart=HDPrivateKey.DepthEnd,HDPrivateKey.ParentFingerPrintEnd=HDPrivateKey.ParentFingerPrintStart+HDPrivateKey.ParentFingerPrintSize,HDPrivateKey.ChildIndexStart=HDPrivateKey.ParentFingerPrintEnd,HDPrivateKey.ChildIndexEnd=HDPrivateKey.ChildIndexStart+HDPrivateKey.ChildIndexSize,HDPrivateKey.ChainCodeStart=HDPrivateKey.ChildIndexEnd,HDPrivateKey.ChainCodeEnd=HDPrivateKey.ChainCodeStart+HDPrivateKey.ChainCodeSize,HDPrivateKey.PrivateKeyStart=HDPrivateKey.ChainCodeEnd+1,HDPrivateKey.PrivateKeyEnd=HDPrivateKey.PrivateKeyStart+HDPrivateKey.PrivateKeySize,HDPrivateKey.ChecksumStart=HDPrivateKey.PrivateKeyEnd,HDPrivateKey.ChecksumEnd=HDPrivateKey.ChecksumStart+HDPrivateKey.CheckSumSize,assert(HDPrivateKey.ChecksumEnd===HDPrivateKey.SerializedByteSize),module.exports=HDPrivateKey}).call(this,require("buffer").Buffer)},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./crypto/random":36,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdpublickey":46,"./networks":47,"./privatekey":49,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,assert:21,buffer:150,lodash:269}],46:[function(require,module,exports){(function(Buffer){"use strict";function HDPublicKey(arg){if(arg instanceof HDPublicKey)return arg;if(!(this instanceof HDPublicKey))return new HDPublicKey(arg);if(arg){if(_.isString(arg)||BufferUtil.isBuffer(arg)){var error=HDPublicKey.getSerializedError(arg);if(error){if(BufferUtil.isBuffer(arg)&&!HDPublicKey.getSerializedError(arg.toString()))return this._buildFromSerialized(arg.toString());if(error instanceof hdErrors.ArgumentIsPrivateExtended)return new HDPrivateKey(arg).hdPublicKey;throw error}return this._buildFromSerialized(arg)}if(_.isObject(arg))return arg instanceof HDPrivateKey?this._buildFromPrivate(arg):this._buildFromObject(arg);throw new hdErrors.UnrecognizedArgument(arg)}throw new hdErrors.MustSupplyArgument}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_=require("lodash"),$=require("./util/preconditions"),BN=require("./crypto/bn"),Base58=require("./encoding/base58"),Base58Check=require("./encoding/base58check"),Hash=require("./crypto/hash"),HDPrivateKey=require("./hdprivatekey"),Network=require("./networks"),Point=require("./crypto/point"),PublicKey=require("./publickey"),bitcoreErrors=require("./errors"),errors=bitcoreErrors,hdErrors=bitcoreErrors.HDPublicKey,assert=require("assert"),JSUtil=require("./util/js"),BufferUtil=require("./util/buffer");HDPublicKey.isValidPath=function(arg){if(_.isString(arg)){var indexes=HDPrivateKey._getDerivationIndexes(arg);return null!==indexes&&_.every(indexes,HDPublicKey.isValidPath)}return!!_.isNumber(arg)&&(arg>=0&&arg=HDPublicKey.Hardened||hardened)throw new hdErrors.InvalidIndexCantDeriveHardened;if(index<0)throw new hdErrors.InvalidPath(index);var publicKey,indexBuffer=BufferUtil.integerAsBuffer(index),data=BufferUtil.concat([this.publicKey.toBuffer(),indexBuffer]),hash=Hash.sha512hmac(data,this._buffers.chainCode),leftPart=BN.fromBuffer(hash.slice(0,32),{size:32}),chainCode=hash.slice(32,64);try{publicKey=PublicKey.fromPoint(Point.getG().mul(leftPart).add(this.publicKey.point))}catch(e){return this._deriveWithNumber(index+1)}return new HDPublicKey({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:index,chainCode:chainCode,publicKey:publicKey})},HDPublicKey.prototype._deriveFromString=function(path){if(_.includes(path,"'"))throw new hdErrors.InvalidIndexCantDeriveHardened;if(!HDPublicKey.isValidPath(path))throw new hdErrors.InvalidPath(path);return HDPrivateKey._getDerivationIndexes(path).reduce(function(prev,index){return prev._deriveWithNumber(index)},this)},HDPublicKey.isValidSerialized=function(data,network){return _.isNull(HDPublicKey.getSerializedError(data,network))},HDPublicKey.getSerializedError=function(data,network){if(!_.isString(data)&&!BufferUtil.isBuffer(data))return new hdErrors.UnrecognizedArgument("expected buffer or string");if(!Base58.validCharacters(data))return new errors.InvalidB58Char("(unknown)",data);try{data=Base58Check.decode(data)}catch(e){return new errors.InvalidB58Checksum(data)}if(data.length!==HDPublicKey.DataSize)return new hdErrors.InvalidLength(data);if(!_.isUndefined(network)){var error=HDPublicKey._validateNetwork(data,network);if(error)return error}var version=BufferUtil.integerFromBuffer(data.slice(0,4));return version===Network.livenet.xprivkey||version===Network.testnet.xprivkey?new hdErrors.ArgumentIsPrivateExtended:null},HDPublicKey._validateNetwork=function(data,networkArg){var network=Network.get(networkArg);if(!network)return new errors.InvalidNetworkArgument(networkArg);var version=data.slice(HDPublicKey.VersionStart,HDPublicKey.VersionEnd);return BufferUtil.integerFromBuffer(version)!==network.xpubkey?new errors.InvalidNetwork(version):null},HDPublicKey.prototype._buildFromPrivate=function(arg){var args=_.clone(arg._buffers),point=Point.getG().mul(BN.fromBuffer(args.privateKey));return args.publicKey=Point.pointToCompressed(point),args.version=BufferUtil.integerAsBuffer(Network.get(BufferUtil.integerFromBuffer(args.version)).xpubkey),args.privateKey=void 0,args.checksum=void 0,args.xprivkey=void 0,this._buildFromBuffers(args)},HDPublicKey.prototype._buildFromObject=function(arg){var buffers={version:arg.network?BufferUtil.integerAsBuffer(Network.get(arg.network).xpubkey):arg.version,depth:_.isNumber(arg.depth)?BufferUtil.integerAsSingleByteBuffer(arg.depth):arg.depth,parentFingerPrint:_.isNumber(arg.parentFingerPrint)?BufferUtil.integerAsBuffer(arg.parentFingerPrint):arg.parentFingerPrint,childIndex:_.isNumber(arg.childIndex)?BufferUtil.integerAsBuffer(arg.childIndex):arg.childIndex,chainCode:_.isString(arg.chainCode)?BufferUtil.hexToBuffer(arg.chainCode):arg.chainCode,publicKey:_.isString(arg.publicKey)?BufferUtil.hexToBuffer(arg.publicKey):BufferUtil.isBuffer(arg.publicKey)?arg.publicKey:arg.publicKey.toBuffer(),checksum:_.isNumber(arg.checksum)?BufferUtil.integerAsBuffer(arg.checksum):arg.checksum};return this._buildFromBuffers(buffers)},HDPublicKey.prototype._buildFromSerialized=function(arg){var decoded=Base58Check.decode(arg),buffers={version:decoded.slice(HDPublicKey.VersionStart,HDPublicKey.VersionEnd),depth:decoded.slice(HDPublicKey.DepthStart,HDPublicKey.DepthEnd),parentFingerPrint:decoded.slice(HDPublicKey.ParentFingerPrintStart,HDPublicKey.ParentFingerPrintEnd),childIndex:decoded.slice(HDPublicKey.ChildIndexStart,HDPublicKey.ChildIndexEnd),chainCode:decoded.slice(HDPublicKey.ChainCodeStart,HDPublicKey.ChainCodeEnd),publicKey:decoded.slice(HDPublicKey.PublicKeyStart,HDPublicKey.PublicKeyEnd),checksum:decoded.slice(HDPublicKey.ChecksumStart,HDPublicKey.ChecksumEnd),xpubkey:arg};return this._buildFromBuffers(buffers)},HDPublicKey.prototype._buildFromBuffers=function(arg){HDPublicKey._validateBufferArguments(arg),JSUtil.defineImmutable(this,{_buffers:arg});var sequence=[arg.version,arg.depth,arg.parentFingerPrint,arg.childIndex,arg.chainCode,arg.publicKey],concat=BufferUtil.concat(sequence),checksum=Base58Check.checksum(concat);if(arg.checksum&&arg.checksum.length){if(arg.checksum.toString("hex")!==checksum.toString("hex"))throw new errors.InvalidB58Checksum(concat,checksum)}else arg.checksum=checksum;var xpubkey,network=Network.get(BufferUtil.integerFromBuffer(arg.version));xpubkey=Base58Check.encode(BufferUtil.concat(sequence)),arg.xpubkey=new Buffer(xpubkey);var publicKey=new PublicKey(arg.publicKey,{network:network}),size=HDPublicKey.ParentFingerPrintSize,fingerPrint=Hash.sha256ripemd160(publicKey.toBuffer()).slice(0,size);return JSUtil.defineImmutable(this,{xpubkey:xpubkey,network:network,depth:BufferUtil.integerFromSingleByteBuffer(arg.depth),publicKey:publicKey,fingerPrint:fingerPrint}),this},HDPublicKey._validateBufferArguments=function(arg){var checkBuffer=function(name,size){var buff=arg[name];assert(BufferUtil.isBuffer(buff),name+" argument is not a buffer, it's "+(void 0===buff?"undefined":_typeof(buff))),assert(buff.length===size,name+" has not the expected size: found "+buff.length+", expected "+size)};checkBuffer("version",HDPublicKey.VersionSize),checkBuffer("depth",HDPublicKey.DepthSize),checkBuffer("parentFingerPrint",HDPublicKey.ParentFingerPrintSize),checkBuffer("childIndex",HDPublicKey.ChildIndexSize),checkBuffer("chainCode",HDPublicKey.ChainCodeSize),checkBuffer("publicKey",HDPublicKey.PublicKeySize),arg.checksum&&arg.checksum.length&&checkBuffer("checksum",HDPublicKey.CheckSumSize)},HDPublicKey.fromString=function(arg){return $.checkArgument(_.isString(arg),"No valid string was provided"),new HDPublicKey(arg)},HDPublicKey.fromObject=function(arg){return $.checkArgument(_.isObject(arg),"No valid argument was provided"),new HDPublicKey(arg)},HDPublicKey.prototype.toString=function(){return this.xpubkey},HDPublicKey.prototype.inspect=function(){return""},HDPublicKey.prototype.toObject=HDPublicKey.prototype.toJSON=function(){return{network:Network.get(BufferUtil.integerFromBuffer(this._buffers.version)).name,depth:BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:BufferUtil.integerFromBuffer(this.fingerPrint),parentFingerPrint:BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:BufferUtil.integerFromBuffer(this._buffers.childIndex),chainCode:BufferUtil.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:BufferUtil.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},HDPublicKey.fromBuffer=function(arg){return new HDPublicKey(arg)},HDPublicKey.prototype.toBuffer=function(){return BufferUtil.copy(this._buffers.xpubkey)},HDPublicKey.Hardened=2147483648,HDPublicKey.RootElementAlias=["m","M"],HDPublicKey.VersionSize=4,HDPublicKey.DepthSize=1,HDPublicKey.ParentFingerPrintSize=4,HDPublicKey.ChildIndexSize=4,HDPublicKey.ChainCodeSize=32,HDPublicKey.PublicKeySize=33,HDPublicKey.CheckSumSize=4,HDPublicKey.DataSize=78,HDPublicKey.SerializedByteSize=82,HDPublicKey.VersionStart=0,HDPublicKey.VersionEnd=HDPublicKey.VersionStart+HDPublicKey.VersionSize,HDPublicKey.DepthStart=HDPublicKey.VersionEnd,HDPublicKey.DepthEnd=HDPublicKey.DepthStart+HDPublicKey.DepthSize,HDPublicKey.ParentFingerPrintStart=HDPublicKey.DepthEnd,HDPublicKey.ParentFingerPrintEnd=HDPublicKey.ParentFingerPrintStart+HDPublicKey.ParentFingerPrintSize,HDPublicKey.ChildIndexStart=HDPublicKey.ParentFingerPrintEnd,HDPublicKey.ChildIndexEnd=HDPublicKey.ChildIndexStart+HDPublicKey.ChildIndexSize,HDPublicKey.ChainCodeStart=HDPublicKey.ChildIndexEnd,HDPublicKey.ChainCodeEnd=HDPublicKey.ChainCodeStart+HDPublicKey.ChainCodeSize,HDPublicKey.PublicKeyStart=HDPublicKey.ChainCodeEnd,HDPublicKey.PublicKeyEnd=HDPublicKey.PublicKeyStart+HDPublicKey.PublicKeySize,HDPublicKey.ChecksumStart=HDPublicKey.PublicKeyEnd,HDPublicKey.ChecksumEnd=HDPublicKey.ChecksumStart+HDPublicKey.CheckSumSize,assert(HDPublicKey.PublicKeyEnd===HDPublicKey.DataSize),assert(HDPublicKey.ChecksumEnd===HDPublicKey.SerializedByteSize),module.exports=HDPublicKey}).call(this,require("buffer").Buffer)},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdprivatekey":45,"./networks":47,"./publickey":50,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,assert:21,buffer:150,lodash:269}],47:[function(require,module,exports){"use strict";function Network(){}function get(arg,keys){if(~networks.indexOf(arg))return arg;{if(!keys)return networkMaps[arg];_.isArray(keys)||(keys=[keys]);var containsArg=function(key){return networks[index][key]===arg};for(var index in networks)if(_.some(keys,containsArg))return networks[index]}}function addNetwork(data){var network=new Network;return JSUtil.defineImmutable(network,{name:data.name,alias:data.alias,pubkeyhash:data.pubkeyhash,privatekey:data.privatekey,scripthash:data.scripthash,xpubkey:data.xpubkey,xprivkey:data.xprivkey}),data.networkMagic&&JSUtil.defineImmutable(network,{networkMagic:BufferUtil.integerAsBuffer(data.networkMagic)}),data.port&&JSUtil.defineImmutable(network,{port:data.port}),data.dnsSeeds&&JSUtil.defineImmutable(network,{dnsSeeds:data.dnsSeeds}),_.each(network,function(value){_.isUndefined(value)||_.isObject(value)||(networkMaps[value]=network)}),networks.push(network),network}function removeNetwork(network){for(var i=0;i=0&&n<=16,"Invalid Argument: n must be between 0 and 16"),0===n?Opcode("OP_0"):new Opcode(Opcode.map.OP_1+n-1)},Opcode.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},Opcode.reverseMap=[];for(var k in Opcode.map)Opcode.reverseMap[Opcode.map[k]]=k;_.extend(Opcode,Opcode.map),Opcode.isSmallIntOp=function(opcode){return opcode instanceof Opcode&&(opcode=opcode.toNumber()),opcode===Opcode.map.OP_0||opcode>=Opcode.map.OP_1&&opcode<=Opcode.map.OP_16},Opcode.prototype.inspect=function(){return""},module.exports=Opcode}).call(this,require("buffer").Buffer)},{"./util/buffer":68,"./util/js":69,"./util/preconditions":70,buffer:150,lodash:269}],49:[function(require,module,exports){(function(Buffer){"use strict";function PrivateKey(data,network){if(!(this instanceof PrivateKey))return new PrivateKey(data,network);if(data instanceof PrivateKey)return data;var info=this._classifyArguments(data,network);if(!info.bn||0===info.bn.cmp(new BN(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!info.bn.lt(Point.getN()))throw new TypeError("Number must be less than N");if(void 0===info.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return JSUtil.defineImmutable(this,{bn:info.bn,compressed:info.compressed,network:info.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var _=require("lodash"),Address=require("./address"),Base58Check=require("./encoding/base58check"),BN=require("./crypto/bn"),JSUtil=require("./util/js"),Networks=require("./networks"),Point=require("./crypto/point"),PublicKey=require("./publickey"),Random=require("./crypto/random"),$=require("./util/preconditions");PrivateKey.prototype._classifyArguments=function(data,network){var info={compressed:!0,network:network?Networks.get(network):Networks.defaultNetwork};if(_.isUndefined(data)||_.isNull(data))info.bn=PrivateKey._getRandomBN();else if(data instanceof BN)info.bn=data;else if(data instanceof Buffer||data instanceof Uint8Array)info=PrivateKey._transformBuffer(data,network);else if(data.bn&&data.network)info=PrivateKey._transformObject(data);else if(!network&&Networks.get(data))info.bn=PrivateKey._getRandomBN(),info.network=Networks.get(data);else{if("string"!=typeof data)throw new TypeError("First argument is an unrecognized data type.");JSUtil.isHexa(data)?info.bn=new BN(new Buffer(data,"hex")):info=PrivateKey._transformWIF(data,network)}return info},PrivateKey._getRandomBN=function(){var condition,bn;do{var privbuf=Random.getRandomBuffer(32);bn=BN.fromBuffer(privbuf),condition=bn.lt(Point.getN())}while(!condition);return bn},PrivateKey._transformBuffer=function(buf,network){var info={};if(32===buf.length)return PrivateKey._transformBNBuffer(buf,network);if(info.network=Networks.get(buf[0],"privatekey"),!info.network)throw new Error("Invalid network");if(network&&info.network!==Networks.get(network))throw new TypeError("Private key network mismatch");if(34===buf.length&&1===buf[33])info.compressed=!0;else{if(33!==buf.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");info.compressed=!1}return info.bn=BN.fromBuffer(buf.slice(1,33)),info},PrivateKey._transformBNBuffer=function(buf,network){var info={};return info.network=Networks.get(network)||Networks.defaultNetwork,info.bn=BN.fromBuffer(buf),info.compressed=!1,info},PrivateKey._transformWIF=function(str,network){return PrivateKey._transformBuffer(Base58Check.decode(str),network)},PrivateKey.fromBuffer=function(arg,network){return new PrivateKey(arg,network)},PrivateKey._transformObject=function(json){return{bn:new BN(json.bn,"hex"),network:Networks.get(json.network),compressed:json.compressed}},PrivateKey.fromString=PrivateKey.fromWIF=function(str){return $.checkArgument(_.isString(str),"First argument is expected to be a string."),new PrivateKey(str)},PrivateKey.fromObject=function(obj){return $.checkArgument(_.isObject(obj),"First argument is expected to be an object."),new PrivateKey(obj)},PrivateKey.fromRandom=function(network){return new PrivateKey(PrivateKey._getRandomBN(),network)},PrivateKey.getValidationError=function(data,network){var error;try{new PrivateKey(data,network)}catch(e){error=e}return error},PrivateKey.isValid=function(data,network){return!!data&&!PrivateKey.getValidationError(data,network)},PrivateKey.prototype.toString=function(){return this.toBuffer().toString("hex")},PrivateKey.prototype.toWIF=function(){var buf,network=this.network,compressed=this.compressed;return buf=compressed?Buffer.concat([new Buffer([network.privatekey]),this.bn.toBuffer({size:32}),new Buffer([1])]):Buffer.concat([new Buffer([network.privatekey]),this.bn.toBuffer({size:32})]),Base58Check.encode(buf)},PrivateKey.prototype.toBigNumber=function(){return this.bn},PrivateKey.prototype.toBuffer=function(){return this.bn.toBuffer()},PrivateKey.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},PrivateKey.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=PublicKey.fromPrivateKey(this)),this._pubkey},PrivateKey.prototype.toAddress=function(network){var pubkey=this.toPublicKey();return Address.fromPublicKey(pubkey,network||this.network)},PrivateKey.prototype.toObject=PrivateKey.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},PrivateKey.prototype.inspect=function(){var uncompressed=this.compressed?"":", uncompressed";return""},module.exports=PrivateKey}).call(this,require("buffer").Buffer)},{"./address":27,"./crypto/bn":32,"./crypto/point":35,"./crypto/random":36,"./encoding/base58check":39,"./networks":47,"./publickey":50,"./util/js":69,"./util/preconditions":70,buffer:150,lodash:269}],50:[function(require,module,exports){(function(Buffer){"use strict";function PublicKey(data,extra){if(!(this instanceof PublicKey))return new PublicKey(data,extra);if($.checkArgument(data,"First argument is required, please include public key data."),data instanceof PublicKey)return data;extra=extra||{};var info=this._classifyArgs(data,extra);return info.point.validate(),JSUtil.defineImmutable(this,{point:info.point,compressed:info.compressed,network:info.network||Network.defaultNetwork}),this}var BN=require("./crypto/bn"),Point=require("./crypto/point"),Hash=require("./crypto/hash"),JSUtil=require("./util/js"),Network=require("./networks"),_=require("lodash"),$=require("./util/preconditions");PublicKey.prototype._classifyArgs=function(data,extra){var info={compressed:_.isUndefined(extra.compressed)||extra.compressed};if(data instanceof Point)info.point=data;else if(data.x&&data.y)info=PublicKey._transformObject(data);else if("string"==typeof data)info=PublicKey._transformDER(new Buffer(data,"hex"));else if(PublicKey._isBuffer(data))info=PublicKey._transformDER(data);else{if(!PublicKey._isPrivateKey(data))throw new TypeError("First argument is an unrecognized data format.");info=PublicKey._transformPrivateKey(data)}return info.network||(info.network=_.isUndefined(extra.network)?void 0:Network.get(extra.network)),info},PublicKey._isPrivateKey=function(param){return param instanceof require("./privatekey")},PublicKey._isBuffer=function(param){return param instanceof Buffer||param instanceof Uint8Array},PublicKey._transformPrivateKey=function(privkey){$.checkArgument(PublicKey._isPrivateKey(privkey),"Must be an instance of PrivateKey");var info={};return info.point=Point.getG().mul(privkey.bn),info.compressed=privkey.compressed,info.network=privkey.network,info},PublicKey._transformDER=function(buf,strict){$.checkArgument(PublicKey._isBuffer(buf),"Must be a hex buffer of DER encoded public key");var info={};strict=!!_.isUndefined(strict)||strict;var x,y,xbuf,ybuf;if(4!==buf[0]&&(strict||6!==buf[0]&&7!==buf[0]))if(3===buf[0])xbuf=buf.slice(1),x=new BN(xbuf),info=PublicKey._transformX(!0,x),info.compressed=!0;else{if(2!==buf[0])throw new TypeError("Invalid DER format public key");xbuf=buf.slice(1),x=new BN(xbuf),info=PublicKey._transformX(!1,x),info.compressed=!0}else{if(xbuf=buf.slice(1,33),ybuf=buf.slice(33,65),32!==xbuf.length||32!==ybuf.length||65!==buf.length)throw new TypeError("Length of x and y must be 32 bytes");x=new BN(xbuf),y=new BN(ybuf),info.point=new Point(x,y),info.compressed=!1}return info},PublicKey._transformX=function(odd,x){$.checkArgument("boolean"==typeof odd,"Must specify whether y is odd or not (true or false)");var info={};return info.point=Point.fromX(odd,x),info},PublicKey._transformObject=function(json){var x=new BN(json.x,"hex"),y=new BN(json.y,"hex");return new PublicKey(new Point(x,y),{compressed:json.compressed})},PublicKey.fromPrivateKey=function(privkey){$.checkArgument(PublicKey._isPrivateKey(privkey),"Must be an instance of PrivateKey");var info=PublicKey._transformPrivateKey(privkey);return new PublicKey(info.point,{compressed:info.compressed,network:info.network})},PublicKey.fromDER=PublicKey.fromBuffer=function(buf,strict){$.checkArgument(PublicKey._isBuffer(buf),"Must be a hex buffer of DER encoded public key");var info=PublicKey._transformDER(buf,strict);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.fromPoint=function(point,compressed){return $.checkArgument(point instanceof Point,"First argument must be an instance of Point."),new PublicKey(point,{compressed:compressed})},PublicKey.fromString=function(str,encoding){var buf=new Buffer(str,encoding||"hex"),info=PublicKey._transformDER(buf);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.fromX=function(odd,x){var info=PublicKey._transformX(odd,x);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.getValidationError=function(data){var error;try{new PublicKey(data)}catch(e){error=e}return error},PublicKey.isValid=function(data){return!PublicKey.getValidationError(data)},PublicKey.prototype.toObject=PublicKey.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},PublicKey.prototype.toBuffer=PublicKey.prototype.toDER=function(){var prefix,x=this.point.getX(),y=this.point.getY(),xbuf=x.toBuffer({size:32}),ybuf=y.toBuffer({size:32});if(this.compressed){var odd=ybuf[ybuf.length-1]%2;return prefix=new Buffer(odd?[3]:[2]),Buffer.concat([prefix,xbuf])} -return prefix=new Buffer([4]),Buffer.concat([prefix,xbuf,ybuf])},PublicKey.prototype._getID=function(){return Hash.sha256ripemd160(this.toBuffer())},PublicKey.prototype.toAddress=function(network){return require("./address").fromPublicKey(this,network||this.network)},PublicKey.prototype.toString=function(){return this.toDER().toString("hex")},PublicKey.prototype.inspect=function(){return""},module.exports=PublicKey}).call(this,require("buffer").Buffer)},{"./address":27,"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./networks":47,"./privatekey":49,"./util/js":69,"./util/preconditions":70,buffer:150,lodash:269}],51:[function(require,module,exports){"use strict";module.exports=require("./script"),module.exports.Interpreter=require("./interpreter")},{"./interpreter":52,"./script":53}],52:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),Script=require("./script"),Opcode=require("../opcode"),BN=require("../crypto/bn"),Hash=require("../crypto/hash"),Signature=require("../crypto/signature"),PublicKey=require("../publickey"),Interpreter=function Interpreter(obj){if(!(this instanceof Interpreter))return new Interpreter(obj);obj?(this.initialize(),this.set(obj)):this.initialize()};Interpreter.prototype.verify=function(scriptSig,scriptPubkey,tx,nin,flags){var Transaction=require("../transaction");_.isUndefined(tx)&&(tx=new Transaction),_.isUndefined(nin)&&(nin=0),_.isUndefined(flags)&&(flags=0),this.set({script:scriptSig,tx:tx,nin:nin,flags:flags});var stackCopy;if(0!=(flags&Interpreter.SCRIPT_VERIFY_SIGPUSHONLY)&&!scriptSig.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;flags&Interpreter.SCRIPT_VERIFY_P2SH&&(stackCopy=this.stack.slice());var stack=this.stack;if(this.initialize(),this.set({script:scriptPubkey,stack:stack,tx:tx,nin:nin,flags:flags}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var buf=this.stack[this.stack.length-1];if(!Interpreter.castToBool(buf))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(flags&Interpreter.SCRIPT_VERIFY_P2SH&&scriptPubkey.isScriptHashOut()){if(!scriptSig.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===stackCopy.length)throw new Error("internal error - stack copy empty");var redeemScriptSerialized=stackCopy[stackCopy.length-1],redeemScript=Script.fromBuffer(redeemScriptSerialized);return stackCopy.pop(),this.initialize(),this.set({script:redeemScript,stack:stackCopy,tx:tx,nin:nin,flags:flags}),!!this.evaluate()&&(0===stackCopy.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!Interpreter.castToBool(stackCopy[stackCopy.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},module.exports=Interpreter,Interpreter.prototype.initialize=function(obj){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},Interpreter.prototype.set=function(obj){this.script=obj.script||this.script,this.tx=obj.tx||this.tx,this.nin=void 0!==obj.nin?obj.nin:this.nin,this.stack=obj.stack||this.stack,this.altstack=obj.altack||this.altstack,this.pc=void 0!==obj.pc?obj.pc:this.pc,this.pbegincodehash=void 0!==obj.pbegincodehash?obj.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==obj.nOpCount?obj.nOpCount:this.nOpCount,this.vfExec=obj.vfExec||this.vfExec,this.errstr=obj.errstr||this.errstr,this.flags=void 0!==obj.flags?obj.flags:this.flags},Interpreter.true=new Buffer([1]),Interpreter.false=new Buffer([]),Interpreter.MAX_SCRIPT_ELEMENT_SIZE=520,Interpreter.LOCKTIME_THRESHOLD=5e8,Interpreter.LOCKTIME_THRESHOLD_BN=new BN(Interpreter.LOCKTIME_THRESHOLD),Interpreter.SCRIPT_VERIFY_NONE=0,Interpreter.SCRIPT_VERIFY_P2SH=1,Interpreter.SCRIPT_VERIFY_STRICTENC=2,Interpreter.SCRIPT_VERIFY_DERSIG=4,Interpreter.SCRIPT_VERIFY_LOW_S=8,Interpreter.SCRIPT_VERIFY_NULLDUMMY=16,Interpreter.SCRIPT_VERIFY_SIGPUSHONLY=32,Interpreter.SCRIPT_VERIFY_MINIMALDATA=64,Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,Interpreter.castToBool=function(buf){for(var i=0;i1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},Interpreter.prototype.checkLockTime=function(nLockTime){return!!(this.tx.nLockTime=Interpreter.LOCKTIME_THRESHOLD&&nLockTime.gte(Interpreter.LOCKTIME_THRESHOLD_BN))&&(!nLockTime.gt(new BN(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},Interpreter.prototype.step=function(){var buf,buf1,buf2,spliced,n,x1,x2,bn,bn1,bn2,bufSig,bufPubkey,subscript,sig,pubkey,fValue,fSuccess,fRequireMinimal=0!=(this.flags&Interpreter.SCRIPT_VERIFY_MINIMALDATA),fExec=-1===this.vfExec.indexOf(!1),chunk=this.script.chunks[this.pc];this.pc++;var opcodenum=chunk.opcodenum;if(_.isUndefined(opcodenum))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(chunk.buf&&chunk.buf.length>Interpreter.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(opcodenum>Opcode.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(opcodenum===Opcode.OP_CAT||opcodenum===Opcode.OP_SUBSTR||opcodenum===Opcode.OP_LEFT||opcodenum===Opcode.OP_RIGHT||opcodenum===Opcode.OP_INVERT||opcodenum===Opcode.OP_AND||opcodenum===Opcode.OP_OR||opcodenum===Opcode.OP_XOR||opcodenum===Opcode.OP_2MUL||opcodenum===Opcode.OP_2DIV||opcodenum===Opcode.OP_MUL||opcodenum===Opcode.OP_DIV||opcodenum===Opcode.OP_MOD||opcodenum===Opcode.OP_LSHIFT||opcodenum===Opcode.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(fExec&&0<=opcodenum&&opcodenum<=Opcode.OP_PUSHDATA4){if(fRequireMinimal&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(chunk.buf){if(chunk.len!==chunk.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(chunk.buf)}else this.stack.push(Interpreter.false)}else if(fExec||Opcode.OP_IF<=opcodenum&&opcodenum<=Opcode.OP_ENDIF)switch(opcodenum){case Opcode.OP_1NEGATE:case Opcode.OP_1:case Opcode.OP_2:case Opcode.OP_3:case Opcode.OP_4:case Opcode.OP_5:case Opcode.OP_6:case Opcode.OP_7:case Opcode.OP_8:case Opcode.OP_9:case Opcode.OP_10:case Opcode.OP_11:case Opcode.OP_12:case Opcode.OP_13:case Opcode.OP_14:case Opcode.OP_15:case Opcode.OP_16:n=opcodenum-(Opcode.OP_1-1),buf=new BN(n).toScriptNumBuffer(),this.stack.push(buf);break;case Opcode.OP_NOP:break;case Opcode.OP_NOP2:case Opcode.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var nLockTime=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal,5);if(nLockTime.lt(new BN(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(nLockTime))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case Opcode.OP_NOP1:case Opcode.OP_NOP3:case Opcode.OP_NOP4:case Opcode.OP_NOP5:case Opcode.OP_NOP6:case Opcode.OP_NOP7:case Opcode.OP_NOP8:case Opcode.OP_NOP9:case Opcode.OP_NOP10:if(this.flags&Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case Opcode.OP_IF:case Opcode.OP_NOTIF:if(fValue=!1,fExec){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;buf=this.stack.pop(),fValue=Interpreter.castToBool(buf),opcodenum===Opcode.OP_NOTIF&&(fValue=!fValue)}this.vfExec.push(fValue);break;case Opcode.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case Opcode.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case Opcode.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(buf=this.stack[this.stack.length-1],!(fValue=Interpreter.castToBool(buf)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case Opcode.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case Opcode.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case Opcode.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case Opcode.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case Opcode.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-2],buf2=this.stack[this.stack.length-1],this.stack.push(buf1),this.stack.push(buf2);break;case Opcode.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-3],buf2=this.stack[this.stack.length-2];var buf3=this.stack[this.stack.length-1];this.stack.push(buf1),this.stack.push(buf2),this.stack.push(buf3);break;case Opcode.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-4],buf2=this.stack[this.stack.length-3],this.stack.push(buf1),this.stack.push(buf2);break;case Opcode.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;spliced=this.stack.splice(this.stack.length-6,2),this.stack.push(spliced[0]),this.stack.push(spliced[1]);break;case Opcode.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;spliced=this.stack.splice(this.stack.length-4,2),this.stack.push(spliced[0]),this.stack.push(spliced[1]);break;case Opcode.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-1],fValue=Interpreter.castToBool(buf),fValue&&this.stack.push(buf);break;case Opcode.OP_DEPTH:buf=new BN(this.stack.length).toScriptNumBuffer(),this.stack.push(buf);break;case Opcode.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case Opcode.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case Opcode.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case Opcode.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case Opcode.OP_PICK:case Opcode.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(buf=this.stack[this.stack.length-1],bn=BN.fromScriptNumBuffer(buf,fRequireMinimal),n=bn.toNumber(),this.stack.pop(),n<0||n>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-n-1],opcodenum===Opcode.OP_ROLL&&this.stack.splice(this.stack.length-n-1,1),this.stack.push(buf);break;case Opcode.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;x1=this.stack[this.stack.length-3],x2=this.stack[this.stack.length-2];var x3=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=x2,this.stack[this.stack.length-2]=x3,this.stack[this.stack.length-1]=x1;break;case Opcode.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;x1=this.stack[this.stack.length-2],x2=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=x2,this.stack[this.stack.length-1]=x1;break;case Opcode.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case Opcode.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bn=new BN(this.stack[this.stack.length-1].length),this.stack.push(bn.toScriptNumBuffer());break;case Opcode.OP_EQUAL:case Opcode.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-2],buf2=this.stack[this.stack.length-1];var fEqual=buf1.toString("hex")===buf2.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(fEqual?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_EQUALVERIFY){if(!fEqual)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case Opcode.OP_1ADD:case Opcode.OP_1SUB:case Opcode.OP_NEGATE:case Opcode.OP_ABS:case Opcode.OP_NOT:case Opcode.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(buf=this.stack[this.stack.length-1],bn=BN.fromScriptNumBuffer(buf,fRequireMinimal),opcodenum){case Opcode.OP_1ADD:bn=bn.add(BN.One);break;case Opcode.OP_1SUB:bn=bn.sub(BN.One);break;case Opcode.OP_NEGATE:bn=bn.neg();break;case Opcode.OP_ABS:bn.cmp(BN.Zero)<0&&(bn=bn.neg());break;case Opcode.OP_NOT:bn=new BN((0===bn.cmp(BN.Zero))+0);break;case Opcode.OP_0NOTEQUAL:bn=new BN((0!==bn.cmp(BN.Zero))+0)}this.stack.pop(),this.stack.push(bn.toScriptNumBuffer());break;case Opcode.OP_ADD:case Opcode.OP_SUB:case Opcode.OP_BOOLAND:case Opcode.OP_BOOLOR:case Opcode.OP_NUMEQUAL:case Opcode.OP_NUMEQUALVERIFY:case Opcode.OP_NUMNOTEQUAL:case Opcode.OP_LESSTHAN:case Opcode.OP_GREATERTHAN:case Opcode.OP_LESSTHANOREQUAL:case Opcode.OP_GREATERTHANOREQUAL:case Opcode.OP_MIN:case Opcode.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(bn1=BN.fromScriptNumBuffer(this.stack[this.stack.length-2],fRequireMinimal),bn2=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal),bn=new BN(0),opcodenum){case Opcode.OP_ADD:bn=bn1.add(bn2);break;case Opcode.OP_SUB:bn=bn1.sub(bn2);break;case Opcode.OP_BOOLAND:bn=new BN((0!==bn1.cmp(BN.Zero)&&0!==bn2.cmp(BN.Zero))+0);break;case Opcode.OP_BOOLOR:bn=new BN((0!==bn1.cmp(BN.Zero)||0!==bn2.cmp(BN.Zero))+0);break;case Opcode.OP_NUMEQUAL:case Opcode.OP_NUMEQUALVERIFY:bn=new BN((0===bn1.cmp(bn2))+0);break;case Opcode.OP_NUMNOTEQUAL:bn=new BN((0!==bn1.cmp(bn2))+0);break;case Opcode.OP_LESSTHAN:bn=new BN((bn1.cmp(bn2)<0)+0);break;case Opcode.OP_GREATERTHAN:bn=new BN((bn1.cmp(bn2)>0)+0);break;case Opcode.OP_LESSTHANOREQUAL:bn=new BN((bn1.cmp(bn2)<=0)+0);break;case Opcode.OP_GREATERTHANOREQUAL:bn=new BN((bn1.cmp(bn2)>=0)+0);break;case Opcode.OP_MIN:bn=bn1.cmp(bn2)<0?bn1:bn2;break;case Opcode.OP_MAX:bn=bn1.cmp(bn2)>0?bn1:bn2}if(this.stack.pop(),this.stack.pop(),this.stack.push(bn.toScriptNumBuffer()),opcodenum===Opcode.OP_NUMEQUALVERIFY){if(!Interpreter.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case Opcode.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bn1=BN.fromScriptNumBuffer(this.stack[this.stack.length-3],fRequireMinimal),bn2=BN.fromScriptNumBuffer(this.stack[this.stack.length-2],fRequireMinimal);var bn3=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal);fValue=bn2.cmp(bn1)<=0&&bn1.cmp(bn3)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(fValue?Interpreter.true:Interpreter.false);break;case Opcode.OP_RIPEMD160:case Opcode.OP_SHA1:case Opcode.OP_SHA256:case Opcode.OP_HASH160:case Opcode.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-1];var bufHash;opcodenum===Opcode.OP_RIPEMD160?bufHash=Hash.ripemd160(buf):opcodenum===Opcode.OP_SHA1?bufHash=Hash.sha1(buf):opcodenum===Opcode.OP_SHA256?bufHash=Hash.sha256(buf):opcodenum===Opcode.OP_HASH160?bufHash=Hash.sha256ripemd160(buf):opcodenum===Opcode.OP_HASH256&&(bufHash=Hash.sha256sha256(buf)),this.stack.pop(),this.stack.push(bufHash);break;case Opcode.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case Opcode.OP_CHECKSIG:case Opcode.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bufSig=this.stack[this.stack.length-2],bufPubkey=this.stack[this.stack.length-1],subscript=(new Script).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var tmpScript=(new Script).add(bufSig);if(subscript.findAndDelete(tmpScript),!this.checkSignatureEncoding(bufSig)||!this.checkPubkeyEncoding(bufPubkey))return!1;try{sig=Signature.fromTxFormat(bufSig),pubkey=PublicKey.fromBuffer(bufPubkey,!1),fSuccess=this.tx.verifySignature(sig,pubkey,this.nin,subscript)}catch(e){fSuccess=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(fSuccess?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_CHECKSIGVERIFY){if(!fSuccess)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case Opcode.OP_CHECKMULTISIG:case Opcode.OP_CHECKMULTISIGVERIFY:var i=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=nKeysCount,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var ikey=++i;if(i+=nKeysCount,this.stack.lengthnKeysCount)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var isig=++i;if(i+=nSigsCount,this.stack.length0;){if(bufSig=this.stack[this.stack.length-isig],bufPubkey=this.stack[this.stack.length-ikey],!this.checkSignatureEncoding(bufSig)||!this.checkPubkeyEncoding(bufPubkey))return!1;var fOk;try{sig=Signature.fromTxFormat(bufSig),pubkey=PublicKey.fromBuffer(bufPubkey,!1),fOk=this.tx.verifySignature(sig,pubkey,this.nin,subscript)}catch(e){fOk=!1}fOk&&(isig++,nSigsCount--),ikey++,nKeysCount--,nSigsCount>nKeysCount&&(fSuccess=!1)}for(;i-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&Interpreter.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(fSuccess?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_CHECKMULTISIGVERIFY){if(!fSuccess)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../opcode":48,"../publickey":50,"../transaction":54,"./script":53,buffer:150,lodash:269}],53:[function(require,module,exports){(function(Buffer){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},Address=require("../address"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Opcode=require("../opcode"),PublicKey=require("../publickey"),Signature=require("../crypto/signature"),Networks=require("../networks"),$=require("../util/preconditions"),_=require("lodash"),errors=require("../errors"),buffer=require("buffer"),BufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),Script=function Script(from){return this instanceof Script?(this.chunks=[],BufferUtil.isBuffer(from)?Script.fromBuffer(from):from instanceof Address?Script.fromAddress(from):from instanceof Script?Script.fromBuffer(from.toBuffer()):_.isString(from)?Script.fromString(from):void(_.isObject(from)&&_.isArray(from.chunks)&&this.set(from))):new Script(from)};Script.prototype.set=function(obj){return $.checkArgument(_.isObject(obj)),$.checkArgument(_.isArray(obj.chunks)),this.chunks=obj.chunks,this},Script.fromBuffer=function(buffer){var script=new Script;script.chunks=[];for(var br=new BufferReader(buffer);!br.finished();)try{var len,buf,opcodenum=br.readUInt8();opcodenum>0&&opcodenum0&&opcodenum0&&(str=asm?str+" "+chunk.buf.toString("hex"):str+" "+chunk.len+" 0x"+chunk.buf.toString("hex"));else if(void 0!==Opcode.reverseMap[opcodenum])asm?0===opcodenum?str+=" 0":79===opcodenum?str+=" -1":str=str+" "+Opcode(opcodenum).toString():str=str+" "+Opcode(opcodenum).toString();else{var numstr=opcodenum.toString(16);numstr.length%2!=0&&(numstr="0"+numstr),str=asm?str+" "+numstr:str+" 0x"+numstr}return str},Script.prototype.toASM=function(){for(var str="",i=0;i"},Script.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==Opcode.OP_DUP||this.chunks[1].opcodenum!==Opcode.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==Opcode.OP_EQUALVERIFY||this.chunks[4].opcodenum!==Opcode.OP_CHECKSIG)},Script.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var signatureBuf=this.chunks[0].buf,pubkeyBuf=this.chunks[1].buf;if(signatureBuf&&signatureBuf.length&&48===signatureBuf[0]&&pubkeyBuf&&pubkeyBuf.length){var version=pubkeyBuf[0];if((4===version||6===version||7===version)&&65===pubkeyBuf.length)return!0;if((3===version||2===version)&&33===pubkeyBuf.length)return!0}}return!1},Script.prototype.getPublicKey=function(){return $.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},Script.prototype.getPublicKeyHash=function(){return $.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},Script.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===Opcode.OP_CHECKSIG){var pubkeyBuf=this.chunks[0].buf,version=pubkeyBuf[0],isVersion=!1;if(4!==version&&6!==version&&7!==version||65!==pubkeyBuf.length?3!==version&&2!==version||33!==pubkeyBuf.length||(isVersion=!0):isVersion=!0,isVersion)return PublicKey.isValid(pubkeyBuf)}return!1},Script.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var signatureBuf=this.chunks[0].buf;if(signatureBuf&&signatureBuf.length&&48===signatureBuf[0])return!0}return!1},Script.prototype.isScriptHashOut=function(){var buf=this.toBuffer();return 23===buf.length&&buf[0]===Opcode.OP_HASH160&&20===buf[1]&&buf[buf.length-1]===Opcode.OP_EQUAL},Script.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var redeemChunk=this.chunks[this.chunks.length-1],redeemBuf=redeemChunk.buf;if(!redeemBuf)return!1;var redeemScript;try{redeemScript=Script.fromBuffer(redeemBuf)}catch(e){if(e instanceof errors.Script.InvalidBuffer)return!1;throw e}return redeemScript.classify()!==Script.types.UNKNOWN},Script.prototype.isMultisigOut=function(){return this.chunks.length>3&&Opcode.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(obj){return obj.buf&&BufferUtil.isBuffer(obj.buf)})&&Opcode.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===Opcode.OP_CHECKMULTISIG},Script.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(obj){return obj.buf&&BufferUtil.isBuffer(obj.buf)&&Signature.isTxDER(obj.buf)})},Script.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===Opcode.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=Script.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},Script.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new Buffer(_.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new Buffer(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},Script.prototype.isPushOnly=function(){return _.every(this.chunks,function(chunk){return chunk.opcodenum<=Opcode.OP_16})},Script.types={},Script.types.UNKNOWN="Unknown",Script.types.PUBKEY_OUT="Pay to public key",Script.types.PUBKEY_IN="Spend from public key",Script.types.PUBKEYHASH_OUT="Pay to public key hash",Script.types.PUBKEYHASH_IN="Spend from public key hash",Script.types.SCRIPTHASH_OUT="Pay to script hash",Script.types.SCRIPTHASH_IN="Spend from script hash",Script.types.MULTISIG_OUT="Pay to multisig",Script.types.MULTISIG_IN="Spend from multisig",Script.types.DATA_OUT="Data push",Script.OP_RETURN_STANDARD_SIZE=80,Script.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var outputType=this.classifyOutput();return outputType!=Script.types.UNKNOWN?outputType:this.classifyInput()},Script.outputIdentifiers={},Script.outputIdentifiers.PUBKEY_OUT=Script.prototype.isPublicKeyOut,Script.outputIdentifiers.PUBKEYHASH_OUT=Script.prototype.isPublicKeyHashOut,Script.outputIdentifiers.MULTISIG_OUT=Script.prototype.isMultisigOut,Script.outputIdentifiers.SCRIPTHASH_OUT=Script.prototype.isScriptHashOut,Script.outputIdentifiers.DATA_OUT=Script.prototype.isDataOut,Script.prototype.classifyOutput=function(){for(var type in Script.outputIdentifiers)if(Script.outputIdentifiers[type].bind(this)())return Script.types[type];return Script.types.UNKNOWN},Script.inputIdentifiers={},Script.inputIdentifiers.PUBKEY_IN=Script.prototype.isPublicKeyIn,Script.inputIdentifiers.PUBKEYHASH_IN=Script.prototype.isPublicKeyHashIn,Script.inputIdentifiers.MULTISIG_IN=Script.prototype.isMultisigIn,Script.inputIdentifiers.SCRIPTHASH_IN=Script.prototype.isScriptHashIn,Script.prototype.classifyInput=function(){for(var type in Script.inputIdentifiers)if(Script.inputIdentifiers[type].bind(this)())return Script.types[type];return Script.types.UNKNOWN},Script.prototype.isStandard=function(){return this.classify()!==Script.types.UNKNOWN},Script.prototype.prepend=function(obj){return this._addByType(obj,!0),this},Script.prototype.equals=function(script){if($.checkState(script instanceof Script,"Must provide another script"),this.chunks.length!==script.chunks.length)return!1;var i;for(i=0;i=0&&len=1&&buf[0]<=16?opcodenum===Opcode.OP_1+(buf[0]-1):1===buf.length&&129===buf[0]?opcodenum===Opcode.OP_1NEGATE:buf.length<=75?opcodenum===buf.length:buf.length<=255?opcodenum===Opcode.OP_PUSHDATA1:!(buf.length<=65535)||opcodenum===Opcode.OP_PUSHDATA2)},Script.prototype._decodeOP_N=function(opcode){if(opcode===Opcode.OP_0)return 0;if(opcode>=Opcode.OP_1&&opcode<=Opcode.OP_16)return opcode-(Opcode.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(opcode))},Script.prototype.getSignatureOperationsCount=function(accurate){accurate=!!_.isUndefined(accurate)||accurate;var self=this,n=0,lastOpcode=Opcode.OP_INVALIDOPCODE;return _.each(self.chunks,function(chunk){var opcode=chunk.opcodenum;opcode==Opcode.OP_CHECKSIG||opcode==Opcode.OP_CHECKSIGVERIFY?n++:opcode!=Opcode.OP_CHECKMULTISIG&&opcode!=Opcode.OP_CHECKMULTISIGVERIFY||(accurate&&lastOpcode>=Opcode.OP_1&&lastOpcode<=Opcode.OP_16?n+=self._decodeOP_N(lastOpcode):n+=20),lastOpcode=opcode}),n},module.exports=Script}).call(this,require("buffer").Buffer)},{"../address":27,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../networks":47,"../opcode":48,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:150,lodash:269}],54:[function(require,module,exports){"use strict";module.exports=require("./transaction"),module.exports.Input=require("./input"),module.exports.Output=require("./output"),module.exports.UnspentOutput=require("./unspentoutput"),module.exports.Signature=require("./signature"),module.exports.Sighash=require("./sighash")},{"./input":55,"./output":61,"./sighash":62,"./signature":63,"./transaction":64,"./unspentoutput":65}],55:[function(require,module,exports){"use strict";module.exports=require("./input"),module.exports.PublicKey=require("./publickey"),module.exports.PublicKeyHash=require("./publickeyhash"),module.exports.MultiSig=require("./multisig.js"),module.exports.MultiSigScriptHash=require("./multisigscripthash.js")},{"./input":56,"./multisig.js":57,"./multisigscripthash.js":58,"./publickey":59,"./publickeyhash":60}],56:[function(require,module,exports){"use strict";function Input(params){return this instanceof Input?params?this._fromObject(params):void 0:new Input(params)}var _=require("lodash"),$=require("../../util/preconditions"),errors=require("../../errors"),BufferWriter=require("../../encoding/bufferwriter"),buffer=require("buffer"),BufferUtil=require("../../util/buffer"),JSUtil=require("../../util/js"),Script=require("../../script"),Sighash=require("../sighash"),Output=require("../output");Input.MAXINT=4294967295,Input.DEFAULT_SEQNUMBER=4294967295,Input.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,Input.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(Input.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new Script(this._scriptBuffer),this._script._isInput=!0),this._script)}}),Input.fromObject=function(obj){return $.checkArgument(_.isObject(obj)),(new Input)._fromObject(obj)},Input.prototype._fromObject=function(params){var prevTxId;if(prevTxId=_.isString(params.prevTxId)&&JSUtil.isHexa(params.prevTxId)?new buffer.Buffer(params.prevTxId,"hex"):params.prevTxId,this.output=params.output?params.output instanceof Output?params.output:new Output(params.output):void 0,this.prevTxId=prevTxId||params.txidbuf,this.outputIndex=_.isUndefined(params.outputIndex)?params.txoutnum:params.outputIndex,this.sequenceNumber=_.isUndefined(params.sequenceNumber)?_.isUndefined(params.seqnum)?4294967295:params.seqnum:params.sequenceNumber,_.isUndefined(params.script)&&_.isUndefined(params.scriptBuffer))throw new errors.Transaction.Input.MissingScript;return this.setScript(params.scriptBuffer||params.script),this},Input.prototype.toObject=Input.prototype.toJSON=function(){var obj={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(obj.scriptString=this.script.toString()),this.output&&(obj.output=this.output.toObject()),obj},Input.fromBufferReader=function(br){var input=new Input;return input.prevTxId=br.readReverse(32),input.outputIndex=br.readUInt32LE(),input._scriptBuffer=br.readVarLengthBuffer(),input.sequenceNumber=br.readUInt32LE(),input},Input.prototype.toBufferWriter=function(writer){writer||(writer=new BufferWriter),writer.writeReverse(this.prevTxId),writer.writeUInt32LE(this.outputIndex);var script=this._scriptBuffer;return writer.writeVarintNum(script.length),writer.write(script),writer.writeUInt32LE(this.sequenceNumber),writer},Input.prototype.setScript=function(script){if(this._script=null,script instanceof Script)this._script=script,this._script._isInput=!0,this._scriptBuffer=script.toBuffer();else if(JSUtil.isHexa(script))this._scriptBuffer=new buffer.Buffer(script,"hex");else if(_.isString(script))this._script=new Script(script),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!BufferUtil.isBuffer(script))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new buffer.Buffer(script)}return this},Input.prototype.getSignatures=function(){throw new errors.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},Input.prototype.isFullySigned=function(){throw new errors.AbstractMethodInvoked("Input#isFullySigned")},Input.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},Input.prototype.addSignature=function(){throw new errors.AbstractMethodInvoked("Input#addSignature")},Input.prototype.clearSignatures=function(){throw new errors.AbstractMethodInvoked("Input#clearSignatures")},Input.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.output.script)},Input.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},Input.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},module.exports=Input},{"../../encoding/bufferwriter":41,"../../errors":43,"../../script":51,"../../util/buffer":68,"../../util/js":69,"../../util/preconditions":70,"../output":61,"../sighash":62,buffer:150,lodash:269}],57:[function(require,module,exports){"use strict";function MultiSigInput(input,pubkeys,threshold,signatures){Input.apply(this,arguments);var self=this;pubkeys=pubkeys||input.publicKeys,threshold=threshold||input.threshold,signatures=signatures||input.signatures,this.publicKeys=_.sortBy(pubkeys,function(publicKey){return publicKey.toString("hex")}),$.checkState(Script.buildMultisigOut(this.publicKeys,threshold).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},_.each(this.publicKeys,function(publicKey,index){self.publicKeyIndex[publicKey.toString()]=index}),this.threshold=threshold,this.signatures=signatures?this._deserializeSignatures(signatures):new Array(this.publicKeys.length)}var _=require("lodash"),inherits=require("inherits"),Input=(require("../transaction"),require("./input")),Output=require("../output"),$=require("../../util/preconditions"),Script=require("../../script"),Signature=require("../../crypto/signature"),Sighash=require("../sighash"),BufferUtil=(require("../../publickey"),require("../../util/buffer")),TransactionSignature=require("../signature");inherits(MultiSigInput,Input),MultiSigInput.prototype.toObject=function(){var obj=Input.prototype.toObject.apply(this,arguments);return obj.threshold=this.threshold,obj.publicKeys=_.map(this.publicKeys,function(publicKey){return publicKey.toString()}),obj.signatures=this._serializeSignatures(),obj},MultiSigInput.prototype._deserializeSignatures=function(signatures){return _.map(signatures,function(signature){if(signature)return new TransactionSignature(signature)})},MultiSigInput.prototype._serializeSignatures=function(){return _.map(this.signatures,function(signature){if(signature)return signature.toObject()})},MultiSigInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var self=this,results=[];return _.each(this.publicKeys,function(publicKey){publicKey.toString()===privateKey.publicKey.toString()&&results.push(new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:self.prevTxId,outputIndex:self.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,self.output.script),sigtype:sigtype}))}),results},MultiSigInput.prototype.addSignature=function(transaction,signature){return $.checkState(!this.isFullySigned(),"All needed signatures have already been added"),$.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),"Signature has no matching public key"),$.checkState(this.isValidSignature(transaction,signature)),this.signatures[this.publicKeyIndex[signature.publicKey.toString()]]=signature,this._updateScript(),this},MultiSigInput.prototype._updateScript=function(){return this.setScript(Script.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},MultiSigInput.prototype._createSignatures=function(){return _.map(_.filter(this.signatures,function(signature){return!_.isUndefined(signature)}),function(signature){return BufferUtil.concat([signature.signature.toDER(),BufferUtil.integerAsSingleByteBuffer(signature.sigtype)])})},MultiSigInput.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},MultiSigInput.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},MultiSigInput.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},MultiSigInput.prototype.countSignatures=function(){return _.reduce(this.signatures,function(sum,signature){return sum+!!signature},0)},MultiSigInput.prototype.publicKeysWithoutSignature=function(){var self=this;return _.filter(this.publicKeys,function(publicKey){return!self.signatures[self.publicKeyIndex[publicKey.toString()]]})},MultiSigInput.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.output.script)},MultiSigInput.normalizeSignatures=function(transaction,input,inputIndex,signatures,publicKeys){return publicKeys.map(function(pubKey){var signatureMatch=null;return signatures=signatures.filter(function(signatureBuffer){if(signatureMatch)return!0;var signature=new TransactionSignature({signature:Signature.fromTxFormat(signatureBuffer),publicKey:pubKey,prevTxId:input.prevTxId,outputIndex:input.outputIndex,inputIndex:inputIndex,sigtype:Signature.SIGHASH_ALL});return signature.signature.nhashtype=signature.sigtype,!Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,input.output.script)||(signatureMatch=signature,!1)}),signatureMatch||null})},MultiSigInput.OPCODES_SIZE=1,MultiSigInput.SIGNATURE_SIZE=73,MultiSigInput.prototype._estimateSize=function(){return MultiSigInput.OPCODES_SIZE+this.threshold*MultiSigInput.SIGNATURE_SIZE},module.exports=MultiSigInput},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"../transaction":64,"./input":56,inherits:258,lodash:269}],58:[function(require,module,exports){"use strict";function MultiSigScriptHashInput(input,pubkeys,threshold,signatures){Input.apply(this,arguments);var self=this;pubkeys=pubkeys||input.publicKeys,threshold=threshold||input.threshold,signatures=signatures||input.signatures,this.publicKeys=_.sortBy(pubkeys,function(publicKey){return publicKey.toString("hex")}),this.redeemScript=Script.buildMultisigOut(this.publicKeys,threshold),$.checkState(Script.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},_.each(this.publicKeys,function(publicKey,index){self.publicKeyIndex[publicKey.toString()]=index}),this.threshold=threshold,this.signatures=signatures?this._deserializeSignatures(signatures):new Array(this.publicKeys.length)}var _=require("lodash"),inherits=require("inherits"),Input=require("./input"),Output=require("../output"),$=require("../../util/preconditions"),Script=require("../../script"),Signature=require("../../crypto/signature"),Sighash=require("../sighash"),BufferUtil=(require("../../publickey"),require("../../util/buffer")),TransactionSignature=require("../signature");inherits(MultiSigScriptHashInput,Input),MultiSigScriptHashInput.prototype.toObject=function(){var obj=Input.prototype.toObject.apply(this,arguments);return obj.threshold=this.threshold,obj.publicKeys=_.map(this.publicKeys,function(publicKey){return publicKey.toString()}),obj.signatures=this._serializeSignatures(),obj},MultiSigScriptHashInput.prototype._deserializeSignatures=function(signatures){return _.map(signatures,function(signature){if(signature)return new TransactionSignature(signature)})},MultiSigScriptHashInput.prototype._serializeSignatures=function(){return _.map(this.signatures,function(signature){if(signature)return signature.toObject()})},MultiSigScriptHashInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var self=this,results=[];return _.each(this.publicKeys,function(publicKey){publicKey.toString()===privateKey.publicKey.toString()&&results.push(new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:self.prevTxId,outputIndex:self.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,self.redeemScript),sigtype:sigtype}))}),results},MultiSigScriptHashInput.prototype.addSignature=function(transaction,signature){return $.checkState(!this.isFullySigned(),"All needed signatures have already been added"),$.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),"Signature has no matching public key"),$.checkState(this.isValidSignature(transaction,signature)),this.signatures[this.publicKeyIndex[signature.publicKey.toString()]]=signature,this._updateScript(),this},MultiSigScriptHashInput.prototype._updateScript=function(){return this.setScript(Script.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},MultiSigScriptHashInput.prototype._createSignatures=function(){return _.map(_.filter(this.signatures,function(signature){return!_.isUndefined(signature)}),function(signature){return BufferUtil.concat([signature.signature.toDER(),BufferUtil.integerAsSingleByteBuffer(signature.sigtype)])})},MultiSigScriptHashInput.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},MultiSigScriptHashInput.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},MultiSigScriptHashInput.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},MultiSigScriptHashInput.prototype.countSignatures=function(){return _.reduce(this.signatures,function(sum,signature){return sum+!!signature},0)},MultiSigScriptHashInput.prototype.publicKeysWithoutSignature=function(){var self=this;return _.filter(this.publicKeys,function(publicKey){return!self.signatures[self.publicKeyIndex[publicKey.toString()]]})},MultiSigScriptHashInput.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.redeemScript)},MultiSigScriptHashInput.OPCODES_SIZE=7,MultiSigScriptHashInput.SIGNATURE_SIZE=74,MultiSigScriptHashInput.PUBKEY_SIZE=34,MultiSigScriptHashInput.prototype._estimateSize=function(){return MultiSigScriptHashInput.OPCODES_SIZE+this.threshold*MultiSigScriptHashInput.SIGNATURE_SIZE+this.publicKeys.length*MultiSigScriptHashInput.PUBKEY_SIZE},module.exports=MultiSigScriptHashInput},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:258,lodash:269}],59:[function(require,module,exports){"use strict";function PublicKeyInput(){Input.apply(this,arguments)}var inherits=require("inherits"),$=require("../../util/preconditions"),Input=(require("../../util/buffer"),require("./input")),Output=require("../output"),Sighash=require("../sighash"),Script=require("../../script"),Signature=require("../../crypto/signature"),TransactionSignature=require("../signature");inherits(PublicKeyInput,Input),PublicKeyInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var publicKey=privateKey.toPublicKey();return publicKey.toString()===this.output.script.getPublicKey().toString("hex")?[new TransactionSignature({publicKey:publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,this.output.script),sigtype:sigtype})]:[]},PublicKeyInput.prototype.addSignature=function(transaction,signature){return $.checkState(this.isValidSignature(transaction,signature),"Signature is invalid"),this.setScript(Script.buildPublicKeyIn(signature.signature.toDER(),signature.sigtype)),this},PublicKeyInput.prototype.clearSignatures=function(){return this.setScript(Script.empty()),this},PublicKeyInput.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},PublicKeyInput.SCRIPT_MAX_SIZE=73,PublicKeyInput.prototype._estimateSize=function(){return PublicKeyInput.SCRIPT_MAX_SIZE},module.exports=PublicKeyInput},{"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:258}],60:[function(require,module,exports){"use strict";function PublicKeyHashInput(){Input.apply(this,arguments)}var inherits=require("inherits"),$=require("../../util/preconditions"),BufferUtil=require("../../util/buffer"),Hash=require("../../crypto/hash"),Input=require("./input"),Output=require("../output"),Sighash=require("../sighash"),Script=require("../../script"),Signature=require("../../crypto/signature"),TransactionSignature=require("../signature");inherits(PublicKeyHashInput,Input),PublicKeyHashInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype,hashData){return $.checkState(this.output instanceof Output),hashData=hashData||Hash.sha256ripemd160(privateKey.publicKey.toBuffer()),sigtype=sigtype||Signature.SIGHASH_ALL,BufferUtil.equals(hashData,this.output.script.getPublicKeyHash())?[new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,this.output.script),sigtype:sigtype})]:[]},PublicKeyHashInput.prototype.addSignature=function(transaction,signature){return $.checkState(this.isValidSignature(transaction,signature),"Signature is invalid"),this.setScript(Script.buildPublicKeyHashIn(signature.publicKey,signature.signature.toDER(),signature.sigtype)),this},PublicKeyHashInput.prototype.clearSignatures=function(){return this.setScript(Script.empty()),this},PublicKeyHashInput.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},PublicKeyHashInput.SCRIPT_MAX_SIZE=107,PublicKeyHashInput.prototype._estimateSize=function(){return PublicKeyHashInput.SCRIPT_MAX_SIZE},module.exports=PublicKeyHashInput},{"../../crypto/hash":34,"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:258}],61:[function(require,module,exports){"use strict";function Output(args){if(!(this instanceof Output))return new Output(args);if(!_.isObject(args))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=args.satoshis,bufferUtil.isBuffer(args.script))this._scriptBuffer=args.script;else{var script;script=_.isString(args.script)&&JSUtil.isHexa(args.script)?new buffer.Buffer(args.script,"hex"):args.script,this.setScript(script)}}var _=require("lodash"),BN=require("../crypto/bn"),buffer=require("buffer"),bufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),BufferWriter=require("../encoding/bufferwriter"),Script=require("../script"),$=require("../util/preconditions"),errors=require("../errors");Object.defineProperty(Output.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(Output.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(num){num instanceof BN?(this._satoshisBN=num,this._satoshis=num.toNumber()):_.isString(num)?(this._satoshis=parseInt(num),this._satoshisBN=BN.fromNumber(this._satoshis)):($.checkArgument(JSUtil.isNaturalNumber(num),"Output satoshis is not a natural number"),this._satoshisBN=BN.fromNumber(num),this._satoshis=num),$.checkState(JSUtil.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),Output.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Output.prototype.toObject=Output.prototype.toJSON=function(){var obj={satoshis:this.satoshis};return obj.script=this._scriptBuffer.toString("hex"),obj},Output.fromObject=function(data){return new Output(data)},Output.prototype.setScriptFromBuffer=function(buffer){this._scriptBuffer=buffer;try{this._script=Script.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof errors.Script.InvalidBuffer))throw e;this._script=null}},Output.prototype.setScript=function(script){if(script instanceof Script)this._scriptBuffer=script.toBuffer(),this._script=script,this._script._isOutput=!0;else if(_.isString(script))this._script=Script.fromString(script),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!bufferUtil.isBuffer(script))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(script)}return this},Output.prototype.inspect=function(){var scriptStr;return scriptStr=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},Output.fromBufferReader=function(br){var obj={};obj.satoshis=br.readUInt64LEBN();var size=br.readVarintNum();return obj.script=0!==size?br.read(size):new buffer.Buffer([]),new Output(obj)},Output.prototype.toBufferWriter=function(writer){writer||(writer=new BufferWriter),writer.writeUInt64LEBN(this._satoshisBN);var script=this._scriptBuffer;return writer.writeVarintNum(script.length),writer.write(script),writer},module.exports=Output},{"../crypto/bn":32,"../encoding/bufferwriter":41,"../errors":43,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:150,lodash:269}],62:[function(require,module,exports){(function(Buffer){"use strict";function sign(transaction,privateKey,sighashType,inputIndex,subscript){var hashbuf=sighash(transaction,sighashType,inputIndex,subscript);return ECDSA.sign(hashbuf,privateKey,"little").set({nhashtype:sighashType})}function verify(transaction,signature,publicKey,inputIndex,subscript){$.checkArgument(!_.isUndefined(transaction)),$.checkArgument(!_.isUndefined(signature)&&!_.isUndefined(signature.nhashtype));var hashbuf=sighash(transaction,signature.nhashtype,inputIndex,subscript);return ECDSA.verify(hashbuf,signature,publicKey,"little")}var buffer=require("buffer"),Signature=require("../crypto/signature"),Script=require("../script"),Output=require("./output"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),BN=require("../crypto/bn"),Hash=require("../crypto/hash"),ECDSA=require("../crypto/ecdsa"),$=require("../util/preconditions"),_=require("lodash"),sighash=function(transaction,sighashType,inputNumber,subscript){var i,Transaction=require("./transaction"),Input=require("./input"),txcopy=Transaction.shallowCopy(transaction);for(subscript=new Script(subscript),subscript.removeCodeseparators(),i=0;i=txcopy.outputs.length)return new Buffer("0000000000000000000000000000000000000000000000000000000000000001","hex");for(txcopy.outputs.length=inputNumber+1,i=0;imaximumFee)return this._missingChange()?new errors.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new errors.Transaction.FeeError.TooLarge("expected less than "+maximumFee+" but got "+unspent)}if(!opts.disableSmallFees){var minimumFee=Math.ceil(this._estimateFee()/Transaction.FEE_SECURITY_MARGIN);if(unspent"},Transaction.prototype.toBuffer=function(){var writer=new BufferWriter;return this.toBufferWriter(writer).toBuffer()},Transaction.prototype.toBufferWriter=function(writer){return writer.writeInt32LE(this.version),writer.writeVarintNum(this.inputs.length),_.each(this.inputs,function(input){input.toBufferWriter(writer)}),writer.writeVarintNum(this.outputs.length),_.each(this.outputs,function(output){output.toBufferWriter(writer)}),writer.writeUInt32LE(this.nLockTime),writer},Transaction.prototype.fromBuffer=function(buffer){var reader=new BufferReader(buffer);return this.fromBufferReader(reader)},Transaction.prototype.fromBufferReader=function(reader){$.checkArgument(!reader.finished(),"No transaction data received");var i,sizeTxIns,sizeTxOuts;for(this.version=reader.readInt32LE(),sizeTxIns=reader.readVarintNum(),i=0;i=Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new errors.Transaction.BlockHeightTooHigh;if(height<0)throw new errors.Transaction.NLockTimeOutOfRange;for(var i=0;i0?(this._changeIndex=this.outputs.length,this._addOutput(new Output({script:this._changeScript,satoshis:changeAmount}))):this._changeIndex=void 0}},Transaction.prototype.getFee=function(){return this.isCoinbase()?0:_.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},Transaction.prototype._estimateFee=function(){var estimatedSize=this._estimateSize(),available=this._getUnspentValue();return Transaction._estimateFee(estimatedSize,available,this._feePerKb)},Transaction.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},Transaction.prototype._clearSignatures=function(){_.each(this.inputs,function(input){input.clearSignatures()})},Transaction._estimateFee=function(size,amountAvailable,feePerKb){return amountAvailable>Math.ceil(size/1e3)*(feePerKb||Transaction.FEE_PER_KB)&&(size+=Transaction.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(size/1e3)*(feePerKb||Transaction.FEE_PER_KB)},Transaction.prototype._estimateSize=function(){var result=Transaction.MAXIMUM_EXTRA_SIZE;return _.each(this.inputs,function(input){result+=input._estimateSize()}),_.each(this.outputs,function(output){result+=output.script.toBuffer().length+9}),result},Transaction.prototype._removeOutput=function(index){var output=this.outputs[index];this.outputs=_.without(this.outputs,output),this._outputAmount=void 0},Transaction.prototype.removeOutput=function(index){this._removeOutput(index),this._updateChangeOutput()},Transaction.prototype.sort=function(){return this.sortInputs(function(inputs){var copy=Array.prototype.concat.apply([],inputs);return copy.sort(function(first,second){return compare(first.prevTxId,second.prevTxId)||first.outputIndex-second.outputIndex}),copy}),this.sortOutputs(function(outputs){var copy=Array.prototype.concat.apply([],outputs);return copy.sort(function(first,second){return first.satoshis-second.satoshis||compare(first.script.toBuffer(),second.script.toBuffer())}),copy}),this},Transaction.prototype.shuffleOutputs=function(){return this.sortOutputs(_.shuffle)},Transaction.prototype.sortOutputs=function(sortingFunction){var outs=sortingFunction(this.outputs);return this._newOutputOrder(outs)},Transaction.prototype.sortInputs=function(sortingFunction){return this.inputs=sortingFunction(this.inputs),this._clearSignatures(),this},Transaction.prototype._newOutputOrder=function(newOutputs){if(this.outputs.length!==newOutputs.length||0!==_.difference(this.outputs,newOutputs).length)throw new errors.Transaction.InvalidSorting;if(!_.isUndefined(this._changeIndex)){var changeOutput=this.outputs[this._changeIndex];this._changeIndex=_.findIndex(newOutputs,changeOutput)}return this.outputs=newOutputs,this},Transaction.prototype.removeInput=function(txId,outputIndex){var index;if((index=!outputIndex&&_.isNumber(txId)?txId:_.findIndex(this.inputs,function(input){return input.prevTxId.toString("hex")===txId&&input.outputIndex===outputIndex}))<0||index>=this.inputs.length)throw new errors.Transaction.InvalidIndex(index,this.inputs.length);var input=this.inputs[index];this.inputs=_.without(this.inputs,input),this._inputAmount=void 0,this._updateChangeOutput()},Transaction.prototype.sign=function(privateKey,sigtype){$.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var self=this;return _.isArray(privateKey)?(_.each(privateKey,function(privateKey){self.sign(privateKey,sigtype)}),this):(_.each(this.getSignatures(privateKey,sigtype),function(signature){self.applySignature(signature)}),this)},Transaction.prototype.getSignatures=function(privKey,sigtype){privKey=new PrivateKey(privKey),sigtype=sigtype||Signature.SIGHASH_ALL;var transaction=this,results=[],hashData=Hash.sha256ripemd160(privKey.publicKey.toBuffer());return _.each(this.inputs,function(input,index){_.each(input.getSignatures(transaction,privKey,index,sigtype,hashData),function(signature){results.push(signature)})}),results},Transaction.prototype.applySignature=function(signature){return this.inputs[signature.inputIndex].addSignature(this,signature),this},Transaction.prototype.isFullySigned=function(){return _.each(this.inputs,function(input){if(input.isFullySigned===Input.prototype.isFullySigned)throw new errors.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),_.every(_.map(this.inputs,function(input){return input.isFullySigned()}))},Transaction.prototype.isValidSignature=function(signature){var self=this;if(this.inputs[signature.inputIndex].isValidSignature===Input.prototype.isValidSignature)throw new errors.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[signature.inputIndex].isValidSignature(self,signature)},Transaction.prototype.verifySignature=function(sig,pubkey,nin,subscript){return Sighash.verify(this,sig,pubkey,nin,subscript)},Transaction.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var valueoutbn=new BN(0),i=0;i1e6)return"transaction over the maximum block size";var txinmap={};for(i=0;i100)return"coinbase transaction script size invalid"}else for(i=0;i=Input.MAXINT-1&&(input.sequenceNumber=Input.DEFAULT_RBF_SEQNUMBER)}return this},module.exports=Transaction}).call(this,require("buffer").Buffer)},{"../address":27,"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../privatekey":49,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./input":55,"./output":61,"./sighash":62,"./unspentoutput":65,buffer:150,"buffer-compare":148,lodash:269}],65:[function(require,module,exports){"use strict";function UnspentOutput(data){if(!(this instanceof UnspentOutput))return new UnspentOutput(data);$.checkArgument(_.isObject(data),"Must provide an object from where to extract data");var address=data.address?new Address(data.address):void 0,txId=data.txid?data.txid:data.txId;if(!txId||!JSUtil.isHexaString(txId)||txId.length>64)throw new Error("Invalid TXID in object",data);var outputIndex=_.isUndefined(data.vout)?data.outputIndex:data.vout;if(!_.isNumber(outputIndex))throw new Error("Invalid outputIndex, received "+outputIndex);$.checkArgument(!_.isUndefined(data.scriptPubKey)||!_.isUndefined(data.script),"Must provide the scriptPubKey for that output!");var script=new Script(data.scriptPubKey||data.script);$.checkArgument(!_.isUndefined(data.amount)||!_.isUndefined(data.satoshis),"Must provide an amount for the output");var amount=_.isUndefined(data.amount)?data.satoshis:new Unit.fromBTC(data.amount).toSatoshis();$.checkArgument(_.isNumber(amount),"Amount must be a number"),JSUtil.defineImmutable(this,{address:address,txId:txId,outputIndex:outputIndex,script:script,satoshis:amount})}var _=require("lodash"),$=require("../util/preconditions"),JSUtil=require("../util/js"),Script=require("../script"),Address=require("../address"),Unit=require("../unit");UnspentOutput.prototype.inspect=function(){return""},UnspentOutput.prototype.toString=function(){return this.txId+":"+this.outputIndex},UnspentOutput.fromObject=function(data){return new UnspentOutput(data)},UnspentOutput.prototype.toObject=UnspentOutput.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Unit.fromSatoshis(this.satoshis).toBTC()}},module.exports=UnspentOutput},{"../address":27,"../script":51,"../unit":66,"../util/js":69,"../util/preconditions":70,lodash:269}],66:[function(require,module,exports){"use strict";function Unit(amount,code){if(!(this instanceof Unit))return new Unit(amount,code);if(_.isNumber(code)){if(code<=0)throw new errors.Unit.InvalidRate(code);amount/=code,code=Unit.BTC}this._value=this._from(amount,code);var self=this,defineAccesor=function(key){Object.defineProperty(self,key,{get:function(){return self.to(key)},enumerable:!0})};Object.keys(UNITS).forEach(defineAccesor)}var _=require("lodash"),errors=require("./errors"),$=require("./util/preconditions"),UNITS={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(UNITS).forEach(function(key){Unit[key]=key}),Unit.fromObject=function(data){return $.checkArgument(_.isObject(data),"Argument is expected to be an object"),new Unit(data.amount,data.code)},Unit.fromBTC=function(amount){return new Unit(amount,Unit.BTC)},Unit.fromMillis=Unit.fromMilis=function(amount){return new Unit(amount,Unit.mBTC)},Unit.fromMicros=Unit.fromBits=function(amount){return new Unit(amount,Unit.bits)},Unit.fromSatoshis=function(amount){return new Unit(amount,Unit.satoshis)},Unit.fromFiat=function(amount,rate){return new Unit(amount,rate)},Unit.prototype._from=function(amount,code){if(!UNITS[code])throw new errors.Unit.UnknownCode(code);return parseInt((amount*UNITS[code][0]).toFixed())},Unit.prototype.to=function(code){if(_.isNumber(code)){if(code<=0)throw new errors.Unit.InvalidRate(code);return parseFloat((this.BTC*code).toFixed(2))}if(!UNITS[code])throw new errors.Unit.UnknownCode(code);var value=this._value/UNITS[code][0];return parseFloat(value.toFixed(UNITS[code][1]))},Unit.prototype.toBTC=function(){return this.to(Unit.BTC)},Unit.prototype.toMillis=Unit.prototype.toMilis=function(){return this.to(Unit.mBTC)},Unit.prototype.toMicros=Unit.prototype.toBits=function(){return this.to(Unit.bits)},Unit.prototype.toSatoshis=function(){return this.to(Unit.satoshis)},Unit.prototype.atRate=function(rate){return this.to(rate)},Unit.prototype.toString=function(){return this.satoshis+" satoshis"},Unit.prototype.toObject=Unit.prototype.toJSON=function(){return{amount:this.BTC,code:Unit.BTC}},Unit.prototype.inspect=function(){return""},module.exports=Unit},{"./errors":43,"./util/preconditions":70,lodash:269}],67:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_=require("lodash"),URL=require("url"),Address=require("./address"),Unit=require("./unit"),URI=function URI(data,knownParams){if(!(this instanceof URI))return new URI(data,knownParams);if(this.extras={},this.knownParams=knownParams||[],this.address=this.network=this.amount=this.message=null,"string"==typeof data){var params=URI.parse(data);params.amount&&(params.amount=this._parseAmount(params.amount)),this._fromObject(params)}else{if("object"!==(void 0===data?"undefined":_typeof(data)))throw new TypeError("Unrecognized data format.");this._fromObject(data)}};URI.fromString=function(str){if("string"!=typeof str)throw new TypeError("Expected a string");return new URI(str)},URI.fromObject=function(json){return new URI(json)},URI.isValid=function(arg,knownParams){try{new URI(arg,knownParams)}catch(err){return!1}return!0},URI.parse=function(uri){var info=URL.parse(uri,!0);if("bitcoin:"!==info.protocol)throw new TypeError("Invalid bitcoin URI");var group=/[^:]*:\/?\/?([^?]*)/.exec(uri);return info.query.address=group&&group[1]||void 0,info.query},URI.Members=["address","amount","message","label","r"],URI.prototype._fromObject=function(obj){if(!Address.isValid(obj.address))throw new TypeError("Invalid bitcoin address");this.address=new Address(obj.address),this.network=this.address.network,this.amount=obj.amount;for(var key in obj)if("address"!==key&&"amount"!==key){if(/^req-/.exec(key)&&-1===this.knownParams.indexOf(key))throw Error("Unknown required argument "+key);var destination=URI.Members.indexOf(key)>-1?this:this.extras;destination[key]=obj[key]}},URI.prototype._parseAmount=function(amount){if(amount=Number(amount),isNaN(amount))throw new TypeError("Invalid amount");return Unit.fromBTC(amount).toSatoshis()},URI.prototype.toObject=URI.prototype.toJSON=function(){for(var json={},i=0;i"},module.exports=URI},{"./address":27,"./unit":66,lodash:269,url:350}],68:[function(require,module,exports){(function(Buffer){"use strict";function equals(a,b){if(a.length!==b.length)return!1;for(var length=a.length,i=0;i>24&255),bytes.push(integer>>16&255),bytes.push(integer>>8&255),bytes.push(255&integer),new Buffer(bytes)},integerFromBuffer:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer[0]<<24|buffer[1]<<16|buffer[2]<<8|buffer[3]},integerFromSingleByteBuffer:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer[0]},bufferToHex:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer.toString("hex")},reverse:function(param){for(var ret=new buffer.Buffer(param.length),i=0;i=0}}},{lodash:269}],70:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},errors=require("../errors"),_=require("lodash");module.exports={checkState:function(condition,message){if(!condition)throw new errors.InvalidState(message)},checkArgument:function(condition,argumentName,message,docsPath){if(!condition)throw new errors.InvalidArgument(argumentName,message,docsPath)},checkArgumentType:function(argument,type,argumentName){if(argumentName=argumentName||"(unknown name)",_.isString(type)){if("Buffer"===type){var buffer=require("buffer");if(!buffer.Buffer.isBuffer(argument))throw new errors.InvalidArgumentType(argument,type,argumentName)}else if((void 0===argument?"undefined":_typeof(argument))!==type)throw new errors.InvalidArgumentType(argument,type,argumentName)}else if(!(argument instanceof type))throw new errors.InvalidArgumentType(argument,type.name,argumentName)}}},{"../errors":43,buffer:150,lodash:269}],71:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec"),elliptic.eddsa=require("./elliptic/eddsa")},{"../package.json":86,"./elliptic/curve":74,"./elliptic/curves":77,"./elliptic/ec":78,"./elliptic/eddsa":81,"./elliptic/utils":85,brorand:100}],72:[function(require,module,exports){"use strict";function BaseCurve(type,conf){this.type=type,this.p=new BN(conf.p,16),this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p),this.zero=new BN(0).toRed(this.red),this.one=new BN(1).toRed(this.red),this.two=new BN(2).toRed(this.red),this.n=conf.n&&new BN(conf.n,16),this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var adjustCount=this.n&&this.p.div(this.n);!adjustCount||adjustCount.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(curve,type){this.curve=curve,this.type=type,this.precomputed=null}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,getNAF=utils.getNAF,getJSF=utils.getJSF,assert=utils.assert;module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(p,k){assert(p.precomputed);var doubles=p._getDoubles(),naf=getNAF(k,1),I=(1<=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}for(var a=this.jpoint(null,null,null),b=this.jpoint(null,null,null),i=I;i>0;i--){for(var j=0;j=0;i--){for(var k=0;i>=0&&0===naf[i];i--)k++;if(i>=0&&k++,acc=acc.dblp(k),i<0)break;var z=naf[i];assert(0!==z),acc="affine"===p.type?z>0?acc.mixedAdd(wnd[z-1>>1]):acc.mixedAdd(wnd[-z-1>>1].neg()):z>0?acc.add(wnd[z-1>>1]):acc.add(wnd[-z-1>>1].neg())}return"affine"===p.type?acc.toP():acc},BaseCurve.prototype._wnafMulAdd=function(defW,points,coeffs,len,jacobianResult){for(var wndWidth=this._wnafT1,wnd=this._wnafT2,naf=this._wnafT3,max=0,i=0;i=1;i-=2){var a=i-1,b=i;if(1===wndWidth[a]&&1===wndWidth[b]){var comb=[points[a],null,null,points[b]];0===points[a].y.cmp(points[b].y)?(comb[1]=points[a].add(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg())):0===points[a].y.cmp(points[b].y.redNeg())?(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].add(points[b].neg())):(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg()));var index=[-3,-1,-5,-7,0,7,5,1,3],jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max),naf[a]=new Array(max),naf[b]=new Array(max);for(var j=0;j=0;i--){for(var k=0;i>=0;){for(var zero=!0,j=0;j=0&&k++,acc=acc.dblp(k),i<0)break;for(var j=0;j0?p=wnd[j][z-1>>1]:z<0&&(p=wnd[j][-z-1>>1].neg()),acc="affine"===p.type?acc.mixedAdd(p):acc.add(p))}}for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)},BasePoint.prototype._getDoubles=function(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var doubles=[this],acc=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),g=d.redAdd(b),f=g.redSub(c),h=d.redSub(b),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projDbl=function(){var nx,ny,nz,b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var e=this.curve._mulA(c),f=e.redAdd(d);if(this.zOne)nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)),ny=f.redMul(e.redSub(d)),nz=f.redSqr().redSub(f).redSub(f);else{var h=this.z.redSqr(),j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j),ny=f.redMul(e.redSub(d)),nz=f.redMul(j)}}else{var e=c.redAdd(d),h=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j),ny=this.curve._mulC(e).redMul(c.redISub(d)),nz=e.redMul(j)}return this.curve.point(nx,ny,nz)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),c=this.t.redMul(this.curve.dd).redMul(p.t),d=this.z.redMul(p.z.redAdd(p.z)),e=b.redSub(a),f=d.redSub(c),g=d.redAdd(c),h=b.redAdd(a),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projAdd=function(p){var ny,nz,a=this.z.redMul(p.z),b=a.redSqr(),c=this.x.redMul(p.x),d=this.y.redMul(p.y),e=this.curve.d.redMul(c).redMul(d),f=b.redSub(e),g=b.redAdd(e),tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),nx=a.redMul(f).redMul(tmp);return this.curve.twisted?(ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c))),nz=f.redMul(g)):(ny=a.redMul(g).redMul(d.redSub(c)),nz=this.curve._mulC(f).redMul(g)),this.curve.point(nx,ny,nz)},Point.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},Point.prototype.mul=function(k){return this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!1)},Point.prototype.jmulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var zi=this.z.redInvm();return this.x=this.x.redMul(zi),this.y=this.y.redMul(zi),this.t&&(this.t=this.t.redMul(zi)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(other){return this===other||0===this.getX().cmp(other.getX())&&0===this.getY().cmp(other.getY())},Point.prototype.eqXToP=function(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(rx))return!0;for(var xc=x.clone(),t=this.curve.redN.redMul(this.z);;){if(xc.iadd(this.curve.n),xc.cmp(this.curve.p)>=0)return!1;if(rx.redIAdd(t),0===this.x.cmp(rx))return!0}return!1},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:258}],74:[function(require,module,exports){"use strict";var curve=exports;curve.base=require("./base"),curve.short=require("./short"),curve.mont=require("./mont"),curve.edwards=require("./edwards")},{"./base":72,"./edwards":73,"./mont":75,"./short":76}],75:[function(require,module,exports){"use strict";function MontCurve(conf){Base.call(this,"mont",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.i4=new BN(4).toRed(this.red).redInvm(),this.two=new BN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective"),null===x&&null===z?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN(x,16),this.z=new BN(z,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var curve=require("../curve"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,elliptic=require("../../elliptic"),utils=elliptic.utils;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(point){var x=point.normalize().x,x2=x.redSqr(),rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);return 0===rhs.redSqrt().redSqr().cmp(rhs)},inherits(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(bytes,enc){return this.point(utils.toArray(bytes,enc),1)},MontCurve.prototype.point=function(x,z){return new Point(this,x,z)},MontCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var a=this.x.redAdd(this.z),aa=a.redSqr(),b=this.x.redSub(this.z),bb=b.redSqr(),c=aa.redSub(bb),nx=aa.redMul(bb),nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(p,diff){var a=this.x.redAdd(this.z),b=this.x.redSub(this.z),c=p.x.redAdd(p.z),d=p.x.redSub(p.z),da=d.redMul(a),cb=c.redMul(b),nx=diff.z.redMul(da.redAdd(cb).redSqr()),nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)},Point.prototype.mul=function(k){for(var t=k.clone(),a=this,b=this.curve.point(null,null),c=this,bits=[];0!==t.cmpn(0);t.iushrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--)0===bits[i]?(a=a.diffAdd(b,c),b=b.dbl()):(b=a.diffAdd(b,c),a=a.dbl());return b},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.eq=function(other){return 0===this.getX().cmp(other.getX())},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:258}],76:[function(require,module,exports){"use strict";function ShortCurve(conf){Base.call(this,"short",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(conf),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine"),null===x&&null===y?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN(x,16),this.y=new BN(y,16),isRed&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian"),null===x&&null===y&&null===z?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN(0)):(this.x=new BN(x,16),this.y=new BN(y,16),this.z=new BN(z,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var curve=require("../curve"),elliptic=require("../../elliptic"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,assert=elliptic.utils.assert;inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(conf){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var beta,lambda;if(conf.beta)beta=new BN(conf.beta,16).toRed(this.red);else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1],beta=beta.toRed(this.red)}if(conf.lambda)lambda=new BN(conf.lambda,16);else{var lambdas=this._getEndoRoots(this.n);0===this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))?lambda=lambdas[0]:(lambda=lambdas[1],assert(0===this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))))}var basis;return basis=conf.basis?conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}}):this._getEndoBasis(lambda),{beta:beta,lambda:lambda,basis:basis}}},ShortCurve.prototype._getEndoRoots=function(num){var red=num===this.p?this.red:BN.mont(num),tinv=new BN(2).toRed(red).redInvm(),ntinv=tinv.redNeg(),s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);return[ntinv.redAdd(s).fromRed(),ntinv.redSub(s).fromRed()]},ShortCurve.prototype._getEndoBasis=function(lambda){for(var a0,b0,a1,b1,a2,b2,prevR,r,x,aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=lambda,v=this.n.clone(),x1=new BN(1),y1=new BN(0),x2=new BN(0),y2=new BN(1),i=0;0!==u.cmpn(0);){var q=v.div(u);r=v.sub(q.mul(u)),x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0)a0=prevR.neg(),b0=x1,a1=r.neg(),b1=x;else if(a1&&2==++i)break;prevR=r,v=u,u=r,x2=x1,x1=x,y2=y1,y1=y}a2=r.neg(),b2=x;var len1=a1.sqr().add(b1.sqr());return a2.sqr().add(b2.sqr()).cmp(len1)>=0&&(a2=a0,b2=b0),a1.negative&&(a1=a1.neg(),b1=b1.neg()),a2.negative&&(a2=a2.neg(),b2=b2.neg()),[{a:a1,b:b1},{a:a2,b:b2}]},ShortCurve.prototype._endoSplit=function(k){var basis=this.endo.basis,v1=basis[0],v2=basis[1],c1=v2.b.mul(k).divRound(this.n),c2=v1.b.neg().mul(k).divRound(this.n),p1=c1.mul(v1.a),p2=c2.mul(v2.a),q1=c1.mul(v1.b),q2=c2.mul(v2.b);return{k1:k.sub(p1).sub(p2),k2:q1.add(q2).neg()}},ShortCurve.prototype.pointFromX=function(x,odd){x=new BN(x,16),x.red||(x=x.toRed(this.red));var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),y=y2.redSqrt();if(0!==y.redSqr().redSub(y2).cmp(this.zero))throw new Error("invalid point");var isOdd=y.fromRed().isOdd();return(odd&&!isOdd||!odd&&isOdd)&&(y=y.redNeg()),this.point(x,y)},ShortCurve.prototype.validate=function(point){if(point.inf)return!0;var x=point.x,y=point.y,ax=this.a.redMul(x),rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return 0===y.redSqr().redISub(rhs).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(points,coeffs,jacobianResult){for(var npoints=this._endoWnafT1,ncoeffs=this._endoWnafT2,i=0;i":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(0===this.x.cmp(p.x))return this.curve.point(null,null);var c=this.y.redSub(p.y);0!==c.cmpn(0)&&(c=c.redMul(this.x.redSub(p.x).redInvm()));var nx=c.redSqr().redISub(this.x).redISub(p.x),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.dbl=function(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(0===ys1.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,x2=this.x.redSqr(),dyinv=ys1.redInvm(),c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv),nx=c.redSqr().redISub(this.x.redAdd(this.x)),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(k){return k=new BN(k,16),this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve.endo?this.curve._endoWnafMulAdd([this],[k]):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs):this.curve._wnafMulAdd(1,points,coeffs,2)},Point.prototype.jmulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs,!0):this.curve._wnafMulAdd(1,points,coeffs,2,!0)},Point.prototype.eq=function(p){return this===p||this.inf===p.inf&&(this.inf||0===this.x.cmp(p.x)&&0===this.y.cmp(p.y))},Point.prototype.neg=function(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed,negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(x,y,z){return new JPoint(this,x,y,z)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm(),zinv2=zinv.redSqr(),ax=this.x.redMul(zinv2),ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr(),z2=this.z.redSqr(),u1=this.x.redMul(pz2),u2=p.x.redMul(z2),s1=this.y.redMul(pz2.redMul(p.z)),s2=p.y.redMul(z2.redMul(this.z)),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mixedAdd=function(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr(),u1=this.x,u2=p.x.redMul(z2),s1=this.y,s2=p.y.redMul(z2).redMul(this.z),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.dblp=function(pow){if(0===pow)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,i=0;i=0)return!1;if(rx.redIAdd(t),0===this.x.cmp(rx))return!0}return!1},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:258}],77:[function(require,module,exports){"use strict";function PresetCurve(options){"short"===options.type?this.curve=new elliptic.curve.short(options):"edwards"===options.type?this.curve=new elliptic.curve.edwards(options):this.curve=new elliptic.curve.mont(options),this.g=this.curve.g,this.n=this.curve.n,this.hash=options.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,get:function(){var curve=new PresetCurve(options);return Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,value:curve}),curve}})}var curves=exports,hash=require("hash.js"),elliptic=require("../elliptic"),assert=elliptic.utils.assert;curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"../elliptic":71,"./precomputed/secp256k1":84,"hash.js":242}],78:[function(require,module,exports){"use strict";function EC(options){if(!(this instanceof EC))return new EC(options);"string"==typeof options&&(assert(elliptic.curves.hasOwnProperty(options),"Unknown curve "+options),options=elliptic.curves[options]),options instanceof elliptic.curves.PresetCurve&&(options={curve:options}),this.curve=options.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=options.curve.g,this.g.precompute(options.curve.n.bitLength()+1),this.hash=options.hash||options.curve.hash}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},BN=require("bn.js"),HmacDRBG=require("hmac-drbg"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(options){return new KeyPair(this,options)},EC.prototype.keyFromPrivate=function(priv,enc){return KeyPair.fromPrivate(this,priv,enc)},EC.prototype.keyFromPublic=function(pub,enc){return KeyPair.fromPublic(this,pub,enc)},EC.prototype.genKeyPair=function(options){options||(options={});for(var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||elliptic.rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()}),bytes=this.n.byteLength(),ns2=this.n.sub(new BN(2));;){var priv=new BN(drbg.generate(bytes));if(!(priv.cmp(ns2)>0))return priv.iaddn(1),this.keyFromPrivate(priv)}},EC.prototype._truncateToN=function(msg,truncOnly){var delta=8*msg.byteLength()-this.n.bitLength();return delta>0&&(msg=msg.ushrn(delta)),!truncOnly&&msg.cmp(this.n)>=0?msg.sub(this.n):msg},EC.prototype.sign=function(msg,key,enc,options){"object"===(void 0===enc?"undefined":_typeof(enc))&&(options=enc,enc=null),options||(options={}),key=this.keyFromPrivate(key,enc),msg=this._truncateToN(new BN(msg,16));for(var bytes=this.n.byteLength(),bkey=key.getPrivate().toArray("be",bytes),nonce=msg.toArray("be",bytes),drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce:nonce,pers:options.pers,persEnc:options.persEnc||"utf8"}),ns1=this.n.sub(new BN(1)),iter=0;!0;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));if(k=this._truncateToN(k,!0),!(k.cmpn(1)<=0||k.cmp(ns1)>=0)){var kp=this.g.mul(k);if(!kp.isInfinity()){var kpX=kp.getX(),r=kpX.umod(this.n);if(0!==r.cmpn(0)){var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));if(s=s.umod(this.n),0!==s.cmpn(0)){var recoveryParam=(kp.getY().isOdd()?1:0)|(0!==kpX.cmp(r)?2:0);return options.canonical&&s.cmp(this.nh)>0&&(s=this.n.sub(s),recoveryParam^=1),new Signature({r:r,s:s,recoveryParam:recoveryParam})}}}}}},EC.prototype.verify=function(msg,signature,key,enc){msg=this._truncateToN(new BN(msg,16)),key=this.keyFromPublic(key,enc),signature=new Signature(signature,"hex");var r=signature.r,s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var sinv=s.invm(this.n),u1=sinv.mul(msg).umod(this.n),u2=sinv.mul(r).umod(this.n);if(!this.curve._maxwellTrick){var p=this.g.mulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&0===p.getX().umod(this.n).cmp(r)}var p=this.g.jmulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&p.eqXToP(r)},EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits"),signature=new Signature(signature,enc);var n=this.n,e=new BN(msg),r=signature.r,s=signature.s,isYOdd=1&j,isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");r=isSecondKey?this.curve.pointFromX(r.add(this.curve.n),isYOdd):this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n),s1=n.sub(e).mul(rInv).umod(n),s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)},EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){if(signature=new Signature(signature,enc),null!==signature.recoveryParam)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i)}catch(e){continue}if(Qprime.eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":71,"./key":79,"./signature":80,"bn.js":99,"hmac-drbg":255}],79:[function(require,module,exports){"use strict";function KeyPair(ec,options){this.ec=ec,this.priv=null,this.pub=null,options.priv&&this._importPrivate(options.priv,options.privEnc),options.pub&&this._importPublic(options.pub,options.pubEnc)}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=KeyPair,KeyPair.fromPublic=function(ec,pub,enc){return pub instanceof KeyPair?pub:new KeyPair(ec,{pub:pub,pubEnc:enc})},KeyPair.fromPrivate=function(ec,priv,enc){return priv instanceof KeyPair?priv:new KeyPair(ec,{priv:priv,privEnc:enc})},KeyPair.prototype.validate=function(){var pub=this.getPublic();return pub.isInfinity()?{result:!1,reason:"Invalid public key"}:pub.validate()?pub.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(compact,enc){return"string"==typeof compact&&(enc=compact,compact=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),enc?this.pub.encode(enc,compact):this.pub},KeyPair.prototype.getPrivate=function(enc){return"hex"===enc?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(key,enc){this.priv=new BN(key,enc||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(key,enc){if(key.x||key.y)return"mont"===this.ec.curve.type?assert(key.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert(key.x&&key.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(key.x,key.y));this.pub=this.ec.curve.decodePoint(key,enc)},KeyPair.prototype.derive=function(pub){return pub.mul(this.priv).getX()},KeyPair.prototype.sign=function(msg,enc,options){return this.ec.sign(msg,this,enc,options)},KeyPair.prototype.verify=function(msg,signature){return this.ec.verify(msg,signature,this)},KeyPair.prototype.inspect=function(){return""}},{"../../elliptic":71,"bn.js":99}],80:[function(require,module,exports){"use strict";function Signature(options,enc){if(options instanceof Signature)return options;this._importDER(options,enc)||(assert(options.r&&options.s,"Signature without r or s"),this.r=new BN(options.r,16),this.s=new BN(options.s,16),void 0===options.recoveryParam?this.recoveryParam=null:this.recoveryParam=options.recoveryParam)}function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(128&initial))return initial;for(var octetLen=15&initial,val=0,i=0,off=p.place;i>>3);for(arr.push(128|octets);--octets;)arr.push(len>>>(octets<<3)&255);arr.push(len)}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=Signature,Signature.prototype._importDER=function(data,enc){data=utils.toArray(data,enc);var p=new Position;if(48!==data[p.place++])return!1;if(getLength(data,p)+p.place!==data.length)return!1;if(2!==data[p.place++])return!1;var rlen=getLength(data,p),r=data.slice(p.place,rlen+p.place);if(p.place+=rlen,2!==data[p.place++])return!1;var slen=getLength(data,p);if(data.length!==slen+p.place)return!1;var s=data.slice(p.place,slen+p.place);return 0===r[0]&&128&r[1]&&(r=r.slice(1)),0===s[0]&&128&s[1]&&(s=s.slice(1)),this.r=new BN(r),this.s=new BN(s),this.recoveryParam=null,!0},Signature.prototype.toDER=function(enc){var r=this.r.toArray(),s=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&s[0]&&(s=[0].concat(s)),r=rmPadding(r),s=rmPadding(s);!(s[0]||128&s[1]);)s=s.slice(1);var arr=[2];constructLength(arr,r.length),arr=arr.concat(r),arr.push(2),constructLength(arr,s.length);var backHalf=arr.concat(s),res=[48];return constructLength(res,backHalf.length),res=res.concat(backHalf),utils.encode(res,enc)}},{"../../elliptic":71,"bn.js":99}],81:[function(require,module,exports){"use strict";function EDDSA(curve){if(assert("ed25519"===curve,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(curve);var curve=elliptic.curves[curve].curve;this.curve=curve,this.g=curve.g,this.g.precompute(curve.n.bitLength()+1),this.pointClass=curve.point().constructor,this.encodingLength=Math.ceil(curve.n.bitLength()/8),this.hash=hash.sha512}var hash=require("hash.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require("./key"),Signature=require("./signature");module.exports=EDDSA,EDDSA.prototype.sign=function(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret),r=this.hashInt(key.messagePrefix(),message),R=this.g.mul(r),Rencoded=this.encodePoint(R),s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv()),S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded})},EDDSA.prototype.verify=function(message,sig,pub){message=parseBytes(message),sig=this.makeSignature(sig);var key=this.keyFromPublic(pub),h=this.hashInt(sig.Rencoded(),key.pubBytes(),message),SG=this.g.mul(sig.S());return sig.R().add(key.pub().mul(h)).eq(SG)},EDDSA.prototype.hashInt=function(){for(var hash=this.hash(),i=0;i=0;){var z;if(k.isOdd()){var mod=k.andln(ws-1);z=mod>(ws>>1)-1?(ws>>1)-mod:mod,k.isubn(z)}else z=0;naf.push(z);for(var shift=0!==k.cmpn(0)&&0===k.andln(ws-1)?w+1:1,i=1;i0||k2.cmpn(-d2)>0;){var m14=k1.andln(3)+d1&3,m24=k2.andln(3)+d2&3;3===m14&&(m14=-1),3===m24&&(m24=-1);var u1;if(0==(1&m14))u1=0;else{var m8=k1.andln(7)+d1&7;u1=3!==m8&&5!==m8||2!==m24?m14:-m14}jsf[0].push(u1);var u2;if(0==(1&m24))u2=0;else{var m8=k2.andln(7)+d2&7;u2=3!==m8&&5!==m8||2!==m14?m24:-m24}jsf[1].push(u2),2*d1===u1+1&&(d1=1-d1),2*d2===u2+1&&(d2=1-d2),k1.iushrn(1),k2.iushrn(1)}return jsf}function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function(){return void 0!==this[key]?this[key]:this[key]=computer.call(this)}}function parseBytes(bytes){return"string"==typeof bytes?utils.toArray(bytes,"hex"):bytes}function intFromLE(bytes){return new BN(bytes,"hex","le")}var utils=exports,BN=require("bn.js"),minAssert=require("minimalistic-assert"),minUtils=require("minimalistic-crypto-utils");utils.assert=minAssert,utils.toArray=minUtils.toArray,utils.zero2=minUtils.zero2,utils.toHex=minUtils.toHex,utils.encode=minUtils.encode,utils.getNAF=getNAF,utils.getJSF=getJSF,utils.cachedProperty=cachedProperty,utils.parseBytes=parseBytes,utils.intFromLE=intFromLE},{"bn.js":99,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],86:[function(require,module,exports){module.exports={_args:[["elliptic@6.4.0","/home/chris/dev/eth-lightwallet"]],_from:"elliptic@6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/bitcore-lib/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.0",saveSpec:null,fetchSpec:"6.4.0"},_requiredBy:["/bitcore-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_spec:"6.4.0",_where:"/home/chris/dev/eth-lightwallet",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],87:[function(require,module,exports){module.exports={_args:[["bitcore-lib@0.15.0","/home/chris/dev/eth-lightwallet"]],_from:"bitcore-lib@0.15.0",_id:"bitcore-lib@0.15.0",_inBundle:!1,_integrity:"sha512-AeXLWhiivF6CDFzrABZHT4jJrflyylDWTi32o30rF92HW9msfuKpjzrHtFKYGa9w0kNVv5HABQjCB3OEav4PhQ==",_location:"/bitcore-lib",_phantomChildren:{"bn.js":"4.11.8",brorand:"1.1.0","hash.js":"1.1.3","hmac-drbg":"1.0.1",inherits:"2.0.1","minimalistic-assert":"1.0.0","minimalistic-crypto-utils":"1.0.1"},_requested:{type:"version",registry:!0,raw:"bitcore-lib@0.15.0",name:"bitcore-lib",escapedName:"bitcore-lib",rawSpec:"0.15.0",saveSpec:null,fetchSpec:"0.15.0"},_requiredBy:["/bitcore-mnemonic"],_resolved:"https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-0.15.0.tgz",_spec:"0.15.0",_where:"/home/chris/dev/eth-lightwallet",author:{name:"BitPay",email:"dev@bitpay.com"},browser:{request:"browser-request"},bugs:{url:"https://github.com/bitpay/bitcore-lib/issues"},dependencies:{"bn.js":"=4.11.8",bs58:"=4.0.1","buffer-compare":"=1.1.1",elliptic:"=6.4.0",inherits:"=2.0.1",lodash:"=4.17.4"},description:"A pure and powerful JavaScript Bitcoin library.",devDependencies:{"bitcore-build":"git+https://github.com/bitpay/bitcore-build.git#d4e8b2b2f1e2c065c3a807dcb6a6250f61d67ab3",brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0"},homepage:"https://github.com/bitpay/bitcore-lib#readme",keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],license:"MIT",main:"index.js",name:"bitcore-lib",repository:{type:"git",url:"git+https://github.com/bitpay/bitcore-lib.git"},scripts:{build:"gulp",coverage:"gulp coverage",lint:"gulp lint",test:"gulp test"},version:"0.15.0"}},{}],88:[function(require,module,exports){"use strict";module.exports=require("./lib/mnemonic")},{"./lib/mnemonic":90}],89:[function(require,module,exports){"use strict";var spec={name:"Mnemonic",message:"Internal Error on bitcore-mnemonic module {0}",errors:[{name:"InvalidEntropy",message:"Entropy length must be an even multiple of 11 bits: {0}"},{name:"UnknownWordlist",message:"Could not detect the used word list: {0}"},{name:"InvalidMnemonic",message:"Mnemonic string is invalid: {0}"}]};module.exports=require("bitcore-lib").errors.extend(spec)},{"bitcore-lib":26}],90:[function(require,module,exports){(function(Buffer){"use strict" -;var bitcore=require("bitcore-lib"),BN=bitcore.crypto.BN,unorm=require("unorm"),_=bitcore.deps._,pbkdf2=require("./pbkdf2"),errors=require("./errors"),Hash=bitcore.crypto.Hash,Random=bitcore.crypto.Random,$=bitcore.util.preconditions,Mnemonic=function Mnemonic(data,wordlist){if(!(this instanceof Mnemonic))return new Mnemonic(data,wordlist);_.isArray(data)&&(wordlist=data,data=null);var ent,phrase,seed;if(Buffer.isBuffer(data))seed=data;else if(_.isString(data))phrase=unorm.nfkd(data);else if(_.isNumber(data))ent=data;else if(data)throw new bitcore.errors.InvalidArgument("data","Must be a Buffer, a string or an integer");if(ent=ent||128,wordlist=wordlist||Mnemonic._getDictionary(phrase),phrase&&!wordlist)throw new errors.UnknownWordlist(phrase);if(wordlist=wordlist||Mnemonic.Words.ENGLISH,seed&&(phrase=Mnemonic._entropy2mnemonic(seed,wordlist)),phrase&&!Mnemonic.isValid(phrase,wordlist))throw new errors.InvalidMnemonic(phrase);if(ent%32!=0||ent<128)throw new bitcore.errors.InvalidArgument("ENT","Values must be ENT > 128 and ENT % 32 == 0");phrase=phrase||Mnemonic._mnemonic(ent,wordlist),Object.defineProperty(this,"wordlist",{configurable:!1,value:wordlist}),Object.defineProperty(this,"phrase",{configurable:!1,value:phrase})};Mnemonic.Words=require("./words"),Mnemonic.isValid=function(mnemonic,wordlist){if(mnemonic=unorm.nfkd(mnemonic),!(wordlist=wordlist||Mnemonic._getDictionary(mnemonic)))return!1;for(var words=mnemonic.split(" "),bin="",i=0;i"},Mnemonic._mnemonic=function(ENT,wordlist){var buf=Random.getRandomBuffer(ENT/8);return Mnemonic._entropy2mnemonic(buf,wordlist)},Mnemonic._entropy2mnemonic=function(entropy,wordlist){for(var bin="",i=0;i64*(Math.pow(2,32)-1))throw Error("Requested key length too long");if("string"!=typeof key&&!Buffer.isBuffer(key))throw new TypeError("key must a string or Buffer");if("string"!=typeof salt&&!Buffer.isBuffer(salt))throw new TypeError("salt must a string or Buffer");"string"==typeof key&&(key=new Buffer(key)),"string"==typeof salt&&(salt=new Buffer(salt));var DK=new Buffer(dkLen),U=new Buffer(64),T=new Buffer(64),block1=new Buffer(salt.length+4),l=Math.ceil(dkLen/64),r=dkLen-64*(l-1);salt.copy(block1,0,0,salt.length);for(var i=1;i<=l;i++){block1[salt.length+0]=i>>24&255,block1[salt.length+1]=i>>16&255,block1[salt.length+2]=i>>8&255,block1[salt.length+3]=i>>0&255,U=crypto.createHmac("sha512",key).update(block1).digest(),U.copy(T,0,0,64);for(var j=1;j=2&&"0x"===input.slice(0,2)?input.slice(2):input}function add0x(input){return"string"!=typeof input?input:input.length<2||"0x"!==input.slice(0,2)?"0x"+input:input}function leftPadString(stringToPad,padChar,length){for(var repreatedPadChar="",i=0;i0},KeyStore._encryptString=encryptString,KeyStore._decryptString=function(encryptedStr,pwDerivedKey){var secretbox=nacl.util.decodeBase64(encryptedStr.encStr),nonce=nacl.util.decodeBase64(encryptedStr.nonce),decryptedStr=nacl.secretbox.open(secretbox,nonce,pwDerivedKey);if(void 0===decryptedStr)throw new Error("Decryption failed!");return nacl.util.encodeUTF8(decryptedStr)},KeyStore._encryptKey=function(privKey,pwDerivedKey){var privKeyArray=nacl_decodeHex(privKey),nonce=nacl.randomBytes(nacl.secretbox.nonceLength),encKey=nacl.secretbox(privKeyArray,nonce,pwDerivedKey);return encKey={key:nacl.util.encodeBase64(encKey),nonce:nacl.util.encodeBase64(nonce)}},KeyStore._decryptKey=function(encryptedKey,pwDerivedKey){var secretbox=nacl.util.decodeBase64(encryptedKey.key),nonce=nacl.util.decodeBase64(encryptedKey.nonce),decryptedKey=nacl.secretbox.open(secretbox,nonce,pwDerivedKey);if(void 0===decryptedKey)throw new Error("Decryption failed!");return nacl_encodeHex(decryptedKey)},KeyStore._computeAddressFromPrivKey=function(privKey){var keyPair=ec.genKeyPair();keyPair._importPrivate(privKey,"hex");var pubKey=keyPair.getPublic(!1,"hex").slice(2),pubKeyWordArray=CryptoJS.enc.Hex.parse(pubKey);return CryptoJS.SHA3(pubKeyWordArray,{outputLength:256}).toString(CryptoJS.enc.Hex).slice(24)},KeyStore._computePubkeyFromPrivKey=function(privKey,curve){if("curve25519"!==curve)throw new Error('KeyStore._computePubkeyFromPrivKey: Only "curve25519" supported.');var privKeyBase64=new Buffer(privKey,"hex").toString("base64"),privKeyUInt8Array=nacl.util.decodeBase64(privKeyBase64),pubKey=nacl.box.keyPair.fromSecretKey(privKeyUInt8Array).publicKey,pubKeyBase64=nacl.util.encodeBase64(pubKey);return new Buffer(pubKeyBase64,"base64").toString("hex")},KeyStore.prototype._generatePrivKeys=function(pwDerivedKey,n){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");var hdRoot=KeyStore._decryptString(this.encHdRootPriv,pwDerivedKey);if(0===hdRoot.length)throw new Error("Provided password derived key is wrong");for(var keys=[],i=0;i32)throw new Error("Private key larger than 32 bytes. Aborting!");var encPrivKey=KeyStore._encryptKey(privkeyHex,pwDerivedKey);keys[i]={privKey:privkeyHex,encPrivKey:encPrivKey}}return keys},KeyStore._concatAndSha256=function(entropyBuf0,entropyBuf1){var totalEnt=Buffer.concat([entropyBuf0,entropyBuf1]);if(totalEnt.length!==entropyBuf0.length+entropyBuf1.length)throw new Error("generateRandomSeed: Logic error! Concatenation of entropy sources failed.");return Hash.sha256(totalEnt)},KeyStore.generateRandomSeed=function(extraEntropy){var seed="";if(void 0===extraEntropy)seed=new Mnemonic(Mnemonic.Words.ENGLISH);else{if("string"!=typeof extraEntropy)throw new Error("generateRandomSeed: extraEntropy is set but not a string.");var entBuf=new Buffer(extraEntropy),randBuf=Random.getRandomBuffer(32),hashedEnt=this._concatAndSha256(randBuf,entBuf).slice(0,16);seed=new Mnemonic(hashedEnt,Mnemonic.Words.ENGLISH)}return seed.toString()},KeyStore.isSeedValid=function(seed){return Mnemonic.isValid(seed,Mnemonic.Words.ENGLISH)},KeyStore.deserialize=function(keystore){var jsonKS=JSON.parse(keystore);if(void 0===jsonKS.version||3!==jsonKS.version)throw new Error("Old version of serialized keystore. Please use KeyStore.upgradeOldSerialized() to convert it to the latest version.");var keystoreX=new KeyStore;return keystoreX.salt=jsonKS.salt,keystoreX.hdPathString=jsonKS.hdPathString,keystoreX.encSeed=jsonKS.encSeed,keystoreX.encHdRootPriv=jsonKS.encHdRootPriv,keystoreX.version=jsonKS.version,keystoreX.hdIndex=jsonKS.hdIndex,keystoreX.encPrivKeys=jsonKS.encPrivKeys,keystoreX.addresses=jsonKS.addresses,keystoreX},KeyStore.deriveKeyFromPasswordAndSalt=function(password,salt,callback){callback||"function"!=typeof salt?salt||"function"!=typeof callback||(salt="lightwalletSalt"):(callback=salt,salt="lightwalletSalt");scrypt(password,salt,14,8,32,200,function(derKey){var err=null,ui8arr=null;try{ui8arr=new Uint8Array(derKey)}catch(e){err=e}callback(err,ui8arr)},null)},KeyStore.prototype.serialize=function(){var jsonKS={encSeed:this.encSeed,encHdRootPriv:this.encHdRootPriv,addresses:this.addresses,encPrivKeys:this.encPrivKeys,hdPathString:this.hdPathString,salt:this.salt,hdIndex:this.hdIndex,version:this.version};return JSON.stringify(jsonKS)},KeyStore.prototype.getAddresses=function(){return this.addresses.map(function(addr){return add0x(addr)})},KeyStore.prototype.getSeed=function(pwDerivedKey){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");return KeyStore._decryptString(this.encSeed,pwDerivedKey).trim()},KeyStore.prototype.exportPrivateKey=function(address,pwDerivedKey){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");var address=strip0x(address);if(void 0===this.encPrivKeys[address])throw new Error("KeyStore.exportPrivateKey: Address not found in KeyStore");var encPrivKey=this.encPrivKeys[address];return KeyStore._decryptKey(encPrivKey,pwDerivedKey)},KeyStore.prototype.generateNewAddress=function(pwDerivedKey,n){if(!this.isDerivedKeyCorrect(pwDerivedKey))throw new Error("Incorrect derived key!");if(!this.encSeed)throw new Error("KeyStore.generateNewAddress: No seed set");n=n||1;for(var keys=this._generatePrivKeys(pwDerivedKey,n),i=0;i=2&&"0x"===input.slice(0,2)?input.slice(2):input}function _encodeFunctionTxData(functionName,types,args){var fullName=functionName+"("+types.join()+")";return"0x"+CryptoJS.SHA3(fullName,{outputLength:256}).toString(CryptoJS.enc.Hex).slice(0,8)+coder.encodeParams(types,args)}function _getTypesFromAbi(abi,functionName){function matchesFunctionName(json){return json.name===functionName&&"function"===json.type}function getTypes(json){return json.type}return abi.filter(matchesFunctionName)[0].inputs.map(getTypes)}function functionTx(abi,functionName,args,txObject){var types=_getTypesFromAbi(abi,functionName),txData=_encodeFunctionTxData(functionName,types,args),txObjectCopy={};return txObjectCopy.to=add0x(txObject.to),txObjectCopy.gasPrice=add0x(txObject.gasPrice),txObjectCopy.gasLimit=add0x(txObject.gasLimit),txObjectCopy.nonce=add0x(txObject.nonce),txObjectCopy.data=add0x(txData),txObjectCopy.value=add0x(txObject.value),"0x"+new Transaction(txObjectCopy).serialize().toString("hex")}function createdContractAddress(fromAddress,nonce){var rlpEncodedHex=rlp.encode([new Buffer(strip0x(fromAddress),"hex"),nonce]).toString("hex"),rlpEncodedWordArray=CryptoJS.enc.Hex.parse(rlpEncodedHex);return"0x"+CryptoJS.SHA3(rlpEncodedWordArray,{outputLength:256}).toString(CryptoJS.enc.Hex).slice(24)}function createContractTx(fromAddress,txObject){var txObjectCopy={};txObjectCopy.to=add0x(txObject.to),txObjectCopy.gasPrice=add0x(txObject.gasPrice),txObjectCopy.gasLimit=add0x(txObject.gasLimit),txObjectCopy.nonce=add0x(txObject.nonce),txObjectCopy.data=add0x(txObject.data),txObjectCopy.value=add0x(txObject.value);var contractAddress=createdContractAddress(fromAddress,txObject.nonce);return{tx:"0x"+new Transaction(txObjectCopy).serialize().toString("hex"),addr:contractAddress}}function valueTx(txObject){var txObjectCopy={};return txObjectCopy.to=add0x(txObject.to),txObjectCopy.gasPrice=add0x(txObject.gasPrice),txObjectCopy.gasLimit=add0x(txObject.gasLimit),txObjectCopy.nonce=add0x(txObject.nonce),txObjectCopy.value=add0x(txObject.value),"0x"+new Transaction(txObjectCopy).serialize().toString("hex")}var Transaction=require("ethereumjs-tx"),coder=require("web3/lib/solidity/coder"),rlp=require("rlp"),CryptoJS=require("crypto-js");module.exports={_encodeFunctionTxData:_encodeFunctionTxData,_getTypesFromAbi:_getTypesFromAbi,functionTx:functionTx,createdContractAddress:createdContractAddress,createContractTx:createContractTx,valueTx:valueTx}}).call(this,require("buffer").Buffer)},{buffer:149,"crypto-js":183,"ethereumjs-tx":235,rlp:312,"web3/lib/solidity/coder":360}],6:[function(require,module,exports){"use strict";var CryptoJS=require("crypto-js"),keystore=require("./keystore"),EC=(require("ethereumjs-tx"),require("elliptic").ec),bitcore=(new EC("secp256k1"),require("bitcore-lib")),legacyDecryptString=(bitcore.crypto.Random,bitcore.crypto.Hash,require("bitcore-mnemonic"),require("tweetnacl"),require("scrypt-async"),function(encryptedStr,password){return CryptoJS.AES.decrypt(encryptedStr.encStr,password,{iv:encryptedStr.iv,salt:encryptedStr.salt}).toString(CryptoJS.enc.Latin1)}),legacyGenerateEncKey=function(password,salt,keyHash){var encKey=CryptoJS.PBKDF2(password,salt,{keySize:16,iterations:150}).toString();if(keyHash!==CryptoJS.SHA3(encKey).toString())throw new Error("Invalid Password");return encKey},upgradeOldSerialized=function(oldSerialized,password,callback){var oldKS=JSON.parse(oldSerialized);if(void 0===oldKS.version||1===oldKS.version){var derivedKey=legacyGenerateEncKey(password,oldKS.salt,oldKS.keyHash),seed=legacyDecryptString(oldKS.encSeed,derivedKey);keystore.createVault({password:password,seedPhrase:seed,salt:"lightwalletSalt",hdPathString:"m/0'/0'/0'"},function(err,newKeyStore){newKeyStore.keyFromPassword(password,function(err,pwDerivedKey){var hdIndex=oldKS.hdIndex;newKeyStore.generateNewAddress(pwDerivedKey,hdIndex),callback(null,newKeyStore.serialize())})})}else{if(2!==oldKS.version)throw new Error("Keystore is not of correct version.");var salt="lightWalletSalt";void 0!==oldKS.salt&&(salt=oldKS.salt),keystore.deriveKeyFromPasswordAndSalt(password,salt,function(err,pwKey){var seed=keystore._decryptString(oldKS.encSeed,pwKey).trim(),hdPaths=Object.keys(oldKS.ksData),hdPathString="";1===hdPaths.length&&(hdPathString=hdPaths[0]),keystore.createVault({password:password,seedPhrase:seed,salt:salt,hdPathString:hdPathString},function(err,newKeyStore){newKeyStore.keyFromPassword(password,function(err,pwDerivedKey){var hdIndex=oldKS.ksData[hdPathString].hdIndex;newKeyStore.generateNewAddress(pwDerivedKey,hdIndex),callback(null,newKeyStore.serialize())})})})}};module.exports.upgradeOldSerialized=upgradeOldSerialized},{"./keystore":3,"bitcore-lib":26,"bitcore-mnemonic":88,"crypto-js":183,elliptic:219,"ethereumjs-tx":235,"scrypt-async":314,tweetnacl:348}],7:[function(require,module,exports){"use strict";var asn1=exports;asn1.bignum=require("bn.js"),asn1.define=require("./asn1/api").define,asn1.base=require("./asn1/base"),asn1.constants=require("./asn1/constants"),asn1.decoders=require("./asn1/decoders"),asn1.encoders=require("./asn1/encoders")},{"./asn1/api":8,"./asn1/base":10,"./asn1/constants":14,"./asn1/decoders":16,"./asn1/encoders":19,"bn.js":99}],8:[function(require,module,exports){"use strict";function Entity(name,body){this.name=name,this.body=body,this.decoders={},this.encoders={}}var asn1=require("../asn1"),inherits=require("inherits");exports.define=function(name,body){return new Entity(name,body)},Entity.prototype._createNamed=function(base){var named;try{named=require("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){named=function(entity){this._initNamed(entity)}}return inherits(named,base),named.prototype._initNamed=function(entity){base.call(this,entity)},new named(this)},Entity.prototype._getDecoder=function(enc){return enc=enc||"der",this.decoders.hasOwnProperty(enc)||(this.decoders[enc]=this._createNamed(asn1.decoders[enc])),this.decoders[enc]},Entity.prototype.decode=function(data,enc,options){return this._getDecoder(enc).decode(data,options)},Entity.prototype._getEncoder=function(enc){return enc=enc||"der",this.encoders.hasOwnProperty(enc)||(this.encoders[enc]=this._createNamed(asn1.encoders[enc])),this.encoders[enc]},Entity.prototype.encode=function(data,enc,reporter){return this._getEncoder(enc).encode(data,reporter)}},{"../asn1":7,inherits:257,vm:356}],9:[function(require,module,exports){"use strict";function DecoderBuffer(base,options){if(Reporter.call(this,options),!Buffer.isBuffer(base))return void this.error("Input not Buffer");this.base=base,this.offset=0,this.length=base.length}function EncoderBuffer(value,reporter){if(Array.isArray(value))this.length=0,this.value=value.map(function(item){return item instanceof EncoderBuffer||(item=new EncoderBuffer(item,reporter)),this.length+=item.length,item},this);else if("number"==typeof value){if(!(0<=value&&value<=255))return reporter.error("non-byte EncoderBuffer value");this.value=value,this.length=1}else if("string"==typeof value)this.value=value,this.length=Buffer.byteLength(value);else{if(!Buffer.isBuffer(value))return reporter.error("Unsupported type: "+(void 0===value?"undefined":_typeof(value)));this.value=value,this.length=value.length}}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},inherits=require("inherits"),Reporter=require("../base").Reporter,Buffer=require("buffer").Buffer;inherits(DecoderBuffer,Reporter),exports.DecoderBuffer=DecoderBuffer,DecoderBuffer.prototype.save=function(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function(save){var res=new DecoderBuffer(this.base);return res.offset=save.offset,res.length=this.offset,this.offset=save.offset,Reporter.prototype.restore.call(this,save.reporter),res},DecoderBuffer.prototype.isEmpty=function(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function(fail){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(fail||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function(bytes,fail){if(!(this.offset+bytes<=this.length))return this.error(fail||"DecoderBuffer overrun");var res=new DecoderBuffer(this.base);return res._reporterState=this._reporterState,res.offset=this.offset,res.length=this.offset+bytes,this.offset+=bytes,res},DecoderBuffer.prototype.raw=function(save){return this.base.slice(save?save.offset:this.offset,this.length)},exports.EncoderBuffer=EncoderBuffer,EncoderBuffer.prototype.join=function(out,offset){return out||(out=new Buffer(this.length)),offset||(offset=0),0===this.length?out:(Array.isArray(this.value)?this.value.forEach(function(item){item.join(out,offset),offset+=item.length}):("number"==typeof this.value?out[offset]=this.value:"string"==typeof this.value?out.write(this.value,offset):Buffer.isBuffer(this.value)&&this.value.copy(out,offset),offset+=this.length),out)}},{"../base":10,buffer:149,inherits:257}],10:[function(require,module,exports){"use strict";var base=exports;base.Reporter=require("./reporter").Reporter,base.DecoderBuffer=require("./buffer").DecoderBuffer,base.EncoderBuffer=require("./buffer").EncoderBuffer,base.Node=require("./node")},{"./buffer":9,"./node":11,"./reporter":12}],11:[function(require,module,exports){"use strict";function Node(enc,parent){var state={};this._baseState=state,state.enc=enc,state.parent=parent||null,state.children=null,state.tag=null,state.args=null,state.reverseArgs=null,state.choice=null,state.optional=!1,state.any=!1,state.obj=!1,state.use=null,state.useDecoder=null,state.key=null,state.default=null,state.explicit=null,state.implicit=null,state.contains=null,state.parent||(state.children=[],this._wrap())}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},Reporter=require("../base").Reporter,EncoderBuffer=require("../base").EncoderBuffer,DecoderBuffer=require("../base").DecoderBuffer,assert=require("minimalistic-assert"),tags=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],methods=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(tags),overrided=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];module.exports=Node;var stateProps=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function(){var state=this._baseState,cstate={};stateProps.forEach(function(prop){cstate[prop]=state[prop]});var res=new this.constructor(cstate.parent);return res._baseState=cstate,res},Node.prototype._wrap=function(){var state=this._baseState;methods.forEach(function(method){this[method]=function(){var clone=new this.constructor(this);return state.children.push(clone),clone[method].apply(clone,arguments)}},this)},Node.prototype._init=function(body){var state=this._baseState;assert(null===state.parent),body.call(this),state.children=state.children.filter(function(child){return child._baseState.parent===this},this),assert.equal(state.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function(args){var state=this._baseState,children=args.filter(function(arg){return arg instanceof this.constructor},this);args=args.filter(function(arg){return!(arg instanceof this.constructor)},this),0!==children.length&&(assert(null===state.children),state.children=children,children.forEach(function(child){child._baseState.parent=this},this)),0!==args.length&&(assert(null===state.args),state.args=args,state.reverseArgs=args.map(function(arg){if("object"!==(void 0===arg?"undefined":_typeof(arg))||arg.constructor!==Object)return arg;var res={};return Object.keys(arg).forEach(function(key){key==(0|key)&&(key|=0);var value=arg[key];res[value]=key}),res}))},overrided.forEach(function(method){Node.prototype[method]=function(){var state=this._baseState;throw new Error(method+" not implemented for encoding: "+state.enc)}}),tags.forEach(function(tag){Node.prototype[tag]=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);return assert(null===state.tag),state.tag=tag,this._useArgs(args),this}}),Node.prototype.use=function(item){assert(item);var state=this._baseState;return assert(null===state.use),state.use=item,this},Node.prototype.optional=function(){return this._baseState.optional=!0,this},Node.prototype.def=function(val){var state=this._baseState;return assert(null===state.default),state.default=val,state.optional=!0,this},Node.prototype.explicit=function(num){var state=this._baseState;return assert(null===state.explicit&&null===state.implicit),state.explicit=num,this},Node.prototype.implicit=function(num){var state=this._baseState;return assert(null===state.explicit&&null===state.implicit),state.implicit=num,this},Node.prototype.obj=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);return state.obj=!0,0!==args.length&&this._useArgs(args),this},Node.prototype.key=function(newKey){var state=this._baseState;return assert(null===state.key),state.key=newKey,this},Node.prototype.any=function(){return this._baseState.any=!0,this},Node.prototype.choice=function(obj){var state=this._baseState;return assert(null===state.choice),state.choice=obj,this._useArgs(Object.keys(obj).map(function(key){return obj[key]})),this},Node.prototype.contains=function(item){ +var state=this._baseState;return assert(null===state.use),state.contains=item,this},Node.prototype._decode=function(input,options){var state=this._baseState;if(null===state.parent)return input.wrapResult(state.children[0]._decode(input,options));var result=state.default,present=!0,prevKey=null;if(null!==state.key&&(prevKey=input.enterKey(state.key)),state.optional){var tag=null;if(null!==state.explicit?tag=state.explicit:null!==state.implicit?tag=state.implicit:null!==state.tag&&(tag=state.tag),null!==tag||state.any){if(present=this._peekTag(input,tag,state.any),input.isError(present))return present}else{var save=input.save();try{null===state.choice?this._decodeGeneric(state.tag,input,options):this._decodeChoice(input,options),present=!0}catch(e){present=!1}input.restore(save)}}var prevObj;if(state.obj&&present&&(prevObj=input.enterObject()),present){if(null!==state.explicit){var explicit=this._decodeTag(input,state.explicit);if(input.isError(explicit))return explicit;input=explicit}var start=input.offset;if(null===state.use&&null===state.choice){if(state.any)var save=input.save();var body=this._decodeTag(input,null!==state.implicit?state.implicit:state.tag,state.any);if(input.isError(body))return body;state.any?result=input.raw(save):input=body}if(options&&options.track&&null!==state.tag&&options.track(input.path(),start,input.length,"tagged"),options&&options.track&&null!==state.tag&&options.track(input.path(),input.offset,input.length,"content"),result=state.any?result:null===state.choice?this._decodeGeneric(state.tag,input,options):this._decodeChoice(input,options),input.isError(result))return result;if(state.any||null!==state.choice||null===state.children||state.children.forEach(function(child){child._decode(input,options)}),state.contains&&("octstr"===state.tag||"bitstr"===state.tag)){var data=new DecoderBuffer(result);result=this._getUse(state.contains,input._reporterState.obj)._decode(data,options)}}return state.obj&&present&&(result=input.leaveObject(prevObj)),null===state.key||null===result&&!0!==present?null!==prevKey&&input.exitKey(prevKey):input.leaveKey(prevKey,state.key,result),result},Node.prototype._decodeGeneric=function(tag,input,options){var state=this._baseState;return"seq"===tag||"set"===tag?null:"seqof"===tag||"setof"===tag?this._decodeList(input,tag,state.args[0],options):/str$/.test(tag)?this._decodeStr(input,tag,options):"objid"===tag&&state.args?this._decodeObjid(input,state.args[0],state.args[1],options):"objid"===tag?this._decodeObjid(input,null,null,options):"gentime"===tag||"utctime"===tag?this._decodeTime(input,tag,options):"null_"===tag?this._decodeNull(input,options):"bool"===tag?this._decodeBool(input,options):"objDesc"===tag?this._decodeStr(input,tag,options):"int"===tag||"enum"===tag?this._decodeInt(input,state.args&&state.args[0],options):null!==state.use?this._getUse(state.use,input._reporterState.obj)._decode(input,options):input.error("unknown tag: "+tag)},Node.prototype._getUse=function(entity,obj){var state=this._baseState;return state.useDecoder=this._use(entity,obj),assert(null===state.useDecoder._baseState.parent),state.useDecoder=state.useDecoder._baseState.children[0],state.implicit!==state.useDecoder._baseState.implicit&&(state.useDecoder=state.useDecoder.clone(),state.useDecoder._baseState.implicit=state.implicit),state.useDecoder},Node.prototype._decodeChoice=function(input,options){var state=this._baseState,result=null,match=!1;return Object.keys(state.choice).some(function(key){var save=input.save(),node=state.choice[key];try{var value=node._decode(input,options);if(input.isError(value))return!1;result={type:key,value:value},match=!0}catch(e){return input.restore(save),!1}return!0},this),match?result:input.error("Choice not matched")},Node.prototype._createEncoderBuffer=function(data){return new EncoderBuffer(data,this.reporter)},Node.prototype._encode=function(data,reporter,parent){var state=this._baseState;if(null===state.default||state.default!==data){var result=this._encodeValue(data,reporter,parent);if(void 0!==result&&!this._skipDefault(result,reporter,parent))return result}},Node.prototype._encodeValue=function(data,reporter,parent){var state=this._baseState;if(null===state.parent)return state.children[0]._encode(data,reporter||new Reporter);var result=null;if(this.reporter=reporter,state.optional&&void 0===data){if(null===state.default)return;data=state.default}var content=null,primitive=!1;if(state.any)result=this._createEncoderBuffer(data);else if(state.choice)result=this._encodeChoice(data,reporter);else if(state.contains)content=this._getUse(state.contains,parent)._encode(data,reporter),primitive=!0;else if(state.children)content=state.children.map(function(child){if("null_"===child._baseState.tag)return child._encode(null,reporter,data);if(null===child._baseState.key)return reporter.error("Child should have a key");var prevKey=reporter.enterKey(child._baseState.key);if("object"!==(void 0===data?"undefined":_typeof(data)))return reporter.error("Child expected, but input is not object");var res=child._encode(data[child._baseState.key],reporter,data);return reporter.leaveKey(prevKey),res},this).filter(function(child){return child}),content=this._createEncoderBuffer(content);else if("seqof"===state.tag||"setof"===state.tag){if(!state.args||1!==state.args.length)return reporter.error("Too many args for : "+state.tag);if(!Array.isArray(data))return reporter.error("seqof/setof, but data is not Array");var child=this.clone();child._baseState.implicit=null,content=this._createEncoderBuffer(data.map(function(item){var state=this._baseState;return this._getUse(state.args[0],data)._encode(item,reporter)},child))}else null!==state.use?result=this._getUse(state.use,parent)._encode(data,reporter):(content=this._encodePrimitive(state.tag,data),primitive=!0);var result;if(!state.any&&null===state.choice){var tag=null!==state.implicit?state.implicit:state.tag,cls=null===state.implicit?"universal":"context";null===tag?null===state.use&&reporter.error("Tag could be omitted only for .use()"):null===state.use&&(result=this._encodeComposite(tag,primitive,cls,content))}return null!==state.explicit&&(result=this._encodeComposite(state.explicit,!1,"context",result)),result},Node.prototype._encodeChoice=function(data,reporter){var state=this._baseState,node=state.choice[data.type];return node||assert(!1,data.type+" not found in "+JSON.stringify(Object.keys(state.choice))),node._encode(data.value,reporter)},Node.prototype._encodePrimitive=function(tag,data){var state=this._baseState;if(/str$/.test(tag))return this._encodeStr(data,tag);if("objid"===tag&&state.args)return this._encodeObjid(data,state.reverseArgs[0],state.args[1]);if("objid"===tag)return this._encodeObjid(data,null,null);if("gentime"===tag||"utctime"===tag)return this._encodeTime(data,tag);if("null_"===tag)return this._encodeNull();if("int"===tag||"enum"===tag)return this._encodeInt(data,state.args&&state.reverseArgs[0]);if("bool"===tag)return this._encodeBool(data);if("objDesc"===tag)return this._encodeStr(data,tag);throw new Error("Unsupported tag: "+tag)},Node.prototype._isNumstr=function(str){return/^[0-9 ]*$/.test(str)},Node.prototype._isPrintstr=function(str){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str)}},{"../base":10,"minimalistic-assert":272}],12:[function(require,module,exports){"use strict";function Reporter(options){this._reporterState={obj:null,path:[],options:options||{},errors:[]}}function ReporterError(path,msg){this.path=path,this.rethrow(msg)}var inherits=require("inherits");exports.Reporter=Reporter,Reporter.prototype.isError=function(obj){return obj instanceof ReporterError},Reporter.prototype.save=function(){var state=this._reporterState;return{obj:state.obj,pathLen:state.path.length}},Reporter.prototype.restore=function(data){var state=this._reporterState;state.obj=data.obj,state.path=state.path.slice(0,data.pathLen)},Reporter.prototype.enterKey=function(key){return this._reporterState.path.push(key)},Reporter.prototype.exitKey=function(index){var state=this._reporterState;state.path=state.path.slice(0,index-1)},Reporter.prototype.leaveKey=function(index,key,value){var state=this._reporterState;this.exitKey(index),null!==state.obj&&(state.obj[key]=value)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var state=this._reporterState,prev=state.obj;return state.obj={},prev},Reporter.prototype.leaveObject=function(prev){var state=this._reporterState,now=state.obj;return state.obj=prev,now},Reporter.prototype.error=function(msg){var err,state=this._reporterState,inherited=msg instanceof ReporterError;if(err=inherited?msg:new ReporterError(state.path.map(function(elem){return"["+JSON.stringify(elem)+"]"}).join(""),msg.message||msg,msg.stack),!state.options.partial)throw err;return inherited||state.errors.push(err),err},Reporter.prototype.wrapResult=function(result){var state=this._reporterState;return state.options.partial?{result:this.isError(result)?null:result,errors:state.errors}:result},inherits(ReporterError,Error),ReporterError.prototype.rethrow=function(msg){if(this.message=msg+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:257}],13:[function(require,module,exports){"use strict";var constants=require("../constants");exports.tagClass={0:"universal",1:"application",2:"context",3:"private"},exports.tagClassByName=constants._reverse(exports.tagClass),exports.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},exports.tagByName=constants._reverse(exports.tag)},{"../constants":14}],14:[function(require,module,exports){"use strict";var constants=exports;constants._reverse=function(map){var res={};return Object.keys(map).forEach(function(key){(0|key)==key&&(key|=0);var value=map[key];res[value]=key}),res},constants.der=require("./der")},{"./der":13}],15:[function(require,module,exports){"use strict";function DERDecoder(entity){this.enc="der",this.name=entity.name,this.entity=entity,this.tree=new DERNode,this.tree._init(entity.body)}function DERNode(parent){base.Node.call(this,"der",parent)}function derDecodeTag(buf,fail){var tag=buf.readUInt8(fail);if(buf.isError(tag))return tag;var cls=der.tagClass[tag>>6],primitive=0==(32&tag);if(31==(31&tag)){var oct=tag;for(tag=0;128==(128&oct);){if(oct=buf.readUInt8(fail),buf.isError(oct))return oct;tag<<=7,tag|=127&oct}}else tag&=31;return{cls:cls,primitive:primitive,tag:tag,tagStr:der.tag[tag]}}function derDecodeLen(buf,primitive,fail){var len=buf.readUInt8(fail);if(buf.isError(len))return len;if(!primitive&&128===len)return null;if(0==(128&len))return len;var num=127&len;if(num>4)return buf.error("length octect is too long");len=0;for(var i=0;i=31?reporter.error("Multi-octet tag encoding unsupported"):(primitive||(res|=32),res|=der.tagClassByName[cls||"universal"]<<6)}var inherits=require("inherits"),Buffer=require("buffer").Buffer,asn1=require("../../asn1"),base=asn1.base,der=asn1.constants.der;module.exports=DEREncoder,DEREncoder.prototype.encode=function(data,reporter){return this.tree._encode(data,reporter).join()},inherits(DERNode,base.Node),DERNode.prototype._encodeComposite=function(tag,primitive,cls,content){var encodedTag=encodeTag(tag,primitive,cls,this.reporter);if(content.length<128){var header=new Buffer(2);return header[0]=encodedTag,header[1]=content.length,this._createEncoderBuffer([header,content])}for(var lenOctets=1,i=content.length;i>=256;i>>=8)lenOctets++;var header=new Buffer(2+lenOctets);header[0]=encodedTag,header[1]=128|lenOctets;for(var i=1+lenOctets,j=content.length;j>0;i--,j>>=8)header[i]=255&j;return this._createEncoderBuffer([header,content])},DERNode.prototype._encodeStr=function(str,tag){if("bitstr"===tag)return this._createEncoderBuffer([0|str.unused,str.data]);if("bmpstr"===tag){for(var buf=new Buffer(2*str.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");id.splice(0,2,40*id[0]+id[1])}for(var size=0,i=0;i=128;ident>>=7)size++}for(var objid=new Buffer(size),offset=objid.length-1,i=id.length-1;i>=0;i--){var ident=id[i];for(objid[offset--]=127&ident;(ident>>=7)>0;)objid[offset--]=128|127&ident}return this._createEncoderBuffer(objid)},DERNode.prototype._encodeTime=function(time,tag){var str,date=new Date(time);return"gentime"===tag?str=[two(date.getFullYear()),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join(""):"utctime"===tag?str=[two(date.getFullYear()%100),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+tag+" time is not supported yet"),this._encodeStr(str,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(num,values){if("string"==typeof num){if(!values)return this.reporter.error("String int or enum given, but no values map");if(!values.hasOwnProperty(num))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(num));num=values[num]}if("number"!=typeof num&&!Buffer.isBuffer(num)){var numArray=num.toArray();!num.sign&&128&numArray[0]&&numArray.unshift(0),num=new Buffer(numArray)}if(Buffer.isBuffer(num)){var size=num.length;0===num.length&&size++;var out=new Buffer(size);return num.copy(out),0===num.length&&(out[0]=0),this._createEncoderBuffer(out)}if(num<128)return this._createEncoderBuffer(num);if(num<256)return this._createEncoderBuffer([0,num]);for(var size=1,i=num;i>=256;i>>=8)size++;for(var out=new Array(size),i=out.length-1;i>=0;i--)out[i]=255&num,num>>=8;return 128&out[0]&&out.unshift(0),this._createEncoderBuffer(new Buffer(out))},DERNode.prototype._encodeBool=function(value){return this._createEncoderBuffer(value?255:0)},DERNode.prototype._use=function(entity,obj){return"function"==typeof entity&&(entity=entity(obj)),entity._getEncoder("der").tree},DERNode.prototype._skipDefault=function(dataBuffer,reporter,parent){var i,state=this._baseState;if(null===state.default)return!1;var data=dataBuffer.join();if(void 0===state.defaultBuffer&&(state.defaultBuffer=this._encodeValue(state.default,reporter,parent).join()),data.length!==state.defaultBuffer.length)return!1;for(i=0;i=0;i--)if(ka[i]!==kb[i])return!1;for(i=ka.length-1;i>=0;i--)if(key=ka[i],!_deepEqual(a[key],b[key],strict,actualVisitedObjects))return!1;return!0}function notDeepStrictEqual(actual,expected,message){_deepEqual(actual,expected,!0)&&fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(actual,expected){if(!actual||!expected)return!1;if("[object RegExp]"==Object.prototype.toString.call(expected))return expected.test(actual);try{if(actual instanceof expected)return!0}catch(e){}return!Error.isPrototypeOf(expected)&&!0===expected.call({},actual)}function _tryBlock(block){var error;try{block()}catch(e){error=e}return error}function _throws(shouldThrow,block,expected,message){var actual;if("function"!=typeof block)throw new TypeError('"block" argument must be a function');"string"==typeof expected&&(message=expected,expected=null),actual=_tryBlock(block),message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!actual&&fail(actual,expected,"Missing expected exception"+message);var userProvidedMessage="string"==typeof message,isUnwantedException=!shouldThrow&&util.isError(actual),isUnexpectedException=!shouldThrow&&actual&&!expected;if((isUnwantedException&&userProvidedMessage&&expectedException(actual,expected)||isUnexpectedException)&&fail(actual,expected,"Got unwanted exception"+message),shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual)throw actual}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},util=require("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames=function(){return"foo"===function(){}.name}(),assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=getName(stackStartFunction),idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(actual,expected,message){_deepEqual(actual,expected,!0)||fail(actual,expected,message,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert.throws=function(block,error,message){_throws(!0,block,error,message)},assert.doesNotThrow=function(block,error,message){_throws(!1,block,error,message)},assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":355}],22:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;module.exports=function(ALPHABET){function encode(source){if(0===source.length)return"";for(var digits=[0],i=0;i0;)digits.push(carry%BASE),carry=carry/BASE|0}for(var string="",k=0;0===source[k]&&k=0;--q)string+=ALPHABET[digits[q]];return string}function decodeUnsafe(string){if(0===string.length)return Buffer.allocUnsafe(0);for(var bytes=[0],i=0;i>=8;for(;carry>0;)bytes.push(255&carry),carry>>=8}for(var k=0;string[k]===LEADER&&k0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===b64[len-2]?2:"="===b64[len-1]?1:0}function byteLength(b64){return 3*b64.length/4-placeHoldersCount(b64)}function toByteArray(b64){var i,l,tmp,placeHolders,arr,len=b64.length;placeHolders=placeHoldersCount(b64),arr=new Arr(3*len/4-placeHolders),l=placeHolders>0?len-4:len;var L=0;for(i=0;i>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;return 2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]}function encodeChunk(uint8,start,end){for(var tmp,output=[],i=start;ilen2?len2:i+16383));return 1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="="),parts.push(output),parts.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i15&&raise(id,tooManyDigits,n),num=!1):x.s=45===str.charCodeAt(0)?(str=str.slice(1),-1):1,str=convertBase(str,10,b,x.s)}else{if(n instanceof BigNumber)return x.s=n.s,x.e=n.e,x.c=(n=n.c)?n.slice():n,void(id=0);if((num="number"==typeof n)&&0*n==0){if(x.s=1/n<0?(n=-n,-1):1,n===~~n){for(e=0,i=n;i>=10;i/=10,e++);return x.e=e,x.c=[n],void(id=0)}str=n+""}else{if(!isNumeric.test(str=n+""))return parseNumeric(x,str,num);x.s=45===str.charCodeAt(0)?(str=str.slice(1),-1):1}}for((e=str.indexOf("."))>-1&&(str=str.replace(".","")),(i=str.search(/e/i))>0?(e<0&&(e=i),e+=+str.slice(i+1),str=str.substring(0,i)):e<0&&(e=str.length),i=0;48===str.charCodeAt(i);i++);for(len=str.length;48===str.charCodeAt(--len););if(str=str.slice(i,len+1))if(len=str.length,num&&ERRORS&&len>15&&raise(id,tooManyDigits,x.s*n),(e=e-i-1)>MAX_EXP)x.c=x.e=null;else if(e=0&&(k=POW_PRECISION,POW_PRECISION=0,str=str.replace(".",""),y=new BigNumber(baseIn),x=y.pow(str.length-i),POW_PRECISION=k,y.c=toBaseOut(toFixedPoint(coeffToString(x.c),x.e),10,baseOut),y.e=y.c.length),xc=toBaseOut(str,baseIn,baseOut),e=k=xc.length;0==xc[--k];xc.pop());if(!xc[0])return"0";if(i<0?--e:(x.c=xc,x.e=e,x.s=sign,x=div(x,y,dp,rm,baseOut),xc=x.c,r=x.r,e=x.e),d=e+dp+1,i=xc[d],k=baseOut/2,r=r||d<0||null!=xc[d+1],r=rm<4?(null!=i||r)&&(0==rm||rm==(x.s<0?3:2)):i>k||i==k&&(4==rm||r||6==rm&&1&xc[d-1]||rm==(x.s<0?8:7)),d<1||!xc[0])str=r?toFixedPoint("1",-dp):"0";else{if(xc.length=d,r)for(--baseOut;++xc[--d]>baseOut;)xc[d]=0,d||(++e,xc.unshift(1));for(k=xc.length;!xc[--k];);for(i=0,str="";i<=k;str+=ALPHABET.charAt(xc[i++]));str=toFixedPoint(str,e)}return str}function format(n,i,rm,caller){var c0,e,ne,len,str;if(rm=null!=rm&&isValidInt(rm,0,8,caller,roundingMode)?0|rm:ROUNDING_MODE,!n.c)return n.toString();if(c0=n.c[0],ne=n.e,null==i)str=coeffToString(n.c),str=19==caller||24==caller&&ne<=TO_EXP_NEG?toExponential(str,ne):toFixedPoint(str,ne);else if(n=round(new BigNumber(n),i,rm),e=n.e,str=coeffToString(n.c),len=str.length,19==caller||24==caller&&(i<=e||e<=TO_EXP_NEG)){for(;lenlen){if(--i>0)for(str+=".";i--;str+="0");}else if((i+=e-len)>0)for(e+1==len&&(str+=".");i--;str+="0");return n.s<0&&c0?"-"+str:str}function maxOrMin(args,method){var m,n,i=0;for(isArray(args[0])&&(args=args[0]),m=new BigNumber(args[0]);++imax||n!=truncate(n))&&raise(caller,(name||"decimal places")+(nmax?" out of range":" not an integer"),n),!0}function normalise(n,c,e){for(var i=1,j=c.length;!c[--j];c.pop());for(j=c[0];j>=10;j/=10,i++);return(e=i+e*LOG_BASE-1)>MAX_EXP?n.c=n.e=null:e=10;k/=10,d++);if((i=sd-d)<0)i+=LOG_BASE,j=sd,n=xc[ni=0],rd=n/pows10[d-j-1]%10|0;else if((ni=mathceil((i+1)/LOG_BASE))>=xc.length){if(!r)break out;for(;xc.length<=ni;xc.push(0));n=rd=0,d=1,i%=LOG_BASE,j=i-LOG_BASE+1}else{for(n=k=xc[ni],d=1;k>=10;k/=10,d++);i%=LOG_BASE,j=i-LOG_BASE+d,rd=j<0?0:n/pows10[d-j-1]%10|0}if(r=r||sd<0||null!=xc[ni+1]||(j<0?n:n%pows10[d-j-1]),r=rm<4?(rd||r)&&(0==rm||rm==(x.s<0?3:2)):rd>5||5==rd&&(4==rm||r||6==rm&&(i>0?j>0?n/pows10[d-j]:0:xc[ni-1])%10&1||rm==(x.s<0?8:7)),sd<1||!xc[0])return xc.length=0,r?(sd-=x.e+1,xc[0]=pows10[sd%LOG_BASE],x.e=-sd||0):xc[0]=x.e=0,x;if(0==i?(xc.length=ni,k=1,ni--):(xc.length=ni+1,k=pows10[LOG_BASE-i],xc[ni]=j>0?mathfloor(n/pows10[d-j]%pows10[j])*k:0),r)for(;;){if(0==ni){for(i=1,j=xc[0];j>=10;j/=10,i++);for(j=xc[0]+=k,k=1;j>=10;j/=10,k++);i!=k&&(x.e++,xc[0]==BASE&&(xc[0]=1));break}if(xc[ni]+=k,xc[ni]!=BASE)break;xc[ni--]=0,k=1}for(i=xc.length;0===xc[--i];xc.pop());}x.e>MAX_EXP?x.c=x.e=null:x.ei)return null!=(v=a[i++])};return has(p="DECIMAL_PLACES")&&isValidInt(v,0,MAX,2,p)&&(DECIMAL_PLACES=0|v),r[p]=DECIMAL_PLACES,has(p="ROUNDING_MODE")&&isValidInt(v,0,8,2,p)&&(ROUNDING_MODE=0|v),r[p]=ROUNDING_MODE,has(p="EXPONENTIAL_AT")&&(isArray(v)?isValidInt(v[0],-MAX,0,2,p)&&isValidInt(v[1],0,MAX,2,p)&&(TO_EXP_NEG=0|v[0],TO_EXP_POS=0|v[1]):isValidInt(v,-MAX,MAX,2,p)&&(TO_EXP_NEG=-(TO_EXP_POS=0|(v<0?-v:v)))),r[p]=[TO_EXP_NEG,TO_EXP_POS],has(p="RANGE")&&(isArray(v)?isValidInt(v[0],-MAX,-1,2,p)&&isValidInt(v[1],1,MAX,2,p)&&(MIN_EXP=0|v[0],MAX_EXP=0|v[1]):isValidInt(v,-MAX,MAX,2,p)&&(0|v?MIN_EXP=-(MAX_EXP=0|(v<0?-v:v)):ERRORS&&raise(2,p+" cannot be zero",v))),r[p]=[MIN_EXP,MAX_EXP],has(p="ERRORS")&&(v===!!v||1===v||0===v?(id=0,isValidInt=(ERRORS=!!v)?intValidatorWithErrors:intValidatorNoErrors):ERRORS&&raise(2,p+notBool,v)),r[p]=ERRORS,has(p="CRYPTO")&&(v===!!v||1===v||0===v?(CRYPTO=!(!v||!crypto||"object"!=(void 0===crypto?"undefined":_typeof(crypto))),v&&!CRYPTO&&ERRORS&&raise(2,"crypto unavailable",crypto)):ERRORS&&raise(2,p+notBool,v)),r[p]=CRYPTO,has(p="MODULO_MODE")&&isValidInt(v,0,9,2,p)&&(MODULO_MODE=0|v),r[p]=MODULO_MODE,has(p="POW_PRECISION")&&isValidInt(v,0,MAX,2,p)&&(POW_PRECISION=0|v),r[p]=POW_PRECISION,has(p="FORMAT")&&("object"==(void 0===v?"undefined":_typeof(v))?FORMAT=v:ERRORS&&raise(2,p+" not an object",v)),r[p]=FORMAT,r},BigNumber.max=function(){return maxOrMin(arguments,P.lt)},BigNumber.min=function(){return maxOrMin(arguments,P.gt)},BigNumber.random=function(){var random53bitInt=9007199254740992*Math.random()&2097151?function(){return mathfloor(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(dp){var a,b,e,k,v,i=0,c=[],rand=new BigNumber(ONE);if(dp=null!=dp&&isValidInt(dp,0,MAX,14)?0|dp:DECIMAL_PLACES,k=mathceil(dp/LOG_BASE),CRYPTO)if(crypto&&crypto.getRandomValues){for(a=crypto.getRandomValues(new Uint32Array(k*=2));i>>11),v>=9e15?(b=crypto.getRandomValues(new Uint32Array(2)),a[i]=b[0],a[i+1]=b[1]):(c.push(v%1e14),i+=2);i=k/2}else if(crypto&&crypto.randomBytes){for(a=crypto.randomBytes(k*=7);i=9e15?crypto.randomBytes(7).copy(a,i):(c.push(v%1e14),i+=7);i=k/7}else ERRORS&&raise(14,"crypto unavailable",crypto);if(!i)for(;i=10;v/=10,i++);ibL?1:-1;else for(i=cmp=0;ib[i]?1:-1;break}return cmp}function subtract(a,b,aL,base){for(var i=0;aL--;)a[aL]-=i,i=a[aL]1;a.shift());}return function(x,y,dp,rm,base){var cmp,e,i,more,n,prod,prodL,q,qc,rem,remL,rem0,xi,xL,yc0,yL,yz,s=x.s==y.s?1:-1,xc=x.c,yc=y.c;if(!(xc&&xc[0]&&yc&&yc[0]))return new BigNumber(x.s&&y.s&&(xc?!yc||xc[0]!=yc[0]:yc)?xc&&0==xc[0]||!yc?0*s:s/0:NaN);for(q=new BigNumber(s),qc=q.c=[],e=x.e-y.e,s=dp+e+1,base||(base=BASE,e=bitFloor(x.e/LOG_BASE)-bitFloor(y.e/LOG_BASE),s=s/LOG_BASE|0),i=0;yc[i]==(xc[i]||0);i++);if(yc[i]>(xc[i]||0)&&e--,s<0)qc.push(1),more=!0;else{for(xL=xc.length,yL=yc.length,i=0,s+=2,n=mathfloor(base/(yc[0]+1)),n>1&&(yc=multiply(yc,n,base),xc=multiply(xc,n,base),yL=yc.length,xL=xc.length),xi=yL,rem=xc.slice(0,yL),remL=rem.length;remL=base/2&&yc0++;do{if(n=0,(cmp=compare(yc,rem,yL,remL))<0){if(rem0=rem[0],yL!=remL&&(rem0=rem0*base+(rem[1]||0)),(n=mathfloor(rem0/yc0))>1)for(n>=base&&(n=base-1),prod=multiply(yc,n,base),prodL=prod.length,remL=rem.length;1==compare(prod,rem,prodL,remL);)n--,subtract(prod,yL=10;s/=10,i++);round(q,dp+(q.e=i+e*LOG_BASE-1)+1,rm,more)}else q.e=e,q.r=+more;return q}}(),parseNumeric=function(){var basePrefix=/^(-?)0([xbo])/i,dotAfter=/^([^.]+)\.$/,dotBefore=/^\.([^.]+)$/,isInfinityOrNaN=/^-?(Infinity|NaN)$/,whitespaceOrPlus=/^\s*\+|^\s+|\s+$/g;return function(x,str,num,b){var base,s=num?str:str.replace(whitespaceOrPlus,"");if(isInfinityOrNaN.test(s))x.s=isNaN(s)?null:s<0?-1:1;else{if(!num&&(s=s.replace(basePrefix,function(m,p1,p2){return base="x"==(p2=p2.toLowerCase())?16:"b"==p2?2:8,b&&b!=base?m:p1}),b&&(base=b,s=s.replace(dotAfter,"$1").replace(dotBefore,"0.$1")),str!=s))return new BigNumber(s,base);ERRORS&&raise(id,"not a"+(b?" base "+b:"")+" number",str),x.s=null}x.c=x.e=null,id=0}}(),P.absoluteValue=P.abs=function(){var x=new BigNumber(this);return x.s<0&&(x.s=1),x},P.ceil=function(){return round(new BigNumber(this),this.e+1,2)},P.comparedTo=P.cmp=function(y,b){return id=1,compare(this,new BigNumber(y,b))},P.decimalPlaces=P.dp=function(){var n,v,c=this.c;if(!c)return null;if(n=((v=c.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,v=c[v])for(;v%10==0;v/=10,n--);return n<0&&(n=0),n},P.dividedBy=P.div=function(y,b){return id=3,div(this,new BigNumber(y,b),DECIMAL_PLACES,ROUNDING_MODE)},P.dividedToIntegerBy=P.divToInt=function(y,b){return id=4,div(this,new BigNumber(y,b),0,1)},P.equals=P.eq=function(y,b){return id=5,0===compare(this,new BigNumber(y,b))},P.floor=function(){return round(new BigNumber(this),this.e+1,3)},P.greaterThan=P.gt=function(y,b){return id=6,compare(this,new BigNumber(y,b))>0},P.greaterThanOrEqualTo=P.gte=function(y,b){return id=7,1===(b=compare(this,new BigNumber(y,b)))||0===b},P.isFinite=function(){return!!this.c},P.isInteger=P.isInt=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.lessThan=P.lt=function(y,b){return id=8,compare(this,new BigNumber(y,b))<0},P.lessThanOrEqualTo=P.lte=function(y,b){return id=9,-1===(b=compare(this,new BigNumber(y,b)))||0===b},P.minus=P.sub=function(y,b){var i,j,t,xLTy,x=this,a=x.s;if(id=10,y=new BigNumber(y,b),b=y.s,!a||!b)return new BigNumber(NaN);if(a!=b)return y.s=-b,x.plus(y);var xe=x.e/LOG_BASE,ye=y.e/LOG_BASE,xc=x.c,yc=y.c;if(!xe||!ye){if(!xc||!yc)return xc?(y.s=-b,y):new BigNumber(yc?x:NaN);if(!xc[0]||!yc[0])return yc[0]?(y.s=-b,y):new BigNumber(xc[0]?x:3==ROUNDING_MODE?-0:0)}if(xe=bitFloor(xe),ye=bitFloor(ye),xc=xc.slice(),a=xe-ye){for((xLTy=a<0)?(a=-a,t=xc):(ye=xe,t=yc),t.reverse(),b=a;b--;t.push(0));t.reverse()}else for(j=(xLTy=(a=xc.length)<(b=yc.length))?a:b,a=b=0;b0)for(;b--;xc[i++]=0);for(b=BASE-1;j>a;){if(xc[--j]0?(ye=xe,t=yc):(a=-a,t=xc),t.reverse();a--;t.push(0));t.reverse()}for(a=xc.length,b=yc.length,a-b<0&&(t=yc,yc=xc,xc=t,b=a),a=0;b;)a=(xc[--b]=xc[b]+yc[b]+a)/BASE|0,xc[b]%=BASE;return a&&(xc.unshift(a),++ye),normalise(y,xc,ye)},P.precision=P.sd=function(z){var n,v,x=this,c=x.c;if(null!=z&&z!==!!z&&1!==z&&0!==z&&(ERRORS&&raise(13,"argument"+notBool,z),z!=!!z&&(z=null)),!c)return null;if(v=c.length-1,n=v*LOG_BASE+1,v=c[v]){for(;v%10==0;v/=10,n--);for(v=c[0];v>=10;v/=10,n++);}return z&&x.e+1>n&&(n=x.e+1),n},P.round=function(dp,rm){var n=new BigNumber(this);return(null==dp||isValidInt(dp,0,MAX,15))&&round(n,~~dp+this.e+1,null!=rm&&isValidInt(rm,0,8,15,roundingMode)?0|rm:ROUNDING_MODE),n},P.shift=function(k){var n=this;return isValidInt(k,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,16,"argument")?n.times("1e"+truncate(k)):new BigNumber(n.c&&n.c[0]&&(k<-MAX_SAFE_INTEGER||k>MAX_SAFE_INTEGER)?n.s*(k<0?0:1/0):n)},P.squareRoot=P.sqrt=function(){var m,n,r,rep,t,x=this,c=x.c,s=x.s,e=x.e,dp=DECIMAL_PLACES+4,half=new BigNumber("0.5");if(1!==s||!c||!c[0])return new BigNumber(!s||s<0&&(!c||c[0])?NaN:c?x:1/0);if(s=Math.sqrt(+x),0==s||s==1/0?(n=coeffToString(c),(n.length+e)%2==0&&(n+="0"),s=Math.sqrt(n),e=bitFloor((e+1)/2)-(e<0||e%2),s==1/0?n="1e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new BigNumber(n)):r=new BigNumber(s+""),r.c[0])for(e=r.e,s=e+dp,s<3&&(s=0);;)if(t=r,r=half.times(t.plus(div(x,t,dp,1))),coeffToString(t.c).slice(0,s)===(n=coeffToString(r.c)).slice(0,s)){if(r.e=0;){for(c=0,ylo=yc[i]%sqrtBase,yhi=yc[i]/sqrtBase|0,k=xcL,j=i+k;j>i;)xlo=xc[--k]%sqrtBase,xhi=xc[k]/sqrtBase|0,m=yhi*xlo+xhi*ylo,xlo=ylo*xlo+m%sqrtBase*sqrtBase+zc[j]+c,c=(xlo/base|0)+(m/sqrtBase|0)+yhi*xhi,zc[j--]=xlo%base;zc[j]=c}return c?++e:zc.shift(),normalise(y,zc,e)},P.toDigits=function(sd,rm){var n=new BigNumber(this);return sd=null!=sd&&isValidInt(sd,1,MAX,18,"precision")?0|sd:null,rm=null!=rm&&isValidInt(rm,0,8,18,roundingMode)?0|rm:ROUNDING_MODE,sd?round(n,sd,rm):n},P.toExponential=function(dp,rm){return format(this,null!=dp&&isValidInt(dp,0,MAX,19)?1+~~dp:null,rm,19)},P.toFixed=function(dp,rm){return format(this,null!=dp&&isValidInt(dp,0,MAX,20)?~~dp+this.e+1:null,rm,20)},P.toFormat=function(dp,rm){var str=format(this,null!=dp&&isValidInt(dp,0,MAX,21)?~~dp+this.e+1:null,rm,21);if(this.c){var i,arr=str.split("."),g1=+FORMAT.groupSize,g2=+FORMAT.secondaryGroupSize,groupSeparator=FORMAT.groupSeparator,intPart=arr[0],fractionPart=arr[1],isNeg=this.s<0,intDigits=isNeg?intPart.slice(1):intPart,len=intDigits.length;if(g2&&(i=g1,g1=g2,g2=i,len-=i),g1>0&&len>0){for(i=len%g1||g1,intPart=intDigits.substr(0,i);i0&&(intPart+=groupSeparator+intDigits.slice(i)),isNeg&&(intPart="-"+intPart)}str=fractionPart?intPart+FORMAT.decimalSeparator+((g2=+FORMAT.fractionGroupSize)?fractionPart.replace(new RegExp("\\d{"+g2+"}\\B","g"),"$&"+FORMAT.fractionGroupSeparator):fractionPart):intPart}return str},P.toFraction=function(md){var arr,d0,d2,e,exp,n,n0,q,s,k=ERRORS,x=this,xc=x.c,d=new BigNumber(ONE),n1=d0=new BigNumber(ONE),d1=n0=new BigNumber(ONE);if(null!=md&&(ERRORS=!1,n=new BigNumber(md),ERRORS=k,(k=n.isInt())&&!n.lt(ONE)||(ERRORS&&raise(22,"max denominator "+(k?"out of range":"not an integer"),md),md=!k&&n.c&&round(n,n.e+1,1).gte(ONE)?n:null)),!xc)return x.toString();for(s=coeffToString(xc),e=d.e=s.length-x.e-1,d.c[0]=POWS_TEN[(exp=e%LOG_BASE)<0?LOG_BASE+exp:exp],md=!md||n.cmp(d)>0?e>0?d:n1:n,exp=MAX_EXP,MAX_EXP=1/0,n=new BigNumber(s),n0.c[0]=0;q=div(n,d,0,1),d2=d0.plus(q.times(d1)),1!=d2.cmp(md);)d0=d1,d1=d2,n1=n0.plus(q.times(d2=n1)),n0=d2,d=n.minus(q.times(d2=d)),n=d2;return d2=div(md.minus(d0),d1,0,1),n0=n0.plus(d2.times(n1)),d0=d0.plus(d2.times(d1)),n0.s=n1.s=x.s,e*=2,arr=div(n1,d1,e,ROUNDING_MODE).minus(x).abs().cmp(div(n0,d0,e,ROUNDING_MODE).minus(x).abs())<1?[n1.toString(),d1.toString()]:[n0.toString(),d0.toString()],MAX_EXP=exp,arr},P.toNumber=function(){var x=this;return+x||(x.s?0*x.s:NaN)},P.toPower=P.pow=function(n){var k,y,i=mathfloor(n<0?-n:+n),x=this;if(!isValidInt(n,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,23,"exponent")&&(!isFinite(n)||i>MAX_SAFE_INTEGER&&(n/=0)||parseFloat(n)!=n&&!(n=NaN)))return new BigNumber(Math.pow(+x,n));for(k=POW_PRECISION?mathceil(POW_PRECISION/LOG_BASE+2):0,y=new BigNumber(ONE);;){if(i%2){if(y=y.times(x),!y.c)break;k&&y.c.length>k&&(y.c.length=k)}if(!(i=mathfloor(i/2)))break;x=x.times(x),k&&x.c&&x.c.length>k&&(x.c.length=k)}return n<0&&(y=ONE.div(y)),k?round(y,POW_PRECISION,ROUNDING_MODE):y},P.toPrecision=function(sd,rm){return format(this,null!=sd&&isValidInt(sd,1,MAX,24,"precision")?0|sd:null,rm,24)},P.toString=function(b){var str,n=this,s=n.s,e=n.e;return null===e?s?(str="Infinity",s<0&&(str="-"+str)):str="NaN":(str=coeffToString(n.c),str=null!=b&&isValidInt(b,2,64,25,"base")?convertBase(toFixedPoint(str,e),0|b,10,s):e<=TO_EXP_NEG||e>=TO_EXP_POS?toExponential(str,e):toFixedPoint(str,e),s<0&&n.c[0]&&(str="-"+str)),str},P.truncated=P.trunc=function(){return round(new BigNumber(this),this.e+1,1)},P.valueOf=P.toJSON=function(){return this.toString()},null!=configObj&&BigNumber.config(configObj),BigNumber}function bitFloor(n){var i=0|n;return n>0||n===i?i:i-1}function coeffToString(a){for(var s,z,i=1,j=a.length,r=a[0]+"";il^a?1:-1;for(j=(k=xc.length)<(l=yc.length)?k:l,i=0;iyc[i]^a?1:-1;return k==l?0:k>l^a?1:-1}function intValidatorNoErrors(n,min,max){return(n=truncate(n))>=min&&n<=max}function isArray(obj){return"[object Array]"==Object.prototype.toString.call(obj)}function toBaseOut(str,baseIn,baseOut){for(var j,arrL,arr=[0],i=0,len=str.length;ibaseOut-1&&(null==arr[j+1]&&(arr[j+1]=0),arr[j+1]+=arr[j]/baseOut|0,arr[j]%=baseOut)}return arr.reverse()}function toExponential(str,e){return(str.length>1?str.charAt(0)+"."+str.slice(1):str)+(e<0?"e":"e+")+e}function toFixedPoint(str,e){var len,z;if(e<0){for(z="0.";++e;z+="0");str=z+str}else if(len=str.length,++e>len){for(z="0",e-=len;--e;z+="0");str+=z}else e72)return!1;if(48!==buffer[0])return!1;if(buffer[1]!==buffer.length-2)return!1;if(2!==buffer[2])return!1;var lenR=buffer[3];if(0===lenR)return!1;if(5+lenR>=buffer.length)return!1;if(2!==buffer[4+lenR])return!1;var lenS=buffer[5+lenR];return 0!==lenS&&(6+lenR+lenS===buffer.length&&(!(128&buffer[4])&&(!(lenR>1&&0===buffer[4]&&!(128&buffer[5]))&&(!(128&buffer[lenR+6])&&!(lenS>1&&0===buffer[lenR+6]&&!(128&buffer[lenR+7]))))))}function decode(buffer){if(buffer.length<8)throw new Error("DER sequence length is too short");if(buffer.length>72)throw new Error("DER sequence length is too long");if(48!==buffer[0])throw new Error("Expected DER sequence");if(buffer[1]!==buffer.length-2)throw new Error("DER sequence length is invalid");if(2!==buffer[2])throw new Error("Expected DER integer");var lenR=buffer[3];if(0===lenR)throw new Error("R length is zero");if(5+lenR>=buffer.length)throw new Error("R length is too long");if(2!==buffer[4+lenR])throw new Error("Expected DER integer (2)");var lenS=buffer[5+lenR];if(0===lenS)throw new Error("S length is zero");if(6+lenR+lenS!==buffer.length)throw new Error("S length is invalid");if(128&buffer[4])throw new Error("R value is negative");if(lenR>1&&0===buffer[4]&&!(128&buffer[5]))throw new Error("R value excessively padded");if(128&buffer[lenR+6])throw new Error("S value is negative");if(lenS>1&&0===buffer[lenR+6]&&!(128&buffer[lenR+7]))throw new Error("S value excessively padded");return{r:buffer.slice(4,4+lenR),s:buffer.slice(6+lenR)}}function encode(r,s){var lenR=r.length,lenS=s.length;if(0===lenR)throw new Error("R length is zero");if(0===lenS)throw new Error("S length is zero");if(lenR>33)throw new Error("R length is too long");if(lenS>33)throw new Error("S length is too long");if(128&r[0])throw new Error("R value is negative");if(128&s[0])throw new Error("S value is negative");if(lenR>1&&0===r[0]&&!(128&r[1]))throw new Error("R value excessively padded");if(lenS>1&&0===s[0]&&!(128&s[1]))throw new Error("S value excessively padded");var signature=Buffer.allocUnsafe(6+lenR+lenS);return signature[0]=48,signature[1]=signature.length-2,signature[2]=2,signature[3]=r.length,r.copy(signature,4),signature[4+lenR]=2,signature[5+lenR]=s.length,s.copy(signature,6+lenR),signature}var Buffer=require("safe-buffer").Buffer;module.exports={check:check,decode:decode,encode:encode}},{"safe-buffer":313}],26:[function(require,module,exports){(function(global,Buffer){"use strict";var bitcore=module.exports;bitcore.version="v"+require("./package.json").version,bitcore.versionGuard=function(version){if(void 0!==version){throw new Error("More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.")}},bitcore.versionGuard(global._bitcore),global._bitcore=bitcore.version,bitcore.crypto={},bitcore.crypto.BN=require("./lib/crypto/bn"),bitcore.crypto.ECDSA=require("./lib/crypto/ecdsa"),bitcore.crypto.Hash=require("./lib/crypto/hash"),bitcore.crypto.Random=require("./lib/crypto/random"),bitcore.crypto.Point=require("./lib/crypto/point"),bitcore.crypto.Signature=require("./lib/crypto/signature"),bitcore.encoding={},bitcore.encoding.Base58=require("./lib/encoding/base58"),bitcore.encoding.Base58Check=require("./lib/encoding/base58check"),bitcore.encoding.BufferReader=require("./lib/encoding/bufferreader"),bitcore.encoding.BufferWriter=require("./lib/encoding/bufferwriter"),bitcore.encoding.Varint=require("./lib/encoding/varint"),bitcore.util={},bitcore.util.buffer=require("./lib/util/buffer"),bitcore.util.js=require("./lib/util/js"),bitcore.util.preconditions=require("./lib/util/preconditions"),bitcore.errors=require("./lib/errors"),bitcore.Address=require("./lib/address"),bitcore.Block=require("./lib/block"),bitcore.MerkleBlock=require("./lib/block/merkleblock"),bitcore.BlockHeader=require("./lib/block/blockheader"),bitcore.HDPrivateKey=require("./lib/hdprivatekey.js"),bitcore.HDPublicKey=require("./lib/hdpublickey.js"),bitcore.Networks=require("./lib/networks"),bitcore.Opcode=require("./lib/opcode"),bitcore.PrivateKey=require("./lib/privatekey"),bitcore.PublicKey=require("./lib/publickey"),bitcore.Script=require("./lib/script"),bitcore.Transaction=require("./lib/transaction"),bitcore.URI=require("./lib/uri"),bitcore.Unit=require("./lib/unit"),bitcore.deps={},bitcore.deps.bnjs=require("bn.js"),bitcore.deps.bs58=require("bs58"),bitcore.deps.Buffer=Buffer,bitcore.deps.elliptic=require("elliptic"),bitcore.deps._=require("lodash"),bitcore.Transaction.sighash=require("./lib/transaction/sighash")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"./lib/address":27,"./lib/block":30,"./lib/block/blockheader":29,"./lib/block/merkleblock":31,"./lib/crypto/bn":32,"./lib/crypto/ecdsa":33,"./lib/crypto/hash":34,"./lib/crypto/point":35,"./lib/crypto/random":36,"./lib/crypto/signature":37,"./lib/encoding/base58":38,"./lib/encoding/base58check":39,"./lib/encoding/bufferreader":40,"./lib/encoding/bufferwriter":41,"./lib/encoding/varint":42,"./lib/errors":43,"./lib/hdprivatekey.js":45,"./lib/hdpublickey.js":46,"./lib/networks":47,"./lib/opcode":48,"./lib/privatekey":49,"./lib/publickey":50,"./lib/script":51,"./lib/transaction":54,"./lib/transaction/sighash":62,"./lib/unit":66,"./lib/uri":67,"./lib/util/buffer":68,"./lib/util/js":69,"./lib/util/preconditions":70,"./package.json":87,"bn.js":99,bs58:146,buffer:149,elliptic:71,lodash:268}],27:[function(require,module,exports){(function(Buffer){"use strict";function Address(data,network,type){if(!(this instanceof Address))return new Address(data,network,type);if(_.isArray(data)&&_.isNumber(network))return Address.createMultisig(data,network,type);if(data instanceof Address)return data;if($.checkArgument(data,"First argument is required, please include address data.","guide/address.html"),network&&!Networks.get(network))throw new TypeError('Second argument must be "livenet" or "testnet".');if(type&&type!==Address.PayToPublicKeyHash&&type!==Address.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var info=this._classifyArguments(data,network,type);return info.network=info.network||Networks.get(network)||Networks.defaultNetwork,info.type=info.type||type||Address.PayToPublicKeyHash,JSUtil.defineImmutable(this,{hashBuffer:info.hashBuffer,network:info.network,type:info.type}),this} +var _=require("lodash"),$=require("./util/preconditions"),errors=require("./errors"),Base58Check=require("./encoding/base58check"),Networks=require("./networks"),Hash=require("./crypto/hash"),JSUtil=require("./util/js"),PublicKey=require("./publickey");Address.prototype._classifyArguments=function(data,network,type){if((data instanceof Buffer||data instanceof Uint8Array)&&20===data.length)return Address._transformHash(data);if((data instanceof Buffer||data instanceof Uint8Array)&&21===data.length)return Address._transformBuffer(data,network,type);if(data instanceof PublicKey)return Address._transformPublicKey(data);if(data instanceof Script)return Address._transformScript(data,network);if("string"==typeof data)return Address._transformString(data,network,type);if(_.isObject(data))return Address._transformObject(data);throw new TypeError("First argument is an unrecognized data format.")},Address.PayToPublicKeyHash="pubkeyhash",Address.PayToScriptHash="scripthash",Address._transformHash=function(hash){var info={};if(!(hash instanceof Buffer||hash instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==hash.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return info.hashBuffer=hash,info},Address._transformObject=function(data){return $.checkArgument(data.hash||data.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),$.checkArgument(data.type,"Must provide a `type` property"),{hashBuffer:data.hash?new Buffer(data.hash,"hex"):data.hashBuffer,network:Networks.get(data.network)||Networks.defaultNetwork,type:data.type}},Address._classifyFromVersion=function(buffer){var version={},pubkeyhashNetwork=Networks.get(buffer[0],"pubkeyhash"),scripthashNetwork=Networks.get(buffer[0],"scripthash");return pubkeyhashNetwork?(version.network=pubkeyhashNetwork,version.type=Address.PayToPublicKeyHash):scripthashNetwork&&(version.network=scripthashNetwork,version.type=Address.PayToScriptHash),version},Address._transformBuffer=function(buffer,network,type){var info={};if(!(buffer instanceof Buffer||buffer instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==buffer.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var networkObj=Networks.get(network),bufferVersion=Address._classifyFromVersion(buffer);if(network&&!networkObj)throw new TypeError("Unknown network");if(!bufferVersion.network||networkObj&&networkObj!==bufferVersion.network)throw new TypeError("Address has mismatched network type.");if(!bufferVersion.type||type&&type!==bufferVersion.type)throw new TypeError("Address has mismatched type.");return info.hashBuffer=buffer.slice(1),info.network=bufferVersion.network,info.type=bufferVersion.type,info},Address._transformPublicKey=function(pubkey){var info={};if(!(pubkey instanceof PublicKey))throw new TypeError("Address must be an instance of PublicKey.");return info.hashBuffer=Hash.sha256ripemd160(pubkey.toBuffer()),info.type=Address.PayToPublicKeyHash,info},Address._transformScript=function(script,network){$.checkArgument(script instanceof Script,"script must be a Script instance");var info=script.getAddressInfo(network);if(!info)throw new errors.Script.CantDeriveAddress(script);return info},Address.createMultisig=function(publicKeys,threshold,network){return network=network||publicKeys[0].network||Networks.defaultNetwork,Address.payingTo(Script.buildMultisigOut(publicKeys,threshold),network)},Address._transformString=function(data,network,type){if("string"!=typeof data)throw new TypeError("data parameter supplied is not a string.");data=data.trim();var addressBuffer=Base58Check.decode(data);return Address._transformBuffer(addressBuffer,network,type)},Address.fromPublicKey=function(data,network){var info=Address._transformPublicKey(data);return network=network||Networks.defaultNetwork,new Address(info.hashBuffer,network,info.type)},Address.fromPublicKeyHash=function(hash,network){return new Address(Address._transformHash(hash).hashBuffer,network,Address.PayToPublicKeyHash)},Address.fromScriptHash=function(hash,network){return $.checkArgument(hash,"hash parameter is required"),new Address(Address._transformHash(hash).hashBuffer,network,Address.PayToScriptHash)},Address.payingTo=function(script,network){return $.checkArgument(script,"script is required"),$.checkArgument(script instanceof Script,"script must be instance of Script"),Address.fromScriptHash(Hash.sha256ripemd160(script.toBuffer()),network)},Address.fromScript=function(script,network){$.checkArgument(script instanceof Script,"script must be a Script instance");var info=Address._transformScript(script,network);return new Address(info.hashBuffer,network,info.type)},Address.fromBuffer=function(buffer,network,type){var info=Address._transformBuffer(buffer,network,type);return new Address(info.hashBuffer,info.network,info.type)},Address.fromString=function(str,network,type){var info=Address._transformString(str,network,type);return new Address(info.hashBuffer,info.network,info.type)},Address.fromObject=function(obj){return $.checkState(JSUtil.isHexa(obj.hash),'Unexpected hash property, "'+obj.hash+'", expected to be hex.'),new Address(new Buffer(obj.hash,"hex"),obj.network,obj.type)},Address.getValidationError=function(data,network,type){var error;try{new Address(data,network,type)}catch(e){error=e}return error},Address.isValid=function(data,network,type){return!Address.getValidationError(data,network,type)},Address.prototype.isPayToPublicKeyHash=function(){return this.type===Address.PayToPublicKeyHash},Address.prototype.isPayToScriptHash=function(){return this.type===Address.PayToScriptHash},Address.prototype.toBuffer=function(){var version=new Buffer([this.network[this.type]]);return Buffer.concat([version,this.hashBuffer])},Address.prototype.toObject=Address.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},Address.prototype.toString=function(){return Base58Check.encode(this.toBuffer())},Address.prototype.inspect=function(){return""},module.exports=Address;var Script=require("./script")}).call(this,require("buffer").Buffer)},{"./crypto/hash":34,"./encoding/base58check":39,"./errors":43,"./networks":47,"./publickey":50,"./script":51,"./util/js":69,"./util/preconditions":70,buffer:149,lodash:268}],28:[function(require,module,exports){(function(Buffer){"use strict";function Block(arg){return this instanceof Block?(_.extend(this,Block._from(arg)),this):new Block(arg)}var _=require("lodash"),BlockHeader=require("./blockheader"),BN=require("../crypto/bn"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Transaction=require("../transaction"),$=require("../util/preconditions");Block.MAX_BLOCK_SIZE=1e6,Block._from=function(arg){var info={};if(BufferUtil.isBuffer(arg))info=Block._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for Block");info=Block._fromObject(arg)}return info},Block._fromObject=function(data){var transactions=[];return data.transactions.forEach(function(tx){tx instanceof Transaction?transactions.push(tx):transactions.push(Transaction().fromObject(tx))}),{header:BlockHeader.fromObject(data.header),transactions:transactions}},Block.fromObject=function(obj){return new Block(Block._fromObject(obj))},Block._fromBufferReader=function(br){var info={};$.checkState(!br.finished(),"No block data received"),info.header=BlockHeader.fromBufferReader(br);var transactions=br.readVarintNum();info.transactions=[];for(var i=0;i1;size=Math.floor((size+1)/2)){for(var i=0;i"},Block.Values={START_OF_BLOCK:8,NULL_HASH:new Buffer("0000000000000000000000000000000000000000000000000000000000000000","hex")},module.exports=Block}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../transaction":54,"../util/buffer":68,"../util/preconditions":70,"./blockheader":29,buffer:149,lodash:268}],29:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),BN=require("../crypto/bn"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),$=(require("../util/js"),require("../util/preconditions")),BlockHeader=function BlockHeader(arg){if(!(this instanceof BlockHeader))return new BlockHeader(arg);var info=BlockHeader._from(arg);return this.version=info.version,this.prevHash=info.prevHash,this.merkleRoot=info.merkleRoot,this.time=info.time,this.timestamp=info.time,this.bits=info.bits,this.nonce=info.nonce,info.hash&&$.checkState(this.hash===info.hash,"Argument object hash property does not match block hash."),this};BlockHeader._from=function(arg){var info={};if(BufferUtil.isBuffer(arg))info=BlockHeader._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for BlockHeader");info=BlockHeader._fromObject(arg)}return info},BlockHeader._fromObject=function(data){$.checkArgument(data,"data is required");var prevHash=data.prevHash,merkleRoot=data.merkleRoot;return _.isString(data.prevHash)&&(prevHash=BufferUtil.reverse(new Buffer(data.prevHash,"hex"))),_.isString(data.merkleRoot)&&(merkleRoot=BufferUtil.reverse(new Buffer(data.merkleRoot,"hex"))),{hash:data.hash,version:data.version,prevHash:prevHash,merkleRoot:merkleRoot,time:data.time,timestamp:data.time,bits:data.bits,nonce:data.nonce}},BlockHeader.fromObject=function(obj){var info=BlockHeader._fromObject(obj);return new BlockHeader(info)},BlockHeader.fromRawBlock=function(data){BufferUtil.isBuffer(data)||(data=new Buffer(data,"binary"));var br=BufferReader(data);br.pos=BlockHeader.Constants.START_OF_HEADER;var info=BlockHeader._fromBufferReader(br);return new BlockHeader(info)},BlockHeader.fromBuffer=function(buf){var info=BlockHeader._fromBufferReader(BufferReader(buf));return new BlockHeader(info)},BlockHeader.fromString=function(str){var buf=new Buffer(str,"hex");return BlockHeader.fromBuffer(buf)},BlockHeader._fromBufferReader=function(br){var info={};return info.version=br.readInt32LE(),info.prevHash=br.read(32),info.merkleRoot=br.read(32),info.time=br.readUInt32LE(),info.bits=br.readUInt32LE(),info.nonce=br.readUInt32LE(),info},BlockHeader.fromBufferReader=function(br){var info=BlockHeader._fromBufferReader(br);return new BlockHeader(info)},BlockHeader.prototype.toObject=BlockHeader.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:BufferUtil.reverse(this.prevHash).toString("hex"),merkleRoot:BufferUtil.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},BlockHeader.prototype.toBuffer=function(){return this.toBufferWriter().concat()},BlockHeader.prototype.toString=function(){return this.toBuffer().toString("hex")},BlockHeader.prototype.toBufferWriter=function(bw){return bw||(bw=new BufferWriter),bw.writeInt32LE(this.version),bw.write(this.prevHash),bw.write(this.merkleRoot),bw.writeUInt32LE(this.time),bw.writeUInt32LE(this.bits),bw.writeUInt32LE(this.nonce),bw},BlockHeader.prototype.getTargetDifficulty=function(bits){bits=bits||this.bits;for(var target=new BN(16777215&bits),mov=8*((bits>>>24)-3);mov-- >0;)target=target.mul(new BN(2));return target},BlockHeader.prototype.getDifficulty=function(){var difficulty1TargetBN=this.getTargetDifficulty(486604799).mul(new BN(Math.pow(10,8))),currentTargetBN=this.getTargetDifficulty(),difficultyString=difficulty1TargetBN.div(currentTargetBN).toString(10),decimalPos=difficultyString.length-8;return difficultyString=difficultyString.slice(0,decimalPos)+"."+difficultyString.slice(decimalPos),parseFloat(difficultyString)},BlockHeader.prototype._getHash=function(){var buf=this.toBuffer();return Hash.sha256sha256(buf)};var idProperty={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=BufferReader(this._getHash()).readReverse().toString("hex")),this._id},set:_.noop};Object.defineProperty(BlockHeader.prototype,"id",idProperty),Object.defineProperty(BlockHeader.prototype,"hash",idProperty),BlockHeader.prototype.validTimestamp=function(){var currentTime=Math.round((new Date).getTime()/1e3);return!(this.time>currentTime+BlockHeader.Constants.MAX_TIME_OFFSET)},BlockHeader.prototype.validProofOfWork=function(){var pow=new BN(this.id,"hex"),target=this.getTargetDifficulty();return!(pow.cmp(target)>0)},BlockHeader.prototype.inspect=function(){return""},BlockHeader.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new BN("10000000000000000000000000000000000000000000000000000000000000000","hex")},module.exports=BlockHeader}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:149,lodash:268}],30:[function(require,module,exports){"use strict";module.exports=require("./block"),module.exports.BlockHeader=require("./blockheader"),module.exports.MerkleBlock=require("./merkleblock")},{"./block":28,"./blockheader":29,"./merkleblock":31}],31:[function(require,module,exports){(function(Buffer){"use strict";function MerkleBlock(arg){if(!(this instanceof MerkleBlock))return new MerkleBlock(arg);var info={};if(BufferUtil.isBuffer(arg))info=MerkleBlock._fromBufferReader(BufferReader(arg));else{if(!_.isObject(arg))throw new TypeError("Unrecognized argument for MerkleBlock");var header;header=arg.header instanceof BlockHeader?arg.header:BlockHeader.fromObject(arg.header),info={header:header,numTransactions:arg.numTransactions,hashes:arg.hashes,flags:arg.flags}}return _.extend(this,info),this._flagBitsUsed=0,this._hashesUsed=0,this}var _=require("lodash"),BlockHeader=require("./blockheader"),BufferUtil=require("../util/buffer"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Transaction=(require("../util/js"),require("../transaction")),errors=require("../errors"),$=require("../util/preconditions");MerkleBlock.fromBuffer=function(buf){return MerkleBlock.fromBufferReader(BufferReader(buf))},MerkleBlock.fromBufferReader=function(br){return new MerkleBlock(MerkleBlock._fromBufferReader(br))},MerkleBlock.prototype.toBuffer=function(){return this.toBufferWriter().concat()},MerkleBlock.prototype.toBufferWriter=function(bw){bw||(bw=new BufferWriter),bw.write(this.header.toBuffer()),bw.writeUInt32LE(this.numTransactions),bw.writeVarintNum(this.hashes.length);for(var i=0;ithis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new errors.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length8*this.flags.length)return null;var isParentOfMatch=this.flags[opts.flagBitsUsed>>3]>>>(7&opts.flagBitsUsed++)&1;if(0!==depth&&isParentOfMatch){var left=this._traverseMerkleTree(depth-1,2*pos,opts),right=left;return 2*pos+1=this.hashes.length)return null;var hash=this.hashes[opts.hashesUsed++];return 0===depth&&isParentOfMatch&&opts.txs.push(hash),new Buffer(hash,"hex")},MerkleBlock.prototype._calcTreeWidth=function(height){return this.numTransactions+(1<>height},MerkleBlock.prototype._calcTreeHeight=function(){for(var height=0;this._calcTreeWidth(height)>1;)height++;return height},MerkleBlock.prototype.hasTransaction=function(tx){$.checkArgument(!_.isUndefined(tx),"tx cannot be undefined"),$.checkArgument(tx instanceof Transaction||"string"==typeof tx,'Invalid tx given, tx must be a "string" or "Transaction"');var hash=tx;tx instanceof Transaction&&(hash=BufferUtil.reverse(new Buffer(tx.id,"hex")).toString("hex"));var txs=[],height=this._calcTreeHeight();return this._traverseMerkleTree(height,0,{txs:txs}),-1!==txs.indexOf(hash)},MerkleBlock._fromBufferReader=function(br){$.checkState(!br.finished(),"No merkleblock data received");var info={};info.header=BlockHeader.fromBufferReader(br),info.numTransactions=br.readUInt32LE();var numHashes=br.readVarintNum();info.hashes=[];for(var i=0;iopts.size?buf=BN.trim(buf,natlen):natlen0&&0==(127&buf[buf.length-1])&&(buf.length<=1||0==(128&buf[buf.length-2])))throw new Error("non-minimally encoded script number");return BN.fromSM(buf,{endian:"little"})},BN.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},BN.prototype.gt=function(b){return this.cmp(b)>0},BN.prototype.gte=function(b){return this.cmp(b)>=0},BN.prototype.lt=function(b){return this.cmp(b)<0},BN.trim=function(buf,natlen){return buf.slice(natlen-buf.length,buf.length)},BN.pad=function(buf,natlen,size){for(var rbuf=new Buffer(size),i=0;i>1,n=Point.getN(),G=Point.getG(),x=isSecondKey?r.add(n):r,R=Point.fromX(isYOdd,x);if(!R.mul(n).isInfinity())throw new Error("nR is not a valid curve point");var eNeg=e.neg().umod(n),rInv=r.invm(n),Q=R.mul(s).add(G.mul(eNeg)).mul(rInv);return PublicKey.fromPoint(Q,this.sig.compressed)},ECDSA.prototype.sigError=function(){if(!BufferUtil.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var r=this.sig.r,s=this.sig.s;if(!(r.gt(BN.Zero)&&r.lt(Point.getN())&&s.gt(BN.Zero)&&s.lt(Point.getN())))return"r and s not in range";var e=BN.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),n=Point.getN(),sinv=s.invm(n),u1=sinv.mul(e).umod(n),u2=sinv.mul(r).umod(n),p=Point.getG().mulAdd(u1,this.pubkey.point,u2);return p.isInfinity()?"p is infinity":0!==p.getX().umod(n).cmp(r)&&"Invalid signature"},ECDSA.toLowS=function(s){return s.gt(BN.fromBuffer(new Buffer("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(s=Point.getN().sub(s)),s},ECDSA.prototype._findSignature=function(d,e){var k,Q,r,s,N=Point.getN(),G=Point.getG(),badrs=0;do{(!this.k||badrs>0)&&this.deterministicK(badrs),badrs++,k=this.k,Q=G.mul(k),r=Q.x.umod(N),s=k.invm(N).mul(e.add(d.mul(r))).umod(N)}while(r.cmp(BN.Zero)<=0||s.cmp(BN.Zero)<=0);return s=ECDSA.toLowS(s),{s:s,r:r}},ECDSA.prototype.sign=function(){var hashbuf=this.hashbuf,privkey=this.privkey,d=privkey.bn;$.checkState(hashbuf&&privkey&&d,new Error("invalid parameters")),$.checkState(BufferUtil.isBuffer(hashbuf)&&32===hashbuf.length,new Error("hashbuf must be a 32 byte buffer"));var e=BN.fromBuffer(hashbuf,this.endian?{endian:this.endian}:void 0),obj=this._findSignature(d,e);return obj.compressed=this.pubkey.compressed,this.sig=new Signature(obj),this},ECDSA.prototype.signRandomK=function(){return this.randomK(),this.sign()},ECDSA.prototype.toString=function(){var obj={};return this.hashbuf&&(obj.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(obj.privkey=this.privkey.toString()),this.pubkey&&(obj.pubkey=this.pubkey.toString()),this.sig&&(obj.sig=this.sig.toString()),this.k&&(obj.k=this.k.toString()),JSON.stringify(obj)},ECDSA.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},ECDSA.sign=function(hashbuf,privkey,endian){return ECDSA().set({hashbuf:hashbuf,endian:endian,privkey:privkey}).sign().sig},ECDSA.verify=function(hashbuf,sig,pubkey,endian){return ECDSA().set({hashbuf:hashbuf,endian:endian,sig:sig,pubkey:pubkey}).verify().verified},module.exports=ECDSA}).call(this,require("buffer").Buffer)},{"../publickey":50,"../util/buffer":68,"../util/preconditions":70,"./bn":32,"./hash":34,"./point":35,"./random":36,"./signature":37,buffer:149,lodash:268}],34:[function(require,module,exports){(function(Buffer){"use strict";var crypto=require("crypto"),BufferUtil=require("../util/buffer"),$=require("../util/preconditions"),Hash=module.exports;Hash.sha1=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha1").update(buf).digest()},Hash.sha1.blocksize=512,Hash.sha256=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha256").update(buf).digest()},Hash.sha256.blocksize=512,Hash.sha256sha256=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),Hash.sha256(Hash.sha256(buf))},Hash.ripemd160=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("ripemd160").update(buf).digest()},Hash.sha256ripemd160=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),Hash.ripemd160(Hash.sha256(buf))},Hash.sha512=function(buf){return $.checkArgument(BufferUtil.isBuffer(buf)),crypto.createHash("sha512").update(buf).digest()},Hash.sha512.blocksize=1024,Hash.hmac=function(hashf,data,key){$.checkArgument(BufferUtil.isBuffer(data)),$.checkArgument(BufferUtil.isBuffer(key)),$.checkArgument(hashf.blocksize);var blocksize=hashf.blocksize/8;if(key.length>blocksize)key=hashf(key);else if(key>>=8)}return b},module.exports=Random}).call(this,require("_process"),require("buffer").Buffer)},{_process:285,buffer:149,crypto:174}],37:[function(require,module,exports){(function(Buffer){"use strict";var BN=require("./bn"),_=require("lodash"),$=require("../util/preconditions"),BufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),Signature=function Signature(r,s){if(!(this instanceof Signature))return new Signature(r,s);if(r instanceof BN)this.set({r:r,s:s});else if(r){var obj=r;this.set(obj)}};Signature.prototype.set=function(obj){return this.r=obj.r||this.r||void 0,this.s=obj.s||this.s||void 0,this.i=void 0!==obj.i?obj.i:this.i,this.compressed=void 0!==obj.compressed?obj.compressed:this.compressed,this.nhashtype=obj.nhashtype||this.nhashtype||void 0,this},Signature.fromCompact=function(buf){$.checkArgument(BufferUtil.isBuffer(buf),"Argument is expected to be a Buffer");var sig=new Signature,compressed=!0,i=buf.slice(0,1)[0]-27-4;i<0&&(compressed=!1,i+=4);var b2=buf.slice(1,33),b3=buf.slice(33,65);return $.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),$.checkArgument(32===b2.length,new Error("r must be 32 bytes")),$.checkArgument(32===b3.length,new Error("s must be 32 bytes")),sig.compressed=compressed,sig.i=i,sig.r=BN.fromBuffer(b2),sig.s=BN.fromBuffer(b3),sig},Signature.fromDER=Signature.fromBuffer=function(buf,strict){var obj=Signature.parseDER(buf,strict),sig=new Signature;return sig.r=obj.r,sig.s=obj.s,sig},Signature.fromTxFormat=function(buf){var nhashtype=buf.readUInt8(buf.length-1),derbuf=buf.slice(0,buf.length-1),sig=new Signature.fromDER(derbuf,!1);return sig.nhashtype=nhashtype,sig},Signature.fromString=function(str){var buf=new Buffer(str,"hex");return Signature.fromDER(buf)},Signature.parseDER=function(buf,strict){$.checkArgument(BufferUtil.isBuffer(buf),new Error("DER formatted signature should be a buffer")),_.isUndefined(strict)&&(strict=!0);var header=buf[0];$.checkArgument(48===header,new Error("Header byte should be 0x30"));var length=buf[1],buflength=buf.slice(2).length;$.checkArgument(!strict||length===buflength,new Error("Length byte should length of what follows")),length=length73)return!1;if(48!==buf[0])return!1;if(buf[1]!==buf.length-3)return!1;var nLenR=buf[3];if(5+nLenR>=buf.length)return!1;var nLenS=buf[5+nLenR];if(nLenR+nLenS+7!==buf.length)return!1;var R=buf.slice(4);if(2!==buf[2])return!1;if(0===nLenR)return!1;if(128&R[0])return!1;if(nLenR>1&&0===R[0]&&!(128&R[1]))return!1;var S=buf.slice(6+nLenR);return 2===buf[6+nLenR-2]&&(0!==nLenS&&(!(128&S[0])&&!(nLenS>1&&0===S[0]&&!(128&S[1]))))},Signature.prototype.hasLowS=function(){return!this.s.lt(new BN(1))&&!this.s.gt(new BN("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},Signature.prototype.hasDefinedHashtype=function(){if(!JSUtil.isNaturalNumber(this.nhashtype))return!1;var temp=this.nhashtype&~Signature.SIGHASH_ANYONECANPAY;return!(tempSignature.SIGHASH_SINGLE)},Signature.prototype.toTxFormat=function(){var derbuf=this.toDER(),buf=new Buffer(1);return buf.writeUInt8(this.nhashtype,0),Buffer.concat([derbuf,buf])},Signature.SIGHASH_ALL=1,Signature.SIGHASH_NONE=2,Signature.SIGHASH_SINGLE=3,Signature.SIGHASH_ANYONECANPAY=128,module.exports=Signature}).call(this,require("buffer").Buffer)},{"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./bn":32,buffer:149,lodash:268}],38:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),bs58=require("bs58"),buffer=require("buffer"),ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),Base58=function Base58(obj){if(!(this instanceof Base58))return new Base58(obj);if(Buffer.isBuffer(obj)){var buf=obj;this.fromBuffer(buf)}else if("string"==typeof obj){var str=obj;this.fromString(str)}else obj&&this.set(obj)};Base58.validCharacters=function(chars){return buffer.Buffer.isBuffer(chars)&&(chars=chars.toString()),_.every(_.map(chars,function(char){return _.includes(ALPHABET,char)}))},Base58.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this},Base58.encode=function(buf){if(!buffer.Buffer.isBuffer(buf))throw new Error("Input should be a buffer");return bs58.encode(buf)},Base58.decode=function(str){if("string"!=typeof str)throw new Error("Input should be a string");return new Buffer(bs58.decode(str))},Base58.prototype.fromBuffer=function(buf){return this.buf=buf,this},Base58.prototype.fromString=function(str){var buf=Base58.decode(str);return this.buf=buf,this},Base58.prototype.toBuffer=function(){return this.buf},Base58.prototype.toString=function(){return Base58.encode(this.buf)},module.exports=Base58}).call(this,require("buffer").Buffer)},{bs58:146,buffer:149,lodash:268}],39:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),Base58=require("./base58"),buffer=require("buffer"),sha256sha256=require("../crypto/hash").sha256sha256,Base58Check=function Base58Check(obj){if(!(this instanceof Base58Check))return new Base58Check(obj);if(Buffer.isBuffer(obj)){var buf=obj;this.fromBuffer(buf)}else if("string"==typeof obj){var str=obj;this.fromString(str)}else obj&&this.set(obj)};Base58Check.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this},Base58Check.validChecksum=function(data,checksum){return _.isString(data)&&(data=new buffer.Buffer(Base58.decode(data))),_.isString(checksum)&&(checksum=new buffer.Buffer(Base58.decode(checksum))),checksum||(checksum=data.slice(-4),data=data.slice(0,-4)),Base58Check.checksum(data).toString("hex")===checksum.toString("hex")},Base58Check.decode=function(s){if("string"!=typeof s)throw new Error("Input must be a string");var buf=new Buffer(Base58.decode(s));if(buf.length<4)throw new Error("Input string too short");var data=buf.slice(0,-4),csum=buf.slice(-4),hash=sha256sha256(data),hash4=hash.slice(0,4);if(csum.toString("hex")!==hash4.toString("hex"))throw new Error("Checksum mismatch");return data},Base58Check.checksum=function(buffer){return sha256sha256(buffer).slice(0,4)},Base58Check.encode=function(buf){if(!Buffer.isBuffer(buf))throw new Error("Input must be a buffer");var checkedBuf=new Buffer(buf.length+4),hash=Base58Check.checksum(buf);return buf.copy(checkedBuf),hash.copy(checkedBuf,buf.length),Base58.encode(checkedBuf)},Base58Check.prototype.fromBuffer=function(buf){return this.buf=buf,this},Base58Check.prototype.fromString=function(str){var buf=Base58Check.decode(str);return this.buf=buf,this},Base58Check.prototype.toBuffer=function(){return this.buf},Base58Check.prototype.toString=function(){return Base58Check.encode(this.buf)},module.exports=Base58Check}).call(this,require("buffer").Buffer)},{"../crypto/hash":34,"./base58":38,buffer:149,lodash:268}],40:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),$=require("../util/preconditions"),BufferUtil=require("../util/buffer"),BN=require("../crypto/bn"),BufferReader=function BufferReader(buf){if(!(this instanceof BufferReader))return new BufferReader(buf);if(!_.isUndefined(buf))if(Buffer.isBuffer(buf))this.set({buf:buf});else if(_.isString(buf))this.set({buf:new Buffer(buf,"hex")});else{if(!_.isObject(buf))throw new TypeError("Unrecognized argument for BufferReader");var obj=buf;this.set(obj)}};BufferReader.prototype.set=function(obj){return this.buf=obj.buf||this.buf||void 0,this.pos=obj.pos||this.pos||0,this},BufferReader.prototype.eof=function(){return this.pos>=this.buf.length},BufferReader.prototype.finished=BufferReader.prototype.eof,BufferReader.prototype.read=function(len){$.checkArgument(!_.isUndefined(len),"Must specify a length");var buf=this.buf.slice(this.pos,this.pos+len);return this.pos=this.pos+len,buf},BufferReader.prototype.readAll=function(){var buf=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,buf},BufferReader.prototype.readUInt8=function(){var val=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,val},BufferReader.prototype.readUInt16BE=function(){var val=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,val},BufferReader.prototype.readUInt16LE=function(){var val=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,val},BufferReader.prototype.readUInt32BE=function(){var val=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readUInt32LE=function(){var val=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readInt32LE=function(){var val=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,val},BufferReader.prototype.readUInt64BEBN=function(){var buf=this.buf.slice(this.pos,this.pos+8),bn=BN.fromBuffer(buf);return this.pos=this.pos+8,bn},BufferReader.prototype.readUInt64LEBN=function(){var bn,second=this.buf.readUInt32LE(this.pos),first=this.buf.readUInt32LE(this.pos+4),combined=4294967296*first+second;if(combined<=9007199254740991)bn=new BN(combined);else{var data=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);bn=new BN(data,10,"le")}return this.pos=this.pos+8,bn},BufferReader.prototype.readVarintNum=function(){var first=this.readUInt8();switch(first){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var bn=this.readUInt64LEBN(),n=bn.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return first}},BufferReader.prototype.readVarLengthBuffer=function(){var len=this.readVarintNum(),buf=this.read(len);return $.checkState(buf.length===len,"Invalid length while reading varlength buffer. Expected to read: "+len+" and read "+buf.length),buf},BufferReader.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},BufferReader.prototype.readVarintBN=function(){var first=this.readUInt8();switch(first){case 253:return new BN(this.readUInt16LE());case 254:return new BN(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new BN(first)}},BufferReader.prototype.reverse=function(){for(var buf=new Buffer(this.buf.length),i=0;i=0&&arg=HDPrivateKey.Hardened||hardened,index64)throw new hdErrors.InvalidEntropyArgument.TooMuchEntropy(hexa);var hash=Hash.sha512hmac(hexa,new buffer.Buffer("Bitcoin seed"));return new HDPrivateKey({network:Network.get(network)||Network.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:hash.slice(0,32),chainCode:hash.slice(32,64)})},HDPrivateKey.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var HDPublicKey=require("./hdpublickey");this._hdPublicKey=new HDPublicKey(this)}}, +HDPrivateKey.prototype._buildFromBuffers=function(arg){HDPrivateKey._validateBufferArguments(arg),JSUtil.defineImmutable(this,{_buffers:arg});var sequence=[arg.version,arg.depth,arg.parentFingerPrint,arg.childIndex,arg.chainCode,BufferUtil.emptyBuffer(1),arg.privateKey],concat=buffer.Buffer.concat(sequence);if(arg.checksum&&arg.checksum.length){if(arg.checksum.toString()!==Base58Check.checksum(concat).toString())throw new errors.InvalidB58Checksum(concat)}else arg.checksum=Base58Check.checksum(concat);var xprivkey,network=Network.get(BufferUtil.integerFromBuffer(arg.version));xprivkey=Base58Check.encode(buffer.Buffer.concat(sequence)),arg.xprivkey=new Buffer(xprivkey);var privateKey=new PrivateKey(BN.fromBuffer(arg.privateKey),network),publicKey=privateKey.toPublicKey(),size=HDPrivateKey.ParentFingerPrintSize,fingerPrint=Hash.sha256ripemd160(publicKey.toBuffer()).slice(0,size);return JSUtil.defineImmutable(this,{xprivkey:xprivkey,network:network,depth:BufferUtil.integerFromSingleByteBuffer(arg.depth),privateKey:privateKey,publicKey:publicKey,fingerPrint:fingerPrint}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},HDPrivateKey._validateBufferArguments=function(arg){var checkBuffer=function(name,size){var buff=arg[name];assert(BufferUtil.isBuffer(buff),name+" argument is not a buffer"),assert(buff.length===size,name+" has not the expected size: found "+buff.length+", expected "+size)};checkBuffer("version",HDPrivateKey.VersionSize),checkBuffer("depth",HDPrivateKey.DepthSize),checkBuffer("parentFingerPrint",HDPrivateKey.ParentFingerPrintSize),checkBuffer("childIndex",HDPrivateKey.ChildIndexSize),checkBuffer("chainCode",HDPrivateKey.ChainCodeSize),checkBuffer("privateKey",HDPrivateKey.PrivateKeySize),arg.checksum&&arg.checksum.length&&checkBuffer("checksum",HDPrivateKey.CheckSumSize)},HDPrivateKey.prototype.toString=function(){return this.xprivkey},HDPrivateKey.prototype.inspect=function(){return""},HDPrivateKey.prototype.toObject=HDPrivateKey.prototype.toJSON=function(){return{network:Network.get(BufferUtil.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:BufferUtil.integerFromBuffer(this.fingerPrint),parentFingerPrint:BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:BufferUtil.integerFromBuffer(this._buffers.childIndex),chainCode:BufferUtil.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:BufferUtil.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},HDPrivateKey.fromBuffer=function(arg){return new HDPrivateKey(arg.toString())},HDPrivateKey.prototype.toBuffer=function(){return BufferUtil.copy(this._buffers.xprivkey)},HDPrivateKey.DefaultDepth=0,HDPrivateKey.DefaultFingerprint=0,HDPrivateKey.DefaultChildIndex=0,HDPrivateKey.Hardened=2147483648,HDPrivateKey.MaxIndex=2*HDPrivateKey.Hardened,HDPrivateKey.RootElementAlias=["m","M","m'","M'"],HDPrivateKey.VersionSize=4,HDPrivateKey.DepthSize=1,HDPrivateKey.ParentFingerPrintSize=4,HDPrivateKey.ChildIndexSize=4,HDPrivateKey.ChainCodeSize=32,HDPrivateKey.PrivateKeySize=32,HDPrivateKey.CheckSumSize=4,HDPrivateKey.DataLength=78,HDPrivateKey.SerializedByteSize=82,HDPrivateKey.VersionStart=0,HDPrivateKey.VersionEnd=HDPrivateKey.VersionStart+HDPrivateKey.VersionSize,HDPrivateKey.DepthStart=HDPrivateKey.VersionEnd,HDPrivateKey.DepthEnd=HDPrivateKey.DepthStart+HDPrivateKey.DepthSize,HDPrivateKey.ParentFingerPrintStart=HDPrivateKey.DepthEnd,HDPrivateKey.ParentFingerPrintEnd=HDPrivateKey.ParentFingerPrintStart+HDPrivateKey.ParentFingerPrintSize,HDPrivateKey.ChildIndexStart=HDPrivateKey.ParentFingerPrintEnd,HDPrivateKey.ChildIndexEnd=HDPrivateKey.ChildIndexStart+HDPrivateKey.ChildIndexSize,HDPrivateKey.ChainCodeStart=HDPrivateKey.ChildIndexEnd,HDPrivateKey.ChainCodeEnd=HDPrivateKey.ChainCodeStart+HDPrivateKey.ChainCodeSize,HDPrivateKey.PrivateKeyStart=HDPrivateKey.ChainCodeEnd+1,HDPrivateKey.PrivateKeyEnd=HDPrivateKey.PrivateKeyStart+HDPrivateKey.PrivateKeySize,HDPrivateKey.ChecksumStart=HDPrivateKey.PrivateKeyEnd,HDPrivateKey.ChecksumEnd=HDPrivateKey.ChecksumStart+HDPrivateKey.CheckSumSize,assert(HDPrivateKey.ChecksumEnd===HDPrivateKey.SerializedByteSize),module.exports=HDPrivateKey}).call(this,require("buffer").Buffer)},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./crypto/random":36,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdpublickey":46,"./networks":47,"./privatekey":49,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,assert:21,buffer:149,lodash:268}],46:[function(require,module,exports){(function(Buffer){"use strict";function HDPublicKey(arg){if(arg instanceof HDPublicKey)return arg;if(!(this instanceof HDPublicKey))return new HDPublicKey(arg);if(arg){if(_.isString(arg)||BufferUtil.isBuffer(arg)){var error=HDPublicKey.getSerializedError(arg);if(error){if(BufferUtil.isBuffer(arg)&&!HDPublicKey.getSerializedError(arg.toString()))return this._buildFromSerialized(arg.toString());if(error instanceof hdErrors.ArgumentIsPrivateExtended)return new HDPrivateKey(arg).hdPublicKey;throw error}return this._buildFromSerialized(arg)}if(_.isObject(arg))return arg instanceof HDPrivateKey?this._buildFromPrivate(arg):this._buildFromObject(arg);throw new hdErrors.UnrecognizedArgument(arg)}throw new hdErrors.MustSupplyArgument}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_=require("lodash"),$=require("./util/preconditions"),BN=require("./crypto/bn"),Base58=require("./encoding/base58"),Base58Check=require("./encoding/base58check"),Hash=require("./crypto/hash"),HDPrivateKey=require("./hdprivatekey"),Network=require("./networks"),Point=require("./crypto/point"),PublicKey=require("./publickey"),bitcoreErrors=require("./errors"),errors=bitcoreErrors,hdErrors=bitcoreErrors.HDPublicKey,assert=require("assert"),JSUtil=require("./util/js"),BufferUtil=require("./util/buffer");HDPublicKey.isValidPath=function(arg){if(_.isString(arg)){var indexes=HDPrivateKey._getDerivationIndexes(arg);return null!==indexes&&_.every(indexes,HDPublicKey.isValidPath)}return!!_.isNumber(arg)&&(arg>=0&&arg=HDPublicKey.Hardened||hardened)throw new hdErrors.InvalidIndexCantDeriveHardened;if(index<0)throw new hdErrors.InvalidPath(index);var publicKey,indexBuffer=BufferUtil.integerAsBuffer(index),data=BufferUtil.concat([this.publicKey.toBuffer(),indexBuffer]),hash=Hash.sha512hmac(data,this._buffers.chainCode),leftPart=BN.fromBuffer(hash.slice(0,32),{size:32}),chainCode=hash.slice(32,64);try{publicKey=PublicKey.fromPoint(Point.getG().mul(leftPart).add(this.publicKey.point))}catch(e){return this._deriveWithNumber(index+1)}return new HDPublicKey({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:index,chainCode:chainCode,publicKey:publicKey})},HDPublicKey.prototype._deriveFromString=function(path){if(_.includes(path,"'"))throw new hdErrors.InvalidIndexCantDeriveHardened;if(!HDPublicKey.isValidPath(path))throw new hdErrors.InvalidPath(path);return HDPrivateKey._getDerivationIndexes(path).reduce(function(prev,index){return prev._deriveWithNumber(index)},this)},HDPublicKey.isValidSerialized=function(data,network){return _.isNull(HDPublicKey.getSerializedError(data,network))},HDPublicKey.getSerializedError=function(data,network){if(!_.isString(data)&&!BufferUtil.isBuffer(data))return new hdErrors.UnrecognizedArgument("expected buffer or string");if(!Base58.validCharacters(data))return new errors.InvalidB58Char("(unknown)",data);try{data=Base58Check.decode(data)}catch(e){return new errors.InvalidB58Checksum(data)}if(data.length!==HDPublicKey.DataSize)return new hdErrors.InvalidLength(data);if(!_.isUndefined(network)){var error=HDPublicKey._validateNetwork(data,network);if(error)return error}var version=BufferUtil.integerFromBuffer(data.slice(0,4));return version===Network.livenet.xprivkey||version===Network.testnet.xprivkey?new hdErrors.ArgumentIsPrivateExtended:null},HDPublicKey._validateNetwork=function(data,networkArg){var network=Network.get(networkArg);if(!network)return new errors.InvalidNetworkArgument(networkArg);var version=data.slice(HDPublicKey.VersionStart,HDPublicKey.VersionEnd);return BufferUtil.integerFromBuffer(version)!==network.xpubkey?new errors.InvalidNetwork(version):null},HDPublicKey.prototype._buildFromPrivate=function(arg){var args=_.clone(arg._buffers),point=Point.getG().mul(BN.fromBuffer(args.privateKey));return args.publicKey=Point.pointToCompressed(point),args.version=BufferUtil.integerAsBuffer(Network.get(BufferUtil.integerFromBuffer(args.version)).xpubkey),args.privateKey=void 0,args.checksum=void 0,args.xprivkey=void 0,this._buildFromBuffers(args)},HDPublicKey.prototype._buildFromObject=function(arg){var buffers={version:arg.network?BufferUtil.integerAsBuffer(Network.get(arg.network).xpubkey):arg.version,depth:_.isNumber(arg.depth)?BufferUtil.integerAsSingleByteBuffer(arg.depth):arg.depth,parentFingerPrint:_.isNumber(arg.parentFingerPrint)?BufferUtil.integerAsBuffer(arg.parentFingerPrint):arg.parentFingerPrint,childIndex:_.isNumber(arg.childIndex)?BufferUtil.integerAsBuffer(arg.childIndex):arg.childIndex,chainCode:_.isString(arg.chainCode)?BufferUtil.hexToBuffer(arg.chainCode):arg.chainCode,publicKey:_.isString(arg.publicKey)?BufferUtil.hexToBuffer(arg.publicKey):BufferUtil.isBuffer(arg.publicKey)?arg.publicKey:arg.publicKey.toBuffer(),checksum:_.isNumber(arg.checksum)?BufferUtil.integerAsBuffer(arg.checksum):arg.checksum};return this._buildFromBuffers(buffers)},HDPublicKey.prototype._buildFromSerialized=function(arg){var decoded=Base58Check.decode(arg),buffers={version:decoded.slice(HDPublicKey.VersionStart,HDPublicKey.VersionEnd),depth:decoded.slice(HDPublicKey.DepthStart,HDPublicKey.DepthEnd),parentFingerPrint:decoded.slice(HDPublicKey.ParentFingerPrintStart,HDPublicKey.ParentFingerPrintEnd),childIndex:decoded.slice(HDPublicKey.ChildIndexStart,HDPublicKey.ChildIndexEnd),chainCode:decoded.slice(HDPublicKey.ChainCodeStart,HDPublicKey.ChainCodeEnd),publicKey:decoded.slice(HDPublicKey.PublicKeyStart,HDPublicKey.PublicKeyEnd),checksum:decoded.slice(HDPublicKey.ChecksumStart,HDPublicKey.ChecksumEnd),xpubkey:arg};return this._buildFromBuffers(buffers)},HDPublicKey.prototype._buildFromBuffers=function(arg){HDPublicKey._validateBufferArguments(arg),JSUtil.defineImmutable(this,{_buffers:arg});var sequence=[arg.version,arg.depth,arg.parentFingerPrint,arg.childIndex,arg.chainCode,arg.publicKey],concat=BufferUtil.concat(sequence),checksum=Base58Check.checksum(concat);if(arg.checksum&&arg.checksum.length){if(arg.checksum.toString("hex")!==checksum.toString("hex"))throw new errors.InvalidB58Checksum(concat,checksum)}else arg.checksum=checksum;var xpubkey,network=Network.get(BufferUtil.integerFromBuffer(arg.version));xpubkey=Base58Check.encode(BufferUtil.concat(sequence)),arg.xpubkey=new Buffer(xpubkey);var publicKey=new PublicKey(arg.publicKey,{network:network}),size=HDPublicKey.ParentFingerPrintSize,fingerPrint=Hash.sha256ripemd160(publicKey.toBuffer()).slice(0,size);return JSUtil.defineImmutable(this,{xpubkey:xpubkey,network:network,depth:BufferUtil.integerFromSingleByteBuffer(arg.depth),publicKey:publicKey,fingerPrint:fingerPrint}),this},HDPublicKey._validateBufferArguments=function(arg){var checkBuffer=function(name,size){var buff=arg[name];assert(BufferUtil.isBuffer(buff),name+" argument is not a buffer, it's "+(void 0===buff?"undefined":_typeof(buff))),assert(buff.length===size,name+" has not the expected size: found "+buff.length+", expected "+size)};checkBuffer("version",HDPublicKey.VersionSize),checkBuffer("depth",HDPublicKey.DepthSize),checkBuffer("parentFingerPrint",HDPublicKey.ParentFingerPrintSize),checkBuffer("childIndex",HDPublicKey.ChildIndexSize),checkBuffer("chainCode",HDPublicKey.ChainCodeSize),checkBuffer("publicKey",HDPublicKey.PublicKeySize),arg.checksum&&arg.checksum.length&&checkBuffer("checksum",HDPublicKey.CheckSumSize)},HDPublicKey.fromString=function(arg){return $.checkArgument(_.isString(arg),"No valid string was provided"),new HDPublicKey(arg)},HDPublicKey.fromObject=function(arg){return $.checkArgument(_.isObject(arg),"No valid argument was provided"),new HDPublicKey(arg)},HDPublicKey.prototype.toString=function(){return this.xpubkey},HDPublicKey.prototype.inspect=function(){return""},HDPublicKey.prototype.toObject=HDPublicKey.prototype.toJSON=function(){return{network:Network.get(BufferUtil.integerFromBuffer(this._buffers.version)).name,depth:BufferUtil.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:BufferUtil.integerFromBuffer(this.fingerPrint),parentFingerPrint:BufferUtil.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:BufferUtil.integerFromBuffer(this._buffers.childIndex),chainCode:BufferUtil.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:BufferUtil.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},HDPublicKey.fromBuffer=function(arg){return new HDPublicKey(arg)},HDPublicKey.prototype.toBuffer=function(){return BufferUtil.copy(this._buffers.xpubkey)},HDPublicKey.Hardened=2147483648,HDPublicKey.RootElementAlias=["m","M"],HDPublicKey.VersionSize=4,HDPublicKey.DepthSize=1,HDPublicKey.ParentFingerPrintSize=4,HDPublicKey.ChildIndexSize=4,HDPublicKey.ChainCodeSize=32,HDPublicKey.PublicKeySize=33,HDPublicKey.CheckSumSize=4,HDPublicKey.DataSize=78,HDPublicKey.SerializedByteSize=82,HDPublicKey.VersionStart=0,HDPublicKey.VersionEnd=HDPublicKey.VersionStart+HDPublicKey.VersionSize,HDPublicKey.DepthStart=HDPublicKey.VersionEnd,HDPublicKey.DepthEnd=HDPublicKey.DepthStart+HDPublicKey.DepthSize,HDPublicKey.ParentFingerPrintStart=HDPublicKey.DepthEnd,HDPublicKey.ParentFingerPrintEnd=HDPublicKey.ParentFingerPrintStart+HDPublicKey.ParentFingerPrintSize,HDPublicKey.ChildIndexStart=HDPublicKey.ParentFingerPrintEnd,HDPublicKey.ChildIndexEnd=HDPublicKey.ChildIndexStart+HDPublicKey.ChildIndexSize,HDPublicKey.ChainCodeStart=HDPublicKey.ChildIndexEnd,HDPublicKey.ChainCodeEnd=HDPublicKey.ChainCodeStart+HDPublicKey.ChainCodeSize,HDPublicKey.PublicKeyStart=HDPublicKey.ChainCodeEnd,HDPublicKey.PublicKeyEnd=HDPublicKey.PublicKeyStart+HDPublicKey.PublicKeySize,HDPublicKey.ChecksumStart=HDPublicKey.PublicKeyEnd,HDPublicKey.ChecksumEnd=HDPublicKey.ChecksumStart+HDPublicKey.CheckSumSize,assert(HDPublicKey.PublicKeyEnd===HDPublicKey.DataSize),assert(HDPublicKey.ChecksumEnd===HDPublicKey.SerializedByteSize),module.exports=HDPublicKey}).call(this,require("buffer").Buffer)},{"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./encoding/base58":38,"./encoding/base58check":39,"./errors":43,"./hdprivatekey":45,"./networks":47,"./publickey":50,"./util/buffer":68,"./util/js":69,"./util/preconditions":70,assert:21,buffer:149,lodash:268}],47:[function(require,module,exports){"use strict";function Network(){}function get(arg,keys){if(~networks.indexOf(arg))return arg;{if(!keys)return networkMaps[arg];_.isArray(keys)||(keys=[keys]);var containsArg=function(key){return networks[index][key]===arg};for(var index in networks)if(_.some(keys,containsArg))return networks[index]}}function addNetwork(data){var network=new Network;return JSUtil.defineImmutable(network,{name:data.name,alias:data.alias,pubkeyhash:data.pubkeyhash,privatekey:data.privatekey,scripthash:data.scripthash,xpubkey:data.xpubkey,xprivkey:data.xprivkey}),data.networkMagic&&JSUtil.defineImmutable(network,{networkMagic:BufferUtil.integerAsBuffer(data.networkMagic)}),data.port&&JSUtil.defineImmutable(network,{port:data.port}),data.dnsSeeds&&JSUtil.defineImmutable(network,{dnsSeeds:data.dnsSeeds}),_.each(network,function(value){_.isUndefined(value)||_.isObject(value)||(networkMaps[value]=network)}),networks.push(network),network}function removeNetwork(network){for(var i=0;i=0&&n<=16,"Invalid Argument: n must be between 0 and 16"),0===n?Opcode("OP_0"):new Opcode(Opcode.map.OP_1+n-1)},Opcode.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},Opcode.reverseMap=[];for(var k in Opcode.map)Opcode.reverseMap[Opcode.map[k]]=k;_.extend(Opcode,Opcode.map),Opcode.isSmallIntOp=function(opcode){return opcode instanceof Opcode&&(opcode=opcode.toNumber()),opcode===Opcode.map.OP_0||opcode>=Opcode.map.OP_1&&opcode<=Opcode.map.OP_16},Opcode.prototype.inspect=function(){return""},module.exports=Opcode}).call(this,require("buffer").Buffer)},{"./util/buffer":68,"./util/js":69,"./util/preconditions":70,buffer:149,lodash:268}],49:[function(require,module,exports){(function(Buffer){"use strict";function PrivateKey(data,network){if(!(this instanceof PrivateKey))return new PrivateKey(data,network);if(data instanceof PrivateKey)return data;var info=this._classifyArguments(data,network);if(!info.bn||0===info.bn.cmp(new BN(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!info.bn.lt(Point.getN()))throw new TypeError("Number must be less than N");if(void 0===info.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return JSUtil.defineImmutable(this,{bn:info.bn,compressed:info.compressed,network:info.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var _=require("lodash"),Address=require("./address"),Base58Check=require("./encoding/base58check"),BN=require("./crypto/bn"),JSUtil=require("./util/js"),Networks=require("./networks"),Point=require("./crypto/point"),PublicKey=require("./publickey"),Random=require("./crypto/random"),$=require("./util/preconditions");PrivateKey.prototype._classifyArguments=function(data,network){var info={compressed:!0,network:network?Networks.get(network):Networks.defaultNetwork};if(_.isUndefined(data)||_.isNull(data))info.bn=PrivateKey._getRandomBN();else if(data instanceof BN)info.bn=data;else if(data instanceof Buffer||data instanceof Uint8Array)info=PrivateKey._transformBuffer(data,network);else if(data.bn&&data.network)info=PrivateKey._transformObject(data);else if(!network&&Networks.get(data))info.bn=PrivateKey._getRandomBN(),info.network=Networks.get(data);else{if("string"!=typeof data)throw new TypeError("First argument is an unrecognized data type.");JSUtil.isHexa(data)?info.bn=new BN(new Buffer(data,"hex")):info=PrivateKey._transformWIF(data,network)}return info},PrivateKey._getRandomBN=function(){var condition,bn;do{var privbuf=Random.getRandomBuffer(32);bn=BN.fromBuffer(privbuf),condition=bn.lt(Point.getN())}while(!condition);return bn},PrivateKey._transformBuffer=function(buf,network){var info={};if(32===buf.length)return PrivateKey._transformBNBuffer(buf,network);if(info.network=Networks.get(buf[0],"privatekey"),!info.network)throw new Error("Invalid network");if(network&&info.network!==Networks.get(network))throw new TypeError("Private key network mismatch");if(34===buf.length&&1===buf[33])info.compressed=!0;else{if(33!==buf.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");info.compressed=!1}return info.bn=BN.fromBuffer(buf.slice(1,33)),info},PrivateKey._transformBNBuffer=function(buf,network){var info={};return info.network=Networks.get(network)||Networks.defaultNetwork,info.bn=BN.fromBuffer(buf),info.compressed=!1,info},PrivateKey._transformWIF=function(str,network){return PrivateKey._transformBuffer(Base58Check.decode(str),network)},PrivateKey.fromBuffer=function(arg,network){return new PrivateKey(arg,network)},PrivateKey._transformObject=function(json){return{bn:new BN(json.bn,"hex"),network:Networks.get(json.network),compressed:json.compressed}},PrivateKey.fromString=PrivateKey.fromWIF=function(str){return $.checkArgument(_.isString(str),"First argument is expected to be a string."),new PrivateKey(str)},PrivateKey.fromObject=function(obj){return $.checkArgument(_.isObject(obj),"First argument is expected to be an object."),new PrivateKey(obj)},PrivateKey.fromRandom=function(network){return new PrivateKey(PrivateKey._getRandomBN(),network)},PrivateKey.getValidationError=function(data,network){var error;try{new PrivateKey(data,network)}catch(e){error=e}return error},PrivateKey.isValid=function(data,network){return!!data&&!PrivateKey.getValidationError(data,network)},PrivateKey.prototype.toString=function(){return this.toBuffer().toString("hex")},PrivateKey.prototype.toWIF=function(){var buf,network=this.network,compressed=this.compressed;return buf=compressed?Buffer.concat([new Buffer([network.privatekey]),this.bn.toBuffer({size:32}),new Buffer([1])]):Buffer.concat([new Buffer([network.privatekey]),this.bn.toBuffer({size:32})]),Base58Check.encode(buf)},PrivateKey.prototype.toBigNumber=function(){return this.bn},PrivateKey.prototype.toBuffer=function(){return this.bn.toBuffer()},PrivateKey.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},PrivateKey.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=PublicKey.fromPrivateKey(this)),this._pubkey},PrivateKey.prototype.toAddress=function(network){var pubkey=this.toPublicKey();return Address.fromPublicKey(pubkey,network||this.network)},PrivateKey.prototype.toObject=PrivateKey.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},PrivateKey.prototype.inspect=function(){var uncompressed=this.compressed?"":", uncompressed";return""},module.exports=PrivateKey}).call(this,require("buffer").Buffer)},{"./address":27,"./crypto/bn":32,"./crypto/point":35,"./crypto/random":36,"./encoding/base58check":39,"./networks":47,"./publickey":50,"./util/js":69,"./util/preconditions":70,buffer:149,lodash:268}],50:[function(require,module,exports){(function(Buffer){"use strict";function PublicKey(data,extra){if(!(this instanceof PublicKey))return new PublicKey(data,extra);if($.checkArgument(data,"First argument is required, please include public key data."),data instanceof PublicKey)return data;extra=extra||{};var info=this._classifyArgs(data,extra);return info.point.validate(),JSUtil.defineImmutable(this,{point:info.point,compressed:info.compressed,network:info.network||Network.defaultNetwork}),this}var BN=require("./crypto/bn"),Point=require("./crypto/point"),Hash=require("./crypto/hash"),JSUtil=require("./util/js"),Network=require("./networks"),_=require("lodash"),$=require("./util/preconditions");PublicKey.prototype._classifyArgs=function(data,extra){var info={compressed:_.isUndefined(extra.compressed)||extra.compressed};if(data instanceof Point)info.point=data;else if(data.x&&data.y)info=PublicKey._transformObject(data);else if("string"==typeof data)info=PublicKey._transformDER(new Buffer(data,"hex"));else if(PublicKey._isBuffer(data))info=PublicKey._transformDER(data);else{if(!PublicKey._isPrivateKey(data))throw new TypeError("First argument is an unrecognized data format.");info=PublicKey._transformPrivateKey(data)}return info.network||(info.network=_.isUndefined(extra.network)?void 0:Network.get(extra.network)),info},PublicKey._isPrivateKey=function(param){return param instanceof require("./privatekey")},PublicKey._isBuffer=function(param){return param instanceof Buffer||param instanceof Uint8Array},PublicKey._transformPrivateKey=function(privkey){$.checkArgument(PublicKey._isPrivateKey(privkey),"Must be an instance of PrivateKey");var info={};return info.point=Point.getG().mul(privkey.bn),info.compressed=privkey.compressed,info.network=privkey.network,info},PublicKey._transformDER=function(buf,strict){$.checkArgument(PublicKey._isBuffer(buf),"Must be a hex buffer of DER encoded public key");var info={};strict=!!_.isUndefined(strict)||strict;var x,y,xbuf,ybuf;if(4!==buf[0]&&(strict||6!==buf[0]&&7!==buf[0]))if(3===buf[0])xbuf=buf.slice(1),x=new BN(xbuf),info=PublicKey._transformX(!0,x),info.compressed=!0;else{if(2!==buf[0])throw new TypeError("Invalid DER format public key");xbuf=buf.slice(1),x=new BN(xbuf),info=PublicKey._transformX(!1,x),info.compressed=!0}else{if(xbuf=buf.slice(1,33),ybuf=buf.slice(33,65),32!==xbuf.length||32!==ybuf.length||65!==buf.length)throw new TypeError("Length of x and y must be 32 bytes");x=new BN(xbuf),y=new BN(ybuf),info.point=new Point(x,y),info.compressed=!1}return info},PublicKey._transformX=function(odd,x){$.checkArgument("boolean"==typeof odd,"Must specify whether y is odd or not (true or false)");var info={};return info.point=Point.fromX(odd,x),info},PublicKey._transformObject=function(json){var x=new BN(json.x,"hex"),y=new BN(json.y,"hex");return new PublicKey(new Point(x,y),{compressed:json.compressed})},PublicKey.fromPrivateKey=function(privkey){$.checkArgument(PublicKey._isPrivateKey(privkey),"Must be an instance of PrivateKey");var info=PublicKey._transformPrivateKey(privkey);return new PublicKey(info.point,{compressed:info.compressed,network:info.network})},PublicKey.fromDER=PublicKey.fromBuffer=function(buf,strict){$.checkArgument(PublicKey._isBuffer(buf),"Must be a hex buffer of DER encoded public key");var info=PublicKey._transformDER(buf,strict);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.fromPoint=function(point,compressed){return $.checkArgument(point instanceof Point,"First argument must be an instance of Point."),new PublicKey(point,{compressed:compressed})},PublicKey.fromString=function(str,encoding){var buf=new Buffer(str,encoding||"hex"),info=PublicKey._transformDER(buf);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.fromX=function(odd,x){var info=PublicKey._transformX(odd,x);return new PublicKey(info.point,{compressed:info.compressed})},PublicKey.getValidationError=function(data){var error;try{new PublicKey(data)}catch(e){error=e}return error},PublicKey.isValid=function(data){return!PublicKey.getValidationError(data)},PublicKey.prototype.toObject=PublicKey.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2), +y:this.point.getY().toString("hex",2),compressed:this.compressed}},PublicKey.prototype.toBuffer=PublicKey.prototype.toDER=function(){var prefix,x=this.point.getX(),y=this.point.getY(),xbuf=x.toBuffer({size:32}),ybuf=y.toBuffer({size:32});if(this.compressed){var odd=ybuf[ybuf.length-1]%2;return prefix=new Buffer(odd?[3]:[2]),Buffer.concat([prefix,xbuf])}return prefix=new Buffer([4]),Buffer.concat([prefix,xbuf,ybuf])},PublicKey.prototype._getID=function(){return Hash.sha256ripemd160(this.toBuffer())},PublicKey.prototype.toAddress=function(network){return require("./address").fromPublicKey(this,network||this.network)},PublicKey.prototype.toString=function(){return this.toDER().toString("hex")},PublicKey.prototype.inspect=function(){return""},module.exports=PublicKey}).call(this,require("buffer").Buffer)},{"./address":27,"./crypto/bn":32,"./crypto/hash":34,"./crypto/point":35,"./networks":47,"./privatekey":49,"./util/js":69,"./util/preconditions":70,buffer:149,lodash:268}],51:[function(require,module,exports){"use strict";module.exports=require("./script"),module.exports.Interpreter=require("./interpreter")},{"./interpreter":52,"./script":53}],52:[function(require,module,exports){(function(Buffer){"use strict";var _=require("lodash"),Script=require("./script"),Opcode=require("../opcode"),BN=require("../crypto/bn"),Hash=require("../crypto/hash"),Signature=require("../crypto/signature"),PublicKey=require("../publickey"),Interpreter=function Interpreter(obj){if(!(this instanceof Interpreter))return new Interpreter(obj);obj?(this.initialize(),this.set(obj)):this.initialize()};Interpreter.prototype.verify=function(scriptSig,scriptPubkey,tx,nin,flags){var Transaction=require("../transaction");_.isUndefined(tx)&&(tx=new Transaction),_.isUndefined(nin)&&(nin=0),_.isUndefined(flags)&&(flags=0),this.set({script:scriptSig,tx:tx,nin:nin,flags:flags});var stackCopy;if(0!=(flags&Interpreter.SCRIPT_VERIFY_SIGPUSHONLY)&&!scriptSig.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;flags&Interpreter.SCRIPT_VERIFY_P2SH&&(stackCopy=this.stack.slice());var stack=this.stack;if(this.initialize(),this.set({script:scriptPubkey,stack:stack,tx:tx,nin:nin,flags:flags}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var buf=this.stack[this.stack.length-1];if(!Interpreter.castToBool(buf))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(flags&Interpreter.SCRIPT_VERIFY_P2SH&&scriptPubkey.isScriptHashOut()){if(!scriptSig.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===stackCopy.length)throw new Error("internal error - stack copy empty");var redeemScriptSerialized=stackCopy[stackCopy.length-1],redeemScript=Script.fromBuffer(redeemScriptSerialized);return stackCopy.pop(),this.initialize(),this.set({script:redeemScript,stack:stackCopy,tx:tx,nin:nin,flags:flags}),!!this.evaluate()&&(0===stackCopy.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!Interpreter.castToBool(stackCopy[stackCopy.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},module.exports=Interpreter,Interpreter.prototype.initialize=function(obj){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},Interpreter.prototype.set=function(obj){this.script=obj.script||this.script,this.tx=obj.tx||this.tx,this.nin=void 0!==obj.nin?obj.nin:this.nin,this.stack=obj.stack||this.stack,this.altstack=obj.altack||this.altstack,this.pc=void 0!==obj.pc?obj.pc:this.pc,this.pbegincodehash=void 0!==obj.pbegincodehash?obj.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==obj.nOpCount?obj.nOpCount:this.nOpCount,this.vfExec=obj.vfExec||this.vfExec,this.errstr=obj.errstr||this.errstr,this.flags=void 0!==obj.flags?obj.flags:this.flags},Interpreter.true=new Buffer([1]),Interpreter.false=new Buffer([]),Interpreter.MAX_SCRIPT_ELEMENT_SIZE=520,Interpreter.LOCKTIME_THRESHOLD=5e8,Interpreter.LOCKTIME_THRESHOLD_BN=new BN(Interpreter.LOCKTIME_THRESHOLD),Interpreter.SCRIPT_VERIFY_NONE=0,Interpreter.SCRIPT_VERIFY_P2SH=1,Interpreter.SCRIPT_VERIFY_STRICTENC=2,Interpreter.SCRIPT_VERIFY_DERSIG=4,Interpreter.SCRIPT_VERIFY_LOW_S=8,Interpreter.SCRIPT_VERIFY_NULLDUMMY=16,Interpreter.SCRIPT_VERIFY_SIGPUSHONLY=32,Interpreter.SCRIPT_VERIFY_MINIMALDATA=64,Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,Interpreter.castToBool=function(buf){for(var i=0;i1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},Interpreter.prototype.checkLockTime=function(nLockTime){return!!(this.tx.nLockTime=Interpreter.LOCKTIME_THRESHOLD&&nLockTime.gte(Interpreter.LOCKTIME_THRESHOLD_BN))&&(!nLockTime.gt(new BN(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},Interpreter.prototype.step=function(){var buf,buf1,buf2,spliced,n,x1,x2,bn,bn1,bn2,bufSig,bufPubkey,subscript,sig,pubkey,fValue,fSuccess,fRequireMinimal=0!=(this.flags&Interpreter.SCRIPT_VERIFY_MINIMALDATA),fExec=-1===this.vfExec.indexOf(!1),chunk=this.script.chunks[this.pc];this.pc++;var opcodenum=chunk.opcodenum;if(_.isUndefined(opcodenum))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(chunk.buf&&chunk.buf.length>Interpreter.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(opcodenum>Opcode.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(opcodenum===Opcode.OP_CAT||opcodenum===Opcode.OP_SUBSTR||opcodenum===Opcode.OP_LEFT||opcodenum===Opcode.OP_RIGHT||opcodenum===Opcode.OP_INVERT||opcodenum===Opcode.OP_AND||opcodenum===Opcode.OP_OR||opcodenum===Opcode.OP_XOR||opcodenum===Opcode.OP_2MUL||opcodenum===Opcode.OP_2DIV||opcodenum===Opcode.OP_MUL||opcodenum===Opcode.OP_DIV||opcodenum===Opcode.OP_MOD||opcodenum===Opcode.OP_LSHIFT||opcodenum===Opcode.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(fExec&&0<=opcodenum&&opcodenum<=Opcode.OP_PUSHDATA4){if(fRequireMinimal&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(chunk.buf){if(chunk.len!==chunk.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(chunk.buf)}else this.stack.push(Interpreter.false)}else if(fExec||Opcode.OP_IF<=opcodenum&&opcodenum<=Opcode.OP_ENDIF)switch(opcodenum){case Opcode.OP_1NEGATE:case Opcode.OP_1:case Opcode.OP_2:case Opcode.OP_3:case Opcode.OP_4:case Opcode.OP_5:case Opcode.OP_6:case Opcode.OP_7:case Opcode.OP_8:case Opcode.OP_9:case Opcode.OP_10:case Opcode.OP_11:case Opcode.OP_12:case Opcode.OP_13:case Opcode.OP_14:case Opcode.OP_15:case Opcode.OP_16:n=opcodenum-(Opcode.OP_1-1),buf=new BN(n).toScriptNumBuffer(),this.stack.push(buf);break;case Opcode.OP_NOP:break;case Opcode.OP_NOP2:case Opcode.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var nLockTime=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal,5);if(nLockTime.lt(new BN(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(nLockTime))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case Opcode.OP_NOP1:case Opcode.OP_NOP3:case Opcode.OP_NOP4:case Opcode.OP_NOP5:case Opcode.OP_NOP6:case Opcode.OP_NOP7:case Opcode.OP_NOP8:case Opcode.OP_NOP9:case Opcode.OP_NOP10:if(this.flags&Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case Opcode.OP_IF:case Opcode.OP_NOTIF:if(fValue=!1,fExec){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;buf=this.stack.pop(),fValue=Interpreter.castToBool(buf),opcodenum===Opcode.OP_NOTIF&&(fValue=!fValue)}this.vfExec.push(fValue);break;case Opcode.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case Opcode.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case Opcode.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(buf=this.stack[this.stack.length-1],!(fValue=Interpreter.castToBool(buf)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case Opcode.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case Opcode.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case Opcode.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case Opcode.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case Opcode.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-2],buf2=this.stack[this.stack.length-1],this.stack.push(buf1),this.stack.push(buf2);break;case Opcode.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-3],buf2=this.stack[this.stack.length-2];var buf3=this.stack[this.stack.length-1];this.stack.push(buf1),this.stack.push(buf2),this.stack.push(buf3);break;case Opcode.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-4],buf2=this.stack[this.stack.length-3],this.stack.push(buf1),this.stack.push(buf2);break;case Opcode.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;spliced=this.stack.splice(this.stack.length-6,2),this.stack.push(spliced[0]),this.stack.push(spliced[1]);break;case Opcode.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;spliced=this.stack.splice(this.stack.length-4,2),this.stack.push(spliced[0]),this.stack.push(spliced[1]);break;case Opcode.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-1],fValue=Interpreter.castToBool(buf),fValue&&this.stack.push(buf);break;case Opcode.OP_DEPTH:buf=new BN(this.stack.length).toScriptNumBuffer(),this.stack.push(buf);break;case Opcode.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case Opcode.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case Opcode.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case Opcode.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case Opcode.OP_PICK:case Opcode.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(buf=this.stack[this.stack.length-1],bn=BN.fromScriptNumBuffer(buf,fRequireMinimal),n=bn.toNumber(),this.stack.pop(),n<0||n>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-n-1],opcodenum===Opcode.OP_ROLL&&this.stack.splice(this.stack.length-n-1,1),this.stack.push(buf);break;case Opcode.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;x1=this.stack[this.stack.length-3],x2=this.stack[this.stack.length-2];var x3=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=x2,this.stack[this.stack.length-2]=x3,this.stack[this.stack.length-1]=x1;break;case Opcode.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;x1=this.stack[this.stack.length-2],x2=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=x2,this.stack[this.stack.length-1]=x1;break;case Opcode.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case Opcode.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bn=new BN(this.stack[this.stack.length-1].length),this.stack.push(bn.toScriptNumBuffer());break;case Opcode.OP_EQUAL:case Opcode.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf1=this.stack[this.stack.length-2],buf2=this.stack[this.stack.length-1];var fEqual=buf1.toString("hex")===buf2.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(fEqual?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_EQUALVERIFY){if(!fEqual)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case Opcode.OP_1ADD:case Opcode.OP_1SUB:case Opcode.OP_NEGATE:case Opcode.OP_ABS:case Opcode.OP_NOT:case Opcode.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(buf=this.stack[this.stack.length-1],bn=BN.fromScriptNumBuffer(buf,fRequireMinimal),opcodenum){case Opcode.OP_1ADD:bn=bn.add(BN.One);break;case Opcode.OP_1SUB:bn=bn.sub(BN.One);break;case Opcode.OP_NEGATE:bn=bn.neg();break;case Opcode.OP_ABS:bn.cmp(BN.Zero)<0&&(bn=bn.neg());break;case Opcode.OP_NOT:bn=new BN((0===bn.cmp(BN.Zero))+0);break;case Opcode.OP_0NOTEQUAL:bn=new BN((0!==bn.cmp(BN.Zero))+0)}this.stack.pop(),this.stack.push(bn.toScriptNumBuffer());break;case Opcode.OP_ADD:case Opcode.OP_SUB:case Opcode.OP_BOOLAND:case Opcode.OP_BOOLOR:case Opcode.OP_NUMEQUAL:case Opcode.OP_NUMEQUALVERIFY:case Opcode.OP_NUMNOTEQUAL:case Opcode.OP_LESSTHAN:case Opcode.OP_GREATERTHAN:case Opcode.OP_LESSTHANOREQUAL:case Opcode.OP_GREATERTHANOREQUAL:case Opcode.OP_MIN:case Opcode.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(bn1=BN.fromScriptNumBuffer(this.stack[this.stack.length-2],fRequireMinimal),bn2=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal),bn=new BN(0),opcodenum){case Opcode.OP_ADD:bn=bn1.add(bn2);break;case Opcode.OP_SUB:bn=bn1.sub(bn2);break;case Opcode.OP_BOOLAND:bn=new BN((0!==bn1.cmp(BN.Zero)&&0!==bn2.cmp(BN.Zero))+0);break;case Opcode.OP_BOOLOR:bn=new BN((0!==bn1.cmp(BN.Zero)||0!==bn2.cmp(BN.Zero))+0);break;case Opcode.OP_NUMEQUAL:case Opcode.OP_NUMEQUALVERIFY:bn=new BN((0===bn1.cmp(bn2))+0);break;case Opcode.OP_NUMNOTEQUAL:bn=new BN((0!==bn1.cmp(bn2))+0);break;case Opcode.OP_LESSTHAN:bn=new BN((bn1.cmp(bn2)<0)+0);break;case Opcode.OP_GREATERTHAN:bn=new BN((bn1.cmp(bn2)>0)+0);break;case Opcode.OP_LESSTHANOREQUAL:bn=new BN((bn1.cmp(bn2)<=0)+0);break;case Opcode.OP_GREATERTHANOREQUAL:bn=new BN((bn1.cmp(bn2)>=0)+0);break;case Opcode.OP_MIN:bn=bn1.cmp(bn2)<0?bn1:bn2;break;case Opcode.OP_MAX:bn=bn1.cmp(bn2)>0?bn1:bn2}if(this.stack.pop(),this.stack.pop(),this.stack.push(bn.toScriptNumBuffer()),opcodenum===Opcode.OP_NUMEQUALVERIFY){if(!Interpreter.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case Opcode.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bn1=BN.fromScriptNumBuffer(this.stack[this.stack.length-3],fRequireMinimal),bn2=BN.fromScriptNumBuffer(this.stack[this.stack.length-2],fRequireMinimal);var bn3=BN.fromScriptNumBuffer(this.stack[this.stack.length-1],fRequireMinimal);fValue=bn2.cmp(bn1)<=0&&bn1.cmp(bn3)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(fValue?Interpreter.true:Interpreter.false);break;case Opcode.OP_RIPEMD160:case Opcode.OP_SHA1:case Opcode.OP_SHA256:case Opcode.OP_HASH160:case Opcode.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;buf=this.stack[this.stack.length-1];var bufHash;opcodenum===Opcode.OP_RIPEMD160?bufHash=Hash.ripemd160(buf):opcodenum===Opcode.OP_SHA1?bufHash=Hash.sha1(buf):opcodenum===Opcode.OP_SHA256?bufHash=Hash.sha256(buf):opcodenum===Opcode.OP_HASH160?bufHash=Hash.sha256ripemd160(buf):opcodenum===Opcode.OP_HASH256&&(bufHash=Hash.sha256sha256(buf)),this.stack.pop(),this.stack.push(bufHash);break;case Opcode.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case Opcode.OP_CHECKSIG:case Opcode.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;bufSig=this.stack[this.stack.length-2],bufPubkey=this.stack[this.stack.length-1],subscript=(new Script).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var tmpScript=(new Script).add(bufSig);if(subscript.findAndDelete(tmpScript),!this.checkSignatureEncoding(bufSig)||!this.checkPubkeyEncoding(bufPubkey))return!1;try{sig=Signature.fromTxFormat(bufSig),pubkey=PublicKey.fromBuffer(bufPubkey,!1),fSuccess=this.tx.verifySignature(sig,pubkey,this.nin,subscript)}catch(e){fSuccess=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(fSuccess?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_CHECKSIGVERIFY){if(!fSuccess)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case Opcode.OP_CHECKMULTISIG:case Opcode.OP_CHECKMULTISIGVERIFY:var i=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=nKeysCount,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var ikey=++i;if(i+=nKeysCount,this.stack.lengthnKeysCount)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var isig=++i;if(i+=nSigsCount,this.stack.length0;){if(bufSig=this.stack[this.stack.length-isig],bufPubkey=this.stack[this.stack.length-ikey],!this.checkSignatureEncoding(bufSig)||!this.checkPubkeyEncoding(bufPubkey))return!1;var fOk;try{sig=Signature.fromTxFormat(bufSig),pubkey=PublicKey.fromBuffer(bufPubkey,!1),fOk=this.tx.verifySignature(sig,pubkey,this.nin,subscript)}catch(e){fOk=!1}fOk&&(isig++,nSigsCount--),ikey++,nKeysCount--,nSigsCount>nKeysCount&&(fSuccess=!1)}for(;i-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&Interpreter.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(fSuccess?Interpreter.true:Interpreter.false),opcodenum===Opcode.OP_CHECKMULTISIGVERIFY){if(!fSuccess)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,require("buffer").Buffer)},{"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../opcode":48,"../publickey":50,"../transaction":54,"./script":53,buffer:149,lodash:268}],53:[function(require,module,exports){(function(Buffer){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},Address=require("../address"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),Hash=require("../crypto/hash"),Opcode=require("../opcode"),PublicKey=require("../publickey"),Signature=require("../crypto/signature"),Networks=require("../networks"),$=require("../util/preconditions"),_=require("lodash"),errors=require("../errors"),buffer=require("buffer"),BufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),Script=function Script(from){return this instanceof Script?(this.chunks=[],BufferUtil.isBuffer(from)?Script.fromBuffer(from):from instanceof Address?Script.fromAddress(from):from instanceof Script?Script.fromBuffer(from.toBuffer()):_.isString(from)?Script.fromString(from):void(_.isObject(from)&&_.isArray(from.chunks)&&this.set(from))):new Script(from)};Script.prototype.set=function(obj){return $.checkArgument(_.isObject(obj)),$.checkArgument(_.isArray(obj.chunks)),this.chunks=obj.chunks,this},Script.fromBuffer=function(buffer){var script=new Script;script.chunks=[];for(var br=new BufferReader(buffer);!br.finished();)try{var len,buf,opcodenum=br.readUInt8();opcodenum>0&&opcodenum0&&opcodenum0&&(str=asm?str+" "+chunk.buf.toString("hex"):str+" "+chunk.len+" 0x"+chunk.buf.toString("hex"));else if(void 0!==Opcode.reverseMap[opcodenum])asm?0===opcodenum?str+=" 0":79===opcodenum?str+=" -1":str=str+" "+Opcode(opcodenum).toString():str=str+" "+Opcode(opcodenum).toString();else{var numstr=opcodenum.toString(16);numstr.length%2!=0&&(numstr="0"+numstr),str=asm?str+" "+numstr:str+" 0x"+numstr}return str},Script.prototype.toASM=function(){for(var str="",i=0;i"},Script.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==Opcode.OP_DUP||this.chunks[1].opcodenum!==Opcode.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==Opcode.OP_EQUALVERIFY||this.chunks[4].opcodenum!==Opcode.OP_CHECKSIG)},Script.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var signatureBuf=this.chunks[0].buf,pubkeyBuf=this.chunks[1].buf;if(signatureBuf&&signatureBuf.length&&48===signatureBuf[0]&&pubkeyBuf&&pubkeyBuf.length){var version=pubkeyBuf[0];if((4===version||6===version||7===version)&&65===pubkeyBuf.length)return!0;if((3===version||2===version)&&33===pubkeyBuf.length)return!0}}return!1},Script.prototype.getPublicKey=function(){return $.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},Script.prototype.getPublicKeyHash=function(){return $.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},Script.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===Opcode.OP_CHECKSIG){var pubkeyBuf=this.chunks[0].buf,version=pubkeyBuf[0],isVersion=!1;if(4!==version&&6!==version&&7!==version||65!==pubkeyBuf.length?3!==version&&2!==version||33!==pubkeyBuf.length||(isVersion=!0):isVersion=!0,isVersion)return PublicKey.isValid(pubkeyBuf)}return!1},Script.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var signatureBuf=this.chunks[0].buf;if(signatureBuf&&signatureBuf.length&&48===signatureBuf[0])return!0}return!1},Script.prototype.isScriptHashOut=function(){var buf=this.toBuffer();return 23===buf.length&&buf[0]===Opcode.OP_HASH160&&20===buf[1]&&buf[buf.length-1]===Opcode.OP_EQUAL},Script.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var redeemChunk=this.chunks[this.chunks.length-1],redeemBuf=redeemChunk.buf;if(!redeemBuf)return!1;var redeemScript;try{redeemScript=Script.fromBuffer(redeemBuf)}catch(e){if(e instanceof errors.Script.InvalidBuffer)return!1;throw e}return redeemScript.classify()!==Script.types.UNKNOWN},Script.prototype.isMultisigOut=function(){return this.chunks.length>3&&Opcode.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(obj){return obj.buf&&BufferUtil.isBuffer(obj.buf)})&&Opcode.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===Opcode.OP_CHECKMULTISIG},Script.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(obj){return obj.buf&&BufferUtil.isBuffer(obj.buf)&&Signature.isTxDER(obj.buf)})},Script.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===Opcode.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=Script.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},Script.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new Buffer(_.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new Buffer(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},Script.prototype.isPushOnly=function(){return _.every(this.chunks,function(chunk){return chunk.opcodenum<=Opcode.OP_16})},Script.types={},Script.types.UNKNOWN="Unknown",Script.types.PUBKEY_OUT="Pay to public key",Script.types.PUBKEY_IN="Spend from public key",Script.types.PUBKEYHASH_OUT="Pay to public key hash",Script.types.PUBKEYHASH_IN="Spend from public key hash",Script.types.SCRIPTHASH_OUT="Pay to script hash",Script.types.SCRIPTHASH_IN="Spend from script hash",Script.types.MULTISIG_OUT="Pay to multisig",Script.types.MULTISIG_IN="Spend from multisig",Script.types.DATA_OUT="Data push",Script.OP_RETURN_STANDARD_SIZE=80,Script.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var outputType=this.classifyOutput();return outputType!=Script.types.UNKNOWN?outputType:this.classifyInput()},Script.outputIdentifiers={},Script.outputIdentifiers.PUBKEY_OUT=Script.prototype.isPublicKeyOut,Script.outputIdentifiers.PUBKEYHASH_OUT=Script.prototype.isPublicKeyHashOut,Script.outputIdentifiers.MULTISIG_OUT=Script.prototype.isMultisigOut,Script.outputIdentifiers.SCRIPTHASH_OUT=Script.prototype.isScriptHashOut,Script.outputIdentifiers.DATA_OUT=Script.prototype.isDataOut,Script.prototype.classifyOutput=function(){for(var type in Script.outputIdentifiers)if(Script.outputIdentifiers[type].bind(this)())return Script.types[type];return Script.types.UNKNOWN},Script.inputIdentifiers={},Script.inputIdentifiers.PUBKEY_IN=Script.prototype.isPublicKeyIn,Script.inputIdentifiers.PUBKEYHASH_IN=Script.prototype.isPublicKeyHashIn,Script.inputIdentifiers.MULTISIG_IN=Script.prototype.isMultisigIn,Script.inputIdentifiers.SCRIPTHASH_IN=Script.prototype.isScriptHashIn,Script.prototype.classifyInput=function(){for(var type in Script.inputIdentifiers)if(Script.inputIdentifiers[type].bind(this)())return Script.types[type];return Script.types.UNKNOWN},Script.prototype.isStandard=function(){return this.classify()!==Script.types.UNKNOWN},Script.prototype.prepend=function(obj){return this._addByType(obj,!0),this},Script.prototype.equals=function(script){if($.checkState(script instanceof Script,"Must provide another script"),this.chunks.length!==script.chunks.length)return!1;var i;for(i=0;i=0&&len=1&&buf[0]<=16?opcodenum===Opcode.OP_1+(buf[0]-1):1===buf.length&&129===buf[0]?opcodenum===Opcode.OP_1NEGATE:buf.length<=75?opcodenum===buf.length:buf.length<=255?opcodenum===Opcode.OP_PUSHDATA1:!(buf.length<=65535)||opcodenum===Opcode.OP_PUSHDATA2)},Script.prototype._decodeOP_N=function(opcode){if(opcode===Opcode.OP_0)return 0;if(opcode>=Opcode.OP_1&&opcode<=Opcode.OP_16)return opcode-(Opcode.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(opcode))},Script.prototype.getSignatureOperationsCount=function(accurate){accurate=!!_.isUndefined(accurate)||accurate;var self=this,n=0,lastOpcode=Opcode.OP_INVALIDOPCODE;return _.each(self.chunks,function(chunk){var opcode=chunk.opcodenum;opcode==Opcode.OP_CHECKSIG||opcode==Opcode.OP_CHECKSIGVERIFY?n++:opcode!=Opcode.OP_CHECKMULTISIG&&opcode!=Opcode.OP_CHECKMULTISIGVERIFY||(accurate&&lastOpcode>=Opcode.OP_1&&lastOpcode<=Opcode.OP_16?n+=self._decodeOP_N(lastOpcode):n+=20),lastOpcode=opcode}),n},module.exports=Script}).call(this,require("buffer").Buffer)},{"../address":27,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../networks":47,"../opcode":48,"../publickey":50,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:149,lodash:268}],54:[function(require,module,exports){"use strict";module.exports=require("./transaction"),module.exports.Input=require("./input"),module.exports.Output=require("./output"),module.exports.UnspentOutput=require("./unspentoutput"),module.exports.Signature=require("./signature"),module.exports.Sighash=require("./sighash")},{"./input":55,"./output":61,"./sighash":62,"./signature":63,"./transaction":64,"./unspentoutput":65}],55:[function(require,module,exports){"use strict";module.exports=require("./input"),module.exports.PublicKey=require("./publickey"),module.exports.PublicKeyHash=require("./publickeyhash"),module.exports.MultiSig=require("./multisig.js"),module.exports.MultiSigScriptHash=require("./multisigscripthash.js")},{"./input":56,"./multisig.js":57,"./multisigscripthash.js":58,"./publickey":59,"./publickeyhash":60}],56:[function(require,module,exports){"use strict";function Input(params){return this instanceof Input?params?this._fromObject(params):void 0:new Input(params)}var _=require("lodash"),$=require("../../util/preconditions"),errors=require("../../errors"),BufferWriter=require("../../encoding/bufferwriter"),buffer=require("buffer"),BufferUtil=require("../../util/buffer"),JSUtil=require("../../util/js"),Script=require("../../script"),Sighash=require("../sighash"),Output=require("../output");Input.MAXINT=4294967295,Input.DEFAULT_SEQNUMBER=4294967295,Input.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,Input.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(Input.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new Script(this._scriptBuffer),this._script._isInput=!0),this._script)}}),Input.fromObject=function(obj){return $.checkArgument(_.isObject(obj)),(new Input)._fromObject(obj)},Input.prototype._fromObject=function(params){var prevTxId;if(prevTxId=_.isString(params.prevTxId)&&JSUtil.isHexa(params.prevTxId)?new buffer.Buffer(params.prevTxId,"hex"):params.prevTxId,this.output=params.output?params.output instanceof Output?params.output:new Output(params.output):void 0,this.prevTxId=prevTxId||params.txidbuf,this.outputIndex=_.isUndefined(params.outputIndex)?params.txoutnum:params.outputIndex,this.sequenceNumber=_.isUndefined(params.sequenceNumber)?_.isUndefined(params.seqnum)?4294967295:params.seqnum:params.sequenceNumber,_.isUndefined(params.script)&&_.isUndefined(params.scriptBuffer))throw new errors.Transaction.Input.MissingScript;return this.setScript(params.scriptBuffer||params.script),this},Input.prototype.toObject=Input.prototype.toJSON=function(){var obj={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(obj.scriptString=this.script.toString()),this.output&&(obj.output=this.output.toObject()),obj},Input.fromBufferReader=function(br){var input=new Input;return input.prevTxId=br.readReverse(32),input.outputIndex=br.readUInt32LE(),input._scriptBuffer=br.readVarLengthBuffer(),input.sequenceNumber=br.readUInt32LE(),input},Input.prototype.toBufferWriter=function(writer){writer||(writer=new BufferWriter),writer.writeReverse(this.prevTxId),writer.writeUInt32LE(this.outputIndex);var script=this._scriptBuffer;return writer.writeVarintNum(script.length),writer.write(script),writer.writeUInt32LE(this.sequenceNumber),writer},Input.prototype.setScript=function(script){if(this._script=null,script instanceof Script)this._script=script,this._script._isInput=!0,this._scriptBuffer=script.toBuffer();else if(JSUtil.isHexa(script))this._scriptBuffer=new buffer.Buffer(script,"hex");else if(_.isString(script))this._script=new Script(script),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!BufferUtil.isBuffer(script))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new buffer.Buffer(script)}return this},Input.prototype.getSignatures=function(){throw new errors.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},Input.prototype.isFullySigned=function(){throw new errors.AbstractMethodInvoked("Input#isFullySigned")},Input.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},Input.prototype.addSignature=function(){throw new errors.AbstractMethodInvoked("Input#addSignature")},Input.prototype.clearSignatures=function(){throw new errors.AbstractMethodInvoked("Input#clearSignatures")},Input.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.output.script)},Input.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},Input.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},module.exports=Input},{"../../encoding/bufferwriter":41,"../../errors":43,"../../script":51,"../../util/buffer":68,"../../util/js":69,"../../util/preconditions":70,"../output":61,"../sighash":62,buffer:149,lodash:268}],57:[function(require,module,exports){"use strict";function MultiSigInput(input,pubkeys,threshold,signatures){Input.apply(this,arguments);var self=this;pubkeys=pubkeys||input.publicKeys,threshold=threshold||input.threshold,signatures=signatures||input.signatures,this.publicKeys=_.sortBy(pubkeys,function(publicKey){return publicKey.toString("hex")}),$.checkState(Script.buildMultisigOut(this.publicKeys,threshold).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},_.each(this.publicKeys,function(publicKey,index){self.publicKeyIndex[publicKey.toString()]=index}),this.threshold=threshold,this.signatures=signatures?this._deserializeSignatures(signatures):new Array(this.publicKeys.length)}var _=require("lodash"),inherits=require("inherits"),Input=(require("../transaction"),require("./input")),Output=require("../output"),$=require("../../util/preconditions"),Script=require("../../script"),Signature=require("../../crypto/signature"),Sighash=require("../sighash"),BufferUtil=(require("../../publickey"),require("../../util/buffer")),TransactionSignature=require("../signature");inherits(MultiSigInput,Input),MultiSigInput.prototype.toObject=function(){var obj=Input.prototype.toObject.apply(this,arguments);return obj.threshold=this.threshold,obj.publicKeys=_.map(this.publicKeys,function(publicKey){return publicKey.toString()}),obj.signatures=this._serializeSignatures(),obj},MultiSigInput.prototype._deserializeSignatures=function(signatures){return _.map(signatures,function(signature){if(signature)return new TransactionSignature(signature)})},MultiSigInput.prototype._serializeSignatures=function(){return _.map(this.signatures,function(signature){if(signature)return signature.toObject()})},MultiSigInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var self=this,results=[];return _.each(this.publicKeys,function(publicKey){publicKey.toString()===privateKey.publicKey.toString()&&results.push(new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:self.prevTxId,outputIndex:self.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,self.output.script),sigtype:sigtype}))}),results},MultiSigInput.prototype.addSignature=function(transaction,signature){return $.checkState(!this.isFullySigned(),"All needed signatures have already been added"),$.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),"Signature has no matching public key"),$.checkState(this.isValidSignature(transaction,signature)),this.signatures[this.publicKeyIndex[signature.publicKey.toString()]]=signature,this._updateScript(),this},MultiSigInput.prototype._updateScript=function(){return this.setScript(Script.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},MultiSigInput.prototype._createSignatures=function(){return _.map(_.filter(this.signatures,function(signature){return!_.isUndefined(signature)}),function(signature){return BufferUtil.concat([signature.signature.toDER(),BufferUtil.integerAsSingleByteBuffer(signature.sigtype)])})},MultiSigInput.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},MultiSigInput.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},MultiSigInput.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},MultiSigInput.prototype.countSignatures=function(){return _.reduce(this.signatures,function(sum,signature){return sum+!!signature},0)},MultiSigInput.prototype.publicKeysWithoutSignature=function(){var self=this;return _.filter(this.publicKeys,function(publicKey){return!self.signatures[self.publicKeyIndex[publicKey.toString()]]})},MultiSigInput.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.output.script)},MultiSigInput.normalizeSignatures=function(transaction,input,inputIndex,signatures,publicKeys){return publicKeys.map(function(pubKey){var signatureMatch=null;return signatures=signatures.filter(function(signatureBuffer){if(signatureMatch)return!0;var signature=new TransactionSignature({signature:Signature.fromTxFormat(signatureBuffer),publicKey:pubKey,prevTxId:input.prevTxId,outputIndex:input.outputIndex,inputIndex:inputIndex,sigtype:Signature.SIGHASH_ALL});return signature.signature.nhashtype=signature.sigtype,!Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,input.output.script)||(signatureMatch=signature,!1)}),signatureMatch||null})},MultiSigInput.OPCODES_SIZE=1,MultiSigInput.SIGNATURE_SIZE=73,MultiSigInput.prototype._estimateSize=function(){return MultiSigInput.OPCODES_SIZE+this.threshold*MultiSigInput.SIGNATURE_SIZE},module.exports=MultiSigInput},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"../transaction":64,"./input":56,inherits:257,lodash:268}],58:[function(require,module,exports){"use strict";function MultiSigScriptHashInput(input,pubkeys,threshold,signatures){Input.apply(this,arguments);var self=this;pubkeys=pubkeys||input.publicKeys,threshold=threshold||input.threshold,signatures=signatures||input.signatures,this.publicKeys=_.sortBy(pubkeys,function(publicKey){return publicKey.toString("hex")}),this.redeemScript=Script.buildMultisigOut(this.publicKeys,threshold),$.checkState(Script.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},_.each(this.publicKeys,function(publicKey,index){self.publicKeyIndex[publicKey.toString()]=index}),this.threshold=threshold,this.signatures=signatures?this._deserializeSignatures(signatures):new Array(this.publicKeys.length)}var _=require("lodash"),inherits=require("inherits"),Input=require("./input"),Output=require("../output"),$=require("../../util/preconditions"),Script=require("../../script"),Signature=require("../../crypto/signature"),Sighash=require("../sighash"),BufferUtil=(require("../../publickey"),require("../../util/buffer")),TransactionSignature=require("../signature");inherits(MultiSigScriptHashInput,Input),MultiSigScriptHashInput.prototype.toObject=function(){var obj=Input.prototype.toObject.apply(this,arguments);return obj.threshold=this.threshold,obj.publicKeys=_.map(this.publicKeys,function(publicKey){return publicKey.toString()}),obj.signatures=this._serializeSignatures(),obj},MultiSigScriptHashInput.prototype._deserializeSignatures=function(signatures){return _.map(signatures,function(signature){if(signature)return new TransactionSignature(signature)})},MultiSigScriptHashInput.prototype._serializeSignatures=function(){return _.map(this.signatures,function(signature){if(signature)return signature.toObject()})},MultiSigScriptHashInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var self=this,results=[];return _.each(this.publicKeys,function(publicKey){publicKey.toString()===privateKey.publicKey.toString()&&results.push(new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:self.prevTxId,outputIndex:self.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,self.redeemScript),sigtype:sigtype}))}),results},MultiSigScriptHashInput.prototype.addSignature=function(transaction,signature){return $.checkState(!this.isFullySigned(),"All needed signatures have already been added"),$.checkArgument(!_.isUndefined(this.publicKeyIndex[signature.publicKey.toString()]),"Signature has no matching public key"),$.checkState(this.isValidSignature(transaction,signature)),this.signatures[this.publicKeyIndex[signature.publicKey.toString()]]=signature,this._updateScript(),this},MultiSigScriptHashInput.prototype._updateScript=function(){return this.setScript(Script.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},MultiSigScriptHashInput.prototype._createSignatures=function(){return _.map(_.filter(this.signatures,function(signature){return!_.isUndefined(signature)}),function(signature){return BufferUtil.concat([signature.signature.toDER(),BufferUtil.integerAsSingleByteBuffer(signature.sigtype)])})},MultiSigScriptHashInput.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},MultiSigScriptHashInput.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},MultiSigScriptHashInput.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},MultiSigScriptHashInput.prototype.countSignatures=function(){return _.reduce(this.signatures,function(sum,signature){return sum+!!signature},0)},MultiSigScriptHashInput.prototype.publicKeysWithoutSignature=function(){var self=this;return _.filter(this.publicKeys,function(publicKey){return!self.signatures[self.publicKeyIndex[publicKey.toString()]]})},MultiSigScriptHashInput.prototype.isValidSignature=function(transaction,signature){return signature.signature.nhashtype=signature.sigtype,Sighash.verify(transaction,signature.signature,signature.publicKey,signature.inputIndex,this.redeemScript)},MultiSigScriptHashInput.OPCODES_SIZE=7,MultiSigScriptHashInput.SIGNATURE_SIZE=74,MultiSigScriptHashInput.PUBKEY_SIZE=34,MultiSigScriptHashInput.prototype._estimateSize=function(){return MultiSigScriptHashInput.OPCODES_SIZE+this.threshold*MultiSigScriptHashInput.SIGNATURE_SIZE+this.publicKeys.length*MultiSigScriptHashInput.PUBKEY_SIZE},module.exports=MultiSigScriptHashInput},{"../../crypto/signature":37,"../../publickey":50,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:257,lodash:268}],59:[function(require,module,exports){"use strict";function PublicKeyInput(){Input.apply(this,arguments)}var inherits=require("inherits"),$=require("../../util/preconditions"),Input=(require("../../util/buffer"),require("./input")),Output=require("../output"),Sighash=require("../sighash"),Script=require("../../script"),Signature=require("../../crypto/signature"),TransactionSignature=require("../signature");inherits(PublicKeyInput,Input),PublicKeyInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype){$.checkState(this.output instanceof Output),sigtype=sigtype||Signature.SIGHASH_ALL;var publicKey=privateKey.toPublicKey();return publicKey.toString()===this.output.script.getPublicKey().toString("hex")?[new TransactionSignature({publicKey:publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,this.output.script),sigtype:sigtype})]:[]},PublicKeyInput.prototype.addSignature=function(transaction,signature){return $.checkState(this.isValidSignature(transaction,signature),"Signature is invalid"),this.setScript(Script.buildPublicKeyIn(signature.signature.toDER(),signature.sigtype)),this},PublicKeyInput.prototype.clearSignatures=function(){return this.setScript(Script.empty()),this},PublicKeyInput.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},PublicKeyInput.SCRIPT_MAX_SIZE=73,PublicKeyInput.prototype._estimateSize=function(){return PublicKeyInput.SCRIPT_MAX_SIZE},module.exports=PublicKeyInput},{"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:257}],60:[function(require,module,exports){"use strict";function PublicKeyHashInput(){Input.apply(this,arguments)}var inherits=require("inherits"),$=require("../../util/preconditions"),BufferUtil=require("../../util/buffer"),Hash=require("../../crypto/hash"),Input=require("./input"),Output=require("../output"),Sighash=require("../sighash"),Script=require("../../script"),Signature=require("../../crypto/signature"),TransactionSignature=require("../signature");inherits(PublicKeyHashInput,Input),PublicKeyHashInput.prototype.getSignatures=function(transaction,privateKey,index,sigtype,hashData){return $.checkState(this.output instanceof Output),hashData=hashData||Hash.sha256ripemd160(privateKey.publicKey.toBuffer()),sigtype=sigtype||Signature.SIGHASH_ALL,BufferUtil.equals(hashData,this.output.script.getPublicKeyHash())?[new TransactionSignature({publicKey:privateKey.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:index,signature:Sighash.sign(transaction,privateKey,sigtype,index,this.output.script),sigtype:sigtype})]:[]},PublicKeyHashInput.prototype.addSignature=function(transaction,signature){return $.checkState(this.isValidSignature(transaction,signature),"Signature is invalid"),this.setScript(Script.buildPublicKeyHashIn(signature.publicKey,signature.signature.toDER(),signature.sigtype)),this},PublicKeyHashInput.prototype.clearSignatures=function(){return this.setScript(Script.empty()),this},PublicKeyHashInput.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},PublicKeyHashInput.SCRIPT_MAX_SIZE=107,PublicKeyHashInput.prototype._estimateSize=function(){return PublicKeyHashInput.SCRIPT_MAX_SIZE},module.exports=PublicKeyHashInput},{"../../crypto/hash":34,"../../crypto/signature":37,"../../script":51,"../../util/buffer":68,"../../util/preconditions":70,"../output":61,"../sighash":62,"../signature":63,"./input":56,inherits:257}],61:[function(require,module,exports){"use strict";function Output(args){if(!(this instanceof Output))return new Output(args);if(!_.isObject(args))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=args.satoshis,bufferUtil.isBuffer(args.script))this._scriptBuffer=args.script;else{var script;script=_.isString(args.script)&&JSUtil.isHexa(args.script)?new buffer.Buffer(args.script,"hex"):args.script,this.setScript(script)}}var _=require("lodash"),BN=require("../crypto/bn"),buffer=require("buffer"),bufferUtil=require("../util/buffer"),JSUtil=require("../util/js"),BufferWriter=require("../encoding/bufferwriter"),Script=require("../script"),$=require("../util/preconditions"),errors=require("../errors");Object.defineProperty(Output.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(Output.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(num){num instanceof BN?(this._satoshisBN=num,this._satoshis=num.toNumber()):_.isString(num)?(this._satoshis=parseInt(num),this._satoshisBN=BN.fromNumber(this._satoshis)):($.checkArgument(JSUtil.isNaturalNumber(num),"Output satoshis is not a natural number"),this._satoshisBN=BN.fromNumber(num),this._satoshis=num),$.checkState(JSUtil.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),Output.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Output.prototype.toObject=Output.prototype.toJSON=function(){var obj={satoshis:this.satoshis};return obj.script=this._scriptBuffer.toString("hex"),obj},Output.fromObject=function(data){return new Output(data)},Output.prototype.setScriptFromBuffer=function(buffer){this._scriptBuffer=buffer;try{this._script=Script.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof errors.Script.InvalidBuffer))throw e;this._script=null}},Output.prototype.setScript=function(script){if(script instanceof Script)this._scriptBuffer=script.toBuffer(),this._script=script,this._script._isOutput=!0;else if(_.isString(script))this._script=Script.fromString(script),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!bufferUtil.isBuffer(script))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(script)}return this},Output.prototype.inspect=function(){var scriptStr;return scriptStr=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},Output.fromBufferReader=function(br){var obj={};obj.satoshis=br.readUInt64LEBN();var size=br.readVarintNum();return obj.script=0!==size?br.read(size):new buffer.Buffer([]),new Output(obj)},Output.prototype.toBufferWriter=function(writer){writer||(writer=new BufferWriter),writer.writeUInt64LEBN(this._satoshisBN);var script=this._scriptBuffer;return writer.writeVarintNum(script.length),writer.write(script),writer},module.exports=Output},{"../crypto/bn":32,"../encoding/bufferwriter":41,"../errors":43,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,buffer:149,lodash:268}],62:[function(require,module,exports){(function(Buffer){"use strict";function sign(transaction,privateKey,sighashType,inputIndex,subscript){var hashbuf=sighash(transaction,sighashType,inputIndex,subscript);return ECDSA.sign(hashbuf,privateKey,"little").set({nhashtype:sighashType})}function verify(transaction,signature,publicKey,inputIndex,subscript){$.checkArgument(!_.isUndefined(transaction)),$.checkArgument(!_.isUndefined(signature)&&!_.isUndefined(signature.nhashtype));var hashbuf=sighash(transaction,signature.nhashtype,inputIndex,subscript);return ECDSA.verify(hashbuf,signature,publicKey,"little")}var buffer=require("buffer"),Signature=require("../crypto/signature"),Script=require("../script"),Output=require("./output"),BufferReader=require("../encoding/bufferreader"),BufferWriter=require("../encoding/bufferwriter"),BN=require("../crypto/bn"),Hash=require("../crypto/hash"),ECDSA=require("../crypto/ecdsa"),$=require("../util/preconditions"),_=require("lodash"),sighash=function(transaction,sighashType,inputNumber,subscript){var i,Transaction=require("./transaction"),Input=require("./input"),txcopy=Transaction.shallowCopy(transaction);for(subscript=new Script(subscript),subscript.removeCodeseparators(), +i=0;i=txcopy.outputs.length)return new Buffer("0000000000000000000000000000000000000000000000000000000000000001","hex");for(txcopy.outputs.length=inputNumber+1,i=0;imaximumFee)return this._missingChange()?new errors.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new errors.Transaction.FeeError.TooLarge("expected less than "+maximumFee+" but got "+unspent)}if(!opts.disableSmallFees){var minimumFee=Math.ceil(this._estimateFee()/Transaction.FEE_SECURITY_MARGIN);if(unspent"},Transaction.prototype.toBuffer=function(){var writer=new BufferWriter;return this.toBufferWriter(writer).toBuffer()},Transaction.prototype.toBufferWriter=function(writer){return writer.writeInt32LE(this.version),writer.writeVarintNum(this.inputs.length),_.each(this.inputs,function(input){input.toBufferWriter(writer)}),writer.writeVarintNum(this.outputs.length),_.each(this.outputs,function(output){output.toBufferWriter(writer)}),writer.writeUInt32LE(this.nLockTime),writer},Transaction.prototype.fromBuffer=function(buffer){var reader=new BufferReader(buffer);return this.fromBufferReader(reader)},Transaction.prototype.fromBufferReader=function(reader){$.checkArgument(!reader.finished(),"No transaction data received");var i,sizeTxIns,sizeTxOuts;for(this.version=reader.readInt32LE(),sizeTxIns=reader.readVarintNum(),i=0;i=Transaction.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new errors.Transaction.BlockHeightTooHigh;if(height<0)throw new errors.Transaction.NLockTimeOutOfRange;for(var i=0;i0?(this._changeIndex=this.outputs.length,this._addOutput(new Output({script:this._changeScript,satoshis:changeAmount}))):this._changeIndex=void 0}},Transaction.prototype.getFee=function(){return this.isCoinbase()?0:_.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},Transaction.prototype._estimateFee=function(){var estimatedSize=this._estimateSize(),available=this._getUnspentValue();return Transaction._estimateFee(estimatedSize,available,this._feePerKb)},Transaction.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},Transaction.prototype._clearSignatures=function(){_.each(this.inputs,function(input){input.clearSignatures()})},Transaction._estimateFee=function(size,amountAvailable,feePerKb){return amountAvailable>Math.ceil(size/1e3)*(feePerKb||Transaction.FEE_PER_KB)&&(size+=Transaction.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(size/1e3)*(feePerKb||Transaction.FEE_PER_KB)},Transaction.prototype._estimateSize=function(){var result=Transaction.MAXIMUM_EXTRA_SIZE;return _.each(this.inputs,function(input){result+=input._estimateSize()}),_.each(this.outputs,function(output){result+=output.script.toBuffer().length+9}),result},Transaction.prototype._removeOutput=function(index){var output=this.outputs[index];this.outputs=_.without(this.outputs,output),this._outputAmount=void 0},Transaction.prototype.removeOutput=function(index){this._removeOutput(index),this._updateChangeOutput()},Transaction.prototype.sort=function(){return this.sortInputs(function(inputs){var copy=Array.prototype.concat.apply([],inputs);return copy.sort(function(first,second){return compare(first.prevTxId,second.prevTxId)||first.outputIndex-second.outputIndex}),copy}),this.sortOutputs(function(outputs){var copy=Array.prototype.concat.apply([],outputs);return copy.sort(function(first,second){return first.satoshis-second.satoshis||compare(first.script.toBuffer(),second.script.toBuffer())}),copy}),this},Transaction.prototype.shuffleOutputs=function(){return this.sortOutputs(_.shuffle)},Transaction.prototype.sortOutputs=function(sortingFunction){var outs=sortingFunction(this.outputs);return this._newOutputOrder(outs)},Transaction.prototype.sortInputs=function(sortingFunction){return this.inputs=sortingFunction(this.inputs),this._clearSignatures(),this},Transaction.prototype._newOutputOrder=function(newOutputs){if(this.outputs.length!==newOutputs.length||0!==_.difference(this.outputs,newOutputs).length)throw new errors.Transaction.InvalidSorting;if(!_.isUndefined(this._changeIndex)){var changeOutput=this.outputs[this._changeIndex];this._changeIndex=_.findIndex(newOutputs,changeOutput)}return this.outputs=newOutputs,this},Transaction.prototype.removeInput=function(txId,outputIndex){var index;if((index=!outputIndex&&_.isNumber(txId)?txId:_.findIndex(this.inputs,function(input){return input.prevTxId.toString("hex")===txId&&input.outputIndex===outputIndex}))<0||index>=this.inputs.length)throw new errors.Transaction.InvalidIndex(index,this.inputs.length);var input=this.inputs[index];this.inputs=_.without(this.inputs,input),this._inputAmount=void 0,this._updateChangeOutput()},Transaction.prototype.sign=function(privateKey,sigtype){$.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var self=this;return _.isArray(privateKey)?(_.each(privateKey,function(privateKey){self.sign(privateKey,sigtype)}),this):(_.each(this.getSignatures(privateKey,sigtype),function(signature){self.applySignature(signature)}),this)},Transaction.prototype.getSignatures=function(privKey,sigtype){privKey=new PrivateKey(privKey),sigtype=sigtype||Signature.SIGHASH_ALL;var transaction=this,results=[],hashData=Hash.sha256ripemd160(privKey.publicKey.toBuffer());return _.each(this.inputs,function(input,index){_.each(input.getSignatures(transaction,privKey,index,sigtype,hashData),function(signature){results.push(signature)})}),results},Transaction.prototype.applySignature=function(signature){return this.inputs[signature.inputIndex].addSignature(this,signature),this},Transaction.prototype.isFullySigned=function(){return _.each(this.inputs,function(input){if(input.isFullySigned===Input.prototype.isFullySigned)throw new errors.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),_.every(_.map(this.inputs,function(input){return input.isFullySigned()}))},Transaction.prototype.isValidSignature=function(signature){var self=this;if(this.inputs[signature.inputIndex].isValidSignature===Input.prototype.isValidSignature)throw new errors.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[signature.inputIndex].isValidSignature(self,signature)},Transaction.prototype.verifySignature=function(sig,pubkey,nin,subscript){return Sighash.verify(this,sig,pubkey,nin,subscript)},Transaction.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var valueoutbn=new BN(0),i=0;i1e6)return"transaction over the maximum block size";var txinmap={};for(i=0;i100)return"coinbase transaction script size invalid"}else for(i=0;i=Input.MAXINT-1&&(input.sequenceNumber=Input.DEFAULT_RBF_SEQNUMBER)}return this},module.exports=Transaction}).call(this,require("buffer").Buffer)},{"../address":27,"../crypto/bn":32,"../crypto/hash":34,"../crypto/signature":37,"../encoding/bufferreader":40,"../encoding/bufferwriter":41,"../errors":43,"../privatekey":49,"../script":51,"../util/buffer":68,"../util/js":69,"../util/preconditions":70,"./input":55,"./output":61,"./sighash":62,"./unspentoutput":65,buffer:149,"buffer-compare":147,lodash:268}],65:[function(require,module,exports){"use strict";function UnspentOutput(data){if(!(this instanceof UnspentOutput))return new UnspentOutput(data);$.checkArgument(_.isObject(data),"Must provide an object from where to extract data");var address=data.address?new Address(data.address):void 0,txId=data.txid?data.txid:data.txId;if(!txId||!JSUtil.isHexaString(txId)||txId.length>64)throw new Error("Invalid TXID in object",data);var outputIndex=_.isUndefined(data.vout)?data.outputIndex:data.vout;if(!_.isNumber(outputIndex))throw new Error("Invalid outputIndex, received "+outputIndex);$.checkArgument(!_.isUndefined(data.scriptPubKey)||!_.isUndefined(data.script),"Must provide the scriptPubKey for that output!");var script=new Script(data.scriptPubKey||data.script);$.checkArgument(!_.isUndefined(data.amount)||!_.isUndefined(data.satoshis),"Must provide an amount for the output");var amount=_.isUndefined(data.amount)?data.satoshis:new Unit.fromBTC(data.amount).toSatoshis();$.checkArgument(_.isNumber(amount),"Amount must be a number"),JSUtil.defineImmutable(this,{address:address,txId:txId,outputIndex:outputIndex,script:script,satoshis:amount})}var _=require("lodash"),$=require("../util/preconditions"),JSUtil=require("../util/js"),Script=require("../script"),Address=require("../address"),Unit=require("../unit");UnspentOutput.prototype.inspect=function(){return""},UnspentOutput.prototype.toString=function(){return this.txId+":"+this.outputIndex},UnspentOutput.fromObject=function(data){return new UnspentOutput(data)},UnspentOutput.prototype.toObject=UnspentOutput.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Unit.fromSatoshis(this.satoshis).toBTC()}},module.exports=UnspentOutput},{"../address":27,"../script":51,"../unit":66,"../util/js":69,"../util/preconditions":70,lodash:268}],66:[function(require,module,exports){"use strict";function Unit(amount,code){if(!(this instanceof Unit))return new Unit(amount,code);if(_.isNumber(code)){if(code<=0)throw new errors.Unit.InvalidRate(code);amount/=code,code=Unit.BTC}this._value=this._from(amount,code);var self=this,defineAccesor=function(key){Object.defineProperty(self,key,{get:function(){return self.to(key)},enumerable:!0})};Object.keys(UNITS).forEach(defineAccesor)}var _=require("lodash"),errors=require("./errors"),$=require("./util/preconditions"),UNITS={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(UNITS).forEach(function(key){Unit[key]=key}),Unit.fromObject=function(data){return $.checkArgument(_.isObject(data),"Argument is expected to be an object"),new Unit(data.amount,data.code)},Unit.fromBTC=function(amount){return new Unit(amount,Unit.BTC)},Unit.fromMillis=Unit.fromMilis=function(amount){return new Unit(amount,Unit.mBTC)},Unit.fromMicros=Unit.fromBits=function(amount){return new Unit(amount,Unit.bits)},Unit.fromSatoshis=function(amount){return new Unit(amount,Unit.satoshis)},Unit.fromFiat=function(amount,rate){return new Unit(amount,rate)},Unit.prototype._from=function(amount,code){if(!UNITS[code])throw new errors.Unit.UnknownCode(code);return parseInt((amount*UNITS[code][0]).toFixed())},Unit.prototype.to=function(code){if(_.isNumber(code)){if(code<=0)throw new errors.Unit.InvalidRate(code);return parseFloat((this.BTC*code).toFixed(2))}if(!UNITS[code])throw new errors.Unit.UnknownCode(code);var value=this._value/UNITS[code][0];return parseFloat(value.toFixed(UNITS[code][1]))},Unit.prototype.toBTC=function(){return this.to(Unit.BTC)},Unit.prototype.toMillis=Unit.prototype.toMilis=function(){return this.to(Unit.mBTC)},Unit.prototype.toMicros=Unit.prototype.toBits=function(){return this.to(Unit.bits)},Unit.prototype.toSatoshis=function(){return this.to(Unit.satoshis)},Unit.prototype.atRate=function(rate){return this.to(rate)},Unit.prototype.toString=function(){return this.satoshis+" satoshis"},Unit.prototype.toObject=Unit.prototype.toJSON=function(){return{amount:this.BTC,code:Unit.BTC}},Unit.prototype.inspect=function(){return""},module.exports=Unit},{"./errors":43,"./util/preconditions":70,lodash:268}],67:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_=require("lodash"),URL=require("url"),Address=require("./address"),Unit=require("./unit"),URI=function URI(data,knownParams){if(!(this instanceof URI))return new URI(data,knownParams);if(this.extras={},this.knownParams=knownParams||[],this.address=this.network=this.amount=this.message=null,"string"==typeof data){var params=URI.parse(data);params.amount&&(params.amount=this._parseAmount(params.amount)),this._fromObject(params)}else{if("object"!==(void 0===data?"undefined":_typeof(data)))throw new TypeError("Unrecognized data format.");this._fromObject(data)}};URI.fromString=function(str){if("string"!=typeof str)throw new TypeError("Expected a string");return new URI(str)},URI.fromObject=function(json){return new URI(json)},URI.isValid=function(arg,knownParams){try{new URI(arg,knownParams)}catch(err){return!1}return!0},URI.parse=function(uri){var info=URL.parse(uri,!0);if("bitcoin:"!==info.protocol)throw new TypeError("Invalid bitcoin URI");var group=/[^:]*:\/?\/?([^?]*)/.exec(uri);return info.query.address=group&&group[1]||void 0,info.query},URI.Members=["address","amount","message","label","r"],URI.prototype._fromObject=function(obj){if(!Address.isValid(obj.address))throw new TypeError("Invalid bitcoin address");this.address=new Address(obj.address),this.network=this.address.network,this.amount=obj.amount;for(var key in obj)if("address"!==key&&"amount"!==key){if(/^req-/.exec(key)&&-1===this.knownParams.indexOf(key))throw Error("Unknown required argument "+key);var destination=URI.Members.indexOf(key)>-1?this:this.extras;destination[key]=obj[key]}},URI.prototype._parseAmount=function(amount){if(amount=Number(amount),isNaN(amount))throw new TypeError("Invalid amount");return Unit.fromBTC(amount).toSatoshis()},URI.prototype.toObject=URI.prototype.toJSON=function(){for(var json={},i=0;i"},module.exports=URI},{"./address":27,"./unit":66,lodash:268,url:350}],68:[function(require,module,exports){(function(Buffer){"use strict";function equals(a,b){if(a.length!==b.length)return!1;for(var length=a.length,i=0;i>24&255),bytes.push(integer>>16&255),bytes.push(integer>>8&255),bytes.push(255&integer),new Buffer(bytes)},integerFromBuffer:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer[0]<<24|buffer[1]<<16|buffer[2]<<8|buffer[3]},integerFromSingleByteBuffer:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer[0]},bufferToHex:function(buffer){return $.checkArgumentType(buffer,"Buffer","buffer"),buffer.toString("hex")},reverse:function(param){for(var ret=new buffer.Buffer(param.length),i=0;i=0}}},{lodash:268}],70:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},errors=require("../errors"),_=require("lodash");module.exports={checkState:function(condition,message){if(!condition)throw new errors.InvalidState(message)},checkArgument:function(condition,argumentName,message,docsPath){if(!condition)throw new errors.InvalidArgument(argumentName,message,docsPath)},checkArgumentType:function(argument,type,argumentName){if(argumentName=argumentName||"(unknown name)",_.isString(type)){if("Buffer"===type){var buffer=require("buffer");if(!buffer.Buffer.isBuffer(argument))throw new errors.InvalidArgumentType(argument,type,argumentName)}else if((void 0===argument?"undefined":_typeof(argument))!==type)throw new errors.InvalidArgumentType(argument,type,argumentName)}else if(!(argument instanceof type))throw new errors.InvalidArgumentType(argument,type.name,argumentName)}}},{"../errors":43,buffer:149,lodash:268}],71:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec"),elliptic.eddsa=require("./elliptic/eddsa")},{"../package.json":86,"./elliptic/curve":74,"./elliptic/curves":77,"./elliptic/ec":78,"./elliptic/eddsa":81,"./elliptic/utils":85,brorand:100}],72:[function(require,module,exports){"use strict";function BaseCurve(type,conf){this.type=type,this.p=new BN(conf.p,16),this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p),this.zero=new BN(0).toRed(this.red),this.one=new BN(1).toRed(this.red),this.two=new BN(2).toRed(this.red),this.n=conf.n&&new BN(conf.n,16),this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var adjustCount=this.n&&this.p.div(this.n);!adjustCount||adjustCount.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(curve,type){this.curve=curve,this.type=type,this.precomputed=null}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,getNAF=utils.getNAF,getJSF=utils.getJSF,assert=utils.assert;module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(p,k){assert(p.precomputed);var doubles=p._getDoubles(),naf=getNAF(k,1),I=(1<=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}for(var a=this.jpoint(null,null,null),b=this.jpoint(null,null,null),i=I;i>0;i--){for(var j=0;j=0;i--){for(var k=0;i>=0&&0===naf[i];i--)k++;if(i>=0&&k++,acc=acc.dblp(k),i<0)break;var z=naf[i];assert(0!==z),acc="affine"===p.type?z>0?acc.mixedAdd(wnd[z-1>>1]):acc.mixedAdd(wnd[-z-1>>1].neg()):z>0?acc.add(wnd[z-1>>1]):acc.add(wnd[-z-1>>1].neg())}return"affine"===p.type?acc.toP():acc},BaseCurve.prototype._wnafMulAdd=function(defW,points,coeffs,len,jacobianResult){for(var wndWidth=this._wnafT1,wnd=this._wnafT2,naf=this._wnafT3,max=0,i=0;i=1;i-=2){var a=i-1,b=i;if(1===wndWidth[a]&&1===wndWidth[b]){var comb=[points[a],null,null,points[b]];0===points[a].y.cmp(points[b].y)?(comb[1]=points[a].add(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg())):0===points[a].y.cmp(points[b].y.redNeg())?(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].add(points[b].neg())):(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg()));var index=[-3,-1,-5,-7,0,7,5,1,3],jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max),naf[a]=new Array(max),naf[b]=new Array(max);for(var j=0;j=0;i--){for(var k=0;i>=0;){for(var zero=!0,j=0;j=0&&k++,acc=acc.dblp(k),i<0)break;for(var j=0;j0?p=wnd[j][z-1>>1]:z<0&&(p=wnd[j][-z-1>>1].neg()),acc="affine"===p.type?acc.mixedAdd(p):acc.add(p))}}for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)},BasePoint.prototype._getDoubles=function(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var doubles=[this],acc=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),g=d.redAdd(b),f=g.redSub(c),h=d.redSub(b),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projDbl=function(){var nx,ny,nz,b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var e=this.curve._mulA(c),f=e.redAdd(d);if(this.zOne)nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)),ny=f.redMul(e.redSub(d)),nz=f.redSqr().redSub(f).redSub(f);else{var h=this.z.redSqr(),j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j),ny=f.redMul(e.redSub(d)),nz=f.redMul(j)}}else{var e=c.redAdd(d),h=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j),ny=this.curve._mulC(e).redMul(c.redISub(d)),nz=e.redMul(j)}return this.curve.point(nx,ny,nz)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),c=this.t.redMul(this.curve.dd).redMul(p.t),d=this.z.redMul(p.z.redAdd(p.z)),e=b.redSub(a),f=d.redSub(c),g=d.redAdd(c),h=b.redAdd(a),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projAdd=function(p){var ny,nz,a=this.z.redMul(p.z),b=a.redSqr(),c=this.x.redMul(p.x),d=this.y.redMul(p.y),e=this.curve.d.redMul(c).redMul(d),f=b.redSub(e),g=b.redAdd(e),tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),nx=a.redMul(f).redMul(tmp);return this.curve.twisted?(ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c))),nz=f.redMul(g)):(ny=a.redMul(g).redMul(d.redSub(c)),nz=this.curve._mulC(f).redMul(g)),this.curve.point(nx,ny,nz)},Point.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},Point.prototype.mul=function(k){return this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!1)},Point.prototype.jmulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var zi=this.z.redInvm();return this.x=this.x.redMul(zi),this.y=this.y.redMul(zi),this.t&&(this.t=this.t.redMul(zi)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(other){return this===other||0===this.getX().cmp(other.getX())&&0===this.getY().cmp(other.getY())},Point.prototype.eqXToP=function(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(rx))return!0;for(var xc=x.clone(),t=this.curve.redN.redMul(this.z);;){if(xc.iadd(this.curve.n),xc.cmp(this.curve.p)>=0)return!1;if(rx.redIAdd(t),0===this.x.cmp(rx))return!0}return!1},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:257}],74:[function(require,module,exports){"use strict";var curve=exports;curve.base=require("./base"),curve.short=require("./short"),curve.mont=require("./mont"),curve.edwards=require("./edwards")},{"./base":72,"./edwards":73,"./mont":75,"./short":76}],75:[function(require,module,exports){"use strict";function MontCurve(conf){Base.call(this,"mont",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.i4=new BN(4).toRed(this.red).redInvm(),this.two=new BN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective"),null===x&&null===z?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN(x,16),this.z=new BN(z,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var curve=require("../curve"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,elliptic=require("../../elliptic"),utils=elliptic.utils;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(point){var x=point.normalize().x,x2=x.redSqr(),rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);return 0===rhs.redSqrt().redSqr().cmp(rhs)},inherits(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(bytes,enc){return this.point(utils.toArray(bytes,enc),1)},MontCurve.prototype.point=function(x,z){return new Point(this,x,z)},MontCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var a=this.x.redAdd(this.z),aa=a.redSqr(),b=this.x.redSub(this.z),bb=b.redSqr(),c=aa.redSub(bb),nx=aa.redMul(bb),nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(p,diff){var a=this.x.redAdd(this.z),b=this.x.redSub(this.z),c=p.x.redAdd(p.z),d=p.x.redSub(p.z),da=d.redMul(a),cb=c.redMul(b),nx=diff.z.redMul(da.redAdd(cb).redSqr()),nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)},Point.prototype.mul=function(k){for(var t=k.clone(),a=this,b=this.curve.point(null,null),c=this,bits=[];0!==t.cmpn(0);t.iushrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--)0===bits[i]?(a=a.diffAdd(b,c),b=b.dbl()):(b=a.diffAdd(b,c),a=a.dbl());return b},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.eq=function(other){return 0===this.getX().cmp(other.getX())},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:257}],76:[function(require,module,exports){"use strict";function ShortCurve(conf){Base.call(this,"short",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(conf),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine"),null===x&&null===y?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN(x,16),this.y=new BN(y,16),isRed&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian"),null===x&&null===y&&null===z?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN(0)):(this.x=new BN(x,16),this.y=new BN(y,16),this.z=new BN(z,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var curve=require("../curve"),elliptic=require("../../elliptic"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,assert=elliptic.utils.assert;inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(conf){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var beta,lambda;if(conf.beta)beta=new BN(conf.beta,16).toRed(this.red);else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1],beta=beta.toRed(this.red)}if(conf.lambda)lambda=new BN(conf.lambda,16);else{var lambdas=this._getEndoRoots(this.n);0===this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))?lambda=lambdas[0]:(lambda=lambdas[1],assert(0===this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))))}var basis;return basis=conf.basis?conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}}):this._getEndoBasis(lambda),{beta:beta,lambda:lambda,basis:basis}}},ShortCurve.prototype._getEndoRoots=function(num){var red=num===this.p?this.red:BN.mont(num),tinv=new BN(2).toRed(red).redInvm(),ntinv=tinv.redNeg(),s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);return[ntinv.redAdd(s).fromRed(),ntinv.redSub(s).fromRed()]},ShortCurve.prototype._getEndoBasis=function(lambda){for(var a0,b0,a1,b1,a2,b2,prevR,r,x,aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=lambda,v=this.n.clone(),x1=new BN(1),y1=new BN(0),x2=new BN(0),y2=new BN(1),i=0;0!==u.cmpn(0);){var q=v.div(u);r=v.sub(q.mul(u)),x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0)a0=prevR.neg(),b0=x1,a1=r.neg(),b1=x;else if(a1&&2==++i)break;prevR=r,v=u,u=r,x2=x1,x1=x,y2=y1,y1=y}a2=r.neg(),b2=x;var len1=a1.sqr().add(b1.sqr());return a2.sqr().add(b2.sqr()).cmp(len1)>=0&&(a2=a0,b2=b0),a1.negative&&(a1=a1.neg(),b1=b1.neg()),a2.negative&&(a2=a2.neg(),b2=b2.neg()),[{a:a1,b:b1},{a:a2,b:b2}]},ShortCurve.prototype._endoSplit=function(k){var basis=this.endo.basis,v1=basis[0],v2=basis[1],c1=v2.b.mul(k).divRound(this.n),c2=v1.b.neg().mul(k).divRound(this.n),p1=c1.mul(v1.a),p2=c2.mul(v2.a),q1=c1.mul(v1.b),q2=c2.mul(v2.b);return{k1:k.sub(p1).sub(p2),k2:q1.add(q2).neg()}},ShortCurve.prototype.pointFromX=function(x,odd){x=new BN(x,16),x.red||(x=x.toRed(this.red));var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),y=y2.redSqrt();if(0!==y.redSqr().redSub(y2).cmp(this.zero))throw new Error("invalid point");var isOdd=y.fromRed().isOdd();return(odd&&!isOdd||!odd&&isOdd)&&(y=y.redNeg()),this.point(x,y)},ShortCurve.prototype.validate=function(point){if(point.inf)return!0;var x=point.x,y=point.y,ax=this.a.redMul(x),rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return 0===y.redSqr().redISub(rhs).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(points,coeffs,jacobianResult){for(var npoints=this._endoWnafT1,ncoeffs=this._endoWnafT2,i=0;i":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(0===this.x.cmp(p.x))return this.curve.point(null,null);var c=this.y.redSub(p.y);0!==c.cmpn(0)&&(c=c.redMul(this.x.redSub(p.x).redInvm()));var nx=c.redSqr().redISub(this.x).redISub(p.x),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.dbl=function(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(0===ys1.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,x2=this.x.redSqr(),dyinv=ys1.redInvm(),c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv),nx=c.redSqr().redISub(this.x.redAdd(this.x)),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(k){return k=new BN(k,16),this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve.endo?this.curve._endoWnafMulAdd([this],[k]):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs):this.curve._wnafMulAdd(1,points,coeffs,2)},Point.prototype.jmulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs,!0):this.curve._wnafMulAdd(1,points,coeffs,2,!0)},Point.prototype.eq=function(p){return this===p||this.inf===p.inf&&(this.inf||0===this.x.cmp(p.x)&&0===this.y.cmp(p.y))},Point.prototype.neg=function(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed,negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(x,y,z){return new JPoint(this,x,y,z)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm(),zinv2=zinv.redSqr(),ax=this.x.redMul(zinv2),ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr(),z2=this.z.redSqr(),u1=this.x.redMul(pz2),u2=p.x.redMul(z2),s1=this.y.redMul(pz2.redMul(p.z)),s2=p.y.redMul(z2.redMul(this.z)),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mixedAdd=function(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr(),u1=this.x,u2=p.x.redMul(z2),s1=this.y,s2=p.y.redMul(z2).redMul(this.z),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.dblp=function(pow){if(0===pow)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,i=0;i=0)return!1;if(rx.redIAdd(t),0===this.x.cmp(rx))return!0}return!1},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":71,"../curve":74,"bn.js":99,inherits:257}],77:[function(require,module,exports){"use strict";function PresetCurve(options){"short"===options.type?this.curve=new elliptic.curve.short(options):"edwards"===options.type?this.curve=new elliptic.curve.edwards(options):this.curve=new elliptic.curve.mont(options),this.g=this.curve.g,this.n=this.curve.n,this.hash=options.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,get:function(){var curve=new PresetCurve(options);return Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,value:curve}),curve}})}var curves=exports,hash=require("hash.js"),elliptic=require("../elliptic"),assert=elliptic.utils.assert;curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"../elliptic":71,"./precomputed/secp256k1":84,"hash.js":241}],78:[function(require,module,exports){"use strict";function EC(options){if(!(this instanceof EC))return new EC(options);"string"==typeof options&&(assert(elliptic.curves.hasOwnProperty(options),"Unknown curve "+options),options=elliptic.curves[options]),options instanceof elliptic.curves.PresetCurve&&(options={curve:options}),this.curve=options.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=options.curve.g,this.g.precompute(options.curve.n.bitLength()+1),this.hash=options.hash||options.curve.hash}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},BN=require("bn.js"),HmacDRBG=require("hmac-drbg"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(options){return new KeyPair(this,options)},EC.prototype.keyFromPrivate=function(priv,enc){return KeyPair.fromPrivate(this,priv,enc)},EC.prototype.keyFromPublic=function(pub,enc){return KeyPair.fromPublic(this,pub,enc)},EC.prototype.genKeyPair=function(options){options||(options={});for(var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||elliptic.rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()}),bytes=this.n.byteLength(),ns2=this.n.sub(new BN(2));;){var priv=new BN(drbg.generate(bytes));if(!(priv.cmp(ns2)>0))return priv.iaddn(1),this.keyFromPrivate(priv)}},EC.prototype._truncateToN=function(msg,truncOnly){var delta=8*msg.byteLength()-this.n.bitLength();return delta>0&&(msg=msg.ushrn(delta)),!truncOnly&&msg.cmp(this.n)>=0?msg.sub(this.n):msg},EC.prototype.sign=function(msg,key,enc,options){"object"===(void 0===enc?"undefined":_typeof(enc))&&(options=enc,enc=null),options||(options={}),key=this.keyFromPrivate(key,enc),msg=this._truncateToN(new BN(msg,16));for(var bytes=this.n.byteLength(),bkey=key.getPrivate().toArray("be",bytes),nonce=msg.toArray("be",bytes),drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce:nonce,pers:options.pers,persEnc:options.persEnc||"utf8"}),ns1=this.n.sub(new BN(1)),iter=0;!0;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));if(k=this._truncateToN(k,!0),!(k.cmpn(1)<=0||k.cmp(ns1)>=0)){var kp=this.g.mul(k);if(!kp.isInfinity()){var kpX=kp.getX(),r=kpX.umod(this.n);if(0!==r.cmpn(0)){var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));if(s=s.umod(this.n),0!==s.cmpn(0)){var recoveryParam=(kp.getY().isOdd()?1:0)|(0!==kpX.cmp(r)?2:0);return options.canonical&&s.cmp(this.nh)>0&&(s=this.n.sub(s),recoveryParam^=1),new Signature({r:r,s:s,recoveryParam:recoveryParam})}}}}}},EC.prototype.verify=function(msg,signature,key,enc){msg=this._truncateToN(new BN(msg,16)),key=this.keyFromPublic(key,enc),signature=new Signature(signature,"hex");var r=signature.r,s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var sinv=s.invm(this.n),u1=sinv.mul(msg).umod(this.n),u2=sinv.mul(r).umod(this.n);if(!this.curve._maxwellTrick){var p=this.g.mulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&0===p.getX().umod(this.n).cmp(r)}var p=this.g.jmulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&p.eqXToP(r)},EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits"),signature=new Signature(signature,enc);var n=this.n,e=new BN(msg),r=signature.r,s=signature.s,isYOdd=1&j,isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");r=isSecondKey?this.curve.pointFromX(r.add(this.curve.n),isYOdd):this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n),s1=n.sub(e).mul(rInv).umod(n),s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)},EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){if(signature=new Signature(signature,enc),null!==signature.recoveryParam)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i)}catch(e){continue}if(Qprime.eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":71,"./key":79,"./signature":80,"bn.js":99,"hmac-drbg":254}],79:[function(require,module,exports){"use strict";function KeyPair(ec,options){this.ec=ec,this.priv=null,this.pub=null,options.priv&&this._importPrivate(options.priv,options.privEnc),options.pub&&this._importPublic(options.pub,options.pubEnc)}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=KeyPair,KeyPair.fromPublic=function(ec,pub,enc){return pub instanceof KeyPair?pub:new KeyPair(ec,{pub:pub,pubEnc:enc})},KeyPair.fromPrivate=function(ec,priv,enc){return priv instanceof KeyPair?priv:new KeyPair(ec,{priv:priv,privEnc:enc})},KeyPair.prototype.validate=function(){var pub=this.getPublic();return pub.isInfinity()?{result:!1,reason:"Invalid public key"}:pub.validate()?pub.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(compact,enc){return"string"==typeof compact&&(enc=compact,compact=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),enc?this.pub.encode(enc,compact):this.pub},KeyPair.prototype.getPrivate=function(enc){return"hex"===enc?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(key,enc){this.priv=new BN(key,enc||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(key,enc){if(key.x||key.y)return"mont"===this.ec.curve.type?assert(key.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert(key.x&&key.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(key.x,key.y));this.pub=this.ec.curve.decodePoint(key,enc)},KeyPair.prototype.derive=function(pub){return pub.mul(this.priv).getX()},KeyPair.prototype.sign=function(msg,enc,options){return this.ec.sign(msg,this,enc,options)},KeyPair.prototype.verify=function(msg,signature){return this.ec.verify(msg,signature,this)},KeyPair.prototype.inspect=function(){return""}},{"../../elliptic":71,"bn.js":99}],80:[function(require,module,exports){"use strict";function Signature(options,enc){if(options instanceof Signature)return options;this._importDER(options,enc)||(assert(options.r&&options.s,"Signature without r or s"),this.r=new BN(options.r,16),this.s=new BN(options.s,16),void 0===options.recoveryParam?this.recoveryParam=null:this.recoveryParam=options.recoveryParam)}function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(128&initial))return initial;for(var octetLen=15&initial,val=0,i=0,off=p.place;i>>3);for(arr.push(128|octets);--octets;)arr.push(len>>>(octets<<3)&255);arr.push(len)}var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=Signature,Signature.prototype._importDER=function(data,enc){data=utils.toArray(data,enc);var p=new Position;if(48!==data[p.place++])return!1;if(getLength(data,p)+p.place!==data.length)return!1;if(2!==data[p.place++])return!1;var rlen=getLength(data,p),r=data.slice(p.place,rlen+p.place);if(p.place+=rlen,2!==data[p.place++])return!1;var slen=getLength(data,p);if(data.length!==slen+p.place)return!1;var s=data.slice(p.place,slen+p.place);return 0===r[0]&&128&r[1]&&(r=r.slice(1)),0===s[0]&&128&s[1]&&(s=s.slice(1)),this.r=new BN(r),this.s=new BN(s),this.recoveryParam=null,!0},Signature.prototype.toDER=function(enc){var r=this.r.toArray(),s=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&s[0]&&(s=[0].concat(s)),r=rmPadding(r),s=rmPadding(s);!(s[0]||128&s[1]);)s=s.slice(1);var arr=[2];constructLength(arr,r.length),arr=arr.concat(r),arr.push(2),constructLength(arr,s.length);var backHalf=arr.concat(s),res=[48];return constructLength(res,backHalf.length),res=res.concat(backHalf),utils.encode(res,enc)}},{"../../elliptic":71,"bn.js":99}],81:[function(require,module,exports){"use strict";function EDDSA(curve){if(assert("ed25519"===curve,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(curve);var curve=elliptic.curves[curve].curve;this.curve=curve,this.g=curve.g,this.g.precompute(curve.n.bitLength()+1),this.pointClass=curve.point().constructor,this.encodingLength=Math.ceil(curve.n.bitLength()/8),this.hash=hash.sha512}var hash=require("hash.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require("./key"),Signature=require("./signature");module.exports=EDDSA,EDDSA.prototype.sign=function(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret),r=this.hashInt(key.messagePrefix(),message),R=this.g.mul(r),Rencoded=this.encodePoint(R),s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv()),S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded})},EDDSA.prototype.verify=function(message,sig,pub){message=parseBytes(message),sig=this.makeSignature(sig);var key=this.keyFromPublic(pub),h=this.hashInt(sig.Rencoded(),key.pubBytes(),message),SG=this.g.mul(sig.S());return sig.R().add(key.pub().mul(h)).eq(SG)},EDDSA.prototype.hashInt=function(){for(var hash=this.hash(),i=0;i=0;){var z;if(k.isOdd()){var mod=k.andln(ws-1);z=mod>(ws>>1)-1?(ws>>1)-mod:mod,k.isubn(z)}else z=0;naf.push(z);for(var shift=0!==k.cmpn(0)&&0===k.andln(ws-1)?w+1:1,i=1;i0||k2.cmpn(-d2)>0;){var m14=k1.andln(3)+d1&3,m24=k2.andln(3)+d2&3;3===m14&&(m14=-1),3===m24&&(m24=-1);var u1;if(0==(1&m14))u1=0;else{var m8=k1.andln(7)+d1&7;u1=3!==m8&&5!==m8||2!==m24?m14:-m14}jsf[0].push(u1);var u2;if(0==(1&m24))u2=0;else{var m8=k2.andln(7)+d2&7;u2=3!==m8&&5!==m8||2!==m14?m24:-m24}jsf[1].push(u2),2*d1===u1+1&&(d1=1-d1),2*d2===u2+1&&(d2=1-d2),k1.iushrn(1),k2.iushrn(1)}return jsf}function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function(){return void 0!==this[key]?this[key]:this[key]=computer.call(this)}}function parseBytes(bytes){return"string"==typeof bytes?utils.toArray(bytes,"hex"):bytes}function intFromLE(bytes){return new BN(bytes,"hex","le")}var utils=exports,BN=require("bn.js"),minAssert=require("minimalistic-assert"),minUtils=require("minimalistic-crypto-utils");utils.assert=minAssert,utils.toArray=minUtils.toArray,utils.zero2=minUtils.zero2,utils.toHex=minUtils.toHex,utils.encode=minUtils.encode,utils.getNAF=getNAF,utils.getJSF=getJSF,utils.cachedProperty=cachedProperty,utils.parseBytes=parseBytes,utils.intFromLE=intFromLE},{"bn.js":99,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],86:[function(require,module,exports){module.exports={_from:"elliptic@=6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/bitcore-lib/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@=6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"=6.4.0",saveSpec:null,fetchSpec:"=6.4.0"},_requiredBy:["/bitcore-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_spec:"elliptic@=6.4.0",_where:"/home/chris/dev/eth-lightwallet/node_modules/bitcore-lib",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],87:[function(require,module,exports){module.exports={_from:"bitcore-lib@^0.15.0",_id:"bitcore-lib@0.15.0",_inBundle:!1,_integrity:"sha512-AeXLWhiivF6CDFzrABZHT4jJrflyylDWTi32o30rF92HW9msfuKpjzrHtFKYGa9w0kNVv5HABQjCB3OEav4PhQ==",_location:"/bitcore-lib",_phantomChildren:{"bn.js":"4.11.8",brorand:"1.1.0","hash.js":"1.1.3","hmac-drbg":"1.0.1",inherits:"2.0.1","minimalistic-assert":"1.0.0","minimalistic-crypto-utils":"1.0.1"},_requested:{type:"range",registry:!0,raw:"bitcore-lib@^0.15.0",name:"bitcore-lib",escapedName:"bitcore-lib",rawSpec:"^0.15.0",saveSpec:null,fetchSpec:"^0.15.0"},_requiredBy:["/bitcore-mnemonic"],_resolved:"https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-0.15.0.tgz",_shasum:"f924be13869f2aab7e04aeec5642ad3359b6cec2",_spec:"bitcore-lib@^0.15.0",_where:"/home/chris/dev/eth-lightwallet/node_modules/bitcore-mnemonic",author:{name:"BitPay",email:"dev@bitpay.com"},browser:{request:"browser-request"},bugs:{url:"https://github.com/bitpay/bitcore-lib/issues"},bundleDependencies:!1,dependencies:{"bn.js":"=4.11.8",bs58:"=4.0.1","buffer-compare":"=1.1.1",elliptic:"=6.4.0",inherits:"=2.0.1",lodash:"=4.17.4"},deprecated:!1,description:"A pure and powerful JavaScript Bitcoin library.",devDependencies:{"bitcore-build":"git+https://github.com/bitpay/bitcore-build.git#d4e8b2b2f1e2c065c3a807dcb6a6250f61d67ab3",brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0"},homepage:"https://github.com/bitpay/bitcore-lib#readme",keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],license:"MIT",main:"index.js",name:"bitcore-lib",repository:{type:"git",url:"git+https://github.com/bitpay/bitcore-lib.git"},scripts:{build:"gulp",coverage:"gulp coverage",lint:"gulp lint",test:"gulp test"},version:"0.15.0"}},{}],88:[function(require,module,exports){"use strict";module.exports=require("./lib/mnemonic")},{"./lib/mnemonic":90}],89:[function(require,module,exports){"use strict";var spec={name:"Mnemonic",message:"Internal Error on bitcore-mnemonic module {0}",errors:[{name:"InvalidEntropy",message:"Entropy length must be an even multiple of 11 bits: {0}"},{name:"UnknownWordlist",message:"Could not detect the used word list: {0}"},{name:"InvalidMnemonic",message:"Mnemonic string is invalid: {0}"}]};module.exports=require("bitcore-lib").errors.extend(spec)},{ +"bitcore-lib":26}],90:[function(require,module,exports){(function(Buffer){"use strict";var bitcore=require("bitcore-lib"),BN=bitcore.crypto.BN,unorm=require("unorm"),_=bitcore.deps._,pbkdf2=require("./pbkdf2"),errors=require("./errors"),Hash=bitcore.crypto.Hash,Random=bitcore.crypto.Random,$=bitcore.util.preconditions,Mnemonic=function Mnemonic(data,wordlist){if(!(this instanceof Mnemonic))return new Mnemonic(data,wordlist);_.isArray(data)&&(wordlist=data,data=null);var ent,phrase,seed;if(Buffer.isBuffer(data))seed=data;else if(_.isString(data))phrase=unorm.nfkd(data);else if(_.isNumber(data))ent=data;else if(data)throw new bitcore.errors.InvalidArgument("data","Must be a Buffer, a string or an integer");if(ent=ent||128,wordlist=wordlist||Mnemonic._getDictionary(phrase),phrase&&!wordlist)throw new errors.UnknownWordlist(phrase);if(wordlist=wordlist||Mnemonic.Words.ENGLISH,seed&&(phrase=Mnemonic._entropy2mnemonic(seed,wordlist)),phrase&&!Mnemonic.isValid(phrase,wordlist))throw new errors.InvalidMnemonic(phrase);if(ent%32!=0||ent<128)throw new bitcore.errors.InvalidArgument("ENT","Values must be ENT > 128 and ENT % 32 == 0");phrase=phrase||Mnemonic._mnemonic(ent,wordlist),Object.defineProperty(this,"wordlist",{configurable:!1,value:wordlist}),Object.defineProperty(this,"phrase",{configurable:!1,value:phrase})};Mnemonic.Words=require("./words"),Mnemonic.isValid=function(mnemonic,wordlist){if(mnemonic=unorm.nfkd(mnemonic),!(wordlist=wordlist||Mnemonic._getDictionary(mnemonic)))return!1;for(var words=mnemonic.split(" "),bin="",i=0;i"},Mnemonic._mnemonic=function(ENT,wordlist){var buf=Random.getRandomBuffer(ENT/8);return Mnemonic._entropy2mnemonic(buf,wordlist)},Mnemonic._entropy2mnemonic=function(entropy,wordlist){for(var bin="",i=0;i64*(Math.pow(2,32)-1))throw Error("Requested key length too long");if("string"!=typeof key&&!Buffer.isBuffer(key))throw new TypeError("key must a string or Buffer");if("string"!=typeof salt&&!Buffer.isBuffer(salt))throw new TypeError("salt must a string or Buffer");"string"==typeof key&&(key=new Buffer(key)),"string"==typeof salt&&(salt=new Buffer(salt));var DK=new Buffer(dkLen),U=new Buffer(64),T=new Buffer(64),block1=new Buffer(salt.length+4),l=Math.ceil(dkLen/64),r=dkLen-64*(l-1);salt.copy(block1,0,0,salt.length);for(var i=1;i<=l;i++){block1[salt.length+0]=i>>24&255,block1[salt.length+1]=i>>16&255,block1[salt.length+2]=i>>8&255,block1[salt.length+3]=i>>0&255,U=crypto.createHmac("sha512",key).update(block1).digest(),U.copy(T,0,0,64);for(var j=1;j=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:15&c}return r}function parseBase(str,start,end,mul){for(var r=0,len=Math.min(str.length,end),i=start;i=49?c-49+10:c>=17?c-17+10:c}return r}function toBitArray(num){for(var w=new Array(num.bitLength()),bit=0;bit>>wbit}return w}function smallMulTo(self,num,out){out.negative=num.negative^self.negative;var len=self.length+num.length|0;out.length=len,len=len-1|0;var a=0|self.words[0],b=0|num.words[0],r=a*b,lo=67108863&r,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k>>26,rword=67108863&carry,maxJ=Math.min(k,num.length-1),j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j|0;a=0|self.words[i],b=0|num.words[j],r=a*b+rword,ncarry+=r/67108864|0,rword=67108863&r}out.words[k]=0|rword,carry=0|ncarry}return 0!==carry?out.words[k]=0|carry:out.length--,out.strip()}function bigMulTo(self,num,out){out.negative=num.negative^self.negative,out.length=self.length+num.length;for(var carry=0,hncarry=0,k=0;k>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}return 0!==carry?out.words[k]=carry:out.length--,out.strip()}function jumboMulTo(self,num,out){return(new FFTM).mulp(self,num,out)}function FFTM(x,y){this.x=x,this.y=y}function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(m){if("string"==typeof m){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}function Mont(m){Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}"object"===(void 0===module?"undefined":_typeof(module))?module.exports=BN:exports.BN=BN,BN.BN=BN,BN.wordSize=26;var Buffer;try{Buffer=require("buffer").Buffer}catch(e){}BN.isBN=function(num){return num instanceof BN||null!==num&&"object"===(void 0===num?"undefined":_typeof(num))&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){return left.cmp(right)>0?left:right},BN.min=function(left,right){return left.cmp(right)<0?left:right},BN.prototype._init=function(number,base,endian){if("number"==typeof number)return this._initNumber(number,base,endian);if("object"===(void 0===number?"undefined":_typeof(number)))return this._initArray(number,base,endian);"hex"===base&&(base=16),assert(base===(0|base)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;"-"===number[0]&&start++,16===base?this._parseHex(number,start):this._parseBase(number,base,start),"-"===number[0]&&(this.negative=1),this.strip(),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initNumber=function(number,base,endian){number<0&&(this.negative=1,number=-number),number<67108864?(this.words=[67108863&number],this.length=1):number<4503599627370496?(this.words=[67108863&number,number/67108864&67108863],this.length=2):(assert(number<9007199254740992),this.words=[67108863&number,number/67108864&67108863,1],this.length=3),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert("number"==typeof number.length),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)w=number[i]|number[i-1]<<8|number[i-2]<<16,this.words[j]|=w<>>26-off&67108863,(off+=24)>=26&&(off-=26,j++);else if("le"===endian)for(i=0,j=0;i>>26-off&67108863,(off+=24)>=26&&(off-=26,j++);return this.strip()},BN.prototype._parseHex=function(number,start){this.length=Math.ceil((number.length-start)/6),this.words=new Array(this.length);for(var i=0;i=start;i-=6)w=parseHex(number,i,i+6),this.words[j]|=w<>>26-off&4194303,(off+=24)>=26&&(off-=26,j++);i+6!==start&&(w=parseHex(number,start,i+6),this.words[j]|=w<>>26-off&4194303),this.strip()},BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;for(var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0,i=start;i1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function(){return(this.red?""};var zeros=["","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"],groupSizes=[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],groupBases=[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];BN.prototype.toString=function(base,padding){base=base||10,padding=0|padding||1;var out;if(16===base||"hex"===base){out="";for(var off=0,carry=0,i=0;i>>24-off&16777215,out=0!==carry||i!==this.length-1?zeros[6-word.length]+word+out:word+out,off+=2,off>=26&&(off-=26,i--)}for(0!==carry&&(out=carry.toString(16)+out);out.length%padding!=0;)out="0"+out;return 0!==this.negative&&(out="-"+out),out}if(base===(0|base)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();for(c.negative=0;!c.isZero();){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase),out=c.isZero()?r+out:zeros[groupSize-r.length]+r+out}for(this.isZero()&&(out="0"+out);out.length%padding!=0;)out="0"+out;return 0!==this.negative&&(out="-"+out),out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];return 2===this.length?ret+=67108864*this.words[1]:3===this.length&&1===this.words[2]?ret+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(void 0!==Buffer),this.toArrayLike(Buffer,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength=this.byteLength(),reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0"),this.strip();var b,i,littleEndian="le"===endian,res=new ArrayType(reqLength),q=this.clone();if(littleEndian){for(i=0;!q.isZero();i++)b=q.andln(255),q.iushrn(8),res[i]=b;for(;i=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function(w){if(0===w)return 26;var t=w,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return 26*(this.length-1)+hi},BN.prototype.zeroBits=function(){if(this.isZero())return 0;for(var r=0,i=0;inum.length?this.clone().ior(num):num.clone().ior(this)},BN.prototype.uor=function(num){return this.length>num.length?this.clone().iuor(num):num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;b=this.length>num.length?num:this;for(var i=0;inum.length?this.clone().iand(num):num.clone().iand(this)},BN.prototype.uand=function(num){return this.length>num.length?this.clone().iuand(num):num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;this.length>num.length?(a=this,b=num):(a=num,b=this);for(var i=0;inum.length?this.clone().ixor(num):num.clone().ixor(this)},BN.prototype.uxor=function(num){return this.length>num.length?this.clone().iuxor(num):num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert("number"==typeof width&&width>=0);var bytesNeeded=0|Math.ceil(width/26),bitsLeft=width%26;this._expand(bytesNeeded),bitsLeft>0&&bytesNeeded--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-bitsLeft),this.strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert("number"==typeof bit&&bit>=0);var off=bit/26|0,wbit=bit%26;return this._expand(off+1),this.words[off]=val?this.words[off]|1<num.length?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>>26;for(;0!==carry&&i>>26;if(this.length=a.length,0!==carry)this.words[this.length]=carry,this.length++;else if(a!==this)for(;inum.length?this.clone().iadd(num):num.clone().iadd(this)},BN.prototype.isub=function(num){if(0!==num.negative){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(0===cmp)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;cmp>0?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>26,this.words[i]=67108863&r;for(;0!==carry&&i>26,this.words[i]=67108863&r;if(0===carry&&i>>13,a1=0|a[1],al1=8191&a1,ah1=a1>>>13,a2=0|a[2],al2=8191&a2,ah2=a2>>>13,a3=0|a[3],al3=8191&a3,ah3=a3>>>13,a4=0|a[4],al4=8191&a4,ah4=a4>>>13,a5=0|a[5],al5=8191&a5,ah5=a5>>>13,a6=0|a[6],al6=8191&a6,ah6=a6>>>13,a7=0|a[7],al7=8191&a7,ah7=a7>>>13,a8=0|a[8],al8=8191&a8,ah8=a8>>>13,a9=0|a[9],al9=8191&a9,ah9=a9>>>13,b0=0|b[0],bl0=8191&b0,bh0=b0>>>13,b1=0|b[1],bl1=8191&b1,bh1=b1>>>13,b2=0|b[2],bl2=8191&b2,bh2=b2>>>13,b3=0|b[3],bl3=8191&b3,bh3=b3>>>13,b4=0|b[4],bl4=8191&b4,bh4=b4>>>13,b5=0|b[5],bl5=8191&b5,bh5=b5>>>13,b6=0|b[6],bl6=8191&b6,bh6=b6>>>13,b7=0|b[7],bl7=8191&b7,bh7=b7>>>13,b8=0|b[8],bl8=8191&b8,bh8=b8>>>13,b9=0|b[9],bl9=8191&b9,bh9=b9>>>13;out.negative=self.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((8191&mid)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((8191&mid)<<13)|0;return c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,0!==c&&(o[19]=c,out.length++),out};Math.imul||(comb10MulTo=smallMulTo),BN.prototype.mulTo=function(num,out){var len=this.length+num.length;return 10===this.length&&10===num.length?comb10MulTo(this,num,out):len<63?smallMulTo(this,num,out):len<1024?bigMulTo(this,num,out):jumboMulTo(this,num,out)},FFTM.prototype.makeRBT=function(N){for(var t=new Array(N),l=BN.prototype._countBits(N)-1,i=0;i>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i=0;i>>=1)i++;return 1<>>=13,rws[2*i+1]=8191&carry,carry>>>=13;for(i=2*len;i>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i]=67108863&lo}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(0===w.length)return new BN(1);for(var res=this,i=0;i=0);var i,r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r;if(0!==r){var carry=0;for(i=0;i>>26-r}carry&&(this.words[i]=carry,this.length++)}if(0!==s){for(i=this.length-1;i>=0;i--)this.words[i+s]=this.words[i];for(i=0;i=0);var h;h=hint?(hint-hint%26)/26:0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<s)for(this.length-=s,i=0;i=0&&(0!==carry||i>=h);i--){var word=0|this.words[i];this.words[i]=carry<<26-r|word>>>r,carry=word&mask}return maskedWords&&0!==carry&&(maskedWords.words[maskedWords.length++]=carry),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(0===this.negative),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert("number"==typeof bit&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<=0);var r=bits%26,s=(bits-r)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=s)return this;if(0!==r&&s++,this.length=Math.min(s,this.length),0!==r){var mask=67108863^67108863>>>r<=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},BN.prototype.isubn=function(num){if(assert("number"==typeof num),assert(num<67108864),num<0)return this.iaddn(-num);if(0!==this.negative)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(right/67108864|0),this.words[i+shift]=67108863&w}for(;i>26,this.words[i+shift]=67108863&w;if(0===carry)return this.strip();for(assert(-1===carry),carry=0,i=0;i>26,this.words[i]=67108863&w;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=0|b.words[b.length-1];0!==(shift=26-this._countBits(bhi))&&(b=b.ushln(shift),a.iushln(shift),bhi=0|b.words[b.length-1]);var q,m=a.length-b.length;if("mod"!==mode){q=new BN(null),q.length=m+1,q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=67108864*(0|a.words[b.length+j])+(0|a.words[b.length+j-1]);for(qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);0!==a.negative;)qj--,a.negative=0,a._ishlnsubmul(b,1,j),a.isZero()||(a.negative^=1);q&&(q.words[j]=qj)}return q&&q.strip(),a.strip(),"div"!==mode&&0!==shift&&a.iushrn(shift),{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;return 0!==this.negative&&0===num.negative?(res=this.neg().divmod(num,mode),"mod"!==mode&&(div=res.div.neg()),"div"!==mode&&(mod=res.mod.neg(),positive&&0!==mod.negative&&mod.iadd(num)),{div:div,mod:mod}):0===this.negative&&0!==num.negative?(res=this.divmod(num.neg(),mode),"mod"!==mode&&(div=res.div.neg()),{div:div,mod:res.mod}):0!=(this.negative&num.negative)?(res=this.neg().divmod(num.neg(),mode),"div"!==mode&&(mod=res.mod.neg(),positive&&0!==mod.negative&&mod.isub(num)),{div:res.div,mod:mod}):num.length>this.length||this.cmp(num)<0?{div:new BN(0),mod:this}:1===num.length?"div"===mode?{div:this.divn(num.words[0]),mod:null}:"mod"===mode?{div:null,mod:new BN(this.modn(num.words[0]))}:{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}:this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=0!==dm.div.negative?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);return cmp<0||1===r2&&0===cmp?dm.div:0!==dm.div.negative?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);for(var p=(1<<26)%num,acc=0,i=this.length-1;i>=0;i--)acc=(p*acc+(0|this.words[i]))%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);for(var carry=0,i=this.length-1;i>=0;i--){var w=(0|this.words[i])+67108864*carry;this.words[i]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(0===p.negative),assert(!p.isZero());var x=this,y=p.clone();x=0!==x.negative?x.umod(p):x.clone();for(var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;x.isEven()&&y.isEven();)x.iushrn(1),y.iushrn(1),++g;for(var yp=y.clone(),xp=x.clone();!x.isZero();){for(var i=0,im=1;0==(x.words[0]&im)&&i<26;++i,im<<=1);if(i>0)for(x.iushrn(i);i-- >0;)(A.isOdd()||B.isOdd())&&(A.iadd(yp),B.isub(xp)),A.iushrn(1),B.iushrn(1);for(var j=0,jm=1;0==(y.words[0]&jm)&&j<26;++j,jm<<=1);if(j>0)for(y.iushrn(j);j-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(yp),D.isub(xp)),C.iushrn(1),D.iushrn(1);x.cmp(y)>=0?(x.isub(y),A.isub(C),B.isub(D)):(y.isub(x),C.isub(A),D.isub(B))}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(0===p.negative),assert(!p.isZero());var a=this,b=p.clone();a=0!==a.negative?a.umod(p):a.clone();for(var x1=new BN(1),x2=new BN(0),delta=b.clone();a.cmpn(1)>0&&b.cmpn(1)>0;){for(var i=0,im=1;0==(a.words[0]&im)&&i<26;++i,im<<=1);if(i>0)for(a.iushrn(i);i-- >0;)x1.isOdd()&&x1.iadd(delta),x1.iushrn(1);for(var j=0,jm=1;0==(b.words[0]&jm)&&j<26;++j,jm<<=1);if(j>0)for(b.iushrn(j);j-- >0;)x2.isOdd()&&x2.iadd(delta),x2.iushrn(1);a.cmp(b)>=0?(a.isub(b),x1.isub(x2)):(b.isub(a),x2.isub(x1))}var res;return res=0===a.cmpn(1)?x1:x2,res.cmpn(0)<0&&res.iadd(p),res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;b.isEven();)b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(0===r||0===b.cmpn(1))break;a.isub(b)}return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return 0==(1&this.words[0])},BN.prototype.isOdd=function(){return 1==(1&this.words[0])},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert("number"==typeof bit);var r=bit%26,s=(bit-r)/26,q=1<>>26,w&=67108863,this.words[i]=w}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function(num){var negative=num<0;if(0!==this.negative&&!negative)return-1;if(0===this.negative&&negative)return 1;this.strip();var res;if(this.length>1)res=1;else{negative&&(num=-num),assert(num<=67108863,"Number is too big");var w=0|this.words[0];res=w===num?0:wnum.length)return 1;if(this.length=0;i--){var a=0|this.words[i],b=0|num.words[i];if(a!==b){ab&&(res=1);break}}return res},BN.prototype.gtn=function(num){return 1===this.cmpn(num)},BN.prototype.gt=function(num){return 1===this.cmp(num)},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return-1===this.cmpn(num)},BN.prototype.lt=function(num){return-1===this.cmp(num)},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return 0===this.cmpn(num)},BN.prototype.eq=function(num){return 0===this.cmp(num)},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=new Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var rlen,r=num;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen0?r.isub(this.p):r.strip(),r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function(input,output){for(var outLen=Math.min(input.length,9),i=0;i>>22,prev=next}prev>>>=22,input.words[i-10]=prev,0===prev&&input.length>10?input.length-=10:input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;for(var lo=0,i=0;i>>=26,num.words[i]=lo,carry=hi}return 0!==carry&&(num.words[num.length++]=carry),num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if("k256"===name)prime=new K256;else if("p224"===name)prime=new P224;else if("p192"===name)prime=new P192;else{if("p25519"!==name)throw new Error("Unknown prime "+name);prime=new P25519}return primes[name]=prime,prime},Red.prototype._verify1=function(a){assert(0===a.negative,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert(0==(a.negative|b.negative),"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);return res.cmp(this.m)>=0&&res.isub(this.m),res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);return res.cmp(this.m)>=0&&res.isub(this.m),res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);return res.cmpn(0)<0&&res.iadd(this.m),res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);return res.cmpn(0)<0&&res.iadd(this.m),res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2==1),3===mod3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}for(var q=this.m.subn(1),s=0;!q.isZero()&&0===q.andln(1);)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();for(z=new BN(2*z*z).toRed(this);0!==this.pow(z,lpow).cmp(nOne);)z.redIAdd(nOne);for(var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;0!==t.cmp(one);){for(var tmp=t,i=0;0!==tmp.cmp(one);i++)tmp=tmp.redSqr();assert(i=0;i--){for(var word=num.words[i],j=start-1;j>=0;j--){var bit=word>>j&1;res!==wnd[0]&&(res=this.sqr(res)),0!==bit||0!==current?(current<<=1,current|=bit,(4===++currentLen||0===i&&0===j)&&(res=this.mul(res,wnd[current]),currentLen=0,current=0)):currentLen=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)},inherits(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.invm=function(a){return this.imod(a._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===module||module,void 0)},{buffer:101}],100:[function(require,module,exports){"use strict";function Rand(rand){this.rand=rand}var r,_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};if(module.exports=function(len){return r||(r=new Rand(null)),r.generate(len)},module.exports.Rand=Rand,Rand.prototype.generate=function(len){return this._rand(len)},Rand.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var res=new Uint8Array(n),i=0;i>>24]^SUB_MIX1[s1>>>16&255]^SUB_MIX2[s2>>>8&255]^SUB_MIX3[255&s3]^keySchedule[ksRow++],t1=SUB_MIX0[s1>>>24]^SUB_MIX1[s2>>>16&255]^SUB_MIX2[s3>>>8&255]^SUB_MIX3[255&s0]^keySchedule[ksRow++],t2=SUB_MIX0[s2>>>24]^SUB_MIX1[s3>>>16&255]^SUB_MIX2[s0>>>8&255]^SUB_MIX3[255&s1]^keySchedule[ksRow++],t3=SUB_MIX0[s3>>>24]^SUB_MIX1[s0>>>16&255]^SUB_MIX2[s1>>>8&255]^SUB_MIX3[255&s2]^keySchedule[ksRow++],s0=t0,s1=t1,s2=t2,s3=t3;return t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&255]<<16|SBOX[s2>>>8&255]<<8|SBOX[255&s3])^keySchedule[ksRow++],t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&255]<<16|SBOX[s3>>>8&255]<<8|SBOX[255&s0])^keySchedule[ksRow++],t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&255]<<16|SBOX[s0>>>8&255]<<8|SBOX[255&s1])^keySchedule[ksRow++],t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&255]<<16|SBOX[s1>>>8&255]<<8|SBOX[255&s2])^keySchedule[ksRow++],t0>>>=0,t1>>>=0,t2>>>=0,t3>>>=0,[t0,t1,t2,t3]}function AES(key){this._key=asUInt32Array(key),this._reset()}var Buffer=require("safe-buffer").Buffer,RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var d=new Array(256),j=0;j<256;j++)d[j]=j<128?j<<1:j<<1^283;for(var SBOX=[],INV_SBOX=[],SUB_MIX=[[],[],[],[]],INV_SUB_MIX=[[],[],[],[]],x=0,xi=0,i=0;i<256;++i){var sx=xi^xi<<1^xi<<2^xi<<3^xi<<4;sx=sx>>>8^255&sx^99,SBOX[x]=sx,INV_SBOX[sx]=x;var x2=d[x],x4=d[x2],x8=d[x4],t=257*d[sx]^16843008*sx;SUB_MIX[0][x]=t<<24|t>>>8,SUB_MIX[1][x]=t<<16|t>>>16,SUB_MIX[2][x]=t<<8|t>>>24,SUB_MIX[3][x]=t,t=16843009*x8^65537*x4^257*x2^16843008*x,INV_SUB_MIX[0][sx]=t<<24|t>>>8,INV_SUB_MIX[1][sx]=t<<16|t>>>16,INV_SUB_MIX[2][sx]=t<<8|t>>>24,INV_SUB_MIX[3][sx]=t,0===x?x=xi=1:(x=x2^d[d[d[x8^x2]]],xi^=d[d[xi]])}return{SBOX:SBOX,INV_SBOX:INV_SBOX,SUB_MIX:SUB_MIX,INV_SUB_MIX:INV_SUB_MIX}}();AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var keyWords=this._key,keySize=keyWords.length,nRounds=keySize+6,ksRows=4*(nRounds+1),keySchedule=[],k=0;k>>24,t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&255]<<16|G.SBOX[t>>>8&255]<<8|G.SBOX[255&t],t^=RCON[k/keySize|0]<<24):keySize>6&&k%keySize==4&&(t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&255]<<16|G.SBOX[t>>>8&255]<<8|G.SBOX[255&t]),keySchedule[k]=keySchedule[k-keySize]^t}for(var invKeySchedule=[],ik=0;ik>>24]]^G.INV_SUB_MIX[1][G.SBOX[tt>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[tt>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&tt]]}this._nRounds=nRounds,this._keySchedule=keySchedule,this._invKeySchedule=invKeySchedule},AES.prototype.encryptBlockRaw=function(M){return M=asUInt32Array(M),cryptBlock(M,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(M){var out=this.encryptBlockRaw(M),buf=Buffer.allocUnsafe(16);return buf.writeUInt32BE(out[0],0),buf.writeUInt32BE(out[1],4),buf.writeUInt32BE(out[2],8),buf.writeUInt32BE(out[3],12),buf},AES.prototype.decryptBlock=function(M){M=asUInt32Array(M);var m1=M[1];M[1]=M[3],M[3]=m1;var out=cryptBlock(M,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),buf=Buffer.allocUnsafe(16);return buf.writeUInt32BE(out[0],0),buf.writeUInt32BE(out[3],4),buf.writeUInt32BE(out[2],8),buf.writeUInt32BE(out[1],12),buf},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},module.exports.AES=AES},{"safe-buffer":313}],103:[function(require,module,exports){"use strict";function xorTest(a,b){var out=0;a.length!==b.length&&out++;for(var len=Math.min(a.length,b.length),i=0;i16)return out=this.cache.slice(0,16),this.cache=this.cache.slice(16),out}else if(this.cache.length>=16)return out=this.cache.slice(0,16),this.cache=this.cache.slice(16),out;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},exports.createDecipher=createDecipher,exports.createDecipheriv=createDecipheriv},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":151,evp_bytestokey:240,inherits:258,"safe-buffer":313}],106:[function(require,module,exports){"use strict";function Cipher(mode,key,iv){Transform.call(this),this._cache=new Splitter,this._cipher=new aes.AES(key),this._prev=Buffer.from(iv),this._mode=mode,this._autopadding=!0}function Splitter(){this.cache=Buffer.allocUnsafe(0)}function createCipheriv(suite,password,iv){var config=MODES[suite.toLowerCase()];if(!config)throw new TypeError("invalid suite type");if("string"==typeof password&&(password=Buffer.from(password)),password.length!==config.key/8)throw new TypeError("invalid key length "+password.length);if("string"==typeof iv&&(iv=Buffer.from(iv)),"GCM"!==config.mode&&iv.length!==config.iv)throw new TypeError("invalid iv length "+iv.length);return"stream"===config.type?new StreamCipher(config.module,password,iv):"auth"===config.type?new AuthCipher(config.module,password,iv):new Cipher(config.module,password,iv)}function createCipher(suite,password){var config=MODES[suite.toLowerCase()];if(!config)throw new TypeError("invalid suite type");var keys=ebtk(password,!1,config.key,config.iv);return createCipheriv(suite,keys.key,keys.iv)}var MODES=require("./modes"),AuthCipher=require("./authCipher"),Buffer=require("safe-buffer").Buffer,StreamCipher=require("./streamCipher"),Transform=require("cipher-base"),aes=require("./aes"),ebtk=require("evp_bytestokey");require("inherits")(Cipher,Transform),Cipher.prototype._update=function(data){this._cache.add(data);for(var chunk,thing,out=[];chunk=this._cache.get();)thing=this._mode.encrypt(this,chunk),out.push(thing);return Buffer.concat(out)};var PADDING=Buffer.alloc(16,16);Cipher.prototype._final=function(){var chunk=this._cache.flush();if(this._autopadding)return chunk=this._mode.encrypt(this,chunk),this._cipher.scrub(),chunk;if(!chunk.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(setTo){return this._autopadding=!!setTo,this},Splitter.prototype.add=function(data){this.cache=Buffer.concat([this.cache,data])},Splitter.prototype.get=function(){if(this.cache.length>15){var out=this.cache.slice(0,16);return this.cache=this.cache.slice(16),out}return null},Splitter.prototype.flush=function(){for(var len=16-this.cache.length,padBuff=Buffer.allocUnsafe(len),i=-1;++i>>0,0),buf.writeUInt32BE(out[1]>>>0,4),buf.writeUInt32BE(out[2]>>>0,8),buf.writeUInt32BE(out[3]>>>0,12),buf}function GHASH(key){this.h=key,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}var Buffer=require("safe-buffer").Buffer,ZEROES=Buffer.alloc(16,0);GHASH.prototype.ghash=function(block){for(var i=-1;++i0;j--)Vi[j]=Vi[j]>>>1|(1&Vi[j-1])<<31;Vi[0]=Vi[0]>>>1,lsbVi&&(Vi[0]=Vi[0]^225<<24)}this.state=fromArray(Zi)},GHASH.prototype.update=function(buf){this.cache=Buffer.concat([this.cache,buf]);for(var chunk;this.cache.length>=16;)chunk=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(chunk)},GHASH.prototype.final=function(abl,bl){return this.cache.length&&this.ghash(Buffer.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,abl,0,bl])),this.state},module.exports=GHASH},{"safe-buffer":313}],108:[function(require,module,exports){"use strict";function incr32(iv){for(var item,len=iv.length;len--;){if(255!==(item=iv.readUInt8(len))){item++,iv.writeUInt8(item,len);break}iv.writeUInt8(0,len)}}module.exports=incr32},{}],109:[function(require,module,exports){"use strict";var xor=require("buffer-xor");exports.encrypt=function(self,block){var data=xor(block,self._prev);return self._prev=self._cipher.encryptBlock(data),self._prev},exports.decrypt=function(self,block){var pad=self._prev;self._prev=block;var out=self._cipher.decryptBlock(block);return xor(out,pad)}},{"buffer-xor":149}],110:[function(require,module,exports){"use strict";function encryptStart(self,data,decrypt){var len=data.length,out=xor(data,self._cache);return self._cache=self._cache.slice(len),self._prev=Buffer.concat([self._prev,decrypt?data:out]),out}var Buffer=require("safe-buffer").Buffer,xor=require("buffer-xor");exports.encrypt=function(self,data,decrypt){for(var len,out=Buffer.allocUnsafe(0);data.length;){if(0===self._cache.length&&(self._cache=self._cipher.encryptBlock(self._prev),self._prev=Buffer.allocUnsafe(0)),!(self._cache.length<=data.length)){out=Buffer.concat([out,encryptStart(self,data,decrypt)]);break}len=self._cache.length,out=Buffer.concat([out,encryptStart(self,data.slice(0,len),decrypt)]),data=data.slice(len)}return out}},{"buffer-xor":149,"safe-buffer":313}],111:[function(require,module,exports){"use strict";function encryptByte(self,byteParam,decrypt){for(var pad,bit,value,i=-1,out=0;++i<8;)pad=self._cipher.encryptBlock(self._prev),bit=byteParam&1<<7-i?128:0,value=pad[0]^bit,out+=(128&value)>>i%8,self._prev=shiftIn(self._prev,decrypt?bit:value);return out}function shiftIn(buffer,value){var len=buffer.length,i=-1,out=Buffer.allocUnsafe(buffer.length);for(buffer=Buffer.concat([buffer,Buffer.from([value])]);++i>7;return out}var Buffer=require("safe-buffer").Buffer;exports.encrypt=function(self,chunk,decrypt){for(var len=chunk.length,out=Buffer.allocUnsafe(len),i=-1;++i=0||!r.umod(priv.prime1)||!r.umod(priv.prime2);)r=new bn(randomBytes(len));return r}var bn=require("bn.js"),randomBytes=require("randombytes");module.exports=crt,crt.getr=getr}).call(this,require("buffer").Buffer)},{"bn.js":99,buffer:150,randombytes:296}], -123:[function(require,module,exports){"use strict";module.exports=require("./browser/algorithms.json")},{"./browser/algorithms.json":124}],124:[function(require,module,exports){module.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],125:[function(require,module,exports){module.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],126:[function(require,module,exports){(function(Buffer){"use strict";function Sign(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error("Unknown message digest");this._hashType=data.hash,this._hash=createHash(data.hash),this._tag=data.id,this._signType=data.sign}function Verify(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error("Unknown message digest");this._hash=createHash(data.hash),this._tag=data.id,this._signType=data.sign}function createSign(algorithm){return new Sign(algorithm)}function createVerify(algorithm){return new Verify(algorithm)}var createHash=require("create-hash"),stream=require("stream"),inherits=require("inherits"),sign=require("./sign"),verify=require("./verify"),algorithms=require("./algorithms.json");Object.keys(algorithms).forEach(function(key){algorithms[key].id=new Buffer(algorithms[key].id,"hex"),algorithms[key.toLowerCase()]=algorithms[key]}),inherits(Sign,stream.Writable),Sign.prototype._write=function(data,_,done){this._hash.update(data),done()},Sign.prototype.update=function(data,enc){return"string"==typeof data&&(data=new Buffer(data,enc)),this._hash.update(data),this},Sign.prototype.sign=function(key,enc){this.end();var hash=this._hash.digest(),sig=sign(hash,key,this._hashType,this._signType,this._tag);return enc?sig.toString(enc):sig},inherits(Verify,stream.Writable),Verify.prototype._write=function(data,_,done){this._hash.update(data),done()},Verify.prototype.update=function(data,enc){return"string"==typeof data&&(data=new Buffer(data,enc)),this._hash.update(data),this},Verify.prototype.verify=function(key,sig,enc){"string"==typeof sig&&(sig=new Buffer(sig,enc)),this.end();var hash=this._hash.digest();return verify(sig,hash,key,this._signType,this._tag)},module.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}}).call(this,require("buffer").Buffer)},{"./algorithms.json":124,"./sign":127,"./verify":128,buffer:150,"create-hash":170,inherits:258,stream:345}],127:[function(require,module,exports){(function(Buffer){"use strict";function sign(hash,key,hashType,signType,tag){var priv=parseKeys(key);if(priv.curve){if("ecdsa"!==signType&&"ecdsa/rsa"!==signType)throw new Error("wrong private key type");return ecSign(hash,priv)}if("dsa"===priv.type){if("dsa"!==signType)throw new Error("wrong private key type");return dsaSign(hash,priv,hashType)}if("rsa"!==signType&&"ecdsa/rsa"!==signType)throw new Error("wrong private key type");hash=Buffer.concat([tag,hash]);for(var len=priv.modulus.byteLength(),pad=[0,1];hash.length+pad.length+10&&bits.ishrn(shift),bits}function bits2octets(bits,q){bits=bits2int(bits,q),bits=bits.mod(q);var out=new Buffer(bits.toArray());if(out.length=q)throw new Error("invalid sig")}var BN=require("bn.js"),EC=require("elliptic").ec,parseKeys=require("parse-asn1"),curves=require("./curves.json");module.exports=verify}).call(this,require("buffer").Buffer)},{"./curves.json":125,"bn.js":99,buffer:150,elliptic:129,"parse-asn1":279}],129:[function(require,module,exports){arguments[4][71][0].apply(exports,arguments)},{"../package.json":144,"./elliptic/curve":132,"./elliptic/curves":135,"./elliptic/ec":136,"./elliptic/eddsa":139,"./elliptic/utils":143,brorand:100,dup:71}],130:[function(require,module,exports){arguments[4][72][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:72}],131:[function(require,module,exports){arguments[4][73][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:73,inherits:258}],132:[function(require,module,exports){arguments[4][74][0].apply(exports,arguments)},{"./base":130,"./edwards":131,"./mont":133,"./short":134,dup:74}],133:[function(require,module,exports){arguments[4][75][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:75,inherits:258}],134:[function(require,module,exports){arguments[4][76][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:76,inherits:258}],135:[function(require,module,exports){arguments[4][77][0].apply(exports,arguments)},{"../elliptic":129,"./precomputed/secp256k1":142,dup:77,"hash.js":242}],136:[function(require,module,exports){arguments[4][78][0].apply(exports,arguments)},{"../../elliptic":129,"./key":137,"./signature":138,"bn.js":99,dup:78,"hmac-drbg":255}],137:[function(require,module,exports){arguments[4][79][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:79}],138:[function(require,module,exports){arguments[4][80][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:80}],139:[function(require,module,exports){arguments[4][81][0].apply(exports,arguments)},{"../../elliptic":129,"./key":140,"./signature":141,dup:81,"hash.js":242}],140:[function(require,module,exports){arguments[4][82][0].apply(exports,arguments)},{"../../elliptic":129,dup:82}],141:[function(require,module,exports){arguments[4][83][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:83}],142:[function(require,module,exports){arguments[4][84][0].apply(exports,arguments)},{dup:84}],143:[function(require,module,exports){arguments[4][85][0].apply(exports,arguments)},{"bn.js":99,dup:85,"minimalistic-assert":273,"minimalistic-crypto-utils":274}],144:[function(require,module,exports){module.exports={_args:[["elliptic@6.4.0","/home/chris/dev/eth-lightwallet"]],_development:!0,_from:"elliptic@6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/browserify-sign/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.0",saveSpec:null,fetchSpec:"6.4.0"},_requiredBy:["/browserify-sign"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_spec:"6.4.0",_where:"/home/chris/dev/eth-lightwallet",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],145:[function(require,module,exports){"use strict";function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;if(buffer.copy(this.charBuffer,this.charReceived,0,available),this.charReceived+=available,this.charReceived=55296&&charCode<=56319)){if(this.charReceived=this.charLength=0,0===buffer.length)return charStr;break}this.charLength+=this.surrogateSize,charStr=""}this.detectIncompleteChar(buffer);var end=buffer.length;this.charLength&&(buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end),end-=this.charReceived),charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1,charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;return this.charLength+=size,this.charReceived+=size,this.charBuffer.copy(this.charBuffer,size,0,size),buffer.copy(this.charBuffer,0,0,size),charStr.substring(0,end)}return charStr},StringDecoder.prototype.detectIncompleteChar=function(buffer){for(var i=buffer.length>=3?3:buffer.length;i>0;i--){var c=buffer[buffer.length-i];if(1==i&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i},StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length&&(res=this.write(buffer)),this.charReceived){var cr=this.charReceived,buf=this.charBuffer,enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res}},{buffer:150}],147:[function(require,module,exports){"use strict";var basex=require("base-x");module.exports=basex("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":22}],148:[function(require,module,exports){"use strict";module.exports=function(a,b){if("function"==typeof a.compare)return a.compare(b);if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(length){return+length!=length&&(length=0),Buffer.alloc(+length)}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}var indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;jremaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128==(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){ -if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!=0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isnan(val){return val!==val}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:function(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(arr){return arr.__proto__=Buffer.prototype,arr},Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)},Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;iremaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len)<0&&(start=0):start>len&&(start=len),end<0?(end+=len)<0&&(end=0):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,byteLength|=0,!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0)}var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0);var i;if("number"==typeof val)for(i=start;i>>2),i=0,j=0;i>5]|=128<>>9<<4)]=len;for(var a=1732584193,b=-271733879,c=-1732584194,d=271733878,i=0;i>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}function bit_rol(num,cnt){return num<>>32-cnt}var makeHash=require("./make-hash");module.exports=function(buf){return makeHash(buf,core_md5)}},{"./make-hash":171}],173:[function(require,module,exports){"use strict";function Hmac(alg,key){Base.call(this,"digest"),"string"==typeof key&&(key=Buffer.from(key));var blocksize="sha512"===alg||"sha384"===alg?128:64;if(this._alg=alg,this._key=key,key.length>blocksize){key=("rmd160"===alg?new RIPEMD160:sha(alg)).update(key).digest()}else key.lengthblocksize?key=alg(key):key.length>>8^255&sx^99,SBOX[x]=sx,INV_SBOX[sx]=x;var x2=d[x],x4=d[x2],x8=d[x4],t=257*d[sx]^16843008*sx;SUB_MIX_0[x]=t<<24|t>>>8,SUB_MIX_1[x]=t<<16|t>>>16,SUB_MIX_2[x]=t<<8|t>>>24,SUB_MIX_3[x]=t;var t=16843009*x8^65537*x4^257*x2^16843008*x;INV_SUB_MIX_0[sx]=t<<24|t>>>8,INV_SUB_MIX_1[sx]=t<<16|t>>>16,INV_SUB_MIX_2[sx]=t<<8|t>>>24,INV_SUB_MIX_3[sx]=t,x?(x=x2^d[d[d[x8^x2]]],xi^=d[d[xi]]):x=xi=1}}();var RCON=[0,1,2,4,8,16,32,64,128,27,54],AES=C_algo.AES=BlockCipher.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var key=this._keyPriorReset=this._key,keyWords=key.words,keySize=key.sigBytes/4,nRounds=this._nRounds=keySize+6,ksRows=4*(nRounds+1),keySchedule=this._keySchedule=[],ksRow=0;ksRow6&&ksRow%keySize==4&&(t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t]):(t=t<<8|t>>>24,t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t],t^=RCON[ksRow/keySize|0]<<24),keySchedule[ksRow]=keySchedule[ksRow-keySize]^t}for(var invKeySchedule=this._invKeySchedule=[],invKsRow=0;invKsRow>>24]]^INV_SUB_MIX_1[SBOX[t>>>16&255]]^INV_SUB_MIX_2[SBOX[t>>>8&255]]^INV_SUB_MIX_3[SBOX[255&t]]}}},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX)},decryptBlock:function(M,offset){var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t,this._doCryptBlock(M,offset,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX);var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t},_doCryptBlock:function(M,offset,keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX){for(var nRounds=this._nRounds,s0=M[offset]^keySchedule[0],s1=M[offset+1]^keySchedule[1],s2=M[offset+2]^keySchedule[2],s3=M[offset+3]^keySchedule[3],ksRow=4,round=1;round>>24]^SUB_MIX_1[s1>>>16&255]^SUB_MIX_2[s2>>>8&255]^SUB_MIX_3[255&s3]^keySchedule[ksRow++],t1=SUB_MIX_0[s1>>>24]^SUB_MIX_1[s2>>>16&255]^SUB_MIX_2[s3>>>8&255]^SUB_MIX_3[255&s0]^keySchedule[ksRow++],t2=SUB_MIX_0[s2>>>24]^SUB_MIX_1[s3>>>16&255]^SUB_MIX_2[s0>>>8&255]^SUB_MIX_3[255&s1]^keySchedule[ksRow++],t3=SUB_MIX_0[s3>>>24]^SUB_MIX_1[s0>>>16&255]^SUB_MIX_2[s1>>>8&255]^SUB_MIX_3[255&s2]^keySchedule[ksRow++];s0=t0,s1=t1,s2=t2,s3=t3}var t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&255]<<16|SBOX[s2>>>8&255]<<8|SBOX[255&s3])^keySchedule[ksRow++],t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&255]<<16|SBOX[s3>>>8&255]<<8|SBOX[255&s0])^keySchedule[ksRow++],t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&255]<<16|SBOX[s0>>>8&255]<<8|SBOX[255&s1])^keySchedule[ksRow++],t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&255]<<16|SBOX[s1>>>8&255]<<8|SBOX[255&s2])^keySchedule[ksRow++];M[offset]=t0,M[offset+1]=t1,M[offset+2]=t2,M[offset+3]=t3},keySize:8});C.AES=BlockCipher._createHelper(AES)}(),CryptoJS.AES})},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],177:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){CryptoJS.lib.Cipher||function(undefined){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm,C_enc=C.enc,Base64=(C_enc.Utf8,C_enc.Base64),C_algo=C.algo,EvpKDF=C_algo.EvpKDF,Cipher=C_lib.Cipher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),createEncryptor:function(key,cfg){return this.create(this._ENC_XFORM_MODE,key,cfg)},createDecryptor:function(key,cfg){return this.create(this._DEC_XFORM_MODE,key,cfg)},init:function(xformMode,key,cfg){this.cfg=this.cfg.extend(cfg),this._xformMode=xformMode,this._key=key,this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this),this._doReset()},process:function(dataUpdate){return this._append(dataUpdate),this._process()},finalize:function(dataUpdate){return dataUpdate&&this._append(dataUpdate),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(key){return"string"==typeof key?PasswordBasedCipher:SerializableCipher}return function(cipher){return{encrypt:function(message,key,cfg){return selectCipherStrategy(key).encrypt(cipher,message,key,cfg)},decrypt:function(ciphertext,key,cfg){return selectCipherStrategy(key).decrypt(cipher,ciphertext,key,cfg)}}}}()}),C_mode=(C_lib.StreamCipher=Cipher.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),C.mode={}),BlockCipherMode=C_lib.BlockCipherMode=Base.extend({createEncryptor:function(cipher,iv){return this.Encryptor.create(cipher,iv)},createDecryptor:function(cipher,iv){return this.Decryptor.create(cipher,iv)},init:function(cipher,iv){this._cipher=cipher,this._iv=iv}}),CBC=C_mode.CBC=function(){function xorBlock(words,offset,blockSize){var iv=this._iv;if(iv){var block=iv;this._iv=undefined}else var block=this._prevBlock;for(var i=0;i>>2];data.sigBytes-=nPaddingBytes}},CipherParams=(C_lib.BlockCipher=Cipher.extend({cfg:Cipher.cfg.extend({mode:CBC,padding:Pkcs7}),reset:function(){Cipher.reset.call(this);var cfg=this.cfg,iv=cfg.iv,mode=cfg.mode;if(this._xformMode==this._ENC_XFORM_MODE)var modeCreator=mode.createEncryptor;else{var modeCreator=mode.createDecryptor;this._minBufferSize=1}this._mode=modeCreator.call(mode,this,iv&&iv.words)},_doProcessBlock:function(words,offset){this._mode.processBlock(words,offset)},_doFinalize:function(){var padding=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){padding.pad(this._data,this.blockSize);var finalProcessedBlocks=this._process(!0)}else{var finalProcessedBlocks=this._process(!0);padding.unpad(finalProcessedBlocks)}return finalProcessedBlocks},blockSize:4}),C_lib.CipherParams=Base.extend({init:function(cipherParams){this.mixIn(cipherParams)},toString:function(formatter){return(formatter||this.formatter).stringify(this)}})),C_format=C.format={},OpenSSLFormatter=C_format.OpenSSL={stringify:function(cipherParams){var ciphertext=cipherParams.ciphertext,salt=cipherParams.salt;if(salt)var wordArray=WordArray.create([1398893684,1701076831]).concat(salt).concat(ciphertext);else var wordArray=ciphertext;return wordArray.toString(Base64)},parse:function(openSSLStr){var ciphertext=Base64.parse(openSSLStr),ciphertextWords=ciphertext.words;if(1398893684==ciphertextWords[0]&&1701076831==ciphertextWords[1]){var salt=WordArray.create(ciphertextWords.slice(2,4));ciphertextWords.splice(0,4),ciphertext.sigBytes-=16}return CipherParams.create({ciphertext:ciphertext,salt:salt})}},SerializableCipher=C_lib.SerializableCipher=Base.extend({cfg:Base.extend({format:OpenSSLFormatter}),encrypt:function(cipher,message,key,cfg){cfg=this.cfg.extend(cfg);var encryptor=cipher.createEncryptor(key,cfg),ciphertext=encryptor.finalize(message),cipherCfg=encryptor.cfg;return CipherParams.create({ciphertext:ciphertext,key:key,iv:cipherCfg.iv,algorithm:cipher,mode:cipherCfg.mode,padding:cipherCfg.padding,blockSize:cipher.blockSize,formatter:cfg.format})},decrypt:function(cipher,ciphertext,key,cfg){return cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format),cipher.createDecryptor(key,cfg).finalize(ciphertext.ciphertext)},_parse:function(ciphertext,format){return"string"==typeof ciphertext?format.parse(ciphertext,this):ciphertext}}),C_kdf=C.kdf={},OpenSSLKdf=C_kdf.OpenSSL={execute:function(password,keySize,ivSize,salt){salt||(salt=WordArray.random(8));var key=EvpKDF.create({keySize:keySize+ivSize}).compute(password,salt),iv=WordArray.create(key.words.slice(keySize),4*ivSize);return key.sigBytes=4*keySize,CipherParams.create({key:key,iv:iv,salt:salt})}},PasswordBasedCipher=C_lib.PasswordBasedCipher=SerializableCipher.extend({cfg:SerializableCipher.cfg.extend({kdf:OpenSSLKdf}),encrypt:function(cipher,message,password,cfg){cfg=this.cfg.extend(cfg);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize);cfg.iv=derivedParams.iv;var ciphertext=SerializableCipher.encrypt.call(this,cipher,message,derivedParams.key,cfg);return ciphertext.mixIn(derivedParams),ciphertext},decrypt:function(cipher,ciphertext,password,cfg){cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize,ciphertext.salt);return cfg.iv=derivedParams.iv,SerializableCipher.decrypt.call(this,cipher,ciphertext,derivedParams.key,cfg)}})}()})},{"./core":178}],178:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory():"function"==typeof define&&define.amd?define([],factory):root.CryptoJS=factory()}(void 0,function(){var CryptoJS=CryptoJS||function(Math,undefined){var create=Object.create||function(){function F(){}return function(obj){var subtype;return F.prototype=obj,subtype=new F,F.prototype=null,subtype}}(),C={},C_lib=C.lib={},Base=C_lib.Base=function(){return{extend:function(overrides){var subtype=create(this);return overrides&&subtype.mixIn(overrides),subtype.hasOwnProperty("init")&&this.init!==subtype.init||(subtype.init=function(){subtype.$super.init.apply(this,arguments)}),subtype.init.prototype=subtype,subtype.$super=this,subtype},create:function(){var instance=this.extend();return instance.init.apply(instance,arguments),instance},init:function(){},mixIn:function(properties){for(var propertyName in properties)properties.hasOwnProperty(propertyName)&&(this[propertyName]=properties[propertyName]);properties.hasOwnProperty("toString")&&(this.toString=properties.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),WordArray=C_lib.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[],this.sigBytes=void 0!=sigBytes?sigBytes:4*words.length},toString:function(encoder){return(encoder||Hex).stringify(this)},concat:function(wordArray){var thisWords=this.words,thatWords=wordArray.words,thisSigBytes=this.sigBytes,thatSigBytes=wordArray.sigBytes;if(this.clamp(),thisSigBytes%4)for(var i=0;i>>2]>>>24-i%4*8&255;thisWords[thisSigBytes+i>>>2]|=thatByte<<24-(thisSigBytes+i)%4*8}else for(var i=0;i>>2]=thatWords[i>>>2];return this.sigBytes+=thatSigBytes,this},clamp:function(){var words=this.words,sigBytes=this.sigBytes;words[sigBytes>>>2]&=4294967295<<32-sigBytes%4*8,words.length=Math.ceil(sigBytes/4)},clone:function(){var clone=Base.clone.call(this);return clone.words=this.words.slice(0),clone},random:function(nBytes){for(var rcache,words=[],i=0;i>16)&mask,m_w=18e3*(65535&m_w)+(m_w>>16)&mask;var result=(m_z<<16)+m_w&mask;return result/=4294967296,(result+=.5)*(Math.random()>.5?1:-1)}}(4294967296*(rcache||Math.random()));rcache=987654071*_r(),words.push(4294967296*_r()|0)}return new WordArray.init(words,nBytes)}}),C_enc=C.enc={},Hex=C_enc.Hex={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,hexChars=[],i=0;i>>2]>>>24-i%4*8&255;hexChars.push((bite>>>4).toString(16)),hexChars.push((15&bite).toString(16))}return hexChars.join("")},parse:function(hexStr){for(var hexStrLength=hexStr.length,words=[],i=0;i>>3]|=parseInt(hexStr.substr(i,2),16)<<24-i%8*4;return new WordArray.init(words,hexStrLength/2)}},Latin1=C_enc.Latin1={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,latin1Chars=[],i=0;i>>2]>>>24-i%4*8&255;latin1Chars.push(String.fromCharCode(bite))}return latin1Chars.join("")},parse:function(latin1Str){for(var latin1StrLength=latin1Str.length,words=[],i=0;i>>2]|=(255&latin1Str.charCodeAt(i))<<24-i%4*8;return new WordArray.init(words,latin1StrLength)}},Utf8=C_enc.Utf8={stringify:function(wordArray){try{return decodeURIComponent(escape(Latin1.stringify(wordArray)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(utf8Str){return Latin1.parse(unescape(encodeURIComponent(utf8Str)))}},BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm=Base.extend({reset:function(){this._data=new WordArray.init,this._nDataBytes=0},_append:function(data){"string"==typeof data&&(data=Utf8.parse(data)),this._data.concat(data),this._nDataBytes+=data.sigBytes},_process:function(doFlush){var data=this._data,dataWords=data.words,dataSigBytes=data.sigBytes,blockSize=this.blockSize,blockSizeBytes=4*blockSize,nBlocksReady=dataSigBytes/blockSizeBytes;nBlocksReady=doFlush?Math.ceil(nBlocksReady):Math.max((0|nBlocksReady)-this._minBufferSize,0);var nWordsReady=nBlocksReady*blockSize,nBytesReady=Math.min(4*nWordsReady,dataSigBytes);if(nWordsReady){for(var offset=0;offset>>6-i%4*2;words[nBytes>>>2]|=(bits1|bits2)<<24-nBytes%4*8,nBytes++}return WordArray.create(words,nBytes)}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_enc=C.enc;C_enc.Base64={stringify:function(wordArray){var words=wordArray.words,sigBytes=wordArray.sigBytes,map=this._map;wordArray.clamp();for(var base64Chars=[],i=0;i>>2]>>>24-i%4*8&255,byte2=words[i+1>>>2]>>>24-(i+1)%4*8&255,byte3=words[i+2>>>2]>>>24-(i+2)%4*8&255,triplet=byte1<<16|byte2<<8|byte3,j=0;j<4&&i+.75*j>>6*(3-j)&63));var paddingChar=map.charAt(64);if(paddingChar)for(;base64Chars.length%4;)base64Chars.push(paddingChar);return base64Chars.join("")},parse:function(base64Str){var base64StrLength=base64Str.length,map=this._map,reverseMap=this._reverseMap;if(!reverseMap){reverseMap=this._reverseMap=[];for(var j=0;j>>8&16711935}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_enc=C.enc;C_enc.Utf16=C_enc.Utf16BE={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,utf16Chars=[],i=0;i>>2]>>>16-i%4*8&65535;utf16Chars.push(String.fromCharCode(codePoint))}return utf16Chars.join("")},parse:function(utf16Str){for(var utf16StrLength=utf16Str.length,words=[],i=0;i>>1]|=utf16Str.charCodeAt(i)<<16-i%2*16;return WordArray.create(words,2*utf16StrLength)}};C_enc.Utf16LE={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,utf16Chars=[],i=0;i>>2]>>>16-i%4*8&65535);utf16Chars.push(String.fromCharCode(codePoint))}return utf16Chars.join("")},parse:function(utf16Str){for(var utf16StrLength=utf16Str.length,words=[],i=0;i>>1]|=swapEndian(utf16Str.charCodeAt(i)<<16-i%2*16);return WordArray.create(words,2*utf16StrLength)}}}(),CryptoJS.enc.Utf16})},{"./core":178}],181:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha1"),require("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,C_algo=C.algo,MD5=C_algo.MD5,EvpKDF=C_algo.EvpKDF=Base.extend({cfg:Base.extend({keySize:4,hasher:MD5,iterations:1}),init:function(cfg){this.cfg=this.cfg.extend(cfg)},compute:function(password,salt){for(var cfg=this.cfg,hasher=cfg.hasher.create(),derivedKey=WordArray.create(),derivedKeyWords=derivedKey.words,keySize=cfg.keySize,iterations=cfg.iterations;derivedKeyWords.lengthhasherBlockSizeBytes&&(key=hasher.finalize(key)),key.clamp();for(var oKey=this._oKey=key.clone(),iKey=this._iKey=key.clone(),oKeyWords=oKey.words,iKeyWords=iKey.words,i=0;i>>2]|=typedArray[i]<<24-i%4*8;superInit.call(this,words,typedArrayByteLength)}else superInit.apply(this,arguments)}).prototype=WordArray}}(),CryptoJS.lib.WordArray})},{"./core":178}],186:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){function FF(a,b,c,d,x,s,t){var n=a+(b&c|~b&d)+x+t;return(n<>>32-s)+b}function GG(a,b,c,d,x,s,t){var n=a+(b&d|c&~d)+x+t;return(n<>>32-s)+b}function HH(a,b,c,d,x,s,t){var n=a+(b^c^d)+x+t;return(n<>>32-s)+b}function II(a,b,c,d,x,s,t){var n=a+(c^(b|~d))+x+t;return(n<>>32-s)+b}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,T=[];!function(){for(var i=0;i<64;i++)T[i]=4294967296*Math.abs(Math.sin(i+1))|0}();var MD5=C_algo.MD5=Hasher.extend({_doReset:function(){this._hash=new WordArray.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(M,offset){for(var i=0;i<16;i++){var offset_i=offset+i,M_offset_i=M[offset_i];M[offset_i]=16711935&(M_offset_i<<8|M_offset_i>>>24)|4278255360&(M_offset_i<<24|M_offset_i>>>8)}var H=this._hash.words,M_offset_0=M[offset+0],M_offset_1=M[offset+1],M_offset_2=M[offset+2],M_offset_3=M[offset+3],M_offset_4=M[offset+4],M_offset_5=M[offset+5],M_offset_6=M[offset+6],M_offset_7=M[offset+7],M_offset_8=M[offset+8],M_offset_9=M[offset+9],M_offset_10=M[offset+10],M_offset_11=M[offset+11],M_offset_12=M[offset+12],M_offset_13=M[offset+13],M_offset_14=M[offset+14],M_offset_15=M[offset+15],a=H[0],b=H[1],c=H[2],d=H[3];a=FF(a,b,c,d,M_offset_0,7,T[0]),d=FF(d,a,b,c,M_offset_1,12,T[1]),c=FF(c,d,a,b,M_offset_2,17,T[2]),b=FF(b,c,d,a,M_offset_3,22,T[3]),a=FF(a,b,c,d,M_offset_4,7,T[4]),d=FF(d,a,b,c,M_offset_5,12,T[5]),c=FF(c,d,a,b,M_offset_6,17,T[6]),b=FF(b,c,d,a,M_offset_7,22,T[7]),a=FF(a,b,c,d,M_offset_8,7,T[8]),d=FF(d,a,b,c,M_offset_9,12,T[9]),c=FF(c,d,a,b,M_offset_10,17,T[10]),b=FF(b,c,d,a,M_offset_11,22,T[11]),a=FF(a,b,c,d,M_offset_12,7,T[12]),d=FF(d,a,b,c,M_offset_13,12,T[13]),c=FF(c,d,a,b,M_offset_14,17,T[14]),b=FF(b,c,d,a,M_offset_15,22,T[15]),a=GG(a,b,c,d,M_offset_1,5,T[16]),d=GG(d,a,b,c,M_offset_6,9,T[17]),c=GG(c,d,a,b,M_offset_11,14,T[18]),b=GG(b,c,d,a,M_offset_0,20,T[19]),a=GG(a,b,c,d,M_offset_5,5,T[20]),d=GG(d,a,b,c,M_offset_10,9,T[21]),c=GG(c,d,a,b,M_offset_15,14,T[22]),b=GG(b,c,d,a,M_offset_4,20,T[23]),a=GG(a,b,c,d,M_offset_9,5,T[24]),d=GG(d,a,b,c,M_offset_14,9,T[25]),c=GG(c,d,a,b,M_offset_3,14,T[26]),b=GG(b,c,d,a,M_offset_8,20,T[27]),a=GG(a,b,c,d,M_offset_13,5,T[28]),d=GG(d,a,b,c,M_offset_2,9,T[29]),c=GG(c,d,a,b,M_offset_7,14,T[30]),b=GG(b,c,d,a,M_offset_12,20,T[31]),a=HH(a,b,c,d,M_offset_5,4,T[32]),d=HH(d,a,b,c,M_offset_8,11,T[33]),c=HH(c,d,a,b,M_offset_11,16,T[34]),b=HH(b,c,d,a,M_offset_14,23,T[35]),a=HH(a,b,c,d,M_offset_1,4,T[36]),d=HH(d,a,b,c,M_offset_4,11,T[37]),c=HH(c,d,a,b,M_offset_7,16,T[38]),b=HH(b,c,d,a,M_offset_10,23,T[39]),a=HH(a,b,c,d,M_offset_13,4,T[40]),d=HH(d,a,b,c,M_offset_0,11,T[41]),c=HH(c,d,a,b,M_offset_3,16,T[42]),b=HH(b,c,d,a,M_offset_6,23,T[43]),a=HH(a,b,c,d,M_offset_9,4,T[44]),d=HH(d,a,b,c,M_offset_12,11,T[45]),c=HH(c,d,a,b,M_offset_15,16,T[46]),b=HH(b,c,d,a,M_offset_2,23,T[47]),a=II(a,b,c,d,M_offset_0,6,T[48]),d=II(d,a,b,c,M_offset_7,10,T[49]),c=II(c,d,a,b,M_offset_14,15,T[50]),b=II(b,c,d,a,M_offset_5,21,T[51]),a=II(a,b,c,d,M_offset_12,6,T[52]),d=II(d,a,b,c,M_offset_3,10,T[53]),c=II(c,d,a,b,M_offset_10,15,T[54]),b=II(b,c,d,a,M_offset_1,21,T[55]),a=II(a,b,c,d,M_offset_8,6,T[56]),d=II(d,a,b,c,M_offset_15,10,T[57]),c=II(c,d,a,b,M_offset_6,15,T[58]),b=II(b,c,d,a,M_offset_13,21,T[59]),a=II(a,b,c,d,M_offset_4,6,T[60]),d=II(d,a,b,c,M_offset_11,10,T[61]),c=II(c,d,a,b,M_offset_2,15,T[62]),b=II(b,c,d,a,M_offset_9,21,T[63]),H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32;var nBitsTotalH=Math.floor(nBitsTotal/4294967296),nBitsTotalL=nBitsTotal;dataWords[15+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotalH<<8|nBitsTotalH>>>24)|4278255360&(nBitsTotalH<<24|nBitsTotalH>>>8),dataWords[14+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotalL<<8|nBitsTotalL>>>24)|4278255360&(nBitsTotalL<<24|nBitsTotalL>>>8),data.sigBytes=4*(dataWords.length+1),this._process();for(var hash=this._hash,H=hash.words,i=0;i<4;i++){var H_i=H[i];H[i]=16711935&(H_i<<8|H_i>>>24)|4278255360&(H_i<<24|H_i>>>8)}return hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.MD5=Hasher._createHelper(MD5),C.HmacMD5=Hasher._createHmacHelper(MD5)}(Math),CryptoJS.MD5})},{"./core":178}],187:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.mode.CFB=function(){function generateKeystreamAndEncrypt(words,offset,blockSize,cipher){var iv=this._iv;if(iv){var keystream=iv.slice(0);this._iv=void 0}else var keystream=this._prevBlock;cipher.encryptBlock(keystream,0);for(var i=0;i>24&255)){var b1=word>>16&255,b2=word>>8&255,b3=255&word;255===b1?(b1=0,255===b2?(b2=0,255===b3?b3=0:++b3):++b2):++b1,word=0,word+=b1<<16,word+=b2<<8,word+=b3}else word+=1<<24;return word}function incCounter(counter){return 0===(counter[0]=incWord(counter[0]))&&(counter[1]=incWord(counter[1])),counter}var CTRGladman=CryptoJS.lib.BlockCipherMode.extend(),Encryptor=CTRGladman.Encryptor=CTRGladman.extend({processBlock:function(words,offset){var cipher=this._cipher,blockSize=cipher.blockSize,iv=this._iv,counter=this._counter;iv&&(counter=this._counter=iv.slice(0),this._iv=void 0),incCounter(counter);var keystream=counter.slice(0);cipher.encryptBlock(keystream,0);for(var i=0;i>>2]|=nPaddingBytes<<24-lastBytePos%4*8,data.sigBytes+=nPaddingBytes},unpad:function(data){var nPaddingBytes=255&data.words[data.sigBytes-1>>>2];data.sigBytes-=nPaddingBytes}},CryptoJS.pad.Ansix923})},{"./cipher-core":177,"./core":178}],193:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.Iso10126={pad:function(data,blockSize){var blockSizeBytes=4*blockSize,nPaddingBytes=blockSizeBytes-data.sigBytes%blockSizeBytes;data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes-1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes<<24],1))},unpad:function(data){var nPaddingBytes=255&data.words[data.sigBytes-1>>>2];data.sigBytes-=nPaddingBytes}},CryptoJS.pad.Iso10126})},{"./cipher-core":177,"./core":178}],194:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.Iso97971={pad:function(data,blockSize){data.concat(CryptoJS.lib.WordArray.create([2147483648],1)),CryptoJS.pad.ZeroPadding.pad(data,blockSize)},unpad:function(data){CryptoJS.pad.ZeroPadding.unpad(data),data.sigBytes--}},CryptoJS.pad.Iso97971})},{"./cipher-core":177,"./core":178}],195:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.NoPadding={pad:function(){},unpad:function(){}},CryptoJS.pad.NoPadding})},{"./cipher-core":177,"./core":178}],196:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.ZeroPadding={pad:function(data,blockSize){var blockSizeBytes=4*blockSize;data.clamp(),data.sigBytes+=blockSizeBytes-(data.sigBytes%blockSizeBytes||blockSizeBytes)},unpad:function(data){for(var dataWords=data.words,i=data.sigBytes-1;!(dataWords[i>>>2]>>>24-i%4*8&255);)i--;data.sigBytes=i+1}},CryptoJS.pad.ZeroPadding})},{"./cipher-core":177,"./core":178}],197:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha1"),require("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,C_algo=C.algo,SHA1=C_algo.SHA1,HMAC=C_algo.HMAC,PBKDF2=C_algo.PBKDF2=Base.extend({cfg:Base.extend({keySize:4,hasher:SHA1,iterations:1}),init:function(cfg){this.cfg=this.cfg.extend(cfg)},compute:function(password,salt){for(var cfg=this.cfg,hmac=HMAC.create(cfg.hasher,password),derivedKey=WordArray.create(),blockIndex=WordArray.create([1]),derivedKeyWords=derivedKey.words,blockIndexWords=blockIndex.words,keySize=cfg.keySize,iterations=cfg.iterations;derivedKeyWords.length>>0>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0>>0?1:0)|0,this._b=C[7]>>>0>>0?1:0;for(var i=0;i<8;i++){var gx=X[i]+C[i],ga=65535&gx,gb=gx>>>16,gh=((ga*ga>>>17)+ga*gb>>>15)+gb*gb,gl=((4294901760&gx)*gx|0)+((65535&gx)*gx|0);G[i]=gh^gl}X[0]=G[0]+(G[7]<<16|G[7]>>>16)+(G[6]<<16|G[6]>>>16)|0,X[1]=G[1]+(G[0]<<8|G[0]>>>24)+G[7]|0,X[2]=G[2]+(G[1]<<16|G[1]>>>16)+(G[0]<<16|G[0]>>>16)|0,X[3]=G[3]+(G[2]<<8|G[2]>>>24)+G[1]|0,X[4]=G[4]+(G[3]<<16|G[3]>>>16)+(G[2]<<16|G[2]>>>16)|0,X[5]=G[5]+(G[4]<<8|G[4]>>>24)+G[3]|0,X[6]=G[6]+(G[5]<<16|G[5]>>>16)+(G[4]<<16|G[4]>>>16)|0,X[7]=G[7]+(G[6]<<8|G[6]>>>24)+G[5]|0}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,S=[],C_=[],G=[],RabbitLegacy=C_algo.RabbitLegacy=StreamCipher.extend({_doReset:function(){var K=this._key.words,iv=this.cfg.iv,X=this._X=[K[0],K[3]<<16|K[2]>>>16,K[1],K[0]<<16|K[3]>>>16,K[2],K[1]<<16|K[0]>>>16,K[3],K[2]<<16|K[1]>>>16],C=this._C=[K[2]<<16|K[2]>>>16,4294901760&K[0]|65535&K[1],K[3]<<16|K[3]>>>16,4294901760&K[1]|65535&K[2],K[0]<<16|K[0]>>>16,4294901760&K[2]|65535&K[3],K[1]<<16|K[1]>>>16,4294901760&K[3]|65535&K[0]];this._b=0;for(var i=0;i<4;i++)nextState.call(this);for(var i=0;i<8;i++)C[i]^=X[i+4&7];if(iv){var IV=iv.words,IV_0=IV[0],IV_1=IV[1],i0=16711935&(IV_0<<8|IV_0>>>24)|4278255360&(IV_0<<24|IV_0>>>8),i2=16711935&(IV_1<<8|IV_1>>>24)|4278255360&(IV_1<<24|IV_1>>>8),i1=i0>>>16|4294901760&i2,i3=i2<<16|65535&i0;C[0]^=i0,C[1]^=i1,C[2]^=i2,C[3]^=i3,C[4]^=i0,C[5]^=i1,C[6]^=i2,C[7]^=i3;for(var i=0;i<4;i++)nextState.call(this)}},_doProcessBlock:function(M,offset){var X=this._X;nextState.call(this),S[0]=X[0]^X[5]>>>16^X[3]<<16,S[1]=X[2]^X[7]>>>16^X[5]<<16,S[2]=X[4]^X[1]>>>16^X[7]<<16,S[3]=X[6]^X[3]>>>16^X[1]<<16;for(var i=0;i<4;i++)S[i]=16711935&(S[i]<<8|S[i]>>>24)|4278255360&(S[i]<<24|S[i]>>>8),M[offset+i]^=S[i]},blockSize:4,ivSize:2});C.RabbitLegacy=StreamCipher._createHelper(RabbitLegacy)}(),CryptoJS.RabbitLegacy})},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],199:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function nextState(){for(var X=this._X,C=this._C,i=0;i<8;i++)C_[i]=C[i];C[0]=C[0]+1295307597+this._b|0,C[1]=C[1]+3545052371+(C[0]>>>0>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0>>0?1:0)|0,this._b=C[7]>>>0>>0?1:0;for(var i=0;i<8;i++){var gx=X[i]+C[i],ga=65535&gx,gb=gx>>>16,gh=((ga*ga>>>17)+ga*gb>>>15)+gb*gb,gl=((4294901760&gx)*gx|0)+((65535&gx)*gx|0);G[i]=gh^gl}X[0]=G[0]+(G[7]<<16|G[7]>>>16)+(G[6]<<16|G[6]>>>16)|0,X[1]=G[1]+(G[0]<<8|G[0]>>>24)+G[7]|0,X[2]=G[2]+(G[1]<<16|G[1]>>>16)+(G[0]<<16|G[0]>>>16)|0,X[3]=G[3]+(G[2]<<8|G[2]>>>24)+G[1]|0,X[4]=G[4]+(G[3]<<16|G[3]>>>16)+(G[2]<<16|G[2]>>>16)|0,X[5]=G[5]+(G[4]<<8|G[4]>>>24)+G[3]|0,X[6]=G[6]+(G[5]<<16|G[5]>>>16)+(G[4]<<16|G[4]>>>16)|0,X[7]=G[7]+(G[6]<<8|G[6]>>>24)+G[5]|0}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,S=[],C_=[],G=[],Rabbit=C_algo.Rabbit=StreamCipher.extend({_doReset:function(){for(var K=this._key.words,iv=this.cfg.iv,i=0;i<4;i++)K[i]=16711935&(K[i]<<8|K[i]>>>24)|4278255360&(K[i]<<24|K[i]>>>8);var X=this._X=[K[0],K[3]<<16|K[2]>>>16,K[1],K[0]<<16|K[3]>>>16,K[2],K[1]<<16|K[0]>>>16,K[3],K[2]<<16|K[1]>>>16],C=this._C=[K[2]<<16|K[2]>>>16,4294901760&K[0]|65535&K[1],K[3]<<16|K[3]>>>16,4294901760&K[1]|65535&K[2],K[0]<<16|K[0]>>>16,4294901760&K[2]|65535&K[3],K[1]<<16|K[1]>>>16,4294901760&K[3]|65535&K[0]];this._b=0;for(var i=0;i<4;i++)nextState.call(this);for(var i=0;i<8;i++)C[i]^=X[i+4&7];if(iv){var IV=iv.words,IV_0=IV[0],IV_1=IV[1],i0=16711935&(IV_0<<8|IV_0>>>24)|4278255360&(IV_0<<24|IV_0>>>8),i2=16711935&(IV_1<<8|IV_1>>>24)|4278255360&(IV_1<<24|IV_1>>>8),i1=i0>>>16|4294901760&i2,i3=i2<<16|65535&i0;C[0]^=i0,C[1]^=i1,C[2]^=i2,C[3]^=i3,C[4]^=i0,C[5]^=i1,C[6]^=i2,C[7]^=i3;for(var i=0;i<4;i++)nextState.call(this)}},_doProcessBlock:function(M,offset){var X=this._X;nextState.call(this),S[0]=X[0]^X[5]>>>16^X[3]<<16,S[1]=X[2]^X[7]>>>16^X[5]<<16,S[2]=X[4]^X[1]>>>16^X[7]<<16,S[3]=X[6]^X[3]>>>16^X[1]<<16;for(var i=0;i<4;i++)S[i]=16711935&(S[i]<<8|S[i]>>>24)|4278255360&(S[i]<<24|S[i]>>>8),M[offset+i]^=S[i]},blockSize:4,ivSize:2});C.Rabbit=StreamCipher._createHelper(Rabbit)}(),CryptoJS.Rabbit})},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],200:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function generateKeystreamWord(){for(var S=this._S,i=this._i,j=this._j,keystreamWord=0,n=0;n<4;n++){i=(i+1)%256,j=(j+S[i])%256;var t=S[i];S[i]=S[j],S[j]=t,keystreamWord|=S[(S[i]+S[j])%256]<<24-8*n}return this._i=i,this._j=j,keystreamWord}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,RC4=C_algo.RC4=StreamCipher.extend({_doReset:function(){for(var key=this._key,keyWords=key.words,keySigBytes=key.sigBytes,S=this._S=[],i=0;i<256;i++)S[i]=i;for(var i=0,j=0;i<256;i++){var keyByteIndex=i%keySigBytes,keyByte=keyWords[keyByteIndex>>>2]>>>24-keyByteIndex%4*8&255;j=(j+S[i]+keyByte)%256;var t=S[i];S[i]=S[j],S[j]=t}this._i=this._j=0},_doProcessBlock:function(M,offset){M[offset]^=generateKeystreamWord.call(this)},keySize:8,ivSize:0});C.RC4=StreamCipher._createHelper(RC4);var RC4Drop=C_algo.RC4Drop=RC4.extend({cfg:RC4.cfg.extend({drop:192}),_doReset:function(){RC4._doReset.call(this);for(var i=this.cfg.drop;i>0;i--)generateKeystreamWord.call(this)}});C.RC4Drop=StreamCipher._createHelper(RC4Drop)}(),CryptoJS.RC4})},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],201:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){function f1(x,y,z){return x^y^z}function f2(x,y,z){return x&y|~x&z}function f3(x,y,z){return(x|~y)^z}function f4(x,y,z){return x&z|y&~z}function f5(x,y,z){return x^(y|~z)}function rotl(x,n){return x<>>32-n}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,_zl=WordArray.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),_zr=WordArray.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),_sl=WordArray.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),_sr=WordArray.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),_hl=WordArray.create([0,1518500249,1859775393,2400959708,2840853838]),_hr=WordArray.create([1352829926,1548603684,1836072691,2053994217,0]),RIPEMD160=C_algo.RIPEMD160=Hasher.extend({_doReset:function(){this._hash=WordArray.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(M,offset){for(var i=0;i<16;i++){var offset_i=offset+i,M_offset_i=M[offset_i];M[offset_i]=16711935&(M_offset_i<<8|M_offset_i>>>24)|4278255360&(M_offset_i<<24|M_offset_i>>>8)}var al,bl,cl,dl,el,ar,br,cr,dr,er,H=this._hash.words,hl=_hl.words,hr=_hr.words,zl=_zl.words,zr=_zr.words,sl=_sl.words,sr=_sr.words;ar=al=H[0],br=bl=H[1],cr=cl=H[2],dr=dl=H[3],er=el=H[4];for(var t,i=0;i<80;i+=1)t=al+M[offset+zl[i]]|0,t+=i<16?f1(bl,cl,dl)+hl[0]:i<32?f2(bl,cl,dl)+hl[1]:i<48?f3(bl,cl,dl)+hl[2]:i<64?f4(bl,cl,dl)+hl[3]:f5(bl,cl,dl)+hl[4],t|=0,t=rotl(t,sl[i]),t=t+el|0,al=el,el=dl,dl=rotl(cl,10),cl=bl,bl=t,t=ar+M[offset+zr[i]]|0,t+=i<16?f5(br,cr,dr)+hr[0]:i<32?f4(br,cr,dr)+hr[1]:i<48?f3(br,cr,dr)+hr[2]:i<64?f2(br,cr,dr)+hr[3]:f1(br,cr,dr)+hr[4],t|=0,t=rotl(t,sr[i]),t=t+er|0,ar=er,er=dr,dr=rotl(cr,10),cr=br,br=t;t=H[1]+cl+dr|0,H[1]=H[2]+dl+er|0,H[2]=H[3]+el+ar|0,H[3]=H[4]+al+br|0,H[4]=H[0]+bl+cr|0,H[0]=t},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32, -dataWords[14+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotal<<8|nBitsTotal>>>24)|4278255360&(nBitsTotal<<24|nBitsTotal>>>8),data.sigBytes=4*(dataWords.length+1),this._process();for(var hash=this._hash,H=hash.words,i=0;i<5;i++){var H_i=H[i];H[i]=16711935&(H_i<<8|H_i>>>24)|4278255360&(H_i<<24|H_i>>>8)}return hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.RIPEMD160=Hasher._createHelper(RIPEMD160),C.HmacRIPEMD160=Hasher._createHmacHelper(RIPEMD160)}(Math),CryptoJS.RIPEMD160})},{"./core":178}],202:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,W=[],SHA1=C_algo.SHA1=Hasher.extend({_doReset:function(){this._hash=new WordArray.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],i=0;i<80;i++){if(i<16)W[i]=0|M[offset+i];else{var n=W[i-3]^W[i-8]^W[i-14]^W[i-16];W[i]=n<<1|n>>>31}var t=(a<<5|a>>>27)+e+W[i];t+=i<20?1518500249+(b&c|~b&d):i<40?1859775393+(b^c^d):i<60?(b&c|b&d|c&d)-1894007588:(b^c^d)-899497514,e=d,d=c,c=b<<30|b>>>2,b=a,a=t}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[14+(nBitsLeft+64>>>9<<4)]=Math.floor(nBitsTotal/4294967296),dataWords[15+(nBitsLeft+64>>>9<<4)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA1=Hasher._createHelper(SHA1),C.HmacSHA1=Hasher._createHmacHelper(SHA1)}(),CryptoJS.SHA1})},{"./core":178}],203:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_algo=C.algo,SHA256=C_algo.SHA256,SHA224=C_algo.SHA224=SHA256.extend({_doReset:function(){this._hash=new WordArray.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var hash=SHA256._doFinalize.call(this);return hash.sigBytes-=4,hash}});C.SHA224=SHA256._createHelper(SHA224),C.HmacSHA224=SHA256._createHmacHelper(SHA224)}(),CryptoJS.SHA224})},{"./core":178,"./sha256":204}],204:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,H=[],K=[];!function(){function getFractionalBits(n){return 4294967296*(n-(0|n))|0}for(var n=2,nPrime=0;nPrime<64;)(function(n){for(var sqrtN=Math.sqrt(n),factor=2;factor<=sqrtN;factor++)if(!(n%factor))return!1;return!0})(n)&&(nPrime<8&&(H[nPrime]=getFractionalBits(Math.pow(n,.5))),K[nPrime]=getFractionalBits(Math.pow(n,1/3)),nPrime++),n++}();var W=[],SHA256=C_algo.SHA256=Hasher.extend({_doReset:function(){this._hash=new WordArray.init(H.slice(0))},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],f=H[5],g=H[6],h=H[7],i=0;i<64;i++){if(i<16)W[i]=0|M[offset+i];else{var gamma0x=W[i-15],gamma0=(gamma0x<<25|gamma0x>>>7)^(gamma0x<<14|gamma0x>>>18)^gamma0x>>>3,gamma1x=W[i-2],gamma1=(gamma1x<<15|gamma1x>>>17)^(gamma1x<<13|gamma1x>>>19)^gamma1x>>>10;W[i]=gamma0+W[i-7]+gamma1+W[i-16]}var ch=e&f^~e&g,maj=a&b^a&c^b&c,sigma0=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),sigma1=(e<<26|e>>>6)^(e<<21|e>>>11)^(e<<7|e>>>25),t1=h+sigma1+ch+K[i]+W[i],t2=sigma0+maj;h=g,g=f,f=e,e=d+t1|0,d=c,c=b,b=a,a=t1+t2|0}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0,H[5]=H[5]+f|0,H[6]=H[6]+g|0,H[7]=H[7]+h|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[14+(nBitsLeft+64>>>9<<4)]=Math.floor(nBitsTotal/4294967296),dataWords[15+(nBitsLeft+64>>>9<<4)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA256=Hasher._createHelper(SHA256),C.HmacSHA256=Hasher._createHmacHelper(SHA256)}(Math),CryptoJS.SHA256})},{"./core":178}],205:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_x64=C.x64,X64Word=C_x64.Word,C_algo=C.algo,RHO_OFFSETS=[],PI_INDEXES=[],ROUND_CONSTANTS=[];!function(){for(var x=1,y=0,t=0;t<24;t++){RHO_OFFSETS[x+5*y]=(t+1)*(t+2)/2%64;var newX=y%5,newY=(2*x+3*y)%5;x=newX,y=newY}for(var x=0;x<5;x++)for(var y=0;y<5;y++)PI_INDEXES[x+5*y]=y+(2*x+3*y)%5*5;for(var LFSR=1,i=0;i<24;i++){for(var roundConstantMsw=0,roundConstantLsw=0,j=0;j<7;j++){if(1&LFSR){var bitPosition=(1<>>24)|4278255360&(M2i<<24|M2i>>>8),M2i1=16711935&(M2i1<<8|M2i1>>>24)|4278255360&(M2i1<<24|M2i1>>>8);var lane=state[i];lane.high^=M2i1,lane.low^=M2i}for(var round=0;round<24;round++){for(var x=0;x<5;x++){for(var tMsw=0,tLsw=0,y=0;y<5;y++){var lane=state[x+5*y];tMsw^=lane.high,tLsw^=lane.low}var Tx=T[x];Tx.high=tMsw,Tx.low=tLsw}for(var x=0;x<5;x++)for(var Tx4=T[(x+4)%5],Tx1=T[(x+1)%5],Tx1Msw=Tx1.high,Tx1Lsw=Tx1.low,tMsw=Tx4.high^(Tx1Msw<<1|Tx1Lsw>>>31),tLsw=Tx4.low^(Tx1Lsw<<1|Tx1Msw>>>31),y=0;y<5;y++){var lane=state[x+5*y];lane.high^=tMsw,lane.low^=tLsw}for(var laneIndex=1;laneIndex<25;laneIndex++){var lane=state[laneIndex],laneMsw=lane.high,laneLsw=lane.low,rhoOffset=RHO_OFFSETS[laneIndex];if(rhoOffset<32)var tMsw=laneMsw<>>32-rhoOffset,tLsw=laneLsw<>>32-rhoOffset;else var tMsw=laneLsw<>>64-rhoOffset,tLsw=laneMsw<>>64-rhoOffset;var TPiLane=T[PI_INDEXES[laneIndex]];TPiLane.high=tMsw,TPiLane.low=tLsw}var T0=T[0],state0=state[0];T0.high=state0.high,T0.low=state0.low;for(var x=0;x<5;x++)for(var y=0;y<5;y++){var laneIndex=x+5*y,lane=state[laneIndex],TLane=T[laneIndex],Tx1Lane=T[(x+1)%5+5*y],Tx2Lane=T[(x+2)%5+5*y];lane.high=TLane.high^~Tx1Lane.high&Tx2Lane.high,lane.low=TLane.low^~Tx1Lane.low&Tx2Lane.low}var lane=state[0],roundConstant=ROUND_CONSTANTS[round];lane.high^=roundConstant.high,lane.low^=roundConstant.low}},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsLeft=(this._nDataBytes,8*data.sigBytes),blockSizeBits=32*this.blockSize;dataWords[nBitsLeft>>>5]|=1<<24-nBitsLeft%32,dataWords[(Math.ceil((nBitsLeft+1)/blockSizeBits)*blockSizeBits>>>5)-1]|=128,data.sigBytes=4*dataWords.length,this._process();for(var state=this._state,outputLengthBytes=this.cfg.outputLength/8,outputLengthLanes=outputLengthBytes/8,hashWords=[],i=0;i>>24)|4278255360&(laneMsw<<24|laneMsw>>>8),laneLsw=16711935&(laneLsw<<8|laneLsw>>>24)|4278255360&(laneLsw<<24|laneLsw>>>8),hashWords.push(laneLsw),hashWords.push(laneMsw)}return new WordArray.init(hashWords,outputLengthBytes)},clone:function(){for(var clone=Hasher.clone.call(this),state=clone._state=this._state.slice(0),i=0;i<25;i++)state[i]=state[i].clone();return clone}});C.SHA3=Hasher._createHelper(SHA3),C.HmacSHA3=Hasher._createHmacHelper(SHA3)}(Math),CryptoJS.SHA3})},{"./core":178,"./x64-core":209}],206:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core"),require("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_x64=C.x64,X64Word=C_x64.Word,X64WordArray=C_x64.WordArray,C_algo=C.algo,SHA512=C_algo.SHA512,SHA384=C_algo.SHA384=SHA512.extend({_doReset:function(){this._hash=new X64WordArray.init([new X64Word.init(3418070365,3238371032),new X64Word.init(1654270250,914150663),new X64Word.init(2438529370,812702999),new X64Word.init(355462360,4144912697),new X64Word.init(1731405415,4290775857),new X64Word.init(2394180231,1750603025),new X64Word.init(3675008525,1694076839),new X64Word.init(1203062813,3204075428)])},_doFinalize:function(){var hash=SHA512._doFinalize.call(this);return hash.sigBytes-=16,hash}});C.SHA384=SHA512._createHelper(SHA384),C.HmacSHA384=SHA512._createHmacHelper(SHA384)}(),CryptoJS.SHA384})},{"./core":178,"./sha512":207,"./x64-core":209}],207:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function X64Word_create(){return X64Word.create.apply(X64Word,arguments)}var C=CryptoJS,C_lib=C.lib,Hasher=C_lib.Hasher,C_x64=C.x64,X64Word=C_x64.Word,X64WordArray=C_x64.WordArray,C_algo=C.algo,K=[X64Word_create(1116352408,3609767458),X64Word_create(1899447441,602891725),X64Word_create(3049323471,3964484399),X64Word_create(3921009573,2173295548),X64Word_create(961987163,4081628472),X64Word_create(1508970993,3053834265),X64Word_create(2453635748,2937671579),X64Word_create(2870763221,3664609560),X64Word_create(3624381080,2734883394),X64Word_create(310598401,1164996542),X64Word_create(607225278,1323610764),X64Word_create(1426881987,3590304994),X64Word_create(1925078388,4068182383),X64Word_create(2162078206,991336113),X64Word_create(2614888103,633803317),X64Word_create(3248222580,3479774868),X64Word_create(3835390401,2666613458),X64Word_create(4022224774,944711139),X64Word_create(264347078,2341262773),X64Word_create(604807628,2007800933),X64Word_create(770255983,1495990901),X64Word_create(1249150122,1856431235),X64Word_create(1555081692,3175218132),X64Word_create(1996064986,2198950837),X64Word_create(2554220882,3999719339),X64Word_create(2821834349,766784016),X64Word_create(2952996808,2566594879),X64Word_create(3210313671,3203337956),X64Word_create(3336571891,1034457026),X64Word_create(3584528711,2466948901),X64Word_create(113926993,3758326383),X64Word_create(338241895,168717936),X64Word_create(666307205,1188179964),X64Word_create(773529912,1546045734),X64Word_create(1294757372,1522805485),X64Word_create(1396182291,2643833823),X64Word_create(1695183700,2343527390),X64Word_create(1986661051,1014477480),X64Word_create(2177026350,1206759142),X64Word_create(2456956037,344077627),X64Word_create(2730485921,1290863460),X64Word_create(2820302411,3158454273),X64Word_create(3259730800,3505952657),X64Word_create(3345764771,106217008),X64Word_create(3516065817,3606008344),X64Word_create(3600352804,1432725776),X64Word_create(4094571909,1467031594),X64Word_create(275423344,851169720),X64Word_create(430227734,3100823752),X64Word_create(506948616,1363258195),X64Word_create(659060556,3750685593),X64Word_create(883997877,3785050280),X64Word_create(958139571,3318307427),X64Word_create(1322822218,3812723403),X64Word_create(1537002063,2003034995),X64Word_create(1747873779,3602036899),X64Word_create(1955562222,1575990012),X64Word_create(2024104815,1125592928),X64Word_create(2227730452,2716904306),X64Word_create(2361852424,442776044),X64Word_create(2428436474,593698344),X64Word_create(2756734187,3733110249),X64Word_create(3204031479,2999351573),X64Word_create(3329325298,3815920427),X64Word_create(3391569614,3928383900),X64Word_create(3515267271,566280711),X64Word_create(3940187606,3454069534),X64Word_create(4118630271,4000239992),X64Word_create(116418474,1914138554),X64Word_create(174292421,2731055270),X64Word_create(289380356,3203993006),X64Word_create(460393269,320620315),X64Word_create(685471733,587496836),X64Word_create(852142971,1086792851),X64Word_create(1017036298,365543100),X64Word_create(1126000580,2618297676),X64Word_create(1288033470,3409855158),X64Word_create(1501505948,4234509866),X64Word_create(1607167915,987167468),X64Word_create(1816402316,1246189591)],W=[];!function(){for(var i=0;i<80;i++)W[i]=X64Word_create()}();var SHA512=C_algo.SHA512=Hasher.extend({_doReset:function(){this._hash=new X64WordArray.init([new X64Word.init(1779033703,4089235720),new X64Word.init(3144134277,2227873595),new X64Word.init(1013904242,4271175723),new X64Word.init(2773480762,1595750129),new X64Word.init(1359893119,2917565137),new X64Word.init(2600822924,725511199),new X64Word.init(528734635,4215389547),new X64Word.init(1541459225,327033209)])},_doProcessBlock:function(M,offset){for(var H=this._hash.words,H0=H[0],H1=H[1],H2=H[2],H3=H[3],H4=H[4],H5=H[5],H6=H[6],H7=H[7],H0h=H0.high,H0l=H0.low,H1h=H1.high,H1l=H1.low,H2h=H2.high,H2l=H2.low,H3h=H3.high,H3l=H3.low,H4h=H4.high,H4l=H4.low,H5h=H5.high,H5l=H5.low,H6h=H6.high,H6l=H6.low,H7h=H7.high,H7l=H7.low,ah=H0h,al=H0l,bh=H1h,bl=H1l,ch=H2h,cl=H2l,dh=H3h,dl=H3l,eh=H4h,el=H4l,fh=H5h,fl=H5l,gh=H6h,gl=H6l,hh=H7h,hl=H7l,i=0;i<80;i++){var Wi=W[i];if(i<16)var Wih=Wi.high=0|M[offset+2*i],Wil=Wi.low=0|M[offset+2*i+1];else{var gamma0x=W[i-15],gamma0xh=gamma0x.high,gamma0xl=gamma0x.low,gamma0h=(gamma0xh>>>1|gamma0xl<<31)^(gamma0xh>>>8|gamma0xl<<24)^gamma0xh>>>7,gamma0l=(gamma0xl>>>1|gamma0xh<<31)^(gamma0xl>>>8|gamma0xh<<24)^(gamma0xl>>>7|gamma0xh<<25),gamma1x=W[i-2],gamma1xh=gamma1x.high,gamma1xl=gamma1x.low,gamma1h=(gamma1xh>>>19|gamma1xl<<13)^(gamma1xh<<3|gamma1xl>>>29)^gamma1xh>>>6,gamma1l=(gamma1xl>>>19|gamma1xh<<13)^(gamma1xl<<3|gamma1xh>>>29)^(gamma1xl>>>6|gamma1xh<<26),Wi7=W[i-7],Wi7h=Wi7.high,Wi7l=Wi7.low,Wi16=W[i-16],Wi16h=Wi16.high,Wi16l=Wi16.low,Wil=gamma0l+Wi7l,Wih=gamma0h+Wi7h+(Wil>>>0>>0?1:0),Wil=Wil+gamma1l,Wih=Wih+gamma1h+(Wil>>>0>>0?1:0),Wil=Wil+Wi16l,Wih=Wih+Wi16h+(Wil>>>0>>0?1:0);Wi.high=Wih,Wi.low=Wil}var chh=eh&fh^~eh&gh,chl=el&fl^~el&gl,majh=ah&bh^ah&ch^bh&ch,majl=al&bl^al&cl^bl&cl,sigma0h=(ah>>>28|al<<4)^(ah<<30|al>>>2)^(ah<<25|al>>>7),sigma0l=(al>>>28|ah<<4)^(al<<30|ah>>>2)^(al<<25|ah>>>7),sigma1h=(eh>>>14|el<<18)^(eh>>>18|el<<14)^(eh<<23|el>>>9),sigma1l=(el>>>14|eh<<18)^(el>>>18|eh<<14)^(el<<23|eh>>>9),Ki=K[i],Kih=Ki.high,Kil=Ki.low,t1l=hl+sigma1l,t1h=hh+sigma1h+(t1l>>>0>>0?1:0),t1l=t1l+chl,t1h=t1h+chh+(t1l>>>0>>0?1:0),t1l=t1l+Kil,t1h=t1h+Kih+(t1l>>>0>>0?1:0),t1l=t1l+Wil,t1h=t1h+Wih+(t1l>>>0>>0?1:0),t2l=sigma0l+majl,t2h=sigma0h+majh+(t2l>>>0>>0?1:0);hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,el=dl+t1l|0,eh=dh+t1h+(el>>>0
>>0?1:0)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,al=t1l+t2l|0,ah=t1h+t2h+(al>>>0>>0?1:0)|0}H0l=H0.low=H0l+al,H0.high=H0h+ah+(H0l>>>0>>0?1:0),H1l=H1.low=H1l+bl,H1.high=H1h+bh+(H1l>>>0>>0?1:0),H2l=H2.low=H2l+cl,H2.high=H2h+ch+(H2l>>>0>>0?1:0),H3l=H3.low=H3l+dl,H3.high=H3h+dh+(H3l>>>0
>>0?1:0),H4l=H4.low=H4l+el,H4.high=H4h+eh+(H4l>>>0>>0?1:0),H5l=H5.low=H5l+fl,H5.high=H5h+fh+(H5l>>>0>>0?1:0),H6l=H6.low=H6l+gl,H6.high=H6h+gh+(H6l>>>0>>0?1:0),H7l=H7.low=H7l+hl,H7.high=H7h+hh+(H7l>>>0>>0?1:0)},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[30+(nBitsLeft+128>>>10<<5)]=Math.floor(nBitsTotal/4294967296),dataWords[31+(nBitsLeft+128>>>10<<5)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash.toX32()},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone},blockSize:32});C.SHA512=Hasher._createHelper(SHA512),C.HmacSHA512=Hasher._createHmacHelper(SHA512)}(),CryptoJS.SHA512})},{"./core":178,"./x64-core":209}],208:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function exchangeLR(offset,mask){var t=(this._lBlock>>>offset^this._rBlock)&mask;this._rBlock^=t,this._lBlock^=t<>>offset^this._lBlock)&mask;this._lBlock^=t,this._rBlock^=t<>>5]>>>31-keyBitPos%32&1}for(var subKeys=this._subKeys=[],nSubKey=0;nSubKey<16;nSubKey++){for(var subKey=subKeys[nSubKey]=[],bitShift=BIT_SHIFTS[nSubKey],i=0;i<24;i++)subKey[i/6|0]|=keyBits[(PC2[i]-1+bitShift)%28]<<31-i%6,subKey[4+(i/6|0)]|=keyBits[28+(PC2[i+24]-1+bitShift)%28]<<31-i%6;subKey[0]=subKey[0]<<1|subKey[0]>>>31;for(var i=1;i<7;i++)subKey[i]=subKey[i]>>>4*(i-1)+3;subKey[7]=subKey[7]<<5|subKey[7]>>>27}for(var invSubKeys=this._invSubKeys=[],i=0;i<16;i++)invSubKeys[i]=subKeys[15-i]},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._subKeys)},decryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._invSubKeys)},_doCryptBlock:function(M,offset,subKeys){this._lBlock=M[offset],this._rBlock=M[offset+1],exchangeLR.call(this,4,252645135),exchangeLR.call(this,16,65535),exchangeRL.call(this,2,858993459),exchangeRL.call(this,8,16711935),exchangeLR.call(this,1,1431655765);for(var round=0;round<16;round++){for(var subKey=subKeys[round],lBlock=this._lBlock,rBlock=this._rBlock,f=0,i=0;i<8;i++)f|=SBOX_P[i][((rBlock^subKey[i])&SBOX_MASK[i])>>>0];this._lBlock=rBlock,this._rBlock=lBlock^f}var t=this._lBlock;this._lBlock=this._rBlock,this._rBlock=t,exchangeLR.call(this,1,1431655765),exchangeRL.call(this,8,16711935),exchangeRL.call(this,2,858993459),exchangeLR.call(this,16,65535),exchangeLR.call(this,4,252645135),M[offset]=this._lBlock,M[offset+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});C.DES=BlockCipher._createHelper(DES);var TripleDES=C_algo.TripleDES=BlockCipher.extend({_doReset:function(){var key=this._key,keyWords=key.words;this._des1=DES.createEncryptor(WordArray.create(keyWords.slice(0,2))),this._des2=DES.createEncryptor(WordArray.create(keyWords.slice(2,4))),this._des3=DES.createEncryptor(WordArray.create(keyWords.slice(4,6)))},encryptBlock:function(M,offset){this._des1.encryptBlock(M,offset),this._des2.decryptBlock(M,offset),this._des3.encryptBlock(M,offset)},decryptBlock:function(M,offset){this._des3.decryptBlock(M,offset),this._des2.encryptBlock(M,offset),this._des1.decryptBlock(M,offset)},keySize:6,ivSize:2,blockSize:2});C.TripleDES=BlockCipher._createHelper(TripleDES)}(),CryptoJS.TripleDES})},{"./cipher-core":177,"./core":178,"./enc-base64":179,"./evpkdf":181,"./md5":186}],209:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(undefined){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,X32WordArray=C_lib.WordArray,C_x64=C.x64={};C_x64.Word=Base.extend({init:function(high,low){this.high=high,this.low=low}}),C_x64.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[],this.sigBytes=void 0!=sigBytes?sigBytes:8*words.length},toX32:function(){for(var x64Words=this.words,x64WordsLength=x64Words.length,x32Words=[],i=0;i0;count--)inputOff+=this._buffer(data,inputOff),outputOff+=this._flushBuffer(out,outputOff);return inputOff+=this._buffer(data,inputOff),out},Cipher.prototype.final=function(buffer){var first;buffer&&(first=this.update(buffer));var last;return last="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),first?first.concat(last):last},Cipher.prototype._pad=function(buffer,off){if(0===off)return!1;for(;off>>1];kL=utils.r28shl(kL,shift),kR=utils.r28shl(kR,shift),utils.pc2(kL,kR,state.keys,i)}},DES.prototype._update=function(inp,inOff,out,outOff){var state=this._desState,l=utils.readUInt32BE(inp,inOff),r=utils.readUInt32BE(inp,inOff+4);utils.ip(l,r,state.tmp,0),l=state.tmp[0],r=state.tmp[1],"encrypt"===this.type?this._encrypt(state,l,r,state.tmp,0):this._decrypt(state,l,r,state.tmp,0),l=state.tmp[0],r=state.tmp[1],utils.writeUInt32BE(out,l,outOff),utils.writeUInt32BE(out,r,outOff+4)},DES.prototype._pad=function(buffer,off){for(var value=buffer.length-off,i=off;i>>0,l=t}utils.rip(r,l,out,off)},DES.prototype._decrypt=function(state,lStart,rStart,out,off){for(var l=rStart,r=lStart,i=state.keys.length-2;i>=0;i-=2){var keyL=state.keys[i],keyR=state.keys[i+1];utils.expand(l,state.tmp,0),keyL^=state.tmp[0],keyR^=state.tmp[1];var s=utils.substitute(keyL,keyR),f=utils.permute(s),t=l;l=(r^f)>>>0,r=t}utils.rip(l,r,out,off)}},{"../des":210,inherits:258,"minimalistic-assert":273}],214:[function(require,module,exports){"use strict";function EDEState(type,key){assert.equal(key.length,24,"Invalid key length");var k1=key.slice(0,8),k2=key.slice(8,16),k3=key.slice(16,24);this.ciphers="encrypt"===type?[DES.create({type:"encrypt",key:k1}),DES.create({type:"decrypt",key:k2}),DES.create({type:"encrypt",key:k3})]:[DES.create({type:"decrypt",key:k3}),DES.create({type:"encrypt",key:k2}),DES.create({type:"decrypt",key:k1})]}function EDE(options){Cipher.call(this,options);var state=new EDEState(this.type,this.options.key);this._edeState=state}var assert=require("minimalistic-assert"),inherits=require("inherits"),des=require("../des"),Cipher=des.Cipher,DES=des.DES;inherits(EDE,Cipher),module.exports=EDE,EDE.create=function(options){return new EDE(options)},EDE.prototype._update=function(inp,inOff,out,outOff){var state=this._edeState;state.ciphers[0]._update(inp,inOff,out,outOff),state.ciphers[1]._update(out,outOff,out,outOff),state.ciphers[2]._update(out,outOff,out,outOff)},EDE.prototype._pad=DES.prototype._pad,EDE.prototype._unpad=DES.prototype._unpad},{"../des":210,inherits:258,"minimalistic-assert":273}],215:[function(require,module,exports){"use strict";exports.readUInt32BE=function(bytes,off){return(bytes[0+off]<<24|bytes[1+off]<<16|bytes[2+off]<<8|bytes[3+off])>>>0},exports.writeUInt32BE=function(bytes,value,off){bytes[0+off]=value>>>24,bytes[1+off]=value>>>16&255,bytes[2+off]=value>>>8&255,bytes[3+off]=255&value},exports.ip=function(inL,inR,out,off){for(var outL=0,outR=0,i=6;i>=0;i-=2){for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>>j+i&1;for(var j=0;j<=24;j+=8)outL<<=1,outL|=inL>>>j+i&1}for(var i=6;i>=0;i-=2){for(var j=1;j<=25;j+=8)outR<<=1,outR|=inR>>>j+i&1;for(var j=1;j<=25;j+=8)outR<<=1,outR|=inL>>>j+i&1}out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.rip=function(inL,inR,out,off){for(var outL=0,outR=0,i=0;i<4;i++)for(var j=24;j>=0;j-=8)outL<<=1,outL|=inR>>>j+i&1,outL<<=1,outL|=inL>>>j+i&1;for(var i=4;i<8;i++)for(var j=24;j>=0;j-=8)outR<<=1,outR|=inR>>>j+i&1,outR<<=1,outR|=inL>>>j+i&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.pc1=function(inL,inR,out,off){for(var outL=0,outR=0,i=7;i>=5;i--){for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>j+i&1;for(var j=0;j<=24;j+=8)outL<<=1,outL|=inL>>j+i&1}for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>j+i&1;for(var i=1;i<=3;i++){for(var j=0;j<=24;j+=8)outR<<=1,outR|=inR>>j+i&1;for(var j=0;j<=24;j+=8)outR<<=1,outR|=inL>>j+i&1}for(var j=0;j<=24;j+=8)outR<<=1,outR|=inL>>j+i&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.r28shl=function(num,shift){return num<>>28-shift};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];exports.pc2=function(inL,inR,out,off){for(var outL=0,outR=0,len=pc2table.length>>>1,i=0;i>>pc2table[i]&1;for(var i=len;i>>pc2table[i]&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.expand=function(r,out,off){var outL=0,outR=0;outL=(1&r)<<5|r>>>27;for(var i=23;i>=15;i-=4)outL<<=6,outL|=r>>>i&63;for(var i=11;i>=3;i-=4)outR|=r>>>i&63,outR<<=6;outR|=(31&r)<<1|r>>>31,out[off+0]=outL>>>0,out[off+1]=outR>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];exports.substitute=function(inL,inR){for(var out=0,i=0;i<4;i++){var b=inL>>>18-6*i&63,sb=sTable[64*i+b];out<<=4,out|=sb}for(var i=0;i<4;i++){var b=inR>>>18-6*i&63,sb=sTable[256+64*i+b];out<<=4,out|=sb}return out>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];exports.permute=function(num){for(var out=0,i=0;i>>permuteTable[i]&1;return out>>>0},exports.padSplit=function(num,size,group){for(var str=num.toString(2);str.lengthbits;)num.ishrn(1);if(num.isEven()&&num.iadd(ONE),num.testn(1)||num.iadd(TWO),gen.cmp(TWO)){if(!gen.cmp(FIVE))for(;num.mod(TEN).cmp(THREE);)num.iadd(FOUR)}else for(;num.mod(TWENTYFOUR).cmp(ELEVEN);)num.iadd(FOUR);if(n2=num.shrn(1),simpleSieve(n2)&&simpleSieve(num)&&fermatTest(n2)&&fermatTest(num)&&millerRabin.test(n2)&&millerRabin.test(num))return num}}var randomBytes=require("randombytes");module.exports=findPrime,findPrime.simpleSieve=simpleSieve,findPrime.fermatTest=fermatTest;var BN=require("bn.js"),TWENTYFOUR=new BN(24),MillerRabin=require("miller-rabin"),millerRabin=new MillerRabin,ONE=new BN(1),TWO=new BN(2),FIVE=new BN(5),TEN=(new BN(16),new BN(8),new BN(10)),THREE=new BN(3),ELEVEN=(new BN(7),new BN(11)),FOUR=new BN(4),primes=(new BN(12),null)},{"bn.js":99,"miller-rabin":272,randombytes:296}],219:[function(require,module,exports){module.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],220:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.hmacDRBG=require("./elliptic/hmac-drbg"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec")},{"../package.json":234,"./elliptic/curve":223,"./elliptic/curves":226,"./elliptic/ec":227,"./elliptic/hmac-drbg":230,"./elliptic/utils":232,brorand:100}],221:[function(require,module,exports){"use strict";function BaseCurve(type,conf){this.type=type,this.p=new bn(conf.p,16),this.red=conf.prime?bn.red(conf.prime):bn.mont(this.p),this.zero=new bn(0).toRed(this.red),this.one=new bn(1).toRed(this.red),this.two=new bn(2).toRed(this.red),this.n=conf.n&&new bn(conf.n,16),this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4)}function BasePoint(curve,type){this.curve=curve,this.type=type,this.precomputed=null}var bn=require("bn.js"),elliptic=require("../../elliptic"),getNAF=elliptic.utils.getNAF,getJSF=elliptic.utils.getJSF,assert=elliptic.utils.assert;module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(p,k){assert(p.precomputed);var doubles=p._getDoubles(),naf=getNAF(k,1),I=(1<=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}for(var a=this.jpoint(null,null,null),b=this.jpoint(null,null,null),i=I;i>0;i--){for(var j=0;j=0;i--){for(var k=0;i>=0&&0===naf[i];i--)k++;if(i>=0&&k++,acc=acc.dblp(k),i<0)break;var z=naf[i];assert(0!==z),acc="affine"===p.type?z>0?acc.mixedAdd(wnd[z-1>>1]):acc.mixedAdd(wnd[-z-1>>1].neg()):z>0?acc.add(wnd[z-1>>1]):acc.add(wnd[-z-1>>1].neg())}return"affine"===p.type?acc.toP():acc},BaseCurve.prototype._wnafMulAdd=function(defW,points,coeffs,len){for(var wndWidth=this._wnafT1,wnd=this._wnafT2,naf=this._wnafT3,max=0,i=0;i=1;i-=2){var a=i-1,b=i;if(1===wndWidth[a]&&1===wndWidth[b]){var comb=[points[a],null,null,points[b]];0===points[a].y.cmp(points[b].y)?(comb[1]=points[a].add(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg())):0===points[a].y.cmp(points[b].y.redNeg())?(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].add(points[b].neg())):(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg()));var index=[-3,-1,-5,-7,0,7,5,1,3],jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max),naf[a]=new Array(max),naf[b]=new Array(max);for(var j=0;j=0;i--){for(var k=0;i>=0;){for(var zero=!0,j=0;j=0&&k++,acc=acc.dblp(k),i<0)break;for(var j=0;j0?p=wnd[j][z-1>>1]:z<0&&(p=wnd[j][-z-1>>1].neg()),acc="affine"===p.type?acc.mixedAdd(p):acc.add(p))}}for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)},BasePoint.prototype._getDoubles=function(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var doubles=[this],acc=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),g=d.redAdd(b),f=g.redSub(c),h=d.redSub(b),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projDbl=function(){var nx,ny,nz,b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var e=this.curve._mulA(c),f=e.redAdd(d) -;if(this.zOne)nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)),ny=f.redMul(e.redSub(d)),nz=f.redSqr().redSub(f).redSub(f);else{var h=this.z.redSqr(),j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j),ny=f.redMul(e.redSub(d)),nz=f.redMul(j)}}else{var e=c.redAdd(d),h=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j),ny=this.curve._mulC(e).redMul(c.redISub(d)),nz=e.redMul(j)}return this.curve.point(nx,ny,nz)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),c=this.t.redMul(this.curve.dd).redMul(p.t),d=this.z.redMul(p.z.redAdd(p.z)),e=b.redSub(a),f=d.redSub(c),g=d.redAdd(c),h=b.redAdd(a),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projAdd=function(p){var ny,nz,a=this.z.redMul(p.z),b=a.redSqr(),c=this.x.redMul(p.x),d=this.y.redMul(p.y),e=this.curve.d.redMul(c).redMul(d),f=b.redSub(e),g=b.redAdd(e),tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),nx=a.redMul(f).redMul(tmp);return this.curve.twisted?(ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c))),nz=f.redMul(g)):(ny=a.redMul(g).redMul(d.redSub(c)),nz=this.curve._mulC(f).redMul(g)),this.curve.point(nx,ny,nz)},Point.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},Point.prototype.mul=function(k){return this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2)},Point.prototype.normalize=function(){if(this.zOne)return this;var zi=this.z.redInvm();return this.x=this.x.redMul(zi),this.y=this.y.redMul(zi),this.t&&(this.t=this.t.redMul(zi)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},{"../../elliptic":220,"../curve":223,"bn.js":233,inherits:258}],223:[function(require,module,exports){arguments[4][74][0].apply(exports,arguments)},{"./base":221,"./edwards":222,"./mont":224,"./short":225,dup:74}],224:[function(require,module,exports){"use strict";function MontCurve(conf){Base.call(this,"mont",conf),this.a=new bn(conf.a,16).toRed(this.red),this.b=new bn(conf.b,16).toRed(this.red),this.i4=new bn(4).toRed(this.red).redInvm(),this.two=new bn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective"),null===x&&null===z?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bn(x,16),this.z=new bn(z,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var curve=require("../curve"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(point){var x=point.normalize().x,x2=x.redSqr(),rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);return 0===rhs.redSqrt().redSqr().cmp(rhs)},inherits(Point,Base.BasePoint),MontCurve.prototype.point=function(x,z){return new Point(this,x,z)},MontCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)},Point.prototype.precompute=function(){},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var a=this.x.redAdd(this.z),aa=a.redSqr(),b=this.x.redSub(this.z),bb=b.redSqr(),c=aa.redSub(bb),nx=aa.redMul(bb),nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(p,diff){var a=this.x.redAdd(this.z),b=this.x.redSub(this.z),c=p.x.redAdd(p.z),d=p.x.redSub(p.z),da=d.redMul(a),cb=c.redMul(b),nx=diff.z.redMul(da.redAdd(cb).redSqr()),nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)},Point.prototype.mul=function(k){for(var t=k.clone(),a=this,b=this.curve.point(null,null),c=this,bits=[];0!==t.cmpn(0);t.ishrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--)0===bits[i]?(a=a.diffAdd(b,c),b=b.dbl()):(b=a.diffAdd(b,c),a=a.dbl());return b},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":223,"bn.js":233,inherits:258}],225:[function(require,module,exports){"use strict";function ShortCurve(conf){Base.call(this,"short",conf),this.a=new bn(conf.a,16).toRed(this.red),this.b=new bn(conf.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(conf),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine"),null===x&&null===y?(this.x=null,this.y=null,this.inf=!0):(this.x=new bn(x,16),this.y=new bn(y,16),isRed&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian"),null===x&&null===y&&null===z?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bn(0)):(this.x=new bn(x,16),this.y=new bn(y,16),this.z=new bn(z,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,assert=elliptic.utils.assert;inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(conf){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var beta,lambda;if(conf.beta)beta=new bn(conf.beta,16).toRed(this.red);else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1],beta=beta.toRed(this.red)}if(conf.lambda)lambda=new bn(conf.lambda,16);else{var lambdas=this._getEndoRoots(this.n);0===this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))?lambda=lambdas[0]:(lambda=lambdas[1],assert(0===this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))))}var basis;return basis=conf.basis?conf.basis.map(function(vec){return{a:new bn(vec.a,16),b:new bn(vec.b,16)}}):this._getEndoBasis(lambda),{beta:beta,lambda:lambda,basis:basis}}},ShortCurve.prototype._getEndoRoots=function(num){var red=num===this.p?this.red:bn.mont(num),tinv=new bn(2).toRed(red).redInvm(),ntinv=tinv.redNeg(),s=new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv);return[ntinv.redAdd(s).fromRed(),ntinv.redSub(s).fromRed()]},ShortCurve.prototype._getEndoBasis=function(lambda){for(var a0,b0,a1,b1,a2,b2,prevR,r,x,aprxSqrt=this.n.shrn(Math.floor(this.n.bitLength()/2)),u=lambda,v=this.n.clone(),x1=new bn(1),y1=new bn(0),x2=new bn(0),y2=new bn(1),i=0;0!==u.cmpn(0);){var q=v.div(u);r=v.sub(q.mul(u)),x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0)a0=prevR.neg(),b0=x1,a1=r.neg(),b1=x;else if(a1&&2==++i)break;prevR=r,v=u,u=r,x2=x1,x1=x,y2=y1,y1=y}a2=r.neg(),b2=x;var len1=a1.sqr().add(b1.sqr());return a2.sqr().add(b2.sqr()).cmp(len1)>=0&&(a2=a0,b2=b0),a1.sign&&(a1=a1.neg(),b1=b1.neg()),a2.sign&&(a2=a2.neg(),b2=b2.neg()),[{a:a1,b:b1},{a:a2,b:b2}]},ShortCurve.prototype._endoSplit=function(k){var basis=this.endo.basis,v1=basis[0],v2=basis[1],c1=v2.b.mul(k).divRound(this.n),c2=v1.b.neg().mul(k).divRound(this.n),p1=c1.mul(v1.a),p2=c2.mul(v2.a),q1=c1.mul(v1.b),q2=c2.mul(v2.b);return{k1:k.sub(p1).sub(p2),k2:q1.add(q2).neg()}},ShortCurve.prototype.pointFromX=function(odd,x){x=new bn(x,16),x.red||(x=x.toRed(this.red));var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),y=y2.redSqrt(),isOdd=y.fromRed().isOdd();return(odd&&!isOdd||!odd&&isOdd)&&(y=y.redNeg()),this.point(x,y)},ShortCurve.prototype.validate=function(point){if(point.inf)return!0;var x=point.x,y=point.y,ax=this.a.redMul(x),rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return 0===y.redSqr().redISub(rhs).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(points,coeffs){for(var npoints=this._endoWnafT1,ncoeffs=this._endoWnafT2,i=0;i":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(0===this.x.cmp(p.x))return this.curve.point(null,null);var c=this.y.redSub(p.y);0!==c.cmpn(0)&&(c=c.redMul(this.x.redSub(p.x).redInvm()));var nx=c.redSqr().redISub(this.x).redISub(p.x),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.dbl=function(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(0===ys1.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,x2=this.x.redSqr(),dyinv=ys1.redInvm(),c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv),nx=c.redSqr().redISub(this.x.redAdd(this.x)),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(k){return k=new bn(k,16),this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve.endo?this.curve._endoWnafMulAdd([this],[k]):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs):this.curve._wnafMulAdd(1,points,coeffs,2)},Point.prototype.eq=function(p){return this===p||this.inf===p.inf&&(this.inf||0===this.x.cmp(p.x)&&0===this.y.cmp(p.y))},Point.prototype.neg=function(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed,negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(x,y,z){return new JPoint(this,x,y,z)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm(),zinv2=zinv.redSqr(),ax=this.x.redMul(zinv2),ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr(),z2=this.z.redSqr(),u1=this.x.redMul(pz2),u2=p.x.redMul(z2),s1=this.y.redMul(pz2.redMul(p.z)),s2=p.y.redMul(z2.redMul(this.z)),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mixedAdd=function(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr(),u1=this.x,u2=p.x.redMul(z2),s1=this.y,s2=p.y.redMul(z2).redMul(this.z),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.dblp=function(pow){if(0===pow)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,i=0;i":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":220,"../curve":223,"bn.js":233,inherits:258}],226:[function(require,module,exports){"use strict";function PresetCurve(options){"short"===options.type?this.curve=new elliptic.curve.short(options):"edwards"===options.type?this.curve=new elliptic.curve.edwards(options):this.curve=new elliptic.curve.mont(options),this.g=this.curve.g,this.n=this.curve.n,this.hash=options.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,get:function(){var curve=new PresetCurve(options);return Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,value:curve}),curve}})}var curves=exports,hash=require("hash.js"),elliptic=require("../elliptic"),assert=elliptic.utils.assert;curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"../elliptic":220,"./precomputed/secp256k1":231,"hash.js":242}],227:[function(require,module,exports){"use strict";function EC(options){if(!(this instanceof EC))return new EC(options);"string"==typeof options&&(assert(elliptic.curves.hasOwnProperty(options),"Unknown curve "+options),options=elliptic.curves[options]),options instanceof elliptic.curves.PresetCurve&&(options={curve:options}),this.curve=options.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=options.curve.g,this.g.precompute(options.curve.n.bitLength()+1),this.hash=options.hash||options.curve.hash}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(options){return new KeyPair(this,options)},EC.prototype.keyFromPrivate=function(priv,enc){return KeyPair.fromPrivate(this,priv,enc)},EC.prototype.keyFromPublic=function(pub,enc){return KeyPair.fromPublic(this,pub,enc)},EC.prototype.genKeyPair=function(options){options||(options={});for(var drbg=new elliptic.hmacDRBG({hash:this.hash,pers:options.pers,entropy:options.entropy||elliptic.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),bytes=this.n.byteLength(),ns2=this.n.sub(new bn(2));;){var priv=new bn(drbg.generate(bytes));if(!(priv.cmp(ns2)>0))return priv.iaddn(1),this.keyFromPrivate(priv)}},EC.prototype._truncateToN=function(msg,truncOnly){var delta=8*msg.byteLength()-this.n.bitLength();return delta>0&&(msg=msg.shrn(delta)),!truncOnly&&msg.cmp(this.n)>=0?msg.sub(this.n):msg},EC.prototype.sign=function(msg,key,enc,options){"object"===(void 0===enc?"undefined":_typeof(enc))&&(options=enc,enc=null),options||(options={}),key=this.keyFromPrivate(key,enc),msg=this._truncateToN(new bn(msg,16));for(var bytes=this.n.byteLength(),bkey=key.getPrivate().toArray(),i=bkey.length;i<21;i++)bkey.unshift(0);for(var nonce=msg.toArray(),i=nonce.length;i=0)){var kp=this.g.mul(k);if(!kp.isInfinity()){var kpX=kp.getX(),r=kpX.mod(this.n);if(0!==r.cmpn(0)){var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n);if(0!==s.cmpn(0)){options.canonical&&s.cmp(this.nh)>0&&(s=this.n.sub(s));var recoveryParam=(kp.getY().isOdd()?1:0)|(0!==kpX.cmp(r)?2:0);return new Signature({r:r,s:s,recoveryParam:recoveryParam})}}}}}},EC.prototype.verify=function(msg,signature,key,enc){msg=this._truncateToN(new bn(msg,16)),key=this.keyFromPublic(key,enc),signature=new Signature(signature,"hex");var r=signature.r,s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var sinv=s.invm(this.n),u1=sinv.mul(msg).mod(this.n),u2=sinv.mul(r).mod(this.n),p=this.g.mulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&0===p.getX().mod(this.n).cmp(r)},EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits"),signature=new Signature(signature,enc);var n=this.n,e=new bn(msg),r=signature.r,s=signature.s,isYOdd=1&j,isSecondKey=j>>1;if(r.cmp(this.curve.p.mod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");r=this.curve.pointFromX(isYOdd,r);var eNeg=e.neg().mod(n),rInv=signature.r.invm(n);return r.mul(s).add(this.g.mul(eNeg)).mul(rInv)},EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){if(signature=new Signature(signature,enc),null!==signature.recoveryParam)return signature.recoveryParam;for(var i=0;i<4;i++){if(this.recoverPubKey(e,signature,i).eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":220,"./key":228,"./signature":229,"bn.js":233}],228:[function(require,module,exports){"use strict";function KeyPair(ec,options){this.ec=ec,this.priv=null,this.pub=null,options.priv&&this._importPrivate(options.priv,options.privEnc),options.pub&&this._importPublic(options.pub,options.pubEnc)}var bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=KeyPair,KeyPair.fromPublic=function(ec,pub,enc){return pub instanceof KeyPair?pub:new KeyPair(ec,{pub:pub,pubEnc:enc})},KeyPair.fromPrivate=function(ec,priv,enc){return priv instanceof KeyPair?priv:new KeyPair(ec,{priv:priv,privEnc:enc})},KeyPair.prototype.validate=function(){var pub=this.getPublic();return pub.isInfinity()?{result:!1,reason:"Invalid public key"}:pub.validate()?pub.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(compact,enc){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof compact&&(enc=compact,compact=null),!enc)return this.pub;for(var len=this.ec.curve.p.byteLength(),x=this.pub.getX().toArray(),i=x.length;i"}},{"../../elliptic":220,"bn.js":233}],229:[function(require,module,exports){"use strict";function Signature(options,enc){if(options instanceof Signature)return options;this._importDER(options,enc)||(assert(options.r&&options.s,"Signature without r or s"),this.r=new bn(options.r,16),this.s=new bn(options.s,16),null!==options.recoveryParam?this.recoveryParam=options.recoveryParam:this.recoveryParam=null)}var bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=Signature,Signature.prototype._importDER=function(data,enc){if(data=utils.toArray(data,enc),data.length<6||48!==data[0]||2!==data[2])return!1;if(1+data[1]>data.length)return!1;var rlen=data[3];if(rlen>=128)return!1;if(4+rlen+2>=data.length)return!1;if(2!==data[4+rlen])return!1;var slen=data[5+rlen];return!(slen>=128)&&(!(4+rlen+2+slen>data.length)&&(this.r=new bn(data.slice(4,4+rlen)),this.s=new bn(data.slice(4+rlen+2,4+rlen+2+slen)),this.recoveryParam=null,!0))},Signature.prototype.toDER=function(enc){var r=this.r.toArray(),s=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&s[0]&&(s=[0].concat(s));var total=r.length+s.length+4,res=[48,total,2,r.length];return res=res.concat(r,[2,s.length],s),utils.encode(res,enc)}},{"../../elliptic":220,"bn.js":233}],230:[function(require,module,exports){"use strict";function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash,this.predResist=!!options.predResist,this.outLen=this.hash.outSize,this.minEntropy=options.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc),nonce=utils.toArray(options.nonce,options.nonceEnc),pers=utils.toArray(options.pers,options.persEnc);assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(entropy,nonce,pers)}var hash=require("hash.js"),elliptic=require("../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=HmacDRBG,HmacDRBG.prototype._init=function(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(entropy.concat(add||[])),this.reseed=1},HmacDRBG.prototype.generate=function(len,enc,add,addEnc){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof enc&&(addEnc=add,add=enc,enc=null),add&&(add=utils.toArray(add,addEnc),this._update(add));for(var temp=[];temp.length>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}return res}function zero2(word){return 1===word.length?"0"+word:word}function toHex(msg){for(var res="",i=0;i=0;){var z;if(k.isOdd()){var mod=k.andln(ws-1);z=mod>(ws>>1)-1?(ws>>1)-mod:mod,k.isubn(z)}else z=0;naf.push(z);for(var shift=0!==k.cmpn(0)&&0===k.andln(ws-1)?w+1:1,i=1;i0||k2.cmpn(-d2)>0;){var m14=k1.andln(3)+d1&3,m24=k2.andln(3)+d2&3;3===m14&&(m14=-1),3===m24&&(m24=-1);var u1;if(0==(1&m14))u1=0;else{var m8=k1.andln(7)+d1&7;u1=3!==m8&&5!==m8||2!==m24?m14:-m14}jsf[0].push(u1);var u2;if(0==(1&m24))u2=0;else{var m8=k2.andln(7)+d2&7;u2=3!==m8&&5!==m8||2!==m14?m24:-m24}jsf[1].push(u2),2*d1===u1+1&&(d1=1-d1),2*d2===u2+1&&(d2=1-d2),k1.ishrn(1),k2.ishrn(1)}return jsf}var utils=exports;utils.assert=function(val,msg){if(!val)throw new Error(msg||"Assertion failed")},utils.toArray=toArray,utils.zero2=zero2,utils.toHex=toHex,utils.encode=function(arr,enc){return"hex"===enc?toHex(arr):arr},utils.getNAF=getNAF,utils.getJSF=getJSF},{}],233:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(module,exports){function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(null!==number&&"object"===(void 0===number?"undefined":_typeof(number))&&Array.isArray(number.words))return number;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==base&&"be"!==base||(endian=base,base=10),null!==number&&this._init(number||0,base||10,endian||"be")}function parseHex(str,start,end){for(var r=0,len=Math.min(str.length,end),i=start;i=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:15&c}return r}function parseBase(str,start,end,mul){for(var r=0,len=Math.min(str.length,end),i=start;i=49?c-49+10:c>=17?c-17+10:c}return r}function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(m){if("string"==typeof m){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else this.m=m,this.prime=null}function Mont(m){Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).ishln(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.sign=!0,this.minv=this.minv.mod(this.r)}"object"===(void 0===module?"undefined":_typeof(module))?module.exports=BN:exports.BN=BN,BN.BN=BN,BN.wordSize=26,BN.prototype._init=function(number,base,endian){if("number"==typeof number)return this._initNumber(number,base,endian);if("object"===(void 0===number?"undefined":_typeof(number)))return this._initArray(number,base,endian);"hex"===base&&(base=16),assert(base===(0|base)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;"-"===number[0]&&start++,16===base?this._parseHex(number,start):this._parseBase(number,base,start),"-"===number[0]&&(this.sign=!0),this.strip(),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initNumber=function(number,base,endian){number<0&&(this.sign=!0,number=-number),number<67108864?(this.words=[67108863&number],this.length=1):number<4503599627370496?(this.words=[67108863&number,number/67108864&67108863],this.length=2):(assert(number<9007199254740992),this.words=[67108863&number,number/67108864&67108863,1],this.length=3),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert("number"==typeof number.length),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<>>26-off&67108863,off+=24,off>=26&&(off-=26,j++)}else if("le"===endian)for(var i=0,j=0;i>>26-off&67108863,off+=24,off>=26&&(off-=26,j++)}return this.strip()},BN.prototype._parseHex=function(number,start){this.length=Math.ceil((number.length-start)/6),this.words=new Array(this.length);for(var i=0;i=start;i-=6){var w=parseHex(number,i,i+6);this.words[j]|=w<>>26-off&4194303,off+=24,off>=26&&(off-=26,j++)}if(i+6!==start){var w=parseHex(number,start,i+6);this.words[j]|=w<>>26-off&4194303}this.strip()},BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;for(var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0,i=start;i1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},BN.prototype.inspect=function(){return(this.red?""};var zeros=["","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"],groupSizes=[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],groupBases=[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];BN.prototype.toString=function(base,padding){if(16===(base=base||10)||"hex"===base){for(var out="",off=0,padding=0|padding||1,carry=0,i=0;i>>24-off&16777215,out=0!==carry||i!==this.length-1?zeros[6-word.length]+word+out:word+out,off+=2,off>=26&&(off-=26,i--)}for(0!==carry&&(out=carry.toString(16)+out);out.length%padding!=0;)out="0"+out;return this.sign&&(out="-"+out),out}if(base===(0|base)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base],out="",c=this.clone();for(c.sign=!1;0!==c.cmpn(0);){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase),out=0!==c.cmpn(0)?zeros[groupSize-r.length]+r+out:r+out}return 0===this.cmpn(0)&&(out="0"+out),this.sign&&(out="-"+out),out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toArray=function(endian){this.strip();var res=new Array(this.byteLength());res[0]=0;var q=this.clone();if("le"!==endian)for(var i=0;0!==q.cmpn(0);i++){var b=q.andln(255);q.ishrn(8),res[res.length-i-1]=b}else for(var i=0;0!==q.cmpn(0);i++){var b=q.andln(255);q.ishrn(8),res[i]=b}return res},Math.clz32?BN.prototype._countBits=function(w){return 32-Math.clz32(w)}:BN.prototype._countBits=function(w){var t=w,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function(w){if(0===w)return 26;var t=w,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function(){var hi=0,w=this.words[this.length-1],hi=this._countBits(w);return 26*(this.length-1)+hi},BN.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var r=0,i=0;inum.length?this.clone().ior(num):num.clone().ior(this)},BN.prototype.iand=function(num){this.sign=this.sign&&num.sign;var b;b=this.length>num.length?num:this;for(var i=0;inum.length?this.clone().iand(num):num.clone().iand(this)},BN.prototype.ixor=function(num){this.sign=this.sign||num.sign;var a,b;this.length>num.length?(a=this,b=num):(a=num,b=this);for(var i=0;inum.length?this.clone().ixor(num):num.clone().ixor(this)},BN.prototype.setn=function(bit,val){assert("number"==typeof bit&&bit>=0);for(var off=bit/26|0,wbit=bit%26;this.length<=off;)this.words[this.length++]=0;return this.words[off]=val?this.words[off]|1<num.length?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>>26}for(;0!==carry&&i>>26}if(this.length=a.length,0!==carry)this.words[this.length]=carry,this.length++;else if(a!==this)for(;inum.length?this.clone().iadd(num):num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.sign){num.sign=!1;var r=this.iadd(num);return num.sign=!0,r._normSign()}if(this.sign)return this.sign=!1,this.iadd(num),this.sign=!0,this._normSign();var cmp=this.cmp(num);if(0===cmp)return this.sign=!1,this.length=1,this.words[0]=0,this;var a,b;cmp>0?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>26,this.words[i]=67108863&r}for(;0!==carry&&i>26,this.words[i]=67108863&r}if(0===carry&&i>>26,rword=67108863&carry,maxJ=Math.min(k,num.length-1),j=Math.max(0,k-this.length+1);j<=maxJ;j++){var i=k-j,a=0|this.words[i],b=0|num.words[j],r=a*b,lo=67108863&r;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=67108863&lo,ncarry=ncarry+(lo>>>26)|0}out.words[k]=rword,carry=ncarry}return 0!==carry?out.words[k]=carry:out.length--,out.strip()},BN.prototype._bigMulTo=function(num,out){out.sign=num.sign!==this.sign,out.length=this.length+num.length;for(var carry=0,hncarry=0,k=0;k>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}return 0!==carry?out.words[k]=carry:out.length--,out.strip()},BN.prototype.mulTo=function(num,out){return this.length+num.length<63?this._smallMulTo(num,out):this._bigMulTo(num,out)},BN.prototype.mul=function(num){var out=new BN(null);return out.words=new Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.imul=function(num){if(0===this.cmpn(0)||0===num.cmpn(0))return this.words[0]=0,this.length=1,this;var tlen=this.length,nlen=num.length;this.sign=num.sign!==this.sign,this.length=this.length+num.length,this.words[this.length-1]=0;for(var k=this.length-2;k>=0;k--){for(var carry=0,rword=0,maxJ=Math.min(k,nlen-1),j=Math.max(0,k-tlen+1);j<=maxJ;j++){var i=k-j,a=this.words[i],b=num.words[j],r=a*b,lo=67108863&r;carry+=r/67108864|0,lo+=rword,rword=67108863&lo,carry+=lo>>>26}this.words[k]=rword,this.words[k+1]+=carry,carry=0}for(var carry=0,i=1;i>>26}return this.strip()},BN.prototype.imuln=function(num){assert("number"==typeof num);for(var carry=0,i=0;i>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i]=67108863&lo}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.mul(this)},BN.prototype.ishln=function(bits){assert("number"==typeof bits&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r;if(0!==r){for(var carry=0,i=0;i>>26-r}carry&&(this.words[i]=carry,this.length++)}if(0!==s){for(var i=this.length-1;i>=0;i--)this.words[i+s]=this.words[i];for(var i=0;i=0);var h;h=hint?(hint-hint%26)/26:0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<s){this.length-=s;for(var i=0;i=0&&(0!==carry||i>=h);i--){var word=this.words[i];this.words[i]=carry<<26-r|word>>>r,carry=word&mask}return maskedWords&&0!==carry&&(maskedWords.words[maskedWords.length++]=carry),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.testn=function(bit){assert("number"==typeof bit&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<=0);var r=bits%26,s=(bits-r)/26;if(assert(!this.sign,"imaskn works only with positive numbers"),0!==r&&s++,this.length=Math.min(s,this.length),0!==r){var mask=67108863^67108863>>>r<=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},BN.prototype.isubn=function(num){if(assert("number"==typeof num),num<0)return this.iaddn(-num);if(this.sign)return this.sign=!1,this.iaddn(num),this.sign=!0,this;this.words[0]-=num;for(var i=0;i>26)-(right/67108864|0),this.words[i+shift]=67108863&w}for(;i>26,this.words[i+shift]=67108863&w}if(0===carry)return this.strip();assert(-1===carry),carry=0;for(var i=0;i>26,this.words[i]=67108863&w}return this.sign=!0,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1];0!==(shift=26-this._countBits(bhi))&&(b=b.shln(shift),a.ishln(shift),bhi=b.words[b.length-1]);var q,m=a.length-b.length;if("mod"!==mode){q=new BN(null),q.length=m+1,q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=67108864*a.words[b.length+j]+a.words[b.length+j-1];for(qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);a.sign;)qj--,a.sign=!1,a._ishlnsubmul(b,1,j),0!==a.cmpn(0)&&(a.sign=!a.sign);q&&(q.words[j]=qj)}return q&&q.strip(),a.strip(),"div"!==mode&&0!==shift&&a.ishrn(shift),{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode){if(assert(0!==num.cmpn(0)),this.sign&&!num.sign){var div,mod,res=this.neg().divmod(num,mode);return"mod"!==mode&&(div=res.div.neg()),"div"!==mode&&(mod=0===res.mod.cmpn(0)?res.mod:num.sub(res.mod)),{div:div,mod:mod}}if(!this.sign&&num.sign){var div,res=this.divmod(num.neg(),mode);return"mod"!==mode&&(div=res.div.neg()),{div:div,mod:res.mod}}return this.sign&&num.sign?this.neg().divmod(num.neg(),mode):num.length>this.length||this.cmp(num)<0?{div:new BN(0),mod:this}:1===num.length?"div"===mode?{div:this.divn(num.words[0]),mod:null}:"mod"===mode?{div:null,mod:new BN(this.modn(num.words[0]))}:{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}:this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div").div},BN.prototype.mod=function(num){return this.divmod(num,"mod").mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(0===dm.mod.cmpn(0))return dm.div;var mod=dm.div.sign?dm.mod.isub(num):dm.mod,half=num.shrn(1),r2=num.andln(1),cmp=mod.cmp(half);return cmp<0||1===r2&&0===cmp?dm.div:dm.div.sign?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);for(var p=(1<<26)%num,acc=0,i=this.length-1;i>=0;i--)acc=(p*acc+this.words[i])%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);for(var carry=0,i=this.length-1;i>=0;i--){var w=this.words[i]+67108864*carry;this.words[i]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(!p.sign),assert(0!==p.cmpn(0));var x=this,y=p.clone();x=x.sign?x.mod(p):x.clone();for(var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;x.isEven()&&y.isEven();)x.ishrn(1),y.ishrn(1),++g;for(var yp=y.clone(),xp=x.clone();0!==x.cmpn(0);){for(;x.isEven();)x.ishrn(1),A.isEven()&&B.isEven()?(A.ishrn(1),B.ishrn(1)):(A.iadd(yp).ishrn(1),B.isub(xp).ishrn(1));for(;y.isEven();)y.ishrn(1),C.isEven()&&D.isEven()?(C.ishrn(1),D.ishrn(1)):(C.iadd(yp).ishrn(1),D.isub(xp).ishrn(1));x.cmp(y)>=0?(x.isub(y),A.isub(C),B.isub(D)):(y.isub(x),C.isub(A),D.isub(B))}return{a:C,b:D,gcd:y.ishln(g)}},BN.prototype._invmp=function(p){assert(!p.sign),assert(0!==p.cmpn(0));var a=this,b=p.clone();a=a.sign?a.mod(p):a.clone();for(var x1=new BN(1),x2=new BN(0),delta=b.clone();a.cmpn(1)>0&&b.cmpn(1)>0;){for(;a.isEven();)a.ishrn(1),x1.isEven()?x1.ishrn(1):x1.iadd(delta).ishrn(1);for(;b.isEven();)b.ishrn(1),x2.isEven()?x2.ishrn(1):x2.iadd(delta).ishrn(1);a.cmp(b)>=0?(a.isub(b),x1.isub(x2)):(b.isub(a),x2.isub(x1))}return 0===a.cmpn(1)?x1:x2},BN.prototype.gcd=function(num){if(0===this.cmpn(0))return num.clone();if(0===num.cmpn(0))return this.clone();var a=this.clone(),b=num.clone();a.sign=!1,b.sign=!1;for(var shift=0;a.isEven()&&b.isEven();shift++)a.ishrn(1),b.ishrn(1);for(;;){for(;a.isEven();)a.ishrn(1);for(;b.isEven();)b.ishrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(0===r||0===b.cmpn(1))break;a.isub(b)}return b.ishln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.mod(num)},BN.prototype.isEven=function(){return 0==(1&this.words[0])},BN.prototype.isOdd=function(){return 1==(1&this.words[0])},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert("number"==typeof bit);var r=bit%26,s=(bit-r)/26,q=1<>>26,w&=67108863,this.words[i]=w}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.cmpn=function(num){var sign=num<0;if(sign&&(num=-num),this.sign&&!sign)return-1;if(!this.sign&&sign)return 1;num&=67108863,this.strip();var res;if(this.length>1)res=1;else{var w=this.words[0];res=w===num?0:wnum.length)return 1;if(this.length=0;i--){var a=this.words[i],b=num.words[i];if(a!==b){ab&&(res=1);break}}return res},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(!this.sign,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=new Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var rlen,r=num;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen0?r.isub(this.p):r.strip(),r},MPrime.prototype.split=function(input,out){input.ishrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function(input,output){for(var outLen=Math.min(input.length,9),i=0;i>>22,prev=next}input.words[i-10]=prev>>>22,input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;for(var hi,lo=0,i=0;i>>=26,num.words[i]=lo,carry=hi}return 0!==carry&&(num.words[num.length++]=carry),num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if("k256"===name)prime=new K256;else if("p224"===name)prime=new P224;else if("p192"===name)prime=new P192;else{if("p25519"!==name)throw new Error("Unknown prime "+name);prime=new P25519}return primes[name]=prime,prime},Red.prototype._verify1=function(a){assert(!a.sign,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert(!a.sign&&!b.sign,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.mod(this.m)._forceRed(this)},Red.prototype.neg=function(a){var r=a.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);return res.cmp(this.m)>=0&&res.isub(this.m),res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);return res.cmp(this.m)>=0&&res.isub(this.m),res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);return res.cmpn(0)<0&&res.iadd(this.m),res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);return res.cmpn(0)<0&&res.iadd(this.m),res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.shln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a)},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(0===a.cmpn(0))return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2==1),3===mod3){var pow=this.m.add(new BN(1)).ishrn(2),r=this.pow(a,pow);return r}for(var q=this.m.subn(1),s=0;0!==q.cmpn(0)&&0===q.andln(1);)s++,q.ishrn(1);assert(0!==q.cmpn(0));var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).ishrn(1),z=this.m.bitLength();for(z=new BN(2*z*z).toRed(this);0!==this.pow(z,lpow).cmp(nOne);)z.redIAdd(nOne);for(var c=this.pow(z,q),r=this.pow(a,q.addn(1).ishrn(1)),t=this.pow(a,q),m=s;0!==t.cmp(one);){for(var tmp=t,i=0;0!==tmp.cmp(one);i++)tmp=tmp.redSqr();assert(i=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.mul=function(a,b){if(0===a.cmpn(0)||0===b.cmpn(0))return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).ishrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.invm=function(a){return this.imod(a._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===module||module,void 0)},{}],234:[function(require,module,exports){module.exports={_args:[["elliptic@3.1.0","/home/chris/dev/eth-lightwallet"]],_from:"elliptic@3.1.0",_id:"elliptic@3.1.0",_inBundle:!1,_integrity:"sha1-whaC73YnabVqdCAWCRBdoR1fYMw=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@3.1.0",name:"elliptic",escapedName:"elliptic",rawSpec:"3.1.0",saveSpec:null,fetchSpec:"3.1.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz",_spec:"3.1.0",_where:"/home/chris/dev/eth-lightwallet",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^2.0.3",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},description:"EC cryptography",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},version:"3.1.0"}},{}],235:[function(require,module,exports){module.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},{}],236:[function(require,module,exports){(function(Buffer){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var ethUtil=require("ethereumjs-util"),fees=require("ethereum-common/params.json"),BN=ethUtil.BN,N_DIV_2=new BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),Transaction=function(){function Transaction(data){_classCallCheck(this,Transaction),data=data||{};var fields=[{name:"nonce",length:32,allowLess:!0,default:new Buffer([])},{name:"gasPrice",length:32,allowLess:!0,default:new Buffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new Buffer([])},{name:"to",allowZero:!0,length:20,default:new Buffer([])},{name:"value",length:32,allowLess:!0,default:new Buffer([])},{name:"data",alias:"input",allowZero:!0,default:new Buffer([])},{name:"v",allowZero:!0,default:new Buffer([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])}];ethUtil.defineProperties(this,fields,data),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var sigV=ethUtil.bufferToInt(this.v),chainId=Math.floor((sigV-35)/2);chainId<0&&(chainId=0),this._chainId=chainId||data.chainId||0,this._homestead=!0}return Transaction.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},Transaction.prototype.hash=function(includeSignature){void 0===includeSignature&&(includeSignature=!0);var items=void 0;if(includeSignature)items=this.raw;else if(this._chainId>0){var raw=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,items=this.raw,this.raw=raw}else items=this.raw.slice(0,6);return ethUtil.rlphash(items)},Transaction.prototype.getChainId=function(){return this._chainId},Transaction.prototype.getSenderAddress=function(){if(this._from)return this._from;var pubkey=this.getSenderPublicKey();return this._from=ethUtil.publicToAddress(pubkey),this._from},Transaction.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},Transaction.prototype.verifySignature=function(){var msgHash=this.hash(!1);if(this._homestead&&1===new BN(this.s).cmp(N_DIV_2))return!1;try{var v=ethUtil.bufferToInt(this.v);this._chainId>0&&(v-=2*this._chainId+8),this._senderPubKey=ethUtil.ecrecover(msgHash,v,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},Transaction.prototype.sign=function(privateKey){var msgHash=this.hash(!1),sig=ethUtil.ecsign(msgHash,privateKey);this._chainId>0&&(sig.v+=2*this._chainId+8),Object.assign(this,sig)},Transaction.prototype.getDataFee=function(){for(var data=this.raw[5],cost=new BN(0),i=0;i0&&errors.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===stringError||!1===stringError?0===errors.length:errors.join(" ")},Transaction}();module.exports=Transaction}).call(this,require("buffer").Buffer)},{buffer:150,"ethereum-common/params.json":235,"ethereumjs-util":237}],237:[function(require,module,exports){(function(Buffer){"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return void 0===obj?"undefined":_typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":void 0===obj?"undefined":_typeof2(obj)},createKeccakHash=require("keccak"),secp256k1=require("secp256k1"),assert=require("assert"),rlp=require("rlp"),BN=require("bn.js"),createHash=require("create-hash");Object.assign(exports,require("ethjs-util")),exports.MAX_INTEGER=new BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),exports.TWO_POW256=new BN("10000000000000000000000000000000000000000000000000000000000000000",16),exports.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",exports.SHA3_NULL=Buffer.from(exports.SHA3_NULL_S,"hex"),exports.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",exports.SHA3_RLP_ARRAY=Buffer.from(exports.SHA3_RLP_ARRAY_S,"hex"),exports.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",exports.SHA3_RLP=Buffer.from(exports.SHA3_RLP_S,"hex"),exports.BN=BN,exports.rlp=rlp,exports.secp256k1=secp256k1,exports.zeros=function(bytes){return Buffer.allocUnsafe(bytes).fill(0)},exports.setLengthLeft=exports.setLength=function(msg,length,right){var buf=exports.zeros(length);return msg=exports.toBuffer(msg),right?msg.length0&&"0"===first.toString();)a=a.slice(1),first=a[0];return a},exports.toBuffer=function(v){if(!Buffer.isBuffer(v))if(Array.isArray(v))v=Buffer.from(v);else if("string"==typeof v)v=exports.isHexString(v)?Buffer.from(exports.padToEven(exports.stripHexPrefix(v)),"hex"):Buffer.from(v);else if("number"==typeof v)v=exports.intToBuffer(v);else if(null===v||void 0===v)v=Buffer.allocUnsafe(0);else{if(!v.toArray)throw new Error("invalid type");v=Buffer.from(v.toArray())}return v},exports.bufferToInt=function(buf){return new BN(exports.toBuffer(buf)).toNumber()},exports.bufferToHex=function(buf){return buf=exports.toBuffer(buf),"0x"+buf.toString("hex")},exports.fromSigned=function(num){return new BN(num).fromTwos(256)},exports.toUnsigned=function(num){return Buffer.from(num.toTwos(256).toArray())},exports.sha3=function(a,bits){return a=exports.toBuffer(a),bits||(bits=256),createKeccakHash("keccak"+bits).update(a).digest()},exports.sha256=function(a){return a=exports.toBuffer(a),createHash("sha256").update(a).digest()},exports.ripemd160=function(a,padded){a=exports.toBuffer(a);var hash=createHash("rmd160").update(a).digest();return!0===padded?exports.setLength(hash,32):hash},exports.rlphash=function(a){return exports.sha3(rlp.encode(a))},exports.isValidPrivate=function(privateKey){return secp256k1.privateKeyVerify(privateKey)},exports.isValidPublic=function(publicKey,sanitize){return 64===publicKey.length?secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]),publicKey])):!!sanitize&&secp256k1.publicKeyVerify(publicKey)},exports.pubToAddress=exports.publicToAddress=function(pubKey,sanitize){return pubKey=exports.toBuffer(pubKey),sanitize&&64!==pubKey.length&&(pubKey=secp256k1.publicKeyConvert(pubKey,!1).slice(1)),assert(64===pubKey.length),exports.sha3(pubKey).slice(-20)};var privateToPublic=exports.privateToPublic=function(privateKey){return privateKey=exports.toBuffer(privateKey),secp256k1.publicKeyCreate(privateKey,!1).slice(1)};exports.importPublic=function(publicKey){return publicKey=exports.toBuffer(publicKey),64!==publicKey.length&&(publicKey=secp256k1.publicKeyConvert(publicKey,!1).slice(1)),publicKey},exports.ecsign=function(msgHash,privateKey){var sig=secp256k1.sign(msgHash,privateKey),ret={};return ret.r=sig.signature.slice(0,32),ret.s=sig.signature.slice(32,64),ret.v=sig.recovery+27,ret},exports.hashPersonalMessage=function(message){var prefix=exports.toBuffer("Ethereum Signed Message:\n"+message.length.toString());return exports.sha3(Buffer.concat([prefix,message]))},exports.ecrecover=function(msgHash,v,r,s){var signature=Buffer.concat([exports.setLength(r,32),exports.setLength(s,32)],64),recovery=v-27;if(0!==recovery&&1!==recovery)throw new Error("Invalid signature v value");var senderPubKey=secp256k1.recover(msgHash,signature,recovery);return secp256k1.publicKeyConvert(senderPubKey,!1).slice(1)},exports.toRpcSig=function(v,r,s){if(27!==v&&28!==v)throw new Error("Invalid recovery id");return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r,32),exports.setLengthLeft(s,32),exports.toBuffer(v-27)]))},exports.fromRpcSig=function(sig){if(sig=exports.toBuffer(sig),65!==sig.length)throw new Error("Invalid signature length");var v=sig[64];return v<27&&(v+=27),{v:v,r:sig.slice(0,32),s:sig.slice(32,64)}},exports.privateToAddress=function(privateKey){return exports.publicToAddress(privateToPublic(privateKey))},exports.isValidAddress=function(address){return/^0x[0-9a-fA-F]{40}$/i.test(address)},exports.toChecksumAddress=function(address){address=exports.stripHexPrefix(address).toLowerCase();for(var hash=exports.sha3(address).toString("hex"),ret="0x",i=0;i=8?ret+=address[i].toUpperCase():ret+=address[i];return ret},exports.isValidChecksumAddress=function(address){return exports.isValidAddress(address)&&exports.toChecksumAddress(address)===address},exports.generateAddress=function(from,nonce){return from=exports.toBuffer(from),nonce=new BN(nonce),nonce=nonce.isZero()?null:Buffer.from(nonce.toArray()),exports.rlphash([from,nonce]).slice(-20)},exports.isPrecompiled=function(address){var a=exports.unpad(address);return 1===a.length&&a[0]>0&&a[0]<5},exports.addHexPrefix=function(str){return"string"!=typeof str?str:exports.isHexPrefixed(str)?str:"0x"+str},exports.isValidSignature=function(v,r,s,homestead){var SECP256K1_N_DIV_2=new BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),SECP256K1_N=new BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===r.length&&32===s.length&&((27===v||28===v)&&(r=new BN(r),s=new BN(s),!(r.isZero()||r.gt(SECP256K1_N)||s.isZero()||s.gt(SECP256K1_N))&&(!1!==homestead||1!==new BN(s).cmp(SECP256K1_N_DIV_2))))},exports.baToJSON=function(ba){if(Buffer.isBuffer(ba))return"0x"+ba.toString("hex");if(ba instanceof Array){for(var array=[],i=0;i=v.length,"The field "+field.name+" must not have more "+field.length+" bytes")):field.allowZero&&0===v.length||!field.length||assert(field.length===v.length,"The field "+field.name+" must have byte length of "+field.length),self.raw[i]=v}self._fields.push(field.name),Object.defineProperty(self,field.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),field.default&&(self[field.name]=field.default),field.alias&&Object.defineProperty(self,field.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})}),data)if("string"==typeof data&&(data=Buffer.from(exports.stripHexPrefix(data),"hex")),Buffer.isBuffer(data)&&(data=rlp.decode(data)),Array.isArray(data)){if(data.length>self._fields.length)throw new Error("wrong number of fields in data");data.forEach(function(d,i){self[self._fields[i]]=exports.toBuffer(d)})}else{if("object"!==(void 0===data?"undefined":_typeof(data)))throw new Error("invalid data");var keys=Object.keys(data);fields.forEach(function(field){-1!==keys.indexOf(field.name)&&(self[field.name]=data[field.name]),-1!==keys.indexOf(field.alias)&&(self[field.alias]=data[field.alias])})}}}).call(this,require("buffer").Buffer)},{assert:21,"bn.js":99,buffer:150,"create-hash":170,"ethjs-util":238,keccak:262,rlp:312,secp256k1:315}],238:[function(require,module,exports){(function(Buffer){"use strict";function padToEven(value){var a=value;if("string"!=typeof a)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+(void 0===a?"undefined":_typeof(a))+", while padToEven.");return a.length%2&&(a="0"+a),a}function intToHex(i){return"0x"+padToEven(i.toString(16))}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex.slice(2),"hex")}function getBinarySize(str){if("string"!=typeof str)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+(void 0===str?"undefined":_typeof(str))+"'.");return Buffer.byteLength(str,"utf8")}function arrayContainsArray(superset,subset,some){if(!0!==Array.isArray(superset))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+(void 0===superset?"undefined":_typeof(superset))+"'");if(!0!==Array.isArray(subset))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+(void 0===subset?"undefined":_typeof(subset))+"'");return subset[Boolean(some)&&"some"||"every"](function(value){return superset.indexOf(value)>=0})}function toUtf8(hex){return new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g,"")),"hex").toString("utf8")}function toAscii(hex){var str="",i=0,l=hex.length;for("0x"===hex.substring(0,2)&&(i=2);i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],240:[function(require,module,exports){"use strict";function EVP_BytesToKey(password,salt,keyBits,ivLen){if(Buffer.isBuffer(password)||(password=Buffer.from(password,"binary")),salt&&(Buffer.isBuffer(salt)||(salt=Buffer.from(salt,"binary")),8!==salt.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var keyLen=keyBits/8,key=Buffer.alloc(keyLen),iv=Buffer.alloc(ivLen||0),tmp=Buffer.alloc(0);keyLen>0||ivLen>0;){var hash=new MD5;hash.update(tmp),hash.update(password),salt&&hash.update(salt),tmp=hash.digest();var used=0;if(keyLen>0){var keyStart=key.length-keyLen;used=Math.min(keyLen,tmp.length),tmp.copy(key,keyStart,0,used),keyLen-=used}if(used0){var ivStart=iv.length-ivLen,length=Math.min(ivLen,tmp.length-used);tmp.copy(iv,ivStart,used,used+length),ivLen-=length}}return tmp.fill(0),{key:key,iv:iv}}var Buffer=require("safe-buffer").Buffer,MD5=require("md5.js");module.exports=EVP_BytesToKey},{"md5.js":270,"safe-buffer":313}],241:[function(require,module,exports){(function(Buffer){"use strict";function HashBase(blockSize){Transform.call(this),this._block=new Buffer(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var Transform=require("stream").Transform;require("inherits")(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{"buffer"!==encoding&&(chunk=new Buffer(chunk,encoding)),this.update(chunk)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this._digest())}catch(err){error=err}callback(error)},HashBase.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&"string"!=typeof data)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");Buffer.isBuffer(data)||(data=new Buffer(data,encoding||"binary"));for(var block=this._block,offset=0;this._blockOffset+data.length-offset>=this._blockSize;){for(var i=this._blockOffset;i0;++j)this._length[j]+=carry,(carry=this._length[j]/4294967296|0)>0&&(this._length[j]-=4294967296*carry);return this},HashBase.prototype._update=function(data){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var digest=this._digest();return void 0!==encoding&&(digest=digest.toString(encoding)),digest},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase}).call(this,require("buffer").Buffer)},{buffer:150,inherits:258,stream:345}],242:[function(require,module,exports){"use strict";var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.sha384=hash.sha.sha384,hash.sha512=hash.sha.sha512,hash.ripemd160=hash.ripemd.ripemd160},{"./hash/common":243,"./hash/hmac":244,"./hash/ripemd":245,"./hash/sha":246,"./hash/utils":253}],243:[function(require,module,exports){"use strict";function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var utils=require("./utils"),assert=require("minimalistic-assert");exports.BlockHash=BlockHash,BlockHash.prototype.update=function(msg,enc){if(msg=utils.toArray(msg,enc),this.pending?this.pending=this.pending.concat(msg):this.pending=msg,this.pendingTotal+=msg.length,this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length),0===this.pending.length&&(this.pending=null), -msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i>>24&255,res[i++]=len>>>16&255,res[i++]=len>>>8&255,res[i++]=255&len}else for(res[i++]=255&len,res[i++]=len>>>8&255,res[i++]=len>>>16&255,res[i++]=len>>>24&255,res[i++]=0,res[i++]=0,res[i++]=0,res[i++]=0,t=8;tthis.blockSize&&(key=(new this.Hash).update(key).digest()),assert(key.length<=this.blockSize);for(var i=key.length;i>>3}function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}var utils=require("../utils"),rotr32=utils.rotr32;exports.ft_1=ft_1,exports.ch32=ch32,exports.maj32=maj32,exports.p32=p32,exports.s0_256=s0_256,exports.s1_256=s1_256,exports.g0_256=g0_256,exports.g1_256=g1_256},{"../utils":253}],253:[function(require,module,exports){"use strict";function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if("string"==typeof msg)if(enc){if("hex"===enc)for(msg=msg.replace(/[^a-z0-9]+/gi,""),msg.length%2!=0&&(msg="0"+msg),i=0;i>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}else for(i=0;i>>24|w>>>8&65280|w<<8&16711680|(255&w)<<24)>>>0}function toHex32(msg,endian){for(var res="",i=0;i>>0}return res}function split32(msg,endian){for(var res=new Array(4*msg.length),i=0,k=0;i>>24,res[k+1]=m>>>16&255,res[k+2]=m>>>8&255,res[k+3]=255&m):(res[k+3]=m>>>24,res[k+2]=m>>>16&255,res[k+1]=m>>>8&255,res[k]=255&m)}return res}function rotr32(w,b){return w>>>b|w<<32-b}function rotl32(w,b){return w<>>32-b}function sum32(a,b){return a+b>>>0}function sum32_3(a,b,c){return a+b+c>>>0}function sum32_4(a,b,c,d){return a+b+c+d>>>0}function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}function sum64(buf,pos,ah,al){var bh=buf[pos],bl=buf[pos+1],lo=al+bl>>>0,hi=(lo>>0,buf[pos+1]=lo}function sum64_hi(ah,al,bh,bl){return(al+bl>>>0>>0}function sum64_lo(ah,al,bh,bl){return al+bl>>>0}function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0,lo=al;return lo=lo+bl>>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0}function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){return al+bl+cl+dl>>>0}function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0,lo=al;return lo=lo+bl>>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0}function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){return al+bl+cl+dl+el>>>0}function rotr64_hi(ah,al,num){return(al<<32-num|ah>>>num)>>>0}function rotr64_lo(ah,al,num){return(ah<<32-num|al>>>num)>>>0}function shr64_hi(ah,al,num){return ah>>>num}function shr64_lo(ah,al,num){return(ah<<32-num|al>>>num)>>>0}var assert=require("minimalistic-assert"),inherits=require("inherits");exports.inherits=inherits,exports.toArray=toArray,exports.toHex=toHex,exports.htonl=htonl,exports.toHex32=toHex32,exports.zero2=zero2,exports.zero8=zero8,exports.join32=join32,exports.split32=split32,exports.rotr32=rotr32,exports.rotl32=rotl32,exports.sum32=sum32,exports.sum32_3=sum32_3,exports.sum32_4=sum32_4,exports.sum32_5=sum32_5,exports.sum64=sum64,exports.sum64_hi=sum64_hi,exports.sum64_lo=sum64_lo,exports.sum64_4_hi=sum64_4_hi,exports.sum64_4_lo=sum64_4_lo,exports.sum64_5_hi=sum64_5_hi,exports.sum64_5_lo=sum64_5_lo,exports.rotr64_hi=rotr64_hi,exports.rotr64_lo=rotr64_lo,exports.shr64_hi=shr64_hi,exports.shr64_lo=shr64_lo},{inherits:254,"minimalistic-assert":273}],254:[function(require,module,exports){"use strict";"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],255:[function(require,module,exports){"use strict";function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash,this.predResist=!!options.predResist,this.outLen=this.hash.outSize,this.minEntropy=options.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex"),nonce=utils.toArray(options.nonce,options.nonceEnc||"hex"),pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(entropy,nonce,pers)}var hash=require("hash.js"),utils=require("minimalistic-crypto-utils"),assert=require("minimalistic-assert");module.exports=HmacDRBG,HmacDRBG.prototype._init=function(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(entropy.concat(add||[])),this._reseed=1},HmacDRBG.prototype.generate=function(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof enc&&(addEnc=add,add=enc,enc=null),add&&(add=utils.toArray(add,addEnc||"hex"),this._update(add));for(var temp=[];temp.length>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],257:[function(require,module,exports){"use strict";var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i>>31),hi=hi4^(hi1<<1|lo1>>>31),t1slo0=s[0]^lo,t1shi0=s[1]^hi,t1slo5=s[10]^lo,t1shi5=s[11]^hi,t1slo10=s[20]^lo,t1shi10=s[21]^hi,t1slo15=s[30]^lo,t1shi15=s[31]^hi,t1slo20=s[40]^lo,t1shi20=s[41]^hi;lo=lo0^(lo2<<1|hi2>>>31),hi=hi0^(hi2<<1|lo2>>>31);var t1slo1=s[2]^lo,t1shi1=s[3]^hi,t1slo6=s[12]^lo,t1shi6=s[13]^hi,t1slo11=s[22]^lo,t1shi11=s[23]^hi,t1slo16=s[32]^lo,t1shi16=s[33]^hi,t1slo21=s[42]^lo,t1shi21=s[43]^hi;lo=lo1^(lo3<<1|hi3>>>31),hi=hi1^(hi3<<1|lo3>>>31);var t1slo2=s[4]^lo,t1shi2=s[5]^hi,t1slo7=s[14]^lo,t1shi7=s[15]^hi,t1slo12=s[24]^lo,t1shi12=s[25]^hi,t1slo17=s[34]^lo,t1shi17=s[35]^hi,t1slo22=s[44]^lo,t1shi22=s[45]^hi;lo=lo2^(lo4<<1|hi4>>>31),hi=hi2^(hi4<<1|lo4>>>31);var t1slo3=s[6]^lo,t1shi3=s[7]^hi,t1slo8=s[16]^lo,t1shi8=s[17]^hi,t1slo13=s[26]^lo,t1shi13=s[27]^hi,t1slo18=s[36]^lo,t1shi18=s[37]^hi,t1slo23=s[46]^lo,t1shi23=s[47]^hi;lo=lo3^(lo0<<1|hi0>>>31),hi=hi3^(hi0<<1|lo0>>>31) -;var t1slo4=s[8]^lo,t1shi4=s[9]^hi,t1slo9=s[18]^lo,t1shi9=s[19]^hi,t1slo14=s[28]^lo,t1shi14=s[29]^hi,t1slo19=s[38]^lo,t1shi19=s[39]^hi,t1slo24=s[48]^lo,t1shi24=s[49]^hi,t2slo0=t1slo0,t2shi0=t1shi0,t2slo16=t1shi5<<4|t1slo5>>>28,t2shi16=t1slo5<<4|t1shi5>>>28,t2slo7=t1slo10<<3|t1shi10>>>29,t2shi7=t1shi10<<3|t1slo10>>>29,t2slo23=t1shi15<<9|t1slo15>>>23,t2shi23=t1slo15<<9|t1shi15>>>23,t2slo14=t1slo20<<18|t1shi20>>>14,t2shi14=t1shi20<<18|t1slo20>>>14,t2slo10=t1slo1<<1|t1shi1>>>31,t2shi10=t1shi1<<1|t1slo1>>>31,t2slo1=t1shi6<<12|t1slo6>>>20,t2shi1=t1slo6<<12|t1shi6>>>20,t2slo17=t1slo11<<10|t1shi11>>>22,t2shi17=t1shi11<<10|t1slo11>>>22,t2slo8=t1shi16<<13|t1slo16>>>19,t2shi8=t1slo16<<13|t1shi16>>>19,t2slo24=t1slo21<<2|t1shi21>>>30,t2shi24=t1shi21<<2|t1slo21>>>30,t2slo20=t1shi2<<30|t1slo2>>>2,t2shi20=t1slo2<<30|t1shi2>>>2,t2slo11=t1slo7<<6|t1shi7>>>26,t2shi11=t1shi7<<6|t1slo7>>>26,t2slo2=t1shi12<<11|t1slo12>>>21,t2shi2=t1slo12<<11|t1shi12>>>21,t2slo18=t1slo17<<15|t1shi17>>>17,t2shi18=t1shi17<<15|t1slo17>>>17,t2slo9=t1shi22<<29|t1slo22>>>3,t2shi9=t1slo22<<29|t1shi22>>>3,t2slo5=t1slo3<<28|t1shi3>>>4,t2shi5=t1shi3<<28|t1slo3>>>4,t2slo21=t1shi8<<23|t1slo8>>>9,t2shi21=t1slo8<<23|t1shi8>>>9,t2slo12=t1slo13<<25|t1shi13>>>7,t2shi12=t1shi13<<25|t1slo13>>>7,t2slo3=t1slo18<<21|t1shi18>>>11,t2shi3=t1shi18<<21|t1slo18>>>11,t2slo19=t1shi23<<24|t1slo23>>>8,t2shi19=t1slo23<<24|t1shi23>>>8,t2slo15=t1slo4<<27|t1shi4>>>5,t2shi15=t1shi4<<27|t1slo4>>>5,t2slo6=t1slo9<<20|t1shi9>>>12,t2shi6=t1shi9<<20|t1slo9>>>12,t2slo22=t1shi14<<7|t1slo14>>>25,t2shi22=t1slo14<<7|t1shi14>>>25,t2slo13=t1slo19<<8|t1shi19>>>24,t2shi13=t1shi19<<8|t1slo19>>>24,t2slo4=t1slo24<<14|t1shi24>>>18,t2shi4=t1shi24<<14|t1slo24>>>18;s[0]=t2slo0^~t2slo1&t2slo2,s[1]=t2shi0^~t2shi1&t2shi2,s[10]=t2slo5^~t2slo6&t2slo7,s[11]=t2shi5^~t2shi6&t2shi7,s[20]=t2slo10^~t2slo11&t2slo12,s[21]=t2shi10^~t2shi11&t2shi12,s[30]=t2slo15^~t2slo16&t2slo17,s[31]=t2shi15^~t2shi16&t2shi17,s[40]=t2slo20^~t2slo21&t2slo22,s[41]=t2shi20^~t2shi21&t2shi22,s[2]=t2slo1^~t2slo2&t2slo3,s[3]=t2shi1^~t2shi2&t2shi3,s[12]=t2slo6^~t2slo7&t2slo8,s[13]=t2shi6^~t2shi7&t2shi8,s[22]=t2slo11^~t2slo12&t2slo13,s[23]=t2shi11^~t2shi12&t2shi13,s[32]=t2slo16^~t2slo17&t2slo18,s[33]=t2shi16^~t2shi17&t2shi18,s[42]=t2slo21^~t2slo22&t2slo23,s[43]=t2shi21^~t2shi22&t2shi23,s[4]=t2slo2^~t2slo3&t2slo4,s[5]=t2shi2^~t2shi3&t2shi4,s[14]=t2slo7^~t2slo8&t2slo9,s[15]=t2shi7^~t2shi8&t2shi9,s[24]=t2slo12^~t2slo13&t2slo14,s[25]=t2shi12^~t2shi13&t2shi14,s[34]=t2slo17^~t2slo18&t2slo19,s[35]=t2shi17^~t2shi18&t2shi19,s[44]=t2slo22^~t2slo23&t2slo24,s[45]=t2shi22^~t2shi23&t2shi24,s[6]=t2slo3^~t2slo4&t2slo0,s[7]=t2shi3^~t2shi4&t2shi0,s[16]=t2slo8^~t2slo9&t2slo5,s[17]=t2shi8^~t2shi9&t2shi5,s[26]=t2slo13^~t2slo14&t2slo10,s[27]=t2shi13^~t2shi14&t2shi10,s[36]=t2slo18^~t2slo19&t2slo15,s[37]=t2shi18^~t2shi19&t2shi15,s[46]=t2slo23^~t2slo24&t2slo20,s[47]=t2shi23^~t2shi24&t2shi20,s[8]=t2slo4^~t2slo0&t2slo1,s[9]=t2shi4^~t2shi0&t2shi1,s[18]=t2slo9^~t2slo5&t2slo6,s[19]=t2shi9^~t2shi5&t2shi6,s[28]=t2slo14^~t2slo10&t2slo11,s[29]=t2shi14^~t2shi10&t2shi11,s[38]=t2slo19^~t2slo15&t2slo16,s[39]=t2shi19^~t2shi15&t2shi16,s[48]=t2slo24^~t2slo20&t2slo21,s[49]=t2shi24^~t2shi20&t2shi21,s[0]^=P1600_ROUND_CONSTANTS[2*round],s[1]^=P1600_ROUND_CONSTANTS[2*round+1]}}},{}],267:[function(require,module,exports){"use strict";function Keccak(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}var Buffer=require("safe-buffer").Buffer,keccakState=require("./keccak-state-unroll");Keccak.prototype.initialize=function(rate,capacity){for(var i=0;i<50;++i)this.state[i]=0;this.blockSize=rate/8,this.count=0,this.squeezing=!1},Keccak.prototype.absorb=function(data){for(var i=0;i>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return output},Keccak.prototype.copy=function(dest){for(var i=0;i<50;++i)dest.state[i]=this.state[i];dest.blockSize=this.blockSize,dest.count=this.count,dest.squeezing=this.squeezing},module.exports=Keccak},{"./keccak-state-unroll":266,"safe-buffer":313}],268:[function(require,module,exports){arguments[4][254][0].apply(exports,arguments)},{dup:254}],269:[function(require,module,exports){(function(global){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};(function(){function addMapEntry(map,pair){return map.set(pair[0],pair[1]),map}function addSetEntry(set,value){return set.add(value),set}function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,setter,iteratee,accumulator){for(var index=-1,length=null==array?0:array.length;++index-1}function arrayIncludesWith(array,value,comparator){for(var index=-1,length=null==array?0:array.length;++index-1;);return index}function charsEndIndex(strSymbols,chrSymbols){for(var index=strSymbols.length;index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1;);return index}function countHolders(array,placeholder){for(var length=array.length,result=0;length--;)array[length]===placeholder&&++result;return result}function escapeStringChar(chr){return"\\"+stringEscapes[chr]}function getValue(object,key){return null==object?undefined:object[key]}function hasUnicode(string){return reHasUnicode.test(string)}function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}function iteratorToArray(iterator){for(var data,result=[];!(data=iterator.next()).done;)result.push(data.value);return result}function mapToArray(map){var index=-1,result=Array(map.size);return map.forEach(function(value,key){result[++index]=[key,value]}),result}function overArg(func,transform){return function(arg){return func(transform(arg))}}function replaceHolders(array,placeholder){for(var index=-1,length=array.length,resIndex=0,result=[];++index>>1,wrapFlags=[["ary",WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]],argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g,reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source),reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source),reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/,reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /,reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,reEscapeChar=/\\(\\)?/g,reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,reFlags=/\w*$/,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsHostCtor=/^\[object .+?Constructor\]$/,reIsOctal=/^0o[0-7]+$/i,reIsUint=/^(?:0|[1-9]\d*)$/,reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,reNoMatch=/($^)/,reUnescapedString=/['\n\r\u2028\u2029\\]/g,rsComboRange="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",rsBreakRange="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsLower="[a-z\\xdf-\\xf6\\xf8-\\xff]",rsMisc="[^\\ud800-\\udfff"+rsBreakRange+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="[A-Z\\xc0-\\xd6\\xd8-\\xde]",rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",reOptMod="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",rsOptJoin="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",rsRegional,rsSurrPair].join("|")+")[\\ufe0e\\ufe0f]?"+reOptMod+")*",rsSeq="[\\ufe0e\\ufe0f]?"+reOptMod+rsOptJoin,rsEmoji="(?:"+["[\\u2700-\\u27bf]",rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+["[^\\ud800-\\udfff]"+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,"[\\ud800-\\udfff]"].join("|")+")",reApos=RegExp("['’]","g"),reComboMark=RegExp(rsCombo,"g"),reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g"),reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[rsBreak,rsUpper,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+(?:['’](?:d|ll|m|re|s|t|ve))?",rsUpper+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",rsEmoji].join("|"),"g"),reHasUnicode=RegExp("[\\u200d\\ud800-\\udfff"+rsComboRange+"\\ufe0e\\ufe0f]"),reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,contextProps=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],templateCounter=-1,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"},htmlUnescapes={"&":"&","<":"<",">":">",""":'"',"'":"'"},stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},freeParseFloat=parseFloat,freeParseInt=parseInt,freeGlobal="object"==(void 0===global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),freeExports="object"==(void 0===exports?"undefined":_typeof(exports))&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==(void 0===module?"undefined":_typeof(module))&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,freeProcess=moduleExports&&freeGlobal.process,nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsArrayBuffer=nodeUtil&&nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,asciiSize=baseProperty("length"),deburrLetter=basePropertyOf(deburredLetters),escapeHtmlChar=basePropertyOf(htmlEscapes),unescapeHtmlChar=basePropertyOf(htmlUnescapes),_=function runInContext(context){function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper)return value;if(hasOwnProperty.call(value,"__wrapped__"))return wrapperClone(value)}return new LodashWrapper(value)}function baseLodash(){}function LodashWrapper(value,chainAll){this.__wrapped__=value,this.__actions__=[],this.__chain__=!!chainAll,this.__index__=0,this.__values__=undefined}function LazyWrapper(value){this.__wrapped__=value,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=MAX_ARRAY_LENGTH,this.__views__=[]}function lazyClone(){var result=new LazyWrapper(this.__wrapped__);return result.__actions__=copyArray(this.__actions__),result.__dir__=this.__dir__,result.__filtered__=this.__filtered__,result.__iteratees__=copyArray(this.__iteratees__),result.__takeCount__=this.__takeCount__,result.__views__=copyArray(this.__views__),result}function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1,result.__filtered__=!0}else result=this.clone(),result.__dir__*=-1;return result}function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length)return baseWrapperValue(array,this.__actions__);var result=[];outer:for(;length--&&resIndex-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?(++this.size,data.push([key,value])):data[index][1]=value,this}function MapCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index=lower?number:lower)),number}function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer&&(result=object?customizer(value,key,object,stack):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return copyArray(value,result)}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value))return cloneBuffer(value,isDeep);if(tag==objectTag||tag==argsTag||isFunc&&!object){if(result=isFlat||isFunc?{}:initCloneObject(value),!isDeep)return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=initCloneByTag(value,tag,baseClone,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result);var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys,props=isArr?undefined:keysFunc(value);return arrayEach(props||value,function(subValue,key){props&&(key=subValue,subValue=value[key]),assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))}),result}function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}function baseConformsTo(object,source,props){var length=props.length;if(null==object)return!length;for(object=Object(object);length--;){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value))return!1}return!0}function baseDelay(func,wait,args){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=!0,length=array.length,result=[],valuesLength=values.length;if(!length)return result;iteratee&&(values=arrayMap(values,baseUnary(iteratee))),comparator?(includes=arrayIncludesWith,isCommon=!1):values.length>=LARGE_ARRAY_SIZE&&(includes=cacheHas,isCommon=!1,values=new SetCache(values)) -;outer:for(;++indexlength?0:length+start),end=end===undefined||end>length?length:toInteger(end),end<0&&(end+=length),end=start>end?0:toLength(end);start0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=castPath(path,object);for(var index=0,length=path.length;null!=object&&indexother}function baseHas(object,key){return null!=object&&hasOwnProperty.call(object,key)}function baseHasIn(object,key){return null!=object&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:for(;++index-1;)seen!==array&&splice.call(seen,fromIndex,1),splice.call(array,fromIndex,1);return array}function basePullAt(array,indexes){for(var length=array?indexes.length:0,lastIndex=length-1;length--;){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;isIndex(index)?splice.call(array,index,1):baseUnset(array,index)}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){for(var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);length--;)result[fromRight?length:++index]=start,start+=step;return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER)return result;do{n%2&&(result+=string),(n=nativeFloor(n/2))&&(string+=string)}while(n);return result}function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}function baseSample(collection){return arraySample(values(collection))}function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))}function baseSet(object,path,value,customizer){if(!isObject(object))return object;path=castPath(path,object);for(var index=-1,length=path.length,lastIndex=length-1,nested=object;null!=nested&&++indexlength?0:length+start),end=end>length?length:end,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index>>1,computed=array[mid];null!==computed&&!isSymbol(computed)&&(retHighest?computed<=value:computed=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set)return setToArray(set);isCommon=!1,includes=cacheHas,seen=new SetCache}else seen=iteratee?[]:result;outer:for(;++index=length?array:baseSlice(array,start,end)}function cloneBuffer(buffer,isDeep){if(isDeep)return buffer.slice();var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);return buffer.copy(result),result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);return new Uint8Array(result).set(new Uint8Array(arrayBuffer)),result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneMap(map,isDeep,cloneFunc){return arrayReduce(isDeep?cloneFunc(mapToArray(map),CLONE_DEEP_FLAG):mapToArray(map),addMapEntry,new map.constructor)}function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));return result.lastIndex=regexp.lastIndex,result}function cloneSet(set,isDeep,cloneFunc){return arrayReduce(isDeep?cloneFunc(setToArray(set),CLONE_DEEP_FLAG):setToArray(set),addSetEntry,new set.constructor)}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=null===value,valIsReflexive=value===value,valIsSymbol=isSymbol(value),othIsDefined=other!==undefined,othIsNull=null===other,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive)return 1;if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value=ordersLength)return result;return result*("desc"==orders[index]?-1:1)}}return object.index-other.index}function composeArgs(args,partials,holders,isCurried){for(var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;++leftIndex1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;for(customizer=assigner.length>3&&"function"==typeof customizer?(length--,customizer):undefined,guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?undefined:customizer,length=1),object=Object(object);++index-1?iterable[iteratee?collection[index]:index]:undefined}}function createFlow(fromRight){return flatRest(function(funcs){var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;for(fromRight&&funcs.reverse();index--;){var func=funcs[index];if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);if(prereq&&!wrapper&&"wrapper"==getFuncName(func))var wrapper=new LodashWrapper([],!0)}for(index=wrapper?index:length;++index1&&args.reverse(),isAry&&aryarrLength))return!1;var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=!0,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;for(stack.set(array,other),stack.set(other,array);++index1?"& ":"")+details[lastIndex],details=details.join(length>2?", ":" "),source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isIndex(value,length){return!!(length=null==length?MAX_SAFE_INTEGER:length)&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(undefined,arguments)}}function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;for(size=size===undefined?length:size;++index=this.__values__.length;return{done:done,value:done?undefined:this.__values__[this.__index__++]}}function wrapperToIterator(){return this}function wrapperPlant(value){for(var result,parent=this;parent instanceof baseLodash;){var clone=wrapperClone(parent);clone.__index__=0,clone.__values__=undefined,result?previous.__wrapped__=clone:result=clone;var previous=clone;parent=parent.__wrapped__}return previous.__wrapped__=value,result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;return this.__actions__.length&&(wrapped=new LazyWrapper(this)),wrapped=wrapped.reverse(),wrapped.__actions__.push({func:thru,args:[reverse],thisArg:undefined}),new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;return guard&&isIterateeCall(collection,predicate,guard)&&(predicate=undefined),func(collection,getIteratee(predicate,3))}function filter(collection,predicate){return(isArray(collection)?arrayFilter:baseFilter)(collection,getIteratee(predicate,3))}function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){return depth=depth===undefined?1:toInteger(depth),baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){return(isArray(collection)?arrayEach:baseEach)(collection,getIteratee(iteratee,3))}function forEachRight(collection,iteratee){return(isArray(collection)?arrayEachRight:baseEachRight)(collection,getIteratee(iteratee,3))}function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection),fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;return fromIndex<0&&(fromIndex=nativeMax(length+fromIndex,0)),isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}function map(collection,iteratee){return(isArray(collection)?arrayMap:baseMap)(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){return null==collection?[]:(isArray(iteratees)||(iteratees=null==iteratees?[]:[iteratees]),orders=guard?undefined:orders,isArray(orders)||(orders=null==orders?[]:[orders]),baseOrderBy(collection,iteratees,orders))}function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection,predicate){return(isArray(collection)?arrayFilter:baseFilter)(collection,negate(getIteratee(predicate,3)))}function sample(collection){return(isArray(collection)?arraySample:baseSample)(collection)}function sampleSize(collection,n,guard){return n=(guard?isIterateeCall(collection,n,guard):n===undefined)?1:toInteger(n),(isArray(collection)?arraySampleSize:baseSampleSize)(collection,n)}function shuffle(collection){return(isArray(collection)?arrayShuffle:baseShuffle)(collection)}function size(collection){if(null==collection)return 0;if(isArrayLike(collection))return isString(collection)?stringSize(collection):collection.length;var tag=getTag(collection);return tag==mapTag||tag==setTag?collection.size:baseKeys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;return guard&&isIterateeCall(collection,predicate,guard)&&(predicate=undefined),func(collection,getIteratee(predicate,3))}function after(n,func){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return n=toInteger(n),function(){if(--n<1)return func.apply(this,arguments)}}function ary(func,n,guard){return n=guard?undefined:n,n=func&&null==n?func.length:n,createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return n=toInteger(n),function(){return--n>0&&(result=func.apply(this,arguments)),n<=1&&(func=undefined),result}}function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);return result.placeholder=curry.placeholder,result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);return result.placeholder=curryRight.placeholder,result}function debounce(func,wait,options){function invokeFunc(time){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=undefined,lastInvokeTime=time,result=func.apply(thisArg,args)}function leadingEdge(time){return lastInvokeTime=time,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,result=wait-timeSinceLastCall;return maxing?nativeMin(result,maxWait-timeSinceLastInvoke):result}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){return timerId=undefined,trailing&&lastArgs?invokeFunc(time):(lastArgs=lastThis=undefined,result)}function cancel(){timerId!==undefined&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);if(lastArgs=arguments,lastThis=this,lastCallTime=time,isInvoking){if(timerId===undefined)return leadingEdge(lastCallTime);if(maxing)return timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===undefined&&(timerId=setTimeout(timerExpired,wait)),result}var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return wait=toNumber(wait)||0,isObject(options)&&(leading=!!options.leading,maxing="maxWait"in options,maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait,trailing="trailing"in options?!!options.trailing:trailing),debounced.cancel=cancel,debounced.flush=flush,debounced}function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}function memoize(func,resolver){if("function"!=typeof func||null!=resolver&&"function"!=typeof resolver)throw new TypeError(FUNC_ERROR_TEXT);var memoized=function memoized(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result)||cache,result};return memoized.cache=new(memoize.Cache||MapCache),memoized}function negate(predicate){if("function"!=typeof predicate)throw new TypeError(FUNC_ERROR_TEXT);return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}function once(func){return before(2,func)}function rest(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=start===undefined?start:toInteger(start),baseRest(func,start)}function spread(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=null==start?0:nativeMax(toInteger(start),0),baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);return array&&arrayPush(otherArgs,array),apply(func,this,otherArgs)})}function throttle(func,wait,options){var leading=!0,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return isObject(options)&&(leading="leading"in options?!!options.leading:leading,trailing="trailing"in options?!!options.trailing:trailing),debounce(func,wait,{leading:leading,maxWait:wait,trailing:trailing})}function unary(func){return ary(func,1)}function wrap(value,wrapper){return partial(castFunction(wrapper),value)}function castArray(){if(!arguments.length)return[];var value=arguments[0];return isArray(value)?value:[value]}function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}function cloneWith(value,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseClone(value,CLONE_SYMBOLS_FLAG,customizer)}function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}function cloneDeepWith(value,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer)}function conformsTo(object,source){return null==source||baseConformsTo(object,source,keys(source))}function eq(value,other){return value===other||value!==value&&other!==other}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return!0===value||!1===value||isObjectLike(value)&&baseGetTag(value)==boolTag}function isElement(value){return isObjectLike(value)&&1===value.nodeType&&!isPlainObject(value)}function isEmpty(value){if(null==value)return!0;if(isArrayLike(value)&&(isArray(value)||"string"==typeof value||"function"==typeof value.splice||isBuffer(value)||isTypedArray(value)||isArguments(value)))return!value.length;var tag=getTag(value);if(tag==mapTag||tag==setTag)return!value.size;if(isPrototype(value))return!baseKeys(value).length;for(var key in value)if(hasOwnProperty.call(value,key))return!1;return!0}function isEqual(value,other){return baseIsEqual(value,other)} -function isEqualWith(value,other,customizer){customizer="function"==typeof customizer?customizer:undefined;var result=customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}function isError(value){if(!isObjectLike(value))return!1;var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||"string"==typeof value.message&&"string"==typeof value.name&&!isPlainObject(value)}function isFinite(value){return"number"==typeof value&&nativeIsFinite(value)}function isFunction(value){if(!isObject(value))return!1;var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}function isInteger(value){return"number"==typeof value&&value==toInteger(value)}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=void 0===value?"undefined":_typeof(value);return null!=value&&("object"==type||"function"==type)}function isObjectLike(value){return null!=value&&"object"==(void 0===value?"undefined":_typeof(value))}function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value))throw new Error(CORE_ERROR_TEXT);return baseIsNative(value)}function isNull(value){return null===value}function isNil(value){return null==value}function isNumber(value){return"number"==typeof value||isObjectLike(value)&&baseGetTag(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag)return!1;var proto=getPrototype(value);if(null===proto)return!0;var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return"function"==typeof Ctor&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}function isString(value){return"string"==typeof value||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}function isSymbol(value){return"symbol"==(void 0===value?"undefined":_typeof(value))||isObjectLike(value)&&baseGetTag(value)==symbolTag}function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}function toArray(value){if(!value)return[];if(isArrayLike(value))return isString(value)?stringToArray(value):copyArray(value);if(symIterator&&value[symIterator])return iteratorToArray(value[symIterator]());var tag=getTag(value);return(tag==mapTag?mapToArray:tag==setTag?setToArray:values)(value)}function toFinite(value){if(!value)return 0===value?value:0;if((value=toNumber(value))===INFINITY||value===-INFINITY){return(value<0?-1:1)*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):0===value?value:0}function toString(value){return null==value?"":baseToString(value)}function create(prototype,properties){var result=baseCreate(prototype);return null==properties?result:baseAssign(result,properties)}function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return null==object?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return null==object?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return null==object?[]:baseFunctions(object,keys(object))}function functionsIn(object){return null==object?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=null==object?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return null!=object&&hasPath(object,path,baseHas)}function hasIn(object,path){return null!=object&&hasPath(object,path,baseHasIn)}function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,!0):baseKeysIn(object)}function mapKeys(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)}),result}function mapValues(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))}),result}function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}function pickBy(object,predicate){if(null==object)return{};var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});return predicate=getIteratee(predicate),basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;for(length||(length=1,object=undefined);++indexupper){var temp=lower;lower=upper,upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){return(string=toString(string))&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string),target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),0,length);var end=position;return(position-=target.length)>=0&&string.slice(position,end)==target}function escape(string){return string=toString(string),string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){return string=toString(string),string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$&"):string}function pad(string,length,chars){string=toString(string),length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length)return string;var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string),length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength>>0)?(string=toString(string),string&&("string"==typeof separator||null!=separator&&!isRegExp(separator))&&!(separator=baseToString(separator))&&hasUnicode(string)?castSlice(stringToArray(string),0,limit):string.split(separator,limit)):[]}function startsWith(string,target,position){return string=toString(string),position=null==position?0:baseClamp(toInteger(position),0,string.length),target=baseToString(target),string.slice(position,position+target.length)==target}function template(string,options,guard){var settings=lodash.templateSettings;guard&&isIterateeCall(string,options,guard)&&(options=undefined),string=toString(string),options=assignInWith({},options,settings,customDefaultsAssignIn);var isEscaping,isEvaluating,imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys),index=0,interpolate=options.interpolate||reNoMatch,source="__p += '",reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g"),sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){return interpolateValue||(interpolateValue=esTemplateValue),source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar),escapeValue&&(isEscaping=!0,source+="' +\n__e("+escapeValue+") +\n'"),evaluateValue&&(isEvaluating=!0,source+="';\n"+evaluateValue+";\n__p += '"),interpolateValue&&(source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"),index=offset+match.length,match}),source+="';\n";var variable=options.variable;variable||(source="with (obj) {\n"+source+"\n}\n"),source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;"),source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});if(result.source=source,isError(result))throw result;return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrim,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars);return castSlice(strSymbols,charsStartIndex(strSymbols,chrSymbols),charsEndIndex(strSymbols,chrSymbols)+1).join("")}function trimEnd(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrimEnd,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string);return castSlice(strSymbols,0,charsEndIndex(strSymbols,stringToArray(chars))+1).join("")}function trimStart(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrimStart,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string);return castSlice(strSymbols,charsStartIndex(strSymbols,stringToArray(chars))).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?toInteger(options.length):length,omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength)return string;var end=length-stringSize(omission);if(end<1)return omission;var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined)return result+omission;if(strSymbols&&(end+=result.length-end),isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;for(separator.global||(separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g")),separator.lastIndex=0;match=separator.exec(substring);)var newEnd=match.index;result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);index>-1&&(result=result.slice(0,index))}return result+omission}function unescape(string){return string=toString(string),string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}function words(string,pattern,guard){return string=toString(string),pattern=guard?undefined:pattern,pattern===undefined?hasUnicodeWord(string)?unicodeWords(string):asciiWords(string):string.match(pattern)||[]}function cond(pairs){var length=null==pairs?0:pairs.length,toIteratee=getIteratee();return pairs=length?arrayMap(pairs,function(pair){if("function"!=typeof pair[1])throw new TypeError(FUNC_ERROR_TEXT);return[toIteratee(pair[0]),pair[1]]}):[],baseRest(function(args){for(var index=-1;++indexMAX_SAFE_INTEGER)return[];var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee),n-=MAX_ARRAY_LENGTH;for(var result=baseTimes(length,iteratee);++index1?arrays[length-1]:undefined;return iteratee="function"==typeof iteratee?(arrays.pop(),iteratee):undefined,unzipWith(arrays,iteratee)}),wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};return!(length>1||this.__actions__.length)&&value instanceof LazyWrapper&&isIndex(start)?(value=value.slice(start,+start+(length?1:0)),value.__actions__.push({func:thru,args:[interceptor],thisArg:undefined}),new LodashWrapper(value,this.__chain__).thru(function(array){return length&&!array.length&&array.push(undefined),array})):this.thru(interceptor)}),countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?++result[key]:baseAssignValue(result,key,1)}),find=createFind(findIndex),findLast=createFind(findLastIndex),groupBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key].push(value):baseAssignValue(result,key,[value])}),invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc="function"==typeof path,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)}),result}),keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value)}),partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]}),sortBy=baseRest(function(collection,iteratees){if(null==collection)return[];var length=iteratees.length;return length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])?iteratees=[]:length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])&&(iteratees=[iteratees[0]]),baseOrderBy(collection,baseFlatten(iteratees,1),[])}),now=ctxNow||function(){return root.Date.now()},bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)}),bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)}),defer=baseRest(function(func,args){return baseDelay(func,1,args)}),delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});memoize.Cache=MapCache;var overArgs=castRest(function(func,transforms){transforms=1==transforms.length&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){for(var index=-1,length=nativeMin(args.length,funcsLength);++index=other}),isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")},isArray=Array.isArray,isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer,isBuffer=nativeIsBuffer||stubFalse,isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,lt=createRelationalOperation(baseLt),lte=createRelationalOperation(function(value,other){return value<=other}),assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source))return void copyObject(source,keys(source),object);for(var key in source)hasOwnProperty.call(source,key)&&assignValue(object,key,source[key])}),assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)}),assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)}),assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)}),at=flatRest(baseAt),defaults=baseRest(function(args){return args.push(undefined,customDefaultsAssignIn),apply(assignInWith,undefined,args)}),defaultsDeep=baseRest(function(args){return args.push(undefined,customDefaultsMerge),apply(mergeWith,undefined,args)}),invert=createInverter(function(result,value,key){result[value]=key},constant(identity)),invertBy=createInverter(function(result,value,key){hasOwnProperty.call(result,value)?result[value].push(key):result[value]=[key]},getIteratee),invoke=baseRest(baseInvoke),merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)}),mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)}),omit=flatRest(function(object,paths){var result={};if(null==object)return result;var isDeep=!1;paths=arrayMap(paths,function(path){return path=castPath(path,object),isDeep||(isDeep=path.length>1),path}),copyObject(object,getAllKeysIn(object),result),isDeep&&(result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone));for(var length=paths.length;length--;)baseUnset(result,paths[length]);return result}),pick=flatRest(function(object,paths){return null==object?{}:basePick(object,paths)}),toPairs=createToPairs(keys),toPairsIn=createToPairs(keysIn),camelCase=createCompounder(function(result,word,index){return word=word.toLowerCase(),result+(index?capitalize(word):word)}),kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()}),lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()}),lowerFirst=createCaseFirst("toLowerCase"),snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()}),startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)}),upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()}),upperFirst=createCaseFirst("toUpperCase"),attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}}),bindAll=flatRest(function(object,methodNames){return arrayEach(methodNames,function(key){key=toKey(key),baseAssignValue(object,key,bind(object[key],object))}),object}),flow=createFlow(),flowRight=createFlow(!0),method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}}),methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}}),over=createOver(arrayMap),overEvery=createOver(arrayEvery),overSome=createOver(arraySome),range=createRange(),rangeRight=createRange(!0),add=createMathOperation(function(augend,addend){return augend+addend},0),ceil=createRound("ceil"),divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1),floor=createRound("floor"),multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1),round=createRound("round"),subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);return lodash.after=after,lodash.ary=ary,lodash.assign=assign,lodash.assignIn=assignIn,lodash.assignInWith=assignInWith,lodash.assignWith=assignWith,lodash.at=at,lodash.before=before,lodash.bind=bind,lodash.bindAll=bindAll,lodash.bindKey=bindKey,lodash.castArray=castArray,lodash.chain=chain,lodash.chunk=chunk,lodash.compact=compact,lodash.concat=concat,lodash.cond=cond,lodash.conforms=conforms,lodash.constant=constant,lodash.countBy=countBy,lodash.create=create,lodash.curry=curry,lodash.curryRight=curryRight,lodash.debounce=debounce,lodash.defaults=defaults,lodash.defaultsDeep=defaultsDeep,lodash.defer=defer,lodash.delay=delay,lodash.difference=difference,lodash.differenceBy=differenceBy,lodash.differenceWith=differenceWith,lodash.drop=drop,lodash.dropRight=dropRight,lodash.dropRightWhile=dropRightWhile,lodash.dropWhile=dropWhile,lodash.fill=fill,lodash.filter=filter,lodash.flatMap=flatMap,lodash.flatMapDeep=flatMapDeep,lodash.flatMapDepth=flatMapDepth,lodash.flatten=flatten,lodash.flattenDeep=flattenDeep,lodash.flattenDepth=flattenDepth,lodash.flip=flip,lodash.flow=flow,lodash.flowRight=flowRight,lodash.fromPairs=fromPairs,lodash.functions=functions,lodash.functionsIn=functionsIn,lodash.groupBy=groupBy,lodash.initial=initial,lodash.intersection=intersection,lodash.intersectionBy=intersectionBy,lodash.intersectionWith=intersectionWith,lodash.invert=invert,lodash.invertBy=invertBy,lodash.invokeMap=invokeMap,lodash.iteratee=iteratee,lodash.keyBy=keyBy,lodash.keys=keys,lodash.keysIn=keysIn,lodash.map=map,lodash.mapKeys=mapKeys,lodash.mapValues=mapValues,lodash.matches=matches,lodash.matchesProperty=matchesProperty,lodash.memoize=memoize,lodash.merge=merge,lodash.mergeWith=mergeWith,lodash.method=method,lodash.methodOf=methodOf,lodash.mixin=mixin,lodash.negate=negate,lodash.nthArg=nthArg,lodash.omit=omit,lodash.omitBy=omitBy,lodash.once=once,lodash.orderBy=orderBy,lodash.over=over,lodash.overArgs=overArgs,lodash.overEvery=overEvery,lodash.overSome=overSome,lodash.partial=partial,lodash.partialRight=partialRight,lodash.partition=partition,lodash.pick=pick,lodash.pickBy=pickBy,lodash.property=property,lodash.propertyOf=propertyOf,lodash.pull=pull,lodash.pullAll=pullAll,lodash.pullAllBy=pullAllBy,lodash.pullAllWith=pullAllWith,lodash.pullAt=pullAt,lodash.range=range,lodash.rangeRight=rangeRight,lodash.rearg=rearg,lodash.reject=reject,lodash.remove=remove,lodash.rest=rest,lodash.reverse=reverse,lodash.sampleSize=sampleSize,lodash.set=set,lodash.setWith=setWith,lodash.shuffle=shuffle,lodash.slice=slice,lodash.sortBy=sortBy,lodash.sortedUniq=sortedUniq,lodash.sortedUniqBy=sortedUniqBy,lodash.split=split,lodash.spread=spread,lodash.tail=tail,lodash.take=take,lodash.takeRight=takeRight,lodash.takeRightWhile=takeRightWhile,lodash.takeWhile=takeWhile,lodash.tap=tap,lodash.throttle=throttle,lodash.thru=thru,lodash.toArray=toArray,lodash.toPairs=toPairs,lodash.toPairsIn=toPairsIn,lodash.toPath=toPath,lodash.toPlainObject=toPlainObject,lodash.transform=transform,lodash.unary=unary,lodash.union=union,lodash.unionBy=unionBy,lodash.unionWith=unionWith,lodash.uniq=uniq,lodash.uniqBy=uniqBy,lodash.uniqWith=uniqWith,lodash.unset=unset,lodash.unzip=unzip,lodash.unzipWith=unzipWith,lodash.update=update,lodash.updateWith=updateWith,lodash.values=values,lodash.valuesIn=valuesIn,lodash.without=without,lodash.words=words,lodash.wrap=wrap,lodash.xor=xor,lodash.xorBy=xorBy,lodash.xorWith=xorWith,lodash.zip=zip,lodash.zipObject=zipObject,lodash.zipObjectDeep=zipObjectDeep,lodash.zipWith=zipWith,lodash.entries=toPairs,lodash.entriesIn=toPairsIn,lodash.extend=assignIn,lodash.extendWith=assignInWith,mixin(lodash,lodash),lodash.add=add,lodash.attempt=attempt,lodash.camelCase=camelCase,lodash.capitalize=capitalize,lodash.ceil=ceil,lodash.clamp=clamp,lodash.clone=clone,lodash.cloneDeep=cloneDeep,lodash.cloneDeepWith=cloneDeepWith,lodash.cloneWith=cloneWith,lodash.conformsTo=conformsTo,lodash.deburr=deburr,lodash.defaultTo=defaultTo,lodash.divide=divide,lodash.endsWith=endsWith,lodash.eq=eq,lodash.escape=escape,lodash.escapeRegExp=escapeRegExp,lodash.every=every,lodash.find=find,lodash.findIndex=findIndex,lodash.findKey=findKey,lodash.findLast=findLast,lodash.findLastIndex=findLastIndex,lodash.findLastKey=findLastKey,lodash.floor=floor,lodash.forEach=forEach,lodash.forEachRight=forEachRight,lodash.forIn=forIn,lodash.forInRight=forInRight,lodash.forOwn=forOwn,lodash.forOwnRight=forOwnRight,lodash.get=get,lodash.gt=gt,lodash.gte=gte,lodash.has=has,lodash.hasIn=hasIn,lodash.head=head,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.inRange=inRange,lodash.invoke=invoke,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isArrayBuffer=isArrayBuffer,lodash.isArrayLike=isArrayLike,lodash.isArrayLikeObject=isArrayLikeObject,lodash.isBoolean=isBoolean,lodash.isBuffer=isBuffer,lodash.isDate=isDate,lodash.isElement=isElement,lodash.isEmpty=isEmpty,lodash.isEqual=isEqual,lodash.isEqualWith=isEqualWith,lodash.isError=isError,lodash.isFinite=isFinite,lodash.isFunction=isFunction,lodash.isInteger=isInteger,lodash.isLength=isLength,lodash.isMap=isMap,lodash.isMatch=isMatch,lodash.isMatchWith=isMatchWith,lodash.isNaN=isNaN,lodash.isNative=isNative,lodash.isNil=isNil,lodash.isNull=isNull,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isObjectLike=isObjectLike,lodash.isPlainObject=isPlainObject,lodash.isRegExp=isRegExp,lodash.isSafeInteger=isSafeInteger,lodash.isSet=isSet,lodash.isString=isString,lodash.isSymbol=isSymbol,lodash.isTypedArray=isTypedArray,lodash.isUndefined=isUndefined,lodash.isWeakMap=isWeakMap,lodash.isWeakSet=isWeakSet,lodash.join=join,lodash.kebabCase=kebabCase,lodash.last=last,lodash.lastIndexOf=lastIndexOf,lodash.lowerCase=lowerCase,lodash.lowerFirst=lowerFirst,lodash.lt=lt,lodash.lte=lte,lodash.max=max,lodash.maxBy=maxBy,lodash.mean=mean,lodash.meanBy=meanBy,lodash.min=min,lodash.minBy=minBy,lodash.stubArray=stubArray,lodash.stubFalse=stubFalse,lodash.stubObject=stubObject,lodash.stubString=stubString,lodash.stubTrue=stubTrue,lodash.multiply=multiply,lodash.nth=nth,lodash.noConflict=noConflict,lodash.noop=noop,lodash.now=now,lodash.pad=pad,lodash.padEnd=padEnd,lodash.padStart=padStart,lodash.parseInt=parseInt,lodash.random=random,lodash.reduce=reduce,lodash.reduceRight=reduceRight,lodash.repeat=repeat,lodash.replace=replace,lodash.result=result,lodash.round=round,lodash.runInContext=runInContext,lodash.sample=sample,lodash.size=size,lodash.snakeCase=snakeCase,lodash.some=some,lodash.sortedIndex=sortedIndex,lodash.sortedIndexBy=sortedIndexBy,lodash.sortedIndexOf=sortedIndexOf,lodash.sortedLastIndex=sortedLastIndex,lodash.sortedLastIndexBy=sortedLastIndexBy,lodash.sortedLastIndexOf=sortedLastIndexOf,lodash.startCase=startCase,lodash.startsWith=startsWith,lodash.subtract=subtract,lodash.sum=sum,lodash.sumBy=sumBy,lodash.template=template,lodash.times=times,lodash.toFinite=toFinite,lodash.toInteger=toInteger,lodash.toLength=toLength,lodash.toLower=toLower,lodash.toNumber=toNumber,lodash.toSafeInteger=toSafeInteger,lodash.toString=toString,lodash.toUpper=toUpper,lodash.trim=trim,lodash.trimEnd=trimEnd,lodash.trimStart=trimStart,lodash.truncate=truncate,lodash.unescape=unescape,lodash.uniqueId=uniqueId,lodash.upperCase=upperCase,lodash.upperFirst=upperFirst,lodash.each=forEach,lodash.eachRight=forEachRight,lodash.first=head,mixin(lodash,function(){var source={};return baseForOwn(lodash,function(func,methodName){hasOwnProperty.call(lodash.prototype,methodName)||(source[methodName]=func)}),source}(),{chain:!1}),lodash.VERSION="4.17.4",arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash}),arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();return result.__filtered__?result.__takeCount__=nativeMin(n,result.__takeCount__):result.__views__.push({size:nativeMin(n,MAX_ARRAY_LENGTH),type:methodName+(result.__dir__<0?"Right":"")}),result},LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}}),arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||3==type;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();return result.__iteratees__.push({iteratee:getIteratee(iteratee,3),type:type}),result.__filtered__=result.__filtered__||isFilter,result}}),arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}}),arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}}),LazyWrapper.prototype.compact=function(){return this.filter(identity)},LazyWrapper.prototype.find=function(predicate){return this.filter(predicate).head()},LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)},LazyWrapper.prototype.invokeMap=baseRest(function(path,args){return"function"==typeof path?new LazyWrapper(this):this.map(function(value){return baseInvoke(value,path,args)})}),LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)))},LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);var result=this;return result.__filtered__&&(start>0||end<0)?new LazyWrapper(result):(start<0?result=result.takeRight(-start):start&&(result=result.drop(start)),end!==undefined&&(end=toInteger(end),result=end<0?result.dropRight(-end):result.take(end-start)),result)},LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()},LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)},baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+("last"==methodName?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);lodashFunc&&(lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value),interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};useLazy&&checkIteratee&&"function"==typeof iteratee&&1!=iteratee.length&&(isLazy=useLazy=!1);var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);return result.__actions__.push({func:thru,args:[interceptor],thisArg:undefined}),new LodashWrapper(result,chainAll)}return isUnwrapped&&onlyLazy?func.apply(this,args):(result=this.thru(interceptor),isUnwrapped?isTaker?result.value()[0]:result.value():result)})}),arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}}),baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"";(realNames[key]||(realNames[key]=[])).push({name:methodName,func:lodashFunc})}}),realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{name:"wrapper",func:undefined}],LazyWrapper.prototype.clone=lazyClone,LazyWrapper.prototype.reverse=lazyReverse,LazyWrapper.prototype.value=lazyValue,lodash.prototype.at=wrapperAt,lodash.prototype.chain=wrapperChain,lodash.prototype.commit=wrapperCommit,lodash.prototype.next=wrapperNext,lodash.prototype.plant=wrapperPlant,lodash.prototype.reverse=wrapperReverse,lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue,lodash.prototype.first=lodash.prototype.head,symIterator&&(lodash.prototype[symIterator]=wrapperToIterator),lodash}();"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd?(root._=_,define(function(){return _})):freeModule?((freeModule.exports=_)._=_,freeExports._=_):root._=_}).call(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],270:[function(require,module,exports){(function(Buffer){"use strict";function MD5(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(x,n){return x<>>32-n}function fnF(a,b,c,d,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+b|0}function fnG(a,b,c,d,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+b|0}function fnH(a,b,c,d,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+b|0}function fnI(a,b,c,d,m,k,s){return rotl(a+(c^(b|~d))+m+k|0,s)+b|0}var inherits=require("inherits"),HashBase=require("hash-base"),ARRAY16=new Array(16);inherits(MD5,HashBase),MD5.prototype._update=function(){for(var M=ARRAY16,i=0;i<16;++i)M[i]=this._block.readInt32LE(4*i);var a=this._a,b=this._b,c=this._c,d=this._d;a=fnF(a,b,c,d,M[0],3614090360,7),d=fnF(d,a,b,c,M[1],3905402710,12),c=fnF(c,d,a,b,M[2],606105819,17),b=fnF(b,c,d,a,M[3],3250441966,22),a=fnF(a,b,c,d,M[4],4118548399,7),d=fnF(d,a,b,c,M[5],1200080426,12),c=fnF(c,d,a,b,M[6],2821735955,17),b=fnF(b,c,d,a,M[7],4249261313,22),a=fnF(a,b,c,d,M[8],1770035416,7),d=fnF(d,a,b,c,M[9],2336552879,12),c=fnF(c,d,a,b,M[10],4294925233,17),b=fnF(b,c,d,a,M[11],2304563134,22),a=fnF(a,b,c,d,M[12],1804603682,7),d=fnF(d,a,b,c,M[13],4254626195,12),c=fnF(c,d,a,b,M[14],2792965006,17),b=fnF(b,c,d,a,M[15],1236535329,22),a=fnG(a,b,c,d,M[1],4129170786,5),d=fnG(d,a,b,c,M[6],3225465664,9),c=fnG(c,d,a,b,M[11],643717713,14),b=fnG(b,c,d,a,M[0],3921069994,20),a=fnG(a,b,c,d,M[5],3593408605,5),d=fnG(d,a,b,c,M[10],38016083,9),c=fnG(c,d,a,b,M[15],3634488961,14),b=fnG(b,c,d,a,M[4],3889429448,20),a=fnG(a,b,c,d,M[9],568446438,5),d=fnG(d,a,b,c,M[14],3275163606,9),c=fnG(c,d,a,b,M[3],4107603335,14),b=fnG(b,c,d,a,M[8],1163531501,20),a=fnG(a,b,c,d,M[13],2850285829,5),d=fnG(d,a,b,c,M[2],4243563512,9),c=fnG(c,d,a,b,M[7],1735328473,14),b=fnG(b,c,d,a,M[12],2368359562,20),a=fnH(a,b,c,d,M[5],4294588738,4),d=fnH(d,a,b,c,M[8],2272392833,11),c=fnH(c,d,a,b,M[11],1839030562,16),b=fnH(b,c,d,a,M[14],4259657740,23),a=fnH(a,b,c,d,M[1],2763975236,4),d=fnH(d,a,b,c,M[4],1272893353,11),c=fnH(c,d,a,b,M[7],4139469664,16),b=fnH(b,c,d,a,M[10],3200236656,23),a=fnH(a,b,c,d,M[13],681279174,4),d=fnH(d,a,b,c,M[0],3936430074,11),c=fnH(c,d,a,b,M[3],3572445317,16),b=fnH(b,c,d,a,M[6],76029189,23),a=fnH(a,b,c,d,M[9],3654602809,4),d=fnH(d,a,b,c,M[12],3873151461,11),c=fnH(c,d,a,b,M[15],530742520,16),b=fnH(b,c,d,a,M[2],3299628645,23),a=fnI(a,b,c,d,M[0],4096336452,6),d=fnI(d,a,b,c,M[7],1126891415,10),c=fnI(c,d,a,b,M[14],2878612391,15),b=fnI(b,c,d,a,M[5],4237533241,21),a=fnI(a,b,c,d,M[12],1700485571,6),d=fnI(d,a,b,c,M[3],2399980690,10),c=fnI(c,d,a,b,M[10],4293915773,15),b=fnI(b,c,d,a,M[1],2240044497,21),a=fnI(a,b,c,d,M[8],1873313359,6),d=fnI(d,a,b,c,M[15],4264355552,10),c=fnI(c,d,a,b,M[6],2734768916,15),b=fnI(b,c,d,a,M[13],1309151649,21),a=fnI(a,b,c,d,M[4],4149444226,6),d=fnI(d,a,b,c,M[11],3174756917,10),c=fnI(c,d,a,b,M[2],718787259,15),b=fnI(b,c,d,a,M[9],3951481745,21),this._a=this._a+a|0,this._b=this._b+b|0,this._c=this._c+c|0,this._d=this._d+d|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=new Buffer(16);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer},module.exports=MD5}).call(this,require("buffer").Buffer)},{buffer:150,"hash-base":271,inherits:258}],271:[function(require,module,exports){"use strict";function throwIfNotStringOrBuffer(val,prefix){if(!Buffer.isBuffer(val)&&"string"!=typeof val)throw new TypeError(prefix+" must be a string or a buffer")}function HashBase(blockSize){Transform.call(this),this._block=Buffer.allocUnsafe(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var Buffer=require("safe-buffer").Buffer,Transform=require("stream").Transform;require("inherits")(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this.digest())}catch(err){error=err}callback(error)},HashBase.prototype.update=function(data,encoding){if(throwIfNotStringOrBuffer(data,"Data"),this._finalized)throw new Error("Digest already called");Buffer.isBuffer(data)||(data=Buffer.from(data,encoding));for(var block=this._block,offset=0;this._blockOffset+data.length-offset>=this._blockSize;){for(var i=this._blockOffset;i0;++j)this._length[j]+=carry,(carry=this._length[j]/4294967296|0)>0&&(this._length[j]-=4294967296*carry);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var digest=this._digest();void 0!==encoding&&(digest=digest.toString(encoding)),this._block.fill(0),this._blockOffset=0;for(var i=0;i<4;++i)this._length[i]=0;return digest},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase},{inherits:258,"safe-buffer":313,stream:345}],272:[function(require,module,exports){"use strict";function MillerRabin(rand){this.rand=rand||new brorand.Rand}var bn=require("bn.js"),brorand=require("brorand");module.exports=MillerRabin,MillerRabin.create=function(rand){return new MillerRabin(rand)},MillerRabin.prototype._randbelow=function(n){var len=n.bitLength(),min_bytes=Math.ceil(len/8);do{var a=new bn(this.rand.generate(min_bytes))}while(a.cmp(n)>=0);return a},MillerRabin.prototype._randrange=function(start,stop){var size=stop.sub(start);return start.add(this._randbelow(size))},MillerRabin.prototype.test=function(n,k,cb){var len=n.bitLength(),red=bn.mont(n),rone=new bn(1).toRed(red);k||(k=Math.max(1,len/48|0));for(var n1=n.subn(1),s=0;!n1.testn(s);s++);for(var d=n.shrn(s),rn1=n1.toRed(red);k>0;k--){var a=this._randrange(new bn(2),n1);cb&&cb(a);var x=a.toRed(red).redPow(d);if(0!==x.cmp(rone)&&0!==x.cmp(rn1)){for(var i=1;i0;k--){var a=this._randrange(new bn(2),n1),g=n.gcd(a);if(0!==g.cmpn(1))return g;var x=a.toRed(red).redPow(d);if(0!==x.cmp(rone)&&0!==x.cmp(rn1)){for(var i=1;i>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}return res}function zero2(word){return 1===word.length?"0"+word:word}function toHex(msg){for(var res="",i=0;i=6?"utf-8":"binary"}module.exports=defaultEncoding}).call(this,require("_process"))},{_process:145}],283:[function(require,module,exports){"use strict";var MAX_ALLOC=Math.pow(2,30)-1;module.exports=function(iterations,keylen){if("number"!=typeof iterations)throw new TypeError("Iterations not a number");if(iterations<0)throw new TypeError("Bad iterations");if("number"!=typeof keylen)throw new TypeError("Key length not a number");if(keylen<0||keylen>MAX_ALLOC||keylen!==keylen)throw new TypeError("Bad key length")}},{}],284:[function(require,module,exports){"use strict";function Hmac(alg,key,saltLen){var hash=getDigest(alg),blocksize="sha512"===alg||"sha384"===alg?128:64;key.length>blocksize?key=hash(key):key.length=msg.length){status++;break}var ps=msg.slice(2,i-1);msg.slice(i-1,i);if(("0002"!==p1.toString("hex")&&!reverse||"0001"!==p1.toString("hex")&&reverse)&&status++,ps.length<8&&status++,status)throw new Error("decryption error");return msg.slice(i)}function compare(a,b){a=new Buffer(a),b=new Buffer(b);var dif=0,len=a.length;a.length!==b.length&&(dif++,len=Math.min(a.length,b.length));for(var i=-1;++ik||new bn(enc).cmp(key.modulus)>=0)throw new Error("decryption error");var msg;msg=reverse?withPublic(new bn(enc),key):crt(enc,key);var zBuffer=new Buffer(k-msg.length);if(zBuffer.fill(0),msg=Buffer.concat([zBuffer,msg],k),4===padding)return oaep(key,msg);if(1===padding)return pkcs1(key,msg,reverse);if(3===padding)return msg;throw new Error("unknown padding")}}).call(this,require("buffer").Buffer)},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,buffer:150,"create-hash":170,"parse-asn1":279}],289:[function(require,module,exports){(function(Buffer){"use strict";function oaep(key,msg){var k=key.modulus.byteLength(),mLen=msg.length,iHash=createHash("sha1").update(new Buffer("")).digest(),hLen=iHash.length,hLen2=2*hLen;if(mLen>k-hLen2-2)throw new Error("message too long");var ps=new Buffer(k-mLen-hLen2-2);ps.fill(0);var dblen=k-hLen-1,seed=randomBytes(hLen),maskedDb=xor(Buffer.concat([iHash,ps,new Buffer([1]),msg],dblen),mgf(seed,dblen)),maskedSeed=xor(seed,mgf(maskedDb,hLen));return new bn(Buffer.concat([new Buffer([0]),maskedSeed,maskedDb],k))}function pkcs1(key,msg,reverse){var mLen=msg.length,k=key.modulus.byteLength();if(mLen>k-11)throw new Error("message too long");var ps;return reverse?(ps=new Buffer(k-mLen-3),ps.fill(255)):ps=nonZero(k-mLen-3),new bn(Buffer.concat([new Buffer([0,reverse?1:2]),ps,new Buffer([0]),msg],k))}function nonZero(len,crypto){for(var num,out=new Buffer(len),i=0,cache=randomBytes(2*len),cur=0;i=0)throw new Error("data too long for modulus")}return reverse?crt(paddedMsg,key):withPublic(paddedMsg,key)}}).call(this,require("buffer").Buffer)},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,buffer:150,"create-hash":170,"parse-asn1":279,randombytes:296}],290:[function(require,module,exports){(function(Buffer){"use strict";function withPublic(paddedMsg,key){return new Buffer(paddedMsg.toRed(bn.mont(key.modulus)).redPow(new bn(key.publicExponent)).fromRed().toArray())}var bn=require("bn.js");module.exports=withPublic}).call(this,require("buffer").Buffer)},{"bn.js":99,buffer:150}],291:[function(require,module,exports){"use strict";module.exports=function(a,b){for(var len=a.length,i=-1;++i1&&(result=parts[0]+"@",string=parts[1]),string=string.replace(regexSeparators,"."),result+map(string.split("."),fn).join(".")}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function basicToDigit(codePoint){return codePoint-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for(basic=input.lastIndexOf(delimiter),basic<0&&(basic=0),j=0;j=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index=inputLength&&error("invalid-input"),digit=basicToDigit(input.charCodeAt(index++)),(digit>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(digitfloor(maxInt/baseMinusT)&&error("overflow"),w*=baseMinusT;out=output.length+1,bias=adapt(i-oldi,out,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(input=ucs2decode(input),inputLength=input.length,n=initialN,delta=0,bias=initialBias,j=0;j=n&¤tValuefloor((maxInt-delta)/handledCPCountPlusOne)&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;jmaxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;if(punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode},"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],293:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],294:[function(require,module,exports){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i65536)throw new Error("requested too many random bytes");var rawBytes=new global.Uint8Array(size);size>0&&crypto.getRandomValues(rawBytes);var bytes=Buffer.from(rawBytes.buffer);return"function"==typeof cb?process.nextTick(function(){cb(null,bytes)}):bytes}var Buffer=require("safe-buffer").Buffer,crypto=global.crypto||global.msCrypto;crypto&&crypto.getRandomValues?module.exports=randomBytes:module.exports=oldBrowser}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:145,"safe-buffer":313}],297:[function(require,module,exports){"use strict";module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":298}],298:[function(require,module,exports){"use strict";function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),options&&!1===options.readable&&(this.readable=!1),options&&!1===options.writable&&(this.writable=!1),this.allowHalfOpen=!0,options&&!1===options.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||processNextTick(onEndNT,this)}function onEndNT(self){self.end()}var processNextTick=require("process-nextick-args"),objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0?("string"==typeof chunk||state.objectMode||Object.getPrototypeOf(chunk)===Buffer.prototype||(chunk=_uint8ArrayToBuffer(chunk)),addToFront?state.endEmitted?stream.emit("error",new Error("stream.unshift() after end event")):addChunk(stream,state,chunk,!0):state.ended?stream.emit("error",new Error("stream.push() after EOF")):(state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||0!==chunk.length?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1))):addToFront||(state.reading=!1)}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){state.flowing&&0===state.length&&!state.sync?(stream.emit("data",chunk),stream.read(0)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;return _isUint8Array(chunk)||"string"==typeof chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return n<=0||0===state.length&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}function onEofChunk(stream,state){if(!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,emitReadable(stream)}}function emitReadable(stream){var state=stream._readableState;state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,state.sync?processNextTick(emitReadable_,stream):emitReadable_(stream))}function emitReadable_(stream){debug("emit readable"),stream.emit("readable"),flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,processNextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(var len=state.length;!state.reading&&!state.flowing&&!state.ended&&state.length=state.length?(ret=state.decoder?state.buffer.join(""):1===state.buffer.length?state.buffer.head.data:state.buffer.concat(state.length),state.buffer.clear()):ret=fromListPartial(n,state.buffer,state.decoder),ret}function fromListPartial(n,list,hasStrings){var ret;return nstr.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),0===(n-=nb)){nb===str.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=str.slice(nb));break}++c}return list.length-=c,ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n),p=list.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){ -var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),0===(n-=nb)){nb===buf.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=buf.slice(nb));break}++c}return list.length-=c,ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');state.endEmitted||(state.ended=!0,processNextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1,stream.emit("end"))}function indexOf(xs,x){for(var i=0,l=xs.length;i=state.highWaterMark||state.ended))return debug("read: emitReadable",state.length,state.ended),0===state.length&&state.ended?endReadable(this):emitReadable(this),null;if(0===(n=howMuchToRead(n,state))&&state.ended)return 0===state.length&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(0===state.length||state.length-n0?fromList(n,state):null,null===ret?(state.needReadable=!0,n=0):state.length-=n,0===state.length&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),null!==ret&&this.emit("data",ret),ret},Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(dest,pipeOpts){function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&!1===unpipeInfo.hasUnpiped&&(unpipeInfo.hasUnpiped=!0,cleanup())}function onend(){debug("onend"),dest.end()}function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain()}function ondata(chunk){debug("ondata"),increasedAwaitDrain=!1,!1!==dest.write(chunk)||increasedAwaitDrain||((1===state.pipesCount&&state.pipes===dest||state.pipesCount>1&&-1!==indexOf(state.pipes,dest))&&!cleanedUp&&(debug("false write response, pause",src._readableState.awaitDrain),src._readableState.awaitDrain++,increasedAwaitDrain=!0),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),0===EElistenerCount(dest,"error")&&dest.emit("error",er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||!1!==pipeOpts.end)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:unpipe;state.endEmitted?processNextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1,increasedAwaitDrain=!1;return src.on("data",ondata),prependListener(dest,"error",onerror),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(0===state.pipesCount)return this;if(1===state.pipesCount)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){},destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream),WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(_){}}();var realHasInstance;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return!!realHasInstance.call(this,object)||object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,isBuf=_isUint8Array(chunk)&&!state.objectMode;return isBuf&&!Buffer.isBuffer(chunk)&&(chunk=_uint8ArrayToBuffer(chunk)),"function"==typeof encoding&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),"function"!=typeof cb&&(cb=nop),state.ended?writeAfterEnd(this,cb):(isBuf||validChunk(this,state,chunk,cb))&&(state.pendingcb++,ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.finished||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);return this._writableState.defaultEncoding=encoding,this},Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,chunk=null,encoding=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!==chunk&&void 0!==chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||endWritable(this,state,cb)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){this.end(),cb(err)}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":298,"./internal/streams/destroy":304,"./internal/streams/stream":305,_process:145,"core-util-is":152,inherits:306,"process-nextick-args":285,"safe-buffer":313,"util-deprecate":353}],303:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function copyBuffer(src,target,offset){src.copy(target,offset)}var Buffer=require("safe-buffer").Buffer;module.exports=function(){function BufferList(){_classCallCheck(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};0===this.length&&(this.tail=entry),this.head=entry,++this.length},BufferList.prototype.shift=function(){if(0!==this.length){var ret=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},BufferList.prototype.clear=function(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},BufferList.prototype.concat=function(n){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var ret=Buffer.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret},BufferList}()},{"safe-buffer":313}],304:[function(require,module,exports){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed)return void(cb?cb(err):!err||this._writableState&&this._writableState.errorEmitted||processNextTick(emitErrorNT,this,err));this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err){!cb&&err?(processNextTick(emitErrorNT,_this,err),_this._writableState&&(_this._writableState.errorEmitted=!0)):cb&&cb(err)})}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.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(self,err){self.emit("error",err)}var processNextTick=require("process-nextick-args");module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":285}],305:[function(require,module,exports){"use strict";module.exports=require("events").EventEmitter},{events:239}],306:[function(require,module,exports){arguments[4][254][0].apply(exports,arguments)},{dup:254}],307:[function(require,module,exports){"use strict";module.exports=require("./readable").PassThrough},{"./readable":308}],308:[function(require,module,exports){"use strict";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")},{"./lib/_stream_duplex.js":298,"./lib/_stream_passthrough.js":299,"./lib/_stream_readable.js":300,"./lib/_stream_transform.js":301,"./lib/_stream_writable.js":302}],309:[function(require,module,exports){"use strict";module.exports=require("./readable").Transform},{"./readable":308}],310:[function(require,module,exports){"use strict";module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":302}],311:[function(require,module,exports){(function(Buffer){"use strict";function RIPEMD160(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(x,n){return x<>>32-n}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0}var inherits=require("inherits"),HashBase=require("hash-base");inherits(RIPEMD160,HashBase),RIPEMD160.prototype._update=function(){for(var m=new Array(16),i=0;i<16;++i)m[i]=this._block.readInt32LE(4*i);var al=this._a,bl=this._b,cl=this._c,dl=this._d,el=this._e;al=fn1(al,bl,cl,dl,el,m[0],0,11),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[1],0,14),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[2],0,15),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[3],0,12),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[4],0,5),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[5],0,8),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[6],0,7),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[7],0,9),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[8],0,11),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[9],0,13),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[10],0,14),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[11],0,15),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[12],0,6),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[13],0,7),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[14],0,9),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[15],0,8),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[7],1518500249,7),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[4],1518500249,6),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[13],1518500249,8),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[1],1518500249,13),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[10],1518500249,11),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[6],1518500249,9),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[15],1518500249,7),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[3],1518500249,15),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[12],1518500249,7),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[0],1518500249,12),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[9],1518500249,15),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[5],1518500249,9),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[2],1518500249,11),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[14],1518500249,7),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[11],1518500249,13),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[8],1518500249,12),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[3],1859775393,11),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[10],1859775393,13),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[14],1859775393,6),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[4],1859775393,7),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[9],1859775393,14),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[15],1859775393,9),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[8],1859775393,13),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[1],1859775393,15),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[2],1859775393,14),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[7],1859775393,8),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[0],1859775393,13),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[6],1859775393,6),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[13],1859775393,5),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[11],1859775393,12),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[5],1859775393,7),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[12],1859775393,5),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[1],2400959708,11),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[9],2400959708,12),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[11],2400959708,14),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[10],2400959708,15),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[0],2400959708,14),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[8],2400959708,15),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[12],2400959708,9),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[4],2400959708,8),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[13],2400959708,9),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[3],2400959708,14),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[7],2400959708,5),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[15],2400959708,6),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[14],2400959708,8),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[5],2400959708,6),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[6],2400959708,5),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[2],2400959708,12),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[4],2840853838,9),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[0],2840853838,15),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[5],2840853838,5),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[9],2840853838,11),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[7],2840853838,6),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[12],2840853838,8),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[2],2840853838,13),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[10],2840853838,12),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[14],2840853838,5),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[1],2840853838,12),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[3],2840853838,13),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[8],2840853838,14),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[11],2840853838,11),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[6],2840853838,8),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[15],2840853838,5),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[13],2840853838,6),dl=rotl(dl,10);var ar=this._a,br=this._b,cr=this._c,dr=this._d,er=this._e;ar=fn5(ar,br,cr,dr,er,m[5],1352829926,8),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[14],1352829926,9),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[7],1352829926,9),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[0],1352829926,11),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[9],1352829926,13),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[2],1352829926,15),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[11],1352829926,15),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[4],1352829926,5),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[13],1352829926,7),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[6],1352829926,7),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[15],1352829926,8),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[8],1352829926,11),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[1],1352829926,14),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[10],1352829926,14),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[3],1352829926,12),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[12],1352829926,6),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[6],1548603684,9),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[11],1548603684,13),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[3],1548603684,15),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[7],1548603684,7),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[0],1548603684,12),cr=rotl(cr,10), -er=fn4(er,ar,br,cr,dr,m[13],1548603684,8),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[5],1548603684,9),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[10],1548603684,11),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[14],1548603684,7),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[15],1548603684,7),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[8],1548603684,12),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[12],1548603684,7),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[4],1548603684,6),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[9],1548603684,15),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[1],1548603684,13),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[2],1548603684,11),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[15],1836072691,9),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[5],1836072691,7),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[1],1836072691,15),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[3],1836072691,11),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[7],1836072691,8),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[14],1836072691,6),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[6],1836072691,6),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[9],1836072691,14),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[11],1836072691,12),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[8],1836072691,13),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[12],1836072691,5),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[2],1836072691,14),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[10],1836072691,13),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[0],1836072691,13),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[4],1836072691,7),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[13],1836072691,5),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[8],2053994217,15),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[6],2053994217,5),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[4],2053994217,8),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[1],2053994217,11),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[3],2053994217,14),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[11],2053994217,14),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[15],2053994217,6),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[0],2053994217,14),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[5],2053994217,6),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[12],2053994217,9),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[2],2053994217,12),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[13],2053994217,9),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[9],2053994217,12),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[7],2053994217,5),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[10],2053994217,15),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[14],2053994217,8),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[12],0,8),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[15],0,5),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[10],0,12),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[4],0,9),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[1],0,12),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[5],0,5),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[8],0,14),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[7],0,6),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[6],0,8),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[2],0,13),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[13],0,6),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[14],0,5),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[0],0,15),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[3],0,13),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[9],0,11),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[11],0,11),dr=rotl(dr,10);var t=this._b+cl+dr|0;this._b=this._c+dl+er|0,this._c=this._d+el+ar|0,this._d=this._e+al+br|0,this._e=this._a+bl+cr|0,this._a=t},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=new Buffer(20);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer.writeInt32LE(this._e,16),buffer},module.exports=RIPEMD160}).call(this,require("buffer").Buffer)},{buffer:150,"hash-base":241,inherits:258}],312:[function(require,module,exports){(function(Buffer){"use strict";function safeParseInt(v,base){if("00"===v.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(v,base)}function encodeLength(len,offset){if(len<56)return new Buffer([len+offset]);var hexLength=intToHex(len),lLength=hexLength.length/2,firstByte=intToHex(offset+55+lLength);return new Buffer(firstByte+hexLength,"hex")}function _decode(input){var length,llength,data,innerRemainder,d,decoded=[],firstByte=input[0];if(firstByte<=127)return{data:input.slice(0,1),remainder:input.slice(1)};if(firstByte<=183){if(length=firstByte-127,data=128===firstByte?new Buffer([]):input.slice(1,length),2===length&&data[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:data,remainder:input.slice(length)}}if(firstByte<=191){if(llength=firstByte-182,length=safeParseInt(input.slice(1,llength).toString("hex"),16),data=input.slice(llength,length+llength),data.lengthinput.length)throw new Error("invalid rlp: total length is larger than the data");if(innerRemainder=input.slice(llength,totalLength),0===innerRemainder.length)throw new Error("invalid rlp, List has a invalid length");for(;innerRemainder.length;)d=_decode(innerRemainder),decoded.push(d.data),innerRemainder=d.remainder;return{data:decoded,remainder:input.slice(totalLength)}}function isHexPrefixed(str){return"0x"===str.slice(0,2)}function stripHexPrefix(str){return"string"!=typeof str?str:isHexPrefixed(str)?str.slice(2):str}function intToHex(i){var hex=i.toString(16);return hex.length%2&&(hex="0"+hex),hex}function padToEven(a){return a.length%2&&(a="0"+a),a}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex,"hex")}function toBuffer(v){if(!Buffer.isBuffer(v))if("string"==typeof v)v=isHexPrefixed(v)?new Buffer(padToEven(stripHexPrefix(v)),"hex"):new Buffer(v);else if("number"==typeof v)v=v?intToBuffer(v):new Buffer([]);else if(null===v||void 0===v)v=new Buffer([]);else{if(!v.toArray)throw new Error("invalid type");v=new Buffer(v.toArray())}return v}var assert=require("assert");exports.encode=function(input){if(input instanceof Array){for(var output=[],i=0;i=64;){var u,i,j,t1,t2,a=h0,b=h1,c=h2,d=h3,e=h4,f=h5,g=h6,h=h7;for(i=0;i<16;i++)j=off+4*i,w[i]=(255&p[j])<<24|(255&p[j+1])<<16|(255&p[j+2])<<8|255&p[j+3];for(i=16;i<64;i++)u=w[i-2],t1=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,u=w[i-15],t2=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,w[i]=(t1+w[i-7]|0)+(t2+w[i-16]|0)|0;for(i=0;i<64;i++)t1=(((e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7))+(e&f^~e&g)|0)+(h+(K[i]+w[i]|0)|0)|0,t2=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&b^a&c^b&c)|0,h=g,g=f,f=e,e=d+t1|0,d=c,c=b,b=a,a=t1+t2|0;h0=h0+a|0,h1=h1+b|0,h2=h2+c|0,h3=h3+d|0,h4=h4+e|0,h5=h5+f|0,h6=h6+g|0,h7=h7+h|0,off+=64,len-=64}}var 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],h0=1779033703,h1=3144134277,h2=1013904242,h3=2773480762,h4=1359893119,h5=2600822924,h6=528734635,h7=1541459225,w=new Array(64);blocks(m);var i,bytesLeft=m.length%64,bitLenHi=m.length/536870912|0,bitLenLo=m.length<<3,numZeros=bytesLeft<56?56:120,p=m.slice(m.length-bytesLeft,m.length);for(p.push(128),i=bytesLeft+1;i>>24&255),p.push(bitLenHi>>>16&255),p.push(bitLenHi>>>8&255),p.push(bitLenHi>>>0&255),p.push(bitLenLo>>>24&255),p.push(bitLenLo>>>16&255),p.push(bitLenLo>>>8&255),p.push(bitLenLo>>>0&255),blocks(p),[h0>>>24&255,h0>>>16&255,h0>>>8&255,h0>>>0&255,h1>>>24&255,h1>>>16&255,h1>>>8&255,h1>>>0&255,h2>>>24&255,h2>>>16&255,h2>>>8&255,h2>>>0&255,h3>>>24&255,h3>>>16&255,h3>>>8&255,h3>>>0&255,h4>>>24&255,h4>>>16&255,h4>>>8&255,h4>>>0&255,h5>>>24&255,h5>>>16&255,h5>>>8&255,h5>>>0&255,h6>>>24&255,h6>>>16&255,h6>>>8&255,h6>>>0&255,h7>>>24&255,h7>>>16&255,h7>>>8&255,h7>>>0&255]}function PBKDF2_HMAC_SHA256_OneIter(password,salt,dkLen){function incrementCounter(){for(var i=innerLen-1;i>=innerLen-4;i--){if(++inner[i]<=255)return;inner[i]=0}}password=password.length<=64?password:SHA256(password);var i,innerLen=64+salt.length+4,inner=new Array(innerLen),outerKey=new Array(64),dk=[];for(i=0;i<64;i++)inner[i]=54;for(i=0;i=32;)incrementCounter(),dk=dk.concat(SHA256(outerKey.concat(SHA256(inner)))),dkLen-=32;return dkLen>0&&(incrementCounter(),dk=dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0,dkLen))),dk}function salsaXOR(tmp,B,bin,bout){var u,i,j0=tmp[0]^B[bin++],j1=tmp[1]^B[bin++],j2=tmp[2]^B[bin++],j3=tmp[3]^B[bin++],j4=tmp[4]^B[bin++],j5=tmp[5]^B[bin++],j6=tmp[6]^B[bin++],j7=tmp[7]^B[bin++],j8=tmp[8]^B[bin++],j9=tmp[9]^B[bin++],j10=tmp[10]^B[bin++],j11=tmp[11]^B[bin++],j12=tmp[12]^B[bin++],j13=tmp[13]^B[bin++],j14=tmp[14]^B[bin++],j15=tmp[15]^B[bin++],x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15;for(i=0;i<8;i+=2)u=x0+x12,x4^=u<<7|u>>>25,u=x4+x0,x8^=u<<9|u>>>23,u=x8+x4,x12^=u<<13|u>>>19,u=x12+x8,x0^=u<<18|u>>>14,u=x5+x1,x9^=u<<7|u>>>25,u=x9+x5,x13^=u<<9|u>>>23,u=x13+x9,x1^=u<<13|u>>>19,u=x1+x13,x5^=u<<18|u>>>14,u=x10+x6,x14^=u<<7|u>>>25,u=x14+x10,x2^=u<<9|u>>>23,u=x2+x14,x6^=u<<13|u>>>19,u=x6+x2,x10^=u<<18|u>>>14,u=x15+x11,x3^=u<<7|u>>>25,u=x3+x15,x7^=u<<9|u>>>23,u=x7+x3,x11^=u<<13|u>>>19,u=x11+x7,x15^=u<<18|u>>>14,u=x0+x3,x1^=u<<7|u>>>25,u=x1+x0,x2^=u<<9|u>>>23,u=x2+x1,x3^=u<<13|u>>>19,u=x3+x2,x0^=u<<18|u>>>14,u=x5+x4,x6^=u<<7|u>>>25,u=x6+x5,x7^=u<<9|u>>>23,u=x7+x6,x4^=u<<13|u>>>19,u=x4+x7,x5^=u<<18|u>>>14,u=x10+x9,x11^=u<<7|u>>>25,u=x11+x10,x8^=u<<9|u>>>23,u=x8+x11,x9^=u<<13|u>>>19,u=x9+x8,x10^=u<<18|u>>>14,u=x15+x14,x12^=u<<7|u>>>25,u=x12+x15,x13^=u<<9|u>>>23,u=x13+x12,x14^=u<<13|u>>>19,u=x14+x13,x15^=u<<18|u>>>14;B[bout++]=tmp[0]=x0+j0|0,B[bout++]=tmp[1]=x1+j1|0,B[bout++]=tmp[2]=x2+j2|0,B[bout++]=tmp[3]=x3+j3|0,B[bout++]=tmp[4]=x4+j4|0,B[bout++]=tmp[5]=x5+j5|0,B[bout++]=tmp[6]=x6+j6|0,B[bout++]=tmp[7]=x7+j7|0,B[bout++]=tmp[8]=x8+j8|0,B[bout++]=tmp[9]=x9+j9|0,B[bout++]=tmp[10]=x10+j10|0,B[bout++]=tmp[11]=x11+j11|0,B[bout++]=tmp[12]=x12+j12|0,B[bout++]=tmp[13]=x13+j13|0,B[bout++]=tmp[14]=x14+j14|0,B[bout++]=tmp[15]=x15+j15|0}function blockCopy(dst,di,src,si,len){for(;len--;)dst[di++]=src[si++]}function blockXOR(dst,di,src,si,len){for(;len--;)dst[di++]^=src[si++]}function blockMix(tmp,B,bin,bout,r){blockCopy(tmp,0,B,bin+16*(2*r-1),16);for(var i=0;i<2*r;i+=2)salsaXOR(tmp,B,bin+16*i,bout+8*i),salsaXOR(tmp,B,bin+16*i+16,bout+8*i+16*r)}function integerify(B,bi,r){return B[bi+16*(2*r-1)]}function stringToUTF8Bytes(s){for(var arr=[],i=0;i127&&c<2048?(arr.push(c>>6|192),arr.push(63&c|128)):(arr.push(c>>12|224),arr.push(c>>6&63|128),arr.push(63&c|128))}return arr}function bytesToHex(p){for(var enc="0123456789abcdef".split(""),len=p.length,arr=[],i=0;i>>4&15]),arr.push(enc[p[i]>>>0&15]);return arr.join("")}function bytesToBase64(p){for(var a,b,c,t,enc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),len=p.length,arr=[],i=0;i>>18&63]),arr.push(enc[t>>>12&63]),arr.push(enc[t>>>6&63]),arr.push(enc[t>>>0&63]);return len%3>0&&(arr[arr.length-1]="=",len%3==1&&(arr[arr.length-2]="=")),arr.join("")}function smixStart(pos){for(var i=0;i<32*r;i++){var j=pos+4*i;XY[xi+i]=(255&B[j+3])<<24|(255&B[j+2])<<16|(255&B[j+1])<<8|(255&B[j+0])<<0}}function smixStep1(start,end){for(var i=start;i>>0&255,B[pos+4*i+1]=j>>>8&255,B[pos+4*i+2]=j>>>16&255,B[pos+4*i+3]=j>>>24&255}}function interruptedFor(start,end,step,fn,donefn){!function performStep(){nextTick(function(){fn(start,start+step4)throw new Error("scrypt: incorrect number of arguments");var opts=logN;if(callback=r,void 0===(logN=opts.logN)){if(void 0===opts.N)throw new Error("scrypt: missing N parameter");if(opts.N<2||opts.N>-1>>>0)throw new Error("scrypt: N is out of range");if(0!=(opts.N&opts.N-1))throw new Error("scrypt: N is not a power of 2");logN=Math.log(opts.N)/Math.LN2}p=opts.p||1,r=opts.r,dkLen=opts.dkLen||32,interruptStep=opts.interruptStep||0,encoding=opts.encoding}if(p<1)throw new Error("scrypt: invalid p");if(r<=0)throw new Error("scrypt: invalid r");if(logN<1||logN>31)throw new Error("scrypt: logN must be between 1 and 31");var XY,V,B,tmp,N=1<>>0;if(r*p>=1<<30||r>(-1>>>0)/128/p||r>(-1>>>0)/256||N>(-1>>>0)/128/r)throw new Error("scrypt: parameters are too large");"string"==typeof password&&(password=stringToUTF8Bytes(password)),"string"==typeof salt&&(salt=stringToUTF8Bytes(salt)),"undefined"!=typeof Int32Array?(XY=new Int32Array(64*r),V=new Int32Array(32*N*r),tmp=new Int32Array(16)):(XY=[],V=[],tmp=new Array(16)),B=PBKDF2_HMAC_SHA256_OneIter(password,salt,128*p*r);var xi=0,yi=32*r,nextTick="undefined"!=typeof setImmediate?setImmediate:setTimeout;"function"==typeof interruptStep&&(encoding=callback,callback=interruptStep,interruptStep=1e3),interruptStep<=0?function(){for(var i=0;i=y)throw RangeError(message)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":259}],317:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer,bip66=require("bip66"),EC_PRIVKEY_EXPORT_DER_COMPRESSED=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),ZERO_BUFFER_32=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);exports.privateKeyExport=function(privateKey,publicKey,compressed){var result=Buffer.from(compressed?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);return privateKey.copy(result,compressed?8:9),publicKey.copy(result,compressed?181:214),result},exports.privateKeyImport=function(privateKey){var length=privateKey.length,index=0;if(!(length2||length1?privateKey[index+lenb-2]<<8:0);if(index+=lenb,!(length32||length1&&0===r[posR]&&!(128&r[posR+1]);--lenR,++posR);for(var s=Buffer.concat([Buffer.from([0]),sigObj.s]),lenS=33,posS=0;lenS>1&&0===s[posS]&&!(128&s[posS+1]);--lenS,++posS);return bip66.encode(r.slice(posR),s.slice(posS))},exports.signatureImport=function(sig){var r=Buffer.from(ZERO_BUFFER_32),s=Buffer.from(ZERO_BUFFER_32);try{var sigObj=bip66.decode(sig);if(33===sigObj.r.length&&0===sigObj.r[0]&&(sigObj.r=sigObj.r.slice(1)),sigObj.r.length>32)throw new Error("R length is too long");if(33===sigObj.s.length&&0===sigObj.s[0]&&(sigObj.s=sigObj.s.slice(1)),sigObj.s.length>32)throw new Error("S length is too long")}catch(err){return}return sigObj.r.copy(r,32-sigObj.r.length),sigObj.s.copy(s,32-sigObj.s.length),{r:r,s:s}},exports.signatureImportLax=function(sig){var r=Buffer.from(ZERO_BUFFER_32),s=Buffer.from(ZERO_BUFFER_32),length=sig.length,index=0;if(48===sig[index++]){var lenbyte=sig[index++];if(!(128&lenbyte&&(index+=lenbyte-128)>length)&&2===sig[index++]){var rlen=sig[index++];if(128&rlen){if(lenbyte=rlen-128,index+lenbyte>length)return;for(;lenbyte>0&&0===sig[index];index+=1,lenbyte-=1);for(rlen=0;lenbyte>0;index+=1,lenbyte-=1)rlen=(rlen<<8)+sig[index]}if(!(rlen>length-index)){var rindex=index;if(index+=rlen,2===sig[index++]){var slen=sig[index++];if(128&slen){if(lenbyte=slen-128,index+lenbyte>length)return;for(;lenbyte>0&&0===sig[index];index+=1,lenbyte-=1);for(slen=0;lenbyte>0;index+=1,lenbyte-=1)slen=(slen<<8)+sig[index]}if(!(slen>length-index)){var sindex=index;for(index+=slen;rlen>0&&0===sig[rindex];rlen-=1,rindex+=1);if(!(rlen>32)){var rvalue=sig.slice(rindex,rindex+rlen);for(rvalue.copy(r,32-rvalue.length);slen>0&&0===sig[sindex];slen-=1,sindex+=1);if(!(slen>32)){var svalue=sig.slice(sindex,sindex+slen);return svalue.copy(s,32-svalue.length),{r:r,s:s}}}}}}}}}},{bip66:25,"safe-buffer":313}],318:[function(require,module,exports){"use strict";function loadCompressedPublicKey(first,xBuffer){var x=new BN(xBuffer);if(x.cmp(ecparams.p)>=0)return null;x=x.toRed(ecparams.red);var y=x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt();return 3===first!==y.isOdd()&&(y=y.redNeg()),ec.keyPair({pub:{x:x,y:y}})}function loadUncompressedPublicKey(first,xBuffer,yBuffer){var x=new BN(xBuffer),y=new BN(yBuffer);if(x.cmp(ecparams.p)>=0||y.cmp(ecparams.p)>=0)return null;if(x=x.toRed(ecparams.red),y=y.toRed(ecparams.red),(6===first||7===first)&&y.isOdd()!==(7===first))return null;var x3=x.redSqr().redIMul(x);return y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()?ec.keyPair({pub:{x:x,y:y}}):null}function loadPublicKey(publicKey){var first=publicKey[0];switch(first){case 2:case 3:return 33!==publicKey.length?null:loadCompressedPublicKey(first,publicKey.slice(1,33));case 4:case 6:case 7:return 65!==publicKey.length?null:loadUncompressedPublicKey(first,publicKey.slice(1,33),publicKey.slice(33,65));default:return null}}var Buffer=require("safe-buffer").Buffer,createHash=require("create-hash"),BN=require("bn.js"),EC=require("elliptic").ec,messages=require("../messages.json"),ec=new EC("secp256k1"),ecparams=ec.curve;exports.privateKeyVerify=function(privateKey){var bn=new BN(privateKey);return bn.cmp(ecparams.n)<0&&!bn.isZero()},exports.privateKeyExport=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,!0))},exports.privateKeyTweakAdd=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0)throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(bn.iadd(new BN(privateKey)),bn.cmp(ecparams.n)>=0&&bn.isub(ecparams.n),bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return bn.toArrayLike(Buffer,"be",32)},exports.privateKeyTweakMul=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0||bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return bn.imul(new BN(privateKey)),bn.cmp(ecparams.n)&&(bn=bn.umod(ecparams.n)),bn.toArrayLike(Buffer,"be",32)},exports.publicKeyCreate=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,!0))},exports.publicKeyConvert=function(publicKey,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return Buffer.from(pair.getPublic(compressed,!0))},exports.publicKeyVerify=function(publicKey){return null!==loadPublicKey(publicKey)},exports.publicKeyTweakAdd=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);if(tweak=new BN(tweak),tweak.cmp(ecparams.n)>=0)throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return Buffer.from(ecparams.g.mul(tweak).add(pair.pub).encode(!0,compressed))},exports.publicKeyTweakMul=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);if(tweak=new BN(tweak),tweak.cmp(ecparams.n)>=0||tweak.isZero())throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return Buffer.from(pair.pub.mul(tweak).encode(!0,compressed))},exports.publicKeyCombine=function(publicKeys,compressed){for(var pairs=new Array(publicKeys.length),i=0;i=0||s.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);var result=Buffer.from(signature);return 1===s.cmp(ec.nh)&&ecparams.n.sub(s).toArrayLike(Buffer,"be",32).copy(result,32),result},exports.signatureExport=function(signature){var r=signature.slice(0,32),s=signature.slice(32,64);if(new BN(r).cmp(ecparams.n)>=0||new BN(s).cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);return{r:r,s:s}},exports.signatureImport=function(sigObj){var r=new BN(sigObj.r);r.cmp(ecparams.n)>=0&&(r=new BN(0));var s=new BN(sigObj.s);return s.cmp(ecparams.n)>=0&&(s=new BN(0)),Buffer.concat([r.toArrayLike(Buffer,"be",32),s.toArrayLike(Buffer,"be",32)])},exports.sign=function(message,privateKey,noncefn,data){if("function"==typeof noncefn){var getNonce=noncefn;noncefn=function(counter){var nonce=getNonce(message,privateKey,null,data,counter);if(!Buffer.isBuffer(nonce)||32!==nonce.length)throw new Error(messages.ECDSA_SIGN_FAIL);return new BN(nonce)}}var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.ECDSA_SIGN_FAIL);var result=ec.sign(message,privateKey,{canonical:!0,k:noncefn,pers:data});return{signature:Buffer.concat([result.r.toArrayLike(Buffer,"be",32),result.s.toArrayLike(Buffer,"be",32)]),recovery:result.recoveryParam}},exports.verify=function(message,signature,publicKey){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)},sigr=new BN(sigObj.r),sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);if(1===sigs.cmp(ec.nh)||sigr.isZero()||sigs.isZero())return!1;var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(message,sigObj,{x:pair.pub.x,y:pair.pub.y})},exports.recover=function(message,signature,recovery,compressed){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)},sigr=new BN(sigObj.r),sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);try{if(sigr.isZero()||sigs.isZero())throw new Error;var point=ec.recoverPubKey(message,sigObj,recovery);return Buffer.from(point.encode(!0,compressed))}catch(err){throw new Error(messages.ECDSA_RECOVER_FAIL)}},exports.ecdh=function(publicKey,privateKey){var shared=exports.ecdhUnsafe(publicKey,privateKey,!0);return createHash("sha256").update(shared).digest()},exports.ecdhUnsafe=function(publicKey,privateKey,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);var scalar=new BN(privateKey);if(scalar.cmp(ecparams.n)>=0||scalar.isZero())throw new Error(messages.ECDH_FAIL);return Buffer.from(pair.pub.mul(scalar).encode(!0,compressed))}},{"../messages.json":320,"bn.js":99,"create-hash":170,elliptic:321,"safe-buffer":313}],319:[function(require,module,exports){"use strict";function initCompressedValue(value,defaultValue){return void 0===value?defaultValue:(assert.isBoolean(value,messages.COMPRESSED_TYPE_INVALID),value)}var assert=require("./assert"),der=require("./der"),messages=require("./messages.json");module.exports=function(secp256k1){return{privateKeyVerify:function(privateKey){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),32===privateKey.length&&secp256k1.privateKeyVerify(privateKey)},privateKeyExport:function(privateKey,compressed){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0);var publicKey=secp256k1.privateKeyExport(privateKey,compressed);return der.privateKeyExport(privateKey,publicKey,compressed)},privateKeyImport:function(privateKey){if(assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),(privateKey=der.privateKeyImport(privateKey))&&32===privateKey.length&&secp256k1.privateKeyVerify(privateKey))return privateKey;throw new Error(messages.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyTweakAdd:function(privateKey,tweak){ -return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),secp256k1.privateKeyTweakAdd(privateKey,tweak)},privateKeyTweakMul:function(privateKey,tweak){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),secp256k1.privateKeyTweakMul(privateKey,tweak)},publicKeyCreate:function(privateKey,compressed){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyCreate(privateKey,compressed)},publicKeyConvert:function(publicKey,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyConvert(publicKey,compressed)},publicKeyVerify:function(publicKey){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),secp256k1.publicKeyVerify(publicKey)},publicKeyTweakAdd:function(publicKey,tweak,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyTweakAdd(publicKey,tweak,compressed)},publicKeyTweakMul:function(publicKey,tweak,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyTweakMul(publicKey,tweak,compressed)},publicKeyCombine:function(publicKeys,compressed){assert.isArray(publicKeys,messages.EC_PUBLIC_KEYS_TYPE_INVALID),assert.isLengthGTZero(publicKeys,messages.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=this._finalSize&&(this._update(this._block),this._block.fill(0));var bits=8*this._len;if(bits<=4294967295)this._block.writeUInt32BE(bits,this._blockSize-4);else{var lowBits=4294967295&bits,highBits=(bits-lowBits)/4294967296;this._block.writeUInt32BE(highBits,this._blockSize-8),this._block.writeUInt32BE(lowBits,this._blockSize-4)}this._update(this._block);var hash=this._hash();return enc?hash.toString(enc):hash},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},module.exports=Hash},{"safe-buffer":313}],338:[function(require,module,exports){"use strict";var _exports=module.exports=function(algorithm){algorithm=algorithm.toLowerCase();var Algorithm=_exports[algorithm];if(!Algorithm)throw new Error(algorithm+" is not supported (we accept pull requests)");return new Algorithm};_exports.sha=require("./sha"),_exports.sha1=require("./sha1"),_exports.sha224=require("./sha224"),_exports.sha256=require("./sha256"),_exports.sha384=require("./sha384"),_exports.sha512=require("./sha512")},{"./sha":339,"./sha1":340,"./sha224":341,"./sha256":342,"./sha384":343,"./sha512":344}],339:[function(require,module,exports){"use strict";function Sha(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);inherits(Sha,Hash),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=W[i-3]^W[i-8]^W[i-14]^W[i-16];for(var j=0;j<80;++j){var s=~~(j/20),t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha},{"./hash":337,inherits:258,"safe-buffer":313}],340:[function(require,module,exports){"use strict";function Sha1(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl1(num){return num<<1|num>>>31}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);inherits(Sha1,Hash),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=rotl1(W[i-3]^W[i-8]^W[i-14]^W[i-16]);for(var j=0;j<80;++j){var s=~~(j/20),t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha1.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha1},{"./hash":337,inherits:258,"safe-buffer":313}],341:[function(require,module,exports){"use strict";function Sha224(){this.init(),this._w=W,Hash.call(this,64,56)}var inherits=require("inherits"),Sha256=require("./sha256"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(64);inherits(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var H=Buffer.allocUnsafe(28);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H},module.exports=Sha224},{"./hash":337,"./sha256":342,inherits:258,"safe-buffer":313}],342:[function(require,module,exports){"use strict";function Sha256(){this.init(),this._w=W,Hash.call(this,64,56)}function ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x){return(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10)}function sigma1(x){return(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7)}function gamma0(x){return(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3}function gamma1(x){return(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,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],W=new Array(64);inherits(Sha256,Hash),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,f=0|this._f,g=0|this._g,h=0|this._h,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<64;++i)W[i]=gamma1(W[i-2])+W[i-7]+gamma0(W[i-15])+W[i-16]|0;for(var j=0;j<64;++j){var T1=h+sigma1(e)+ch(e,f,g)+K[j]+W[j]|0,T2=sigma0(a)+maj(a,b,c)|0;h=g,g=f,f=e,e=d+T1|0,d=c,c=b,b=a,a=T1+T2|0}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0,this._f=f+this._f|0,this._g=g+this._g|0,this._h=h+this._h|0},Sha256.prototype._hash=function(){var H=Buffer.allocUnsafe(32);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H.writeInt32BE(this._h,28),H},module.exports=Sha256},{"./hash":337,inherits:258,"safe-buffer":313}],343:[function(require,module,exports){"use strict";function Sha384(){this.init(),this._w=W,Hash.call(this,128,112)}var inherits=require("inherits"),SHA512=require("./sha512"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(160);inherits(Sha384,SHA512),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}var H=Buffer.allocUnsafe(48);return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),H},module.exports=Sha384},{"./hash":337,"./sha512":344,inherits:258,"safe-buffer":313}],344:[function(require,module,exports){"use strict";function Sha512(){this.init(),this._w=W,Hash.call(this,128,112)}function Ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x,xl){return(x>>>28|xl<<4)^(xl>>>2|x<<30)^(xl>>>7|x<<25)}function sigma1(x,xl){return(x>>>14|xl<<18)^(x>>>18|xl<<14)^(xl>>>9|x<<23)}function Gamma0(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^x>>>7}function Gamma0l(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^(x>>>7|xl<<25)}function Gamma1(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^x>>>6}function Gamma1l(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^(x>>>6|xl<<26)}function getCarry(a,b){return a>>>0>>0?1:0}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W=new Array(160);inherits(Sha512,Hash),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(M){for(var W=this._w,ah=0|this._ah,bh=0|this._bh,ch=0|this._ch,dh=0|this._dh,eh=0|this._eh,fh=0|this._fh,gh=0|this._gh,hh=0|this._hh,al=0|this._al,bl=0|this._bl,cl=0|this._cl,dl=0|this._dl,el=0|this._el,fl=0|this._fl,gl=0|this._gl,hl=0|this._hl,i=0;i<32;i+=2)W[i]=M.readInt32BE(4*i),W[i+1]=M.readInt32BE(4*i+4);for(;i<160;i+=2){var xh=W[i-30],xl=W[i-30+1],gamma0=Gamma0(xh,xl),gamma0l=Gamma0l(xl,xh);xh=W[i-4],xl=W[i-4+1];var gamma1=Gamma1(xh,xl),gamma1l=Gamma1l(xl,xh),Wi7h=W[i-14],Wi7l=W[i-14+1],Wi16h=W[i-32],Wi16l=W[i-32+1],Wil=gamma0l+Wi7l|0,Wih=gamma0+Wi7h+getCarry(Wil,gamma0l)|0;Wil=Wil+gamma1l|0,Wih=Wih+gamma1+getCarry(Wil,gamma1l)|0,Wil=Wil+Wi16l|0,Wih=Wih+Wi16h+getCarry(Wil,Wi16l)|0,W[i]=Wih,W[i+1]=Wil}for(var j=0;j<160;j+=2){Wih=W[j],Wil=W[j+1];var majh=maj(ah,bh,ch),majl=maj(al,bl,cl),sigma0h=sigma0(ah,al),sigma0l=sigma0(al,ah),sigma1h=sigma1(eh,el),sigma1l=sigma1(el,eh),Kih=K[j],Kil=K[j+1],chh=Ch(eh,fh,gh),chl=Ch(el,fl,gl),t1l=hl+sigma1l|0,t1h=hh+sigma1h+getCarry(t1l,hl)|0;t1l=t1l+chl|0,t1h=t1h+chh+getCarry(t1l,chl)|0,t1l=t1l+Kil|0,t1h=t1h+Kih+getCarry(t1l,Kil)|0,t1l=t1l+Wil|0,t1h=t1h+Wih+getCarry(t1l,Wil)|0;var t2l=sigma0l+majl|0,t2h=sigma0h+majh+getCarry(t2l,sigma0l)|0;hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,el=dl+t1l|0,eh=dh+t1h+getCarry(el,dl)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,al=t1l+t2l|0,ah=t1h+t2h+getCarry(al,t1l)|0}this._al=this._al+al|0,this._bl=this._bl+bl|0,this._cl=this._cl+cl|0,this._dl=this._dl+dl|0,this._el=this._el+el|0,this._fl=this._fl+fl|0,this._gl=this._gl+gl|0,this._hl=this._hl+hl|0,this._ah=this._ah+ah+getCarry(this._al,al)|0,this._bh=this._bh+bh+getCarry(this._bl,bl)|0,this._ch=this._ch+ch+getCarry(this._cl,cl)|0,this._dh=this._dh+dh+getCarry(this._dl,dl)|0,this._eh=this._eh+eh+getCarry(this._el,el)|0,this._fh=this._fh+fh+getCarry(this._fl,fl)|0,this._gh=this._gh+gh+getCarry(this._gl,gl)|0,this._hh=this._hh+hh+getCarry(this._hl,hl)|0},Sha512.prototype._hash=function(){function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}var H=Buffer.allocUnsafe(64);return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),H},module.exports=Sha512},{"./hash":337,inherits:258,"safe-buffer":313}],345:[function(require,module,exports){"use strict";function Stream(){EE.call(this)}module.exports=Stream;var EE=require("events").EventEmitter;require("inherits")(Stream,EE),Stream.Readable=require("readable-stream/readable.js"),Stream.Writable=require("readable-stream/writable.js"),Stream.Duplex=require("readable-stream/duplex.js"),Stream.Transform=require("readable-stream/transform.js"),Stream.PassThrough=require("readable-stream/passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(dest,options){function ondata(chunk){dest.writable&&!1===dest.write(chunk)&&source.pause&&source.pause()}function ondrain(){source.readable&&source.resume&&source.resume()}function onend(){didOnEnd||(didOnEnd=!0,dest.end())}function onclose(){didOnEnd||(didOnEnd=!0,"function"==typeof dest.destroy&&dest.destroy())}function onerror(er){if(cleanup(),0===EE.listenerCount(this,"error"))throw er}function cleanup(){source.removeListener("data",ondata),dest.removeListener("drain",ondrain),source.removeListener("end",onend),source.removeListener("close",onclose),source.removeListener("error",onerror),dest.removeListener("error",onerror),source.removeListener("end",cleanup),source.removeListener("close",cleanup),dest.removeListener("close",cleanup)}var source=this;source.on("data",ondata),dest.on("drain",ondrain),dest._isStdio||options&&!1===options.end||(source.on("end",onend),source.on("close",onclose));var didOnEnd=!1;return source.on("error",onerror),dest.on("error",onerror),source.on("end",cleanup),source.on("close",cleanup),dest.on("close",cleanup),dest.emit("pipe",source),dest}},{events:239,inherits:258,"readable-stream/duplex.js":297,"readable-stream/passthrough.js":307,"readable-stream/readable.js":308,"readable-stream/transform.js":309,"readable-stream/writable.js":310}],346:[function(require,module,exports){"use strict";function _normalizeEncoding(enc){if(!enc)return"utf8";for(var retried;;)switch(enc){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 enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if("string"!=typeof nenc&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(nb)}function utf8CheckByte(byte){return byte<=127?0:byte>>5==6?2:byte>>4==14?3:byte>>3==30?4:-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0?(nb>0&&(self.lastNeed=nb-1),nb):--j=0?(nb>0&&(self.lastNeed=nb-2),nb):--j=0?(nb>0&&(2===nb?nb=0:self.lastNeed=nb-3),nb):0)}function utf8CheckExtraBytes(self,buf,p){if(128!=(192&buf[0]))return self.lastNeed=0,"�".repeat(p);if(self.lastNeed>1&&buf.length>1){if(128!=(192&buf[1]))return self.lastNeed=1,"�".repeat(p+1);if(self.lastNeed>2&&buf.length>2&&128!=(192&buf[2]))return self.lastNeed=2,"�".repeat(p+2)}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);return void 0!==r?r:this.lastNeed<=buf.length?(buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(buf.copy(this.lastChar,p,0,buf.length),void(this.lastNeed-=buf.length))}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"�".repeat(this.lastTotal-this.lastNeed):r}function utf16Text(buf,i){if((buf.length-i)%2==0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;return 0===n?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(buf){ -return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(encoding){switch((encoding=""+encoding)&&encoding.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}};exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(buf){if(0===buf.length)return"";var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(buf)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i>24&255,x[i+1]=h>>16&255,x[i+2]=h>>8&255,x[i+3]=255&h,x[i+4]=l>>24&255,x[i+5]=l>>16&255,x[i+6]=l>>8&255,x[i+7]=255&l}function vn(x,xi,y,yi,n){var i,d=0;for(i=0;i>>8)-1}function crypto_verify_16(x,xi,y,yi){return vn(x,xi,y,yi,16)}function crypto_verify_32(x,xi,y,yi){return vn(x,xi,y,yi,32)}function core_salsa20(o,p,k,c){for(var u,j0=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,j1=255&k[0]|(255&k[1])<<8|(255&k[2])<<16|(255&k[3])<<24,j2=255&k[4]|(255&k[5])<<8|(255&k[6])<<16|(255&k[7])<<24,j3=255&k[8]|(255&k[9])<<8|(255&k[10])<<16|(255&k[11])<<24,j4=255&k[12]|(255&k[13])<<8|(255&k[14])<<16|(255&k[15])<<24,j5=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,j6=255&p[0]|(255&p[1])<<8|(255&p[2])<<16|(255&p[3])<<24,j7=255&p[4]|(255&p[5])<<8|(255&p[6])<<16|(255&p[7])<<24,j8=255&p[8]|(255&p[9])<<8|(255&p[10])<<16|(255&p[11])<<24,j9=255&p[12]|(255&p[13])<<8|(255&p[14])<<16|(255&p[15])<<24,j10=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,j11=255&k[16]|(255&k[17])<<8|(255&k[18])<<16|(255&k[19])<<24,j12=255&k[20]|(255&k[21])<<8|(255&k[22])<<16|(255&k[23])<<24,j13=255&k[24]|(255&k[25])<<8|(255&k[26])<<16|(255&k[27])<<24,j14=255&k[28]|(255&k[29])<<8|(255&k[30])<<16|(255&k[31])<<24,j15=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;x0=x0+j0|0,x1=x1+j1|0,x2=x2+j2|0,x3=x3+j3|0,x4=x4+j4|0,x5=x5+j5|0,x6=x6+j6|0,x7=x7+j7|0,x8=x8+j8|0,x9=x9+j9|0,x10=x10+j10|0,x11=x11+j11|0,x12=x12+j12|0,x13=x13+j13|0,x14=x14+j14|0,x15=x15+j15|0,o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x1>>>0&255,o[5]=x1>>>8&255,o[6]=x1>>>16&255,o[7]=x1>>>24&255,o[8]=x2>>>0&255,o[9]=x2>>>8&255,o[10]=x2>>>16&255,o[11]=x2>>>24&255,o[12]=x3>>>0&255,o[13]=x3>>>8&255,o[14]=x3>>>16&255,o[15]=x3>>>24&255,o[16]=x4>>>0&255,o[17]=x4>>>8&255,o[18]=x4>>>16&255,o[19]=x4>>>24&255,o[20]=x5>>>0&255,o[21]=x5>>>8&255,o[22]=x5>>>16&255,o[23]=x5>>>24&255,o[24]=x6>>>0&255,o[25]=x6>>>8&255,o[26]=x6>>>16&255,o[27]=x6>>>24&255,o[28]=x7>>>0&255,o[29]=x7>>>8&255,o[30]=x7>>>16&255,o[31]=x7>>>24&255,o[32]=x8>>>0&255,o[33]=x8>>>8&255,o[34]=x8>>>16&255,o[35]=x8>>>24&255,o[36]=x9>>>0&255,o[37]=x9>>>8&255,o[38]=x9>>>16&255,o[39]=x9>>>24&255,o[40]=x10>>>0&255,o[41]=x10>>>8&255,o[42]=x10>>>16&255,o[43]=x10>>>24&255,o[44]=x11>>>0&255,o[45]=x11>>>8&255,o[46]=x11>>>16&255,o[47]=x11>>>24&255,o[48]=x12>>>0&255,o[49]=x12>>>8&255,o[50]=x12>>>16&255,o[51]=x12>>>24&255,o[52]=x13>>>0&255,o[53]=x13>>>8&255,o[54]=x13>>>16&255,o[55]=x13>>>24&255,o[56]=x14>>>0&255,o[57]=x14>>>8&255,o[58]=x14>>>16&255,o[59]=x14>>>24&255,o[60]=x15>>>0&255,o[61]=x15>>>8&255,o[62]=x15>>>16&255,o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){for(var u,j0=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,j1=255&k[0]|(255&k[1])<<8|(255&k[2])<<16|(255&k[3])<<24,j2=255&k[4]|(255&k[5])<<8|(255&k[6])<<16|(255&k[7])<<24,j3=255&k[8]|(255&k[9])<<8|(255&k[10])<<16|(255&k[11])<<24,j4=255&k[12]|(255&k[13])<<8|(255&k[14])<<16|(255&k[15])<<24,j5=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,j6=255&p[0]|(255&p[1])<<8|(255&p[2])<<16|(255&p[3])<<24,j7=255&p[4]|(255&p[5])<<8|(255&p[6])<<16|(255&p[7])<<24,j8=255&p[8]|(255&p[9])<<8|(255&p[10])<<16|(255&p[11])<<24,j9=255&p[12]|(255&p[13])<<8|(255&p[14])<<16|(255&p[15])<<24,j10=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,j11=255&k[16]|(255&k[17])<<8|(255&k[18])<<16|(255&k[19])<<24,j12=255&k[20]|(255&k[21])<<8|(255&k[22])<<16|(255&k[23])<<24,j13=255&k[24]|(255&k[25])<<8|(255&k[26])<<16|(255&k[27])<<24,j14=255&k[28]|(255&k[29])<<8|(255&k[30])<<16|(255&k[31])<<24,j15=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x5>>>0&255,o[5]=x5>>>8&255,o[6]=x5>>>16&255,o[7]=x5>>>24&255,o[8]=x10>>>0&255,o[9]=x10>>>8&255,o[10]=x10>>>16&255,o[11]=x10>>>24&255,o[12]=x15>>>0&255,o[13]=x15>>>8&255,o[14]=x15>>>16&255,o[15]=x15>>>24&255,o[16]=x6>>>0&255,o[17]=x6>>>8&255,o[18]=x6>>>16&255,o[19]=x6>>>24&255,o[20]=x7>>>0&255,o[21]=x7>>>8&255,o[22]=x7>>>16&255,o[23]=x7>>>24&255,o[24]=x8>>>0&255,o[25]=x8>>>8&255,o[26]=x8>>>16&255,o[27]=x8>>>24&255,o[28]=x9>>>0&255,o[29]=x9>>>8&255,o[30]=x9>>>16&255,o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var u,i,z=new Uint8Array(16),x=new Uint8Array(64);for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];for(;b>=64;){for(crypto_core_salsa20(x,z,k,sigma),i=0;i<64;i++)c[cpos+i]=m[mpos+i]^x[i];for(u=1,i=8;i<16;i++)u=u+(255&z[i])|0,z[i]=255&u,u>>>=8;b-=64,cpos+=64,mpos+=64}if(b>0)for(crypto_core_salsa20(x,z,k,sigma),i=0;i=64;){for(crypto_core_salsa20(x,z,k,sigma),i=0;i<64;i++)c[cpos+i]=x[i];for(u=1,i=8;i<16;i++)u=u+(255&z[i])|0,z[i]=255&u,u>>>=8;b-=64,cpos+=64}if(b>0)for(crypto_core_salsa20(x,z,k,sigma),i=0;i>16&1),m[i-1]&=65535;m[15]=t[15]-32767-(m[14]>>16&1),b=m[15]>>16&1,m[14]&=65535,sel25519(t,m,1-b)}for(i=0;i<16;i++)o[2*i]=255&t[i],o[2*i+1]=t[i]>>8}function neq25519(a,b){var c=new Uint8Array(32),d=new Uint8Array(32);return pack25519(c,a),pack25519(d,b),crypto_verify_32(c,0,d,0)}function par25519(a){var d=new Uint8Array(32);return pack25519(d,a),1&d[0]}function unpack25519(o,n){var i;for(i=0;i<16;i++)o[i]=n[2*i]+(n[2*i+1]<<8);o[15]&=32767}function A(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]+b[i]}function Z(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]-b[i]}function M(o,a,b){var v,c,t0=0,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,t9=0,t10=0,t11=0,t12=0,t13=0,t14=0,t15=0,t16=0,t17=0,t18=0,t19=0,t20=0,t21=0,t22=0,t23=0,t24=0,t25=0,t26=0,t27=0,t28=0,t29=0,t30=0,b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];v=a[0],t0+=v*b0,t1+=v*b1,t2+=v*b2,t3+=v*b3,t4+=v*b4,t5+=v*b5,t6+=v*b6,t7+=v*b7,t8+=v*b8,t9+=v*b9,t10+=v*b10,t11+=v*b11,t12+=v*b12,t13+=v*b13,t14+=v*b14,t15+=v*b15,v=a[1],t1+=v*b0,t2+=v*b1,t3+=v*b2,t4+=v*b3,t5+=v*b4,t6+=v*b5,t7+=v*b6,t8+=v*b7,t9+=v*b8,t10+=v*b9,t11+=v*b10,t12+=v*b11,t13+=v*b12,t14+=v*b13,t15+=v*b14,t16+=v*b15,v=a[2],t2+=v*b0,t3+=v*b1,t4+=v*b2,t5+=v*b3,t6+=v*b4,t7+=v*b5,t8+=v*b6,t9+=v*b7,t10+=v*b8,t11+=v*b9,t12+=v*b10,t13+=v*b11,t14+=v*b12,t15+=v*b13,t16+=v*b14,t17+=v*b15,v=a[3],t3+=v*b0,t4+=v*b1,t5+=v*b2,t6+=v*b3,t7+=v*b4,t8+=v*b5,t9+=v*b6,t10+=v*b7,t11+=v*b8,t12+=v*b9,t13+=v*b10,t14+=v*b11,t15+=v*b12,t16+=v*b13,t17+=v*b14,t18+=v*b15,v=a[4],t4+=v*b0,t5+=v*b1,t6+=v*b2,t7+=v*b3,t8+=v*b4,t9+=v*b5,t10+=v*b6,t11+=v*b7,t12+=v*b8,t13+=v*b9,t14+=v*b10,t15+=v*b11,t16+=v*b12,t17+=v*b13,t18+=v*b14,t19+=v*b15,v=a[5],t5+=v*b0,t6+=v*b1,t7+=v*b2,t8+=v*b3,t9+=v*b4,t10+=v*b5,t11+=v*b6,t12+=v*b7,t13+=v*b8,t14+=v*b9,t15+=v*b10,t16+=v*b11,t17+=v*b12,t18+=v*b13,t19+=v*b14,t20+=v*b15,v=a[6],t6+=v*b0,t7+=v*b1,t8+=v*b2,t9+=v*b3,t10+=v*b4,t11+=v*b5,t12+=v*b6,t13+=v*b7,t14+=v*b8,t15+=v*b9,t16+=v*b10,t17+=v*b11,t18+=v*b12,t19+=v*b13,t20+=v*b14,t21+=v*b15,v=a[7],t7+=v*b0,t8+=v*b1,t9+=v*b2,t10+=v*b3,t11+=v*b4,t12+=v*b5,t13+=v*b6,t14+=v*b7,t15+=v*b8,t16+=v*b9,t17+=v*b10,t18+=v*b11,t19+=v*b12,t20+=v*b13,t21+=v*b14,t22+=v*b15,v=a[8],t8+=v*b0,t9+=v*b1,t10+=v*b2,t11+=v*b3,t12+=v*b4,t13+=v*b5,t14+=v*b6,t15+=v*b7,t16+=v*b8,t17+=v*b9,t18+=v*b10,t19+=v*b11,t20+=v*b12,t21+=v*b13,t22+=v*b14,t23+=v*b15,v=a[9],t9+=v*b0,t10+=v*b1,t11+=v*b2,t12+=v*b3,t13+=v*b4,t14+=v*b5,t15+=v*b6,t16+=v*b7,t17+=v*b8,t18+=v*b9,t19+=v*b10,t20+=v*b11,t21+=v*b12,t22+=v*b13,t23+=v*b14,t24+=v*b15,v=a[10],t10+=v*b0,t11+=v*b1,t12+=v*b2,t13+=v*b3,t14+=v*b4,t15+=v*b5,t16+=v*b6,t17+=v*b7,t18+=v*b8,t19+=v*b9,t20+=v*b10,t21+=v*b11,t22+=v*b12,t23+=v*b13,t24+=v*b14,t25+=v*b15,v=a[11],t11+=v*b0,t12+=v*b1,t13+=v*b2,t14+=v*b3,t15+=v*b4,t16+=v*b5,t17+=v*b6,t18+=v*b7,t19+=v*b8,t20+=v*b9,t21+=v*b10,t22+=v*b11;t23+=v*b12,t24+=v*b13,t25+=v*b14,t26+=v*b15,v=a[12],t12+=v*b0,t13+=v*b1,t14+=v*b2,t15+=v*b3,t16+=v*b4,t17+=v*b5,t18+=v*b6,t19+=v*b7,t20+=v*b8,t21+=v*b9,t22+=v*b10,t23+=v*b11,t24+=v*b12,t25+=v*b13,t26+=v*b14,t27+=v*b15,v=a[13],t13+=v*b0,t14+=v*b1,t15+=v*b2,t16+=v*b3,t17+=v*b4,t18+=v*b5,t19+=v*b6,t20+=v*b7,t21+=v*b8,t22+=v*b9,t23+=v*b10,t24+=v*b11,t25+=v*b12,t26+=v*b13,t27+=v*b14,t28+=v*b15,v=a[14],t14+=v*b0,t15+=v*b1,t16+=v*b2,t17+=v*b3,t18+=v*b4,t19+=v*b5,t20+=v*b6,t21+=v*b7,t22+=v*b8,t23+=v*b9,t24+=v*b10,t25+=v*b11,t26+=v*b12,t27+=v*b13,t28+=v*b14,t29+=v*b15,v=a[15],t15+=v*b0,t16+=v*b1,t17+=v*b2,t18+=v*b3,t19+=v*b4,t20+=v*b5,t21+=v*b6,t22+=v*b7,t23+=v*b8,t24+=v*b9,t25+=v*b10,t26+=v*b11,t27+=v*b12,t28+=v*b13,t29+=v*b14,t30+=v*b15,t0+=38*t16,t1+=38*t17,t2+=38*t18,t3+=38*t19,t4+=38*t20,t5+=38*t21,t6+=38*t22,t7+=38*t23,t8+=38*t24,t9+=38*t25,t10+=38*t26,t11+=38*t27,t12+=38*t28,t13+=38*t29,t14+=38*t30,c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-65536*c,v=t1+c+65535,c=Math.floor(v/65536),t1=v-65536*c,v=t2+c+65535,c=Math.floor(v/65536),t2=v-65536*c,v=t3+c+65535,c=Math.floor(v/65536),t3=v-65536*c,v=t4+c+65535,c=Math.floor(v/65536),t4=v-65536*c,v=t5+c+65535,c=Math.floor(v/65536),t5=v-65536*c,v=t6+c+65535,c=Math.floor(v/65536),t6=v-65536*c,v=t7+c+65535,c=Math.floor(v/65536),t7=v-65536*c,v=t8+c+65535,c=Math.floor(v/65536),t8=v-65536*c,v=t9+c+65535,c=Math.floor(v/65536),t9=v-65536*c,v=t10+c+65535,c=Math.floor(v/65536),t10=v-65536*c,v=t11+c+65535,c=Math.floor(v/65536),t11=v-65536*c,v=t12+c+65535,c=Math.floor(v/65536),t12=v-65536*c,v=t13+c+65535,c=Math.floor(v/65536),t13=v-65536*c,v=t14+c+65535,c=Math.floor(v/65536),t14=v-65536*c,v=t15+c+65535,c=Math.floor(v/65536),t15=v-65536*c,t0+=c-1+37*(c-1),c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-65536*c,v=t1+c+65535,c=Math.floor(v/65536),t1=v-65536*c,v=t2+c+65535,c=Math.floor(v/65536),t2=v-65536*c,v=t3+c+65535,c=Math.floor(v/65536),t3=v-65536*c,v=t4+c+65535,c=Math.floor(v/65536),t4=v-65536*c,v=t5+c+65535,c=Math.floor(v/65536),t5=v-65536*c,v=t6+c+65535,c=Math.floor(v/65536),t6=v-65536*c,v=t7+c+65535,c=Math.floor(v/65536),t7=v-65536*c,v=t8+c+65535,c=Math.floor(v/65536),t8=v-65536*c,v=t9+c+65535,c=Math.floor(v/65536),t9=v-65536*c,v=t10+c+65535,c=Math.floor(v/65536),t10=v-65536*c,v=t11+c+65535,c=Math.floor(v/65536),t11=v-65536*c,v=t12+c+65535,c=Math.floor(v/65536),t12=v-65536*c,v=t13+c+65535,c=Math.floor(v/65536),t13=v-65536*c,v=t14+c+65535,c=Math.floor(v/65536),t14=v-65536*c,v=t15+c+65535,c=Math.floor(v/65536),t15=v-65536*c,t0+=c-1+37*(c-1),o[0]=t0,o[1]=t1,o[2]=t2,o[3]=t3,o[4]=t4,o[5]=t5,o[6]=t6,o[7]=t7,o[8]=t8,o[9]=t9,o[10]=t10,o[11]=t11,o[12]=t12;o[13]=t13,o[14]=t14,o[15]=t15}function S(o,a){M(o,a,a)}function inv25519(o,i){var a,c=gf();for(a=0;a<16;a++)c[a]=i[a];for(a=253;a>=0;a--)S(c,c),2!==a&&4!==a&&M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function pow2523(o,i){var a,c=gf();for(a=0;a<16;a++)c[a]=i[a];for(a=250;a>=0;a--)S(c,c),1!==a&&M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function crypto_scalarmult(q,n,p){var r,i,z=new Uint8Array(32),x=new Float64Array(80),a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf();for(i=0;i<31;i++)z[i]=n[i];for(z[31]=127&n[31]|64,z[0]&=248,unpack25519(x,p),i=0;i<16;i++)b[i]=x[i],d[i]=a[i]=c[i]=0;for(a[0]=d[0]=1,i=254;i>=0;--i)r=z[i>>>3]>>>(7&i)&1,sel25519(a,b,r),sel25519(c,d,r),A(e,a,c),Z(a,a,c),A(c,b,d),Z(b,b,d),S(d,e),S(f,a),M(a,c,a),M(c,b,e),A(e,a,c),Z(a,a,c),S(b,a),Z(c,d,f),M(a,c,_121665),A(a,a,d),M(c,c,a),M(a,d,f),M(d,b,x),S(b,e),sel25519(a,b,r),sel25519(c,d,r);for(i=0;i<16;i++)x[i+16]=a[i],x[i+32]=c[i],x[i+48]=b[i],x[i+64]=d[i];var x32=x.subarray(32),x16=x.subarray(16);return inv25519(x32,x32),M(x16,x16,x32),pack25519(q,x16),0}function crypto_scalarmult_base(q,n){return crypto_scalarmult(q,n,_9)}function crypto_box_keypair(y,x){return randombytes(x,32),crypto_scalarmult_base(y,x)}function crypto_box_beforenm(k,y,x){var s=new Uint8Array(32);return crypto_scalarmult(s,x,y),crypto_core_hsalsa20(k,_0,s,sigma)}function crypto_box(c,m,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_afternm(c,m,d,n,k)}function crypto_box_open(m,c,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_open_afternm(m,c,d,n,k)}function crypto_hashblocks_hl(hh,hl,m,n){for(var bh0,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bl0,bl1,bl2,bl3,bl4,bl5,bl6,bl7,th,tl,i,j,h,l,a,b,c,d,wh=new Int32Array(16),wl=new Int32Array(16),ah0=hh[0],ah1=hh[1],ah2=hh[2],ah3=hh[3],ah4=hh[4],ah5=hh[5],ah6=hh[6],ah7=hh[7],al0=hl[0],al1=hl[1],al2=hl[2],al3=hl[3],al4=hl[4],al5=hl[5],al6=hl[6],al7=hl[7],pos=0;n>=128;){for(i=0;i<16;i++)j=8*i+pos,wh[i]=m[j+0]<<24|m[j+1]<<16|m[j+2]<<8|m[j+3],wl[i]=m[j+4]<<24|m[j+5]<<16|m[j+6]<<8|m[j+7];for(i=0;i<80;i++)if(bh0=ah0,bh1=ah1,bh2=ah2,bh3=ah3,bh4=ah4,bh5=ah5,bh6=ah6,bh7=ah7,bl0=al0,bl1=al1,bl2=al2,bl3=al3,bl4=al4,bl5=al5,bl6=al6,bl7=al7,h=ah7,l=al7,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=(ah4>>>14|al4<<18)^(ah4>>>18|al4<<14)^(al4>>>9|ah4<<23),l=(al4>>>14|ah4<<18)^(al4>>>18|ah4<<14)^(ah4>>>9|al4<<23),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=ah4&ah5^~ah4&ah6,l=al4&al5^~al4&al6,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=K[2*i],l=K[2*i+1],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=wh[i%16],l=wl[i%16],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,th=65535&c|d<<16,tl=65535&a|b<<16,h=th,l=tl,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=(ah0>>>28|al0<<4)^(al0>>>2|ah0<<30)^(al0>>>7|ah0<<25),l=(al0>>>28|ah0<<4)^(ah0>>>2|al0<<30)^(ah0>>>7|al0<<25),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=ah0&ah1^ah0&ah2^ah1&ah2,l=al0&al1^al0&al2^al1&al2,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh7=65535&c|d<<16,bl7=65535&a|b<<16,h=bh3,l=bl3,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=th,l=tl,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh3=65535&c|d<<16,bl3=65535&a|b<<16,ah1=bh0,ah2=bh1,ah3=bh2,ah4=bh3,ah5=bh4,ah6=bh5,ah7=bh6,ah0=bh7,al1=bl0,al2=bl1,al3=bl2,al4=bl3,al5=bl4,al6=bl5,al7=bl6,al0=bl7,i%16==15)for(j=0;j<16;j++)h=wh[j],l=wl[j],a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=wh[(j+9)%16],l=wl[(j+9)%16],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,th=wh[(j+1)%16],tl=wl[(j+1)%16],h=(th>>>1|tl<<31)^(th>>>8|tl<<24)^th>>>7,l=(tl>>>1|th<<31)^(tl>>>8|th<<24)^(tl>>>7|th<<25),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,th=wh[(j+14)%16],tl=wl[(j+14)%16],h=(th>>>19|tl<<13)^(tl>>>29|th<<3)^th>>>6,l=(tl>>>19|th<<13)^(th>>>29|tl<<3)^(tl>>>6|th<<26),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,wh[j]=65535&c|d<<16,wl[j]=65535&a|b<<16;h=ah0,l=al0,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[0],l=hl[0],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[0]=ah0=65535&c|d<<16,hl[0]=al0=65535&a|b<<16,h=ah1,l=al1,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[1],l=hl[1],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[1]=ah1=65535&c|d<<16,hl[1]=al1=65535&a|b<<16,h=ah2,l=al2,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[2],l=hl[2],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[2]=ah2=65535&c|d<<16,hl[2]=al2=65535&a|b<<16,h=ah3,l=al3,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[3],l=hl[3],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[3]=ah3=65535&c|d<<16,hl[3]=al3=65535&a|b<<16,h=ah4,l=al4,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[4],l=hl[4],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[4]=ah4=65535&c|d<<16,hl[4]=al4=65535&a|b<<16,h=ah5,l=al5,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[5],l=hl[5],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[5]=ah5=65535&c|d<<16,hl[5]=al5=65535&a|b<<16,h=ah6,l=al6,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[6],l=hl[6],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[6]=ah6=65535&c|d<<16,hl[6]=al6=65535&a|b<<16,h=ah7,l=al7,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[7],l=hl[7],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[7]=ah7=65535&c|d<<16,hl[7]=al7=65535&a|b<<16,pos+=128,n-=128}return n}function crypto_hash(out,m,n){var i,hh=new Int32Array(8),hl=new Int32Array(8),x=new Uint8Array(256),b=n;for(hh[0]=1779033703,hh[1]=3144134277,hh[2]=1013904242,hh[3]=2773480762,hh[4]=1359893119,hh[5]=2600822924,hh[6]=528734635,hh[7]=1541459225,hl[0]=4089235720,hl[1]=2227873595,hl[2]=4271175723,hl[3]=1595750129,hl[4]=2917565137,hl[5]=725511199,hl[6]=4215389547,hl[7]=327033209,crypto_hashblocks_hl(hh,hl,m,n),n%=128,i=0;i=0;--i)b=s[i/8|0]>>(7&i)&1,cswap(p,q,b),add(q,p),add(p,p),cswap(p,q,b)}function scalarbase(p,s){var q=[gf(),gf(),gf(),gf()];set25519(q[0],X),set25519(q[1],Y),set25519(q[2],gf1),M(q[3],X,Y),scalarmult(p,q,s)}function crypto_sign_keypair(pk,sk,seeded){var i,d=new Uint8Array(64),p=[gf(),gf(),gf(),gf()];for(seeded||randombytes(sk,32),crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64,scalarbase(p,d),pack(pk,p),i=0;i<32;i++)sk[i+32]=pk[i];return 0}function modL(r,x){var carry,i,j,k;for(i=63;i>=32;--i){for(carry=0,j=i-32,k=i-12;j>8,x[j]-=256*carry;x[j]+=carry,x[i]=0}for(carry=0,j=0;j<32;j++)x[j]+=carry-(x[31]>>4)*L[j],carry=x[j]>>8,x[j]&=255;for(j=0;j<32;j++)x[j]-=carry*L[j];for(i=0;i<32;i++)x[i+1]+=x[i]>>8,r[i]=255&x[i]}function reduce(r){var i,x=new Float64Array(64);for(i=0;i<64;i++)x[i]=r[i];for(i=0;i<64;i++)r[i]=0;modL(r,x)}function crypto_sign(sm,m,n,sk){var i,j,d=new Uint8Array(64),h=new Uint8Array(64),r=new Uint8Array(64),x=new Float64Array(64),p=[gf(),gf(),gf(),gf()];crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64;var smlen=n+64;for(i=0;i>7&&Z(r[0],gf0,r[0]),M(r[3],r[0],r[1]),0)}function crypto_sign_open(m,sm,n,pk){var i,t=new Uint8Array(32),h=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],q=[gf(),gf(),gf(),gf()];if(-1,n<64)return-1;if(unpackneg(q,pk))return-1;for(i=0;i>>13|t1<<3),t2=255&key[4]|(255&key[5])<<8,this.r[2]=7939&(t1>>>10|t2<<6),t3=255&key[6]|(255&key[7])<<8,this.r[3]=8191&(t2>>>7|t3<<9),t4=255&key[8]|(255&key[9])<<8,this.r[4]=255&(t3>>>4|t4<<12),this.r[5]=t4>>>1&8190,t5=255&key[10]|(255&key[11])<<8,this.r[6]=8191&(t4>>>14|t5<<2),t6=255&key[12]|(255&key[13])<<8,this.r[7]=8065&(t5>>>11|t6<<5),t7=255&key[14]|(255&key[15])<<8,this.r[8]=8191&(t6>>>8|t7<<8),this.r[9]=t7>>>5&127,this.pad[0]=255&key[16]|(255&key[17])<<8,this.pad[1]=255&key[18]|(255&key[19])<<8,this.pad[2]=255&key[20]|(255&key[21])<<8,this.pad[3]=255&key[22]|(255&key[23])<<8,this.pad[4]=255&key[24]|(255&key[25])<<8,this.pad[5]=255&key[26]|(255&key[27])<<8,this.pad[6]=255&key[28]|(255&key[29])<<8,this.pad[7]=255&key[30]|(255&key[31])<<8};poly1305.prototype.blocks=function(m,mpos,bytes){for(var t0,t1,t2,t3,t4,t5,t6,t7,c,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,hibit=this.fin?0:2048,h0=this.h[0],h1=this.h[1],h2=this.h[2],h3=this.h[3],h4=this.h[4],h5=this.h[5],h6=this.h[6],h7=this.h[7],h8=this.h[8],h9=this.h[9],r0=this.r[0],r1=this.r[1],r2=this.r[2],r3=this.r[3],r4=this.r[4],r5=this.r[5],r6=this.r[6],r7=this.r[7],r8=this.r[8],r9=this.r[9];bytes>=16;)t0=255&m[mpos+0]|(255&m[mpos+1])<<8,h0+=8191&t0,t1=255&m[mpos+2]|(255&m[mpos+3])<<8,h1+=8191&(t0>>>13|t1<<3),t2=255&m[mpos+4]|(255&m[mpos+5])<<8,h2+=8191&(t1>>>10|t2<<6),t3=255&m[mpos+6]|(255&m[mpos+7])<<8,h3+=8191&(t2>>>7|t3<<9),t4=255&m[mpos+8]|(255&m[mpos+9])<<8,h4+=8191&(t3>>>4|t4<<12),h5+=t4>>>1&8191,t5=255&m[mpos+10]|(255&m[mpos+11])<<8,h6+=8191&(t4>>>14|t5<<2),t6=255&m[mpos+12]|(255&m[mpos+13])<<8,h7+=8191&(t5>>>11|t6<<5),t7=255&m[mpos+14]|(255&m[mpos+15])<<8,h8+=8191&(t6>>>8|t7<<8),h9+=t7>>>5|hibit,c=0,d0=c,d0+=h0*r0,d0+=h1*(5*r9),d0+=h2*(5*r8),d0+=h3*(5*r7),d0+=h4*(5*r6),c=d0>>>13,d0&=8191,d0+=h5*(5*r5),d0+=h6*(5*r4),d0+=h7*(5*r3),d0+=h8*(5*r2),d0+=h9*(5*r1),c+=d0>>>13,d0&=8191,d1=c,d1+=h0*r1,d1+=h1*r0,d1+=h2*(5*r9),d1+=h3*(5*r8),d1+=h4*(5*r7),c=d1>>>13,d1&=8191,d1+=h5*(5*r6),d1+=h6*(5*r5),d1+=h7*(5*r4),d1+=h8*(5*r3),d1+=h9*(5*r2),c+=d1>>>13,d1&=8191,d2=c,d2+=h0*r2,d2+=h1*r1,d2+=h2*r0,d2+=h3*(5*r9),d2+=h4*(5*r8),c=d2>>>13,d2&=8191,d2+=h5*(5*r7),d2+=h6*(5*r6),d2+=h7*(5*r5),d2+=h8*(5*r4),d2+=h9*(5*r3),c+=d2>>>13,d2&=8191,d3=c,d3+=h0*r3,d3+=h1*r2,d3+=h2*r1,d3+=h3*r0,d3+=h4*(5*r9),c=d3>>>13,d3&=8191,d3+=h5*(5*r8),d3+=h6*(5*r7),d3+=h7*(5*r6),d3+=h8*(5*r5),d3+=h9*(5*r4),c+=d3>>>13,d3&=8191,d4=c,d4+=h0*r4,d4+=h1*r3,d4+=h2*r2,d4+=h3*r1,d4+=h4*r0,c=d4>>>13,d4&=8191,d4+=h5*(5*r9),d4+=h6*(5*r8),d4+=h7*(5*r7),d4+=h8*(5*r6),d4+=h9*(5*r5),c+=d4>>>13,d4&=8191,d5=c,d5+=h0*r5,d5+=h1*r4,d5+=h2*r3,d5+=h3*r2,d5+=h4*r1,c=d5>>>13,d5&=8191,d5+=h5*r0,d5+=h6*(5*r9),d5+=h7*(5*r8),d5+=h8*(5*r7),d5+=h9*(5*r6),c+=d5>>>13,d5&=8191,d6=c,d6+=h0*r6,d6+=h1*r5,d6+=h2*r4,d6+=h3*r3,d6+=h4*r2,c=d6>>>13,d6&=8191,d6+=h5*r1,d6+=h6*r0,d6+=h7*(5*r9),d6+=h8*(5*r8),d6+=h9*(5*r7),c+=d6>>>13,d6&=8191,d7=c,d7+=h0*r7,d7+=h1*r6,d7+=h2*r5,d7+=h3*r4,d7+=h4*r3,c=d7>>>13,d7&=8191,d7+=h5*r2,d7+=h6*r1,d7+=h7*r0,d7+=h8*(5*r9),d7+=h9*(5*r8),c+=d7>>>13,d7&=8191,d8=c,d8+=h0*r8,d8+=h1*r7,d8+=h2*r6,d8+=h3*r5,d8+=h4*r4,c=d8>>>13,d8&=8191,d8+=h5*r3,d8+=h6*r2,d8+=h7*r1,d8+=h8*r0,d8+=h9*(5*r9),c+=d8>>>13,d8&=8191,d9=c,d9+=h0*r9,d9+=h1*r8,d9+=h2*r7,d9+=h3*r6,d9+=h4*r5,c=d9>>>13,d9&=8191,d9+=h5*r4,d9+=h6*r3,d9+=h7*r2,d9+=h8*r1,d9+=h9*r0,c+=d9>>>13,d9&=8191,c=(c<<2)+c|0,c=c+d0|0,d0=8191&c,c>>>=13,d1+=c,h0=d0,h1=d1,h2=d2,h3=d3,h4=d4,h5=d5,h6=d6,h7=d7,h8=d8,h9=d9,mpos+=16,bytes-=16;this.h[0]=h0,this.h[1]=h1,this.h[2]=h2,this.h[3]=h3,this.h[4]=h4,this.h[5]=h5,this.h[6]=h6,this.h[7]=h7,this.h[8]=h8,this.h[9]=h9},poly1305.prototype.finish=function(mac,macpos){var c,mask,f,i,g=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(c=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=c,c=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*c,c=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=c,c=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=c,g[0]=this.h[0]+5,c=g[0]>>>13,g[0]&=8191,i=1;i<10;i++)g[i]=this.h[i]+c,c=g[i]>>>13,g[i]&=8191;for(g[9]-=8192,mask=(g[9]>>>15)-1,i=0;i<10;i++)g[i]&=mask;for(mask=~mask,i=0;i<10;i++)this.h[i]=this.h[i]&mask|g[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),f=this.h[0]+this.pad[0],this.h[0]=65535&f,i=1;i<8;i++)f=(this.h[i]+this.pad[i]|0)+(f>>>16)|0,this.h[i]=65535&f;mac[macpos+0]=this.h[0]>>>0&255,mac[macpos+1]=this.h[0]>>>8&255,mac[macpos+2]=this.h[1]>>>0&255,mac[macpos+3]=this.h[1]>>>8&255,mac[macpos+4]=this.h[2]>>>0&255,mac[macpos+5]=this.h[2]>>>8&255,mac[macpos+6]=this.h[3]>>>0&255,mac[macpos+7]=this.h[3]>>>8&255,mac[macpos+8]=this.h[4]>>>0&255,mac[macpos+9]=this.h[4]>>>8&255,mac[macpos+10]=this.h[5]>>>0&255,mac[macpos+11]=this.h[5]>>>8&255,mac[macpos+12]=this.h[6]>>>0&255,mac[macpos+13]=this.h[6]>>>8&255,mac[macpos+14]=this.h[7]>>>0&255,mac[macpos+15]=this.h[7]>>>8&255},poly1305.prototype.update=function(m,mpos,bytes){var i,want;if(this.leftover){for(want=16-this.leftover,want>bytes&&(want=bytes),i=0;i=16&&(want=bytes-bytes%16,this.blocks(m,mpos,want),mpos+=want,bytes-=want),bytes){for(i=0;i>>22,prev=next}prev>>>=22,input.words[i-10]=prev,0===prev&&input.length>10?input.length-=10:input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;for(var lo=0,i=0;i>>=26,num.words[i]=lo,carry=hi}return 0!==carry&&(num.words[num.length++]=carry),num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if("k256"===name)prime=new K256;else if("p224"===name)prime=new P224;else if("p192"===name)prime=new P192;else{if("p25519"!==name)throw new Error("Unknown prime "+name);prime=new P25519}return primes[name]=prime,prime},Red.prototype._verify1=function(a){assert(0===a.negative,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert(0==(a.negative|b.negative),"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);return res.cmp(this.m)>=0&&res.isub(this.m),res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);return res.cmp(this.m)>=0&&res.isub(this.m),res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);return res.cmpn(0)<0&&res.iadd(this.m),res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);return res.cmpn(0)<0&&res.iadd(this.m),res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2==1),3===mod3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}for(var q=this.m.subn(1),s=0;!q.isZero()&&0===q.andln(1);)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();for(z=new BN(2*z*z).toRed(this);0!==this.pow(z,lpow).cmp(nOne);)z.redIAdd(nOne);for(var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;0!==t.cmp(one);){for(var tmp=t,i=0;0!==tmp.cmp(one);i++)tmp=tmp.redSqr();assert(i=0;i--){for(var word=num.words[i],j=start-1;j>=0;j--){var bit=word>>j&1;res!==wnd[0]&&(res=this.sqr(res)),0!==bit||0!==current?(current<<=1,current|=bit,(4===++currentLen||0===i&&0===j)&&(res=this.mul(res,wnd[current]),currentLen=0,current=0)):currentLen=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)},inherits(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.invm=function(a){return this.imod(a._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===module||module,void 0)},{buffer:101}],100:[function(require,module,exports){"use strict";function Rand(rand){this.rand=rand}var r,_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};if(module.exports=function(len){return r||(r=new Rand(null)),r.generate(len)},module.exports.Rand=Rand,Rand.prototype.generate=function(len){return this._rand(len)},Rand.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var res=new Uint8Array(n),i=0;i>>24]^SUB_MIX1[s1>>>16&255]^SUB_MIX2[s2>>>8&255]^SUB_MIX3[255&s3]^keySchedule[ksRow++],t1=SUB_MIX0[s1>>>24]^SUB_MIX1[s2>>>16&255]^SUB_MIX2[s3>>>8&255]^SUB_MIX3[255&s0]^keySchedule[ksRow++],t2=SUB_MIX0[s2>>>24]^SUB_MIX1[s3>>>16&255]^SUB_MIX2[s0>>>8&255]^SUB_MIX3[255&s1]^keySchedule[ksRow++],t3=SUB_MIX0[s3>>>24]^SUB_MIX1[s0>>>16&255]^SUB_MIX2[s1>>>8&255]^SUB_MIX3[255&s2]^keySchedule[ksRow++],s0=t0,s1=t1,s2=t2,s3=t3;return t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&255]<<16|SBOX[s2>>>8&255]<<8|SBOX[255&s3])^keySchedule[ksRow++],t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&255]<<16|SBOX[s3>>>8&255]<<8|SBOX[255&s0])^keySchedule[ksRow++],t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&255]<<16|SBOX[s0>>>8&255]<<8|SBOX[255&s1])^keySchedule[ksRow++],t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&255]<<16|SBOX[s1>>>8&255]<<8|SBOX[255&s2])^keySchedule[ksRow++],t0>>>=0,t1>>>=0,t2>>>=0,t3>>>=0,[t0,t1,t2,t3]}function AES(key){this._key=asUInt32Array(key),this._reset()}var Buffer=require("safe-buffer").Buffer,RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var d=new Array(256),j=0;j<256;j++)d[j]=j<128?j<<1:j<<1^283;for(var SBOX=[],INV_SBOX=[],SUB_MIX=[[],[],[],[]],INV_SUB_MIX=[[],[],[],[]],x=0,xi=0,i=0;i<256;++i){var sx=xi^xi<<1^xi<<2^xi<<3^xi<<4;sx=sx>>>8^255&sx^99,SBOX[x]=sx,INV_SBOX[sx]=x;var x2=d[x],x4=d[x2],x8=d[x4],t=257*d[sx]^16843008*sx;SUB_MIX[0][x]=t<<24|t>>>8,SUB_MIX[1][x]=t<<16|t>>>16,SUB_MIX[2][x]=t<<8|t>>>24,SUB_MIX[3][x]=t,t=16843009*x8^65537*x4^257*x2^16843008*x,INV_SUB_MIX[0][sx]=t<<24|t>>>8,INV_SUB_MIX[1][sx]=t<<16|t>>>16,INV_SUB_MIX[2][sx]=t<<8|t>>>24,INV_SUB_MIX[3][sx]=t,0===x?x=xi=1:(x=x2^d[d[d[x8^x2]]],xi^=d[d[xi]])}return{SBOX:SBOX,INV_SBOX:INV_SBOX,SUB_MIX:SUB_MIX,INV_SUB_MIX:INV_SUB_MIX}}();AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var keyWords=this._key,keySize=keyWords.length,nRounds=keySize+6,ksRows=4*(nRounds+1),keySchedule=[],k=0;k>>24,t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&255]<<16|G.SBOX[t>>>8&255]<<8|G.SBOX[255&t],t^=RCON[k/keySize|0]<<24):keySize>6&&k%keySize==4&&(t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&255]<<16|G.SBOX[t>>>8&255]<<8|G.SBOX[255&t]),keySchedule[k]=keySchedule[k-keySize]^t}for(var invKeySchedule=[],ik=0;ik>>24]]^G.INV_SUB_MIX[1][G.SBOX[tt>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[tt>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&tt]]}this._nRounds=nRounds,this._keySchedule=keySchedule,this._invKeySchedule=invKeySchedule},AES.prototype.encryptBlockRaw=function(M){return M=asUInt32Array(M),cryptBlock(M,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(M){var out=this.encryptBlockRaw(M),buf=Buffer.allocUnsafe(16);return buf.writeUInt32BE(out[0],0),buf.writeUInt32BE(out[1],4),buf.writeUInt32BE(out[2],8),buf.writeUInt32BE(out[3],12),buf},AES.prototype.decryptBlock=function(M){M=asUInt32Array(M);var m1=M[1];M[1]=M[3],M[3]=m1;var out=cryptBlock(M,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),buf=Buffer.allocUnsafe(16);return buf.writeUInt32BE(out[0],0),buf.writeUInt32BE(out[3],4),buf.writeUInt32BE(out[2],8),buf.writeUInt32BE(out[1],12),buf},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},module.exports.AES=AES},{"safe-buffer":313}],103:[function(require,module,exports){"use strict";function xorTest(a,b){var out=0;a.length!==b.length&&out++;for(var len=Math.min(a.length,b.length),i=0;i16)return out=this.cache.slice(0,16),this.cache=this.cache.slice(16),out}else if(this.cache.length>=16)return out=this.cache.slice(0,16),this.cache=this.cache.slice(16),out;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},exports.createDecipher=createDecipher,exports.createDecipheriv=createDecipheriv},{"./aes":102,"./authCipher":103,"./modes":115,"./streamCipher":118,"cipher-base":150,evp_bytestokey:239,inherits:257,"safe-buffer":313}],106:[function(require,module,exports){"use strict";function Cipher(mode,key,iv){Transform.call(this),this._cache=new Splitter,this._cipher=new aes.AES(key),this._prev=Buffer.from(iv),this._mode=mode,this._autopadding=!0}function Splitter(){this.cache=Buffer.allocUnsafe(0)}function createCipheriv(suite,password,iv){var config=MODES[suite.toLowerCase()];if(!config)throw new TypeError("invalid suite type");if("string"==typeof password&&(password=Buffer.from(password)),password.length!==config.key/8)throw new TypeError("invalid key length "+password.length);if("string"==typeof iv&&(iv=Buffer.from(iv)),"GCM"!==config.mode&&iv.length!==config.iv)throw new TypeError("invalid iv length "+iv.length);return"stream"===config.type?new StreamCipher(config.module,password,iv):"auth"===config.type?new AuthCipher(config.module,password,iv):new Cipher(config.module,password,iv)}function createCipher(suite,password){var config=MODES[suite.toLowerCase()];if(!config)throw new TypeError("invalid suite type");var keys=ebtk(password,!1,config.key,config.iv);return createCipheriv(suite,keys.key,keys.iv)}var MODES=require("./modes"),AuthCipher=require("./authCipher"),Buffer=require("safe-buffer").Buffer,StreamCipher=require("./streamCipher"),Transform=require("cipher-base"),aes=require("./aes"),ebtk=require("evp_bytestokey");require("inherits")(Cipher,Transform),Cipher.prototype._update=function(data){this._cache.add(data);for(var chunk,thing,out=[];chunk=this._cache.get();)thing=this._mode.encrypt(this,chunk),out.push(thing);return Buffer.concat(out)};var PADDING=Buffer.alloc(16,16);Cipher.prototype._final=function(){var chunk=this._cache.flush();if(this._autopadding)return chunk=this._mode.encrypt(this,chunk),this._cipher.scrub(),chunk;if(!chunk.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(setTo){return this._autopadding=!!setTo,this},Splitter.prototype.add=function(data){this.cache=Buffer.concat([this.cache,data])},Splitter.prototype.get=function(){if(this.cache.length>15){var out=this.cache.slice(0,16);return this.cache=this.cache.slice(16),out}return null},Splitter.prototype.flush=function(){for(var len=16-this.cache.length,padBuff=Buffer.allocUnsafe(len),i=-1;++i>>0,0),buf.writeUInt32BE(out[1]>>>0,4),buf.writeUInt32BE(out[2]>>>0,8),buf.writeUInt32BE(out[3]>>>0,12),buf}function GHASH(key){this.h=key,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}var Buffer=require("safe-buffer").Buffer,ZEROES=Buffer.alloc(16,0);GHASH.prototype.ghash=function(block){for(var i=-1;++i0;j--)Vi[j]=Vi[j]>>>1|(1&Vi[j-1])<<31;Vi[0]=Vi[0]>>>1,lsbVi&&(Vi[0]=Vi[0]^225<<24)}this.state=fromArray(Zi)},GHASH.prototype.update=function(buf){this.cache=Buffer.concat([this.cache,buf]);for(var chunk;this.cache.length>=16;)chunk=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(chunk)},GHASH.prototype.final=function(abl,bl){return this.cache.length&&this.ghash(Buffer.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,abl,0,bl])),this.state},module.exports=GHASH},{"safe-buffer":313}],108:[function(require,module,exports){"use strict";function incr32(iv){for(var item,len=iv.length;len--;){if(255!==(item=iv.readUInt8(len))){item++,iv.writeUInt8(item,len);break}iv.writeUInt8(0,len)}}module.exports=incr32},{}],109:[function(require,module,exports){"use strict";var xor=require("buffer-xor");exports.encrypt=function(self,block){var data=xor(block,self._prev);return self._prev=self._cipher.encryptBlock(data),self._prev},exports.decrypt=function(self,block){var pad=self._prev;self._prev=block;var out=self._cipher.decryptBlock(block);return xor(out,pad)}},{"buffer-xor":148}],110:[function(require,module,exports){"use strict";function encryptStart(self,data,decrypt){var len=data.length,out=xor(data,self._cache);return self._cache=self._cache.slice(len),self._prev=Buffer.concat([self._prev,decrypt?data:out]),out}var Buffer=require("safe-buffer").Buffer,xor=require("buffer-xor");exports.encrypt=function(self,data,decrypt){for(var len,out=Buffer.allocUnsafe(0);data.length;){if(0===self._cache.length&&(self._cache=self._cipher.encryptBlock(self._prev),self._prev=Buffer.allocUnsafe(0)),!(self._cache.length<=data.length)){out=Buffer.concat([out,encryptStart(self,data,decrypt)]);break}len=self._cache.length,out=Buffer.concat([out,encryptStart(self,data.slice(0,len),decrypt)]),data=data.slice(len)}return out}},{"buffer-xor":148,"safe-buffer":313}],111:[function(require,module,exports){"use strict";function encryptByte(self,byteParam,decrypt){for(var pad,bit,value,i=-1,out=0;++i<8;)pad=self._cipher.encryptBlock(self._prev),bit=byteParam&1<<7-i?128:0,value=pad[0]^bit,out+=(128&value)>>i%8,self._prev=shiftIn(self._prev,decrypt?bit:value);return out}function shiftIn(buffer,value){var len=buffer.length,i=-1,out=Buffer.allocUnsafe(buffer.length);for(buffer=Buffer.concat([buffer,Buffer.from([value])]);++i>7;return out}var Buffer=require("safe-buffer").Buffer;exports.encrypt=function(self,chunk,decrypt){for(var len=chunk.length,out=Buffer.allocUnsafe(len),i=-1;++i=0||!r.umod(priv.prime1)||!r.umod(priv.prime2);)r=new bn(randomBytes(len));return r}var bn=require("bn.js"),randomBytes=require("randombytes");module.exports=crt,crt.getr=getr}).call(this,require("buffer").Buffer)},{"bn.js":99,buffer:149,randombytes:296}], +123:[function(require,module,exports){"use strict";module.exports=require("./browser/algorithms.json")},{"./browser/algorithms.json":124}],124:[function(require,module,exports){module.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],125:[function(require,module,exports){module.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],126:[function(require,module,exports){(function(Buffer){"use strict";function Sign(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error("Unknown message digest");this._hashType=data.hash,this._hash=createHash(data.hash),this._tag=data.id,this._signType=data.sign}function Verify(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error("Unknown message digest");this._hash=createHash(data.hash),this._tag=data.id,this._signType=data.sign}function createSign(algorithm){return new Sign(algorithm)}function createVerify(algorithm){return new Verify(algorithm)}var createHash=require("create-hash"),stream=require("stream"),inherits=require("inherits"),sign=require("./sign"),verify=require("./verify"),algorithms=require("./algorithms.json");Object.keys(algorithms).forEach(function(key){algorithms[key].id=new Buffer(algorithms[key].id,"hex"),algorithms[key.toLowerCase()]=algorithms[key]}),inherits(Sign,stream.Writable),Sign.prototype._write=function(data,_,done){this._hash.update(data),done()},Sign.prototype.update=function(data,enc){return"string"==typeof data&&(data=new Buffer(data,enc)),this._hash.update(data),this},Sign.prototype.sign=function(key,enc){this.end();var hash=this._hash.digest(),sig=sign(hash,key,this._hashType,this._signType,this._tag);return enc?sig.toString(enc):sig},inherits(Verify,stream.Writable),Verify.prototype._write=function(data,_,done){this._hash.update(data),done()},Verify.prototype.update=function(data,enc){return"string"==typeof data&&(data=new Buffer(data,enc)),this._hash.update(data),this},Verify.prototype.verify=function(key,sig,enc){"string"==typeof sig&&(sig=new Buffer(sig,enc)),this.end();var hash=this._hash.digest();return verify(sig,hash,key,this._signType,this._tag)},module.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}}).call(this,require("buffer").Buffer)},{"./algorithms.json":124,"./sign":127,"./verify":128,buffer:149,"create-hash":169,inherits:257,stream:345}],127:[function(require,module,exports){(function(Buffer){"use strict";function sign(hash,key,hashType,signType,tag){var priv=parseKeys(key);if(priv.curve){if("ecdsa"!==signType&&"ecdsa/rsa"!==signType)throw new Error("wrong private key type");return ecSign(hash,priv)}if("dsa"===priv.type){if("dsa"!==signType)throw new Error("wrong private key type");return dsaSign(hash,priv,hashType)}if("rsa"!==signType&&"ecdsa/rsa"!==signType)throw new Error("wrong private key type");hash=Buffer.concat([tag,hash]);for(var len=priv.modulus.byteLength(),pad=[0,1];hash.length+pad.length+10&&bits.ishrn(shift),bits}function bits2octets(bits,q){bits=bits2int(bits,q),bits=bits.mod(q);var out=new Buffer(bits.toArray());if(out.length=q)throw new Error("invalid sig")}var BN=require("bn.js"),EC=require("elliptic").ec,parseKeys=require("parse-asn1"),curves=require("./curves.json");module.exports=verify}).call(this,require("buffer").Buffer)},{"./curves.json":125,"bn.js":99,buffer:149,elliptic:129,"parse-asn1":278}],129:[function(require,module,exports){arguments[4][71][0].apply(exports,arguments)},{"../package.json":144,"./elliptic/curve":132,"./elliptic/curves":135,"./elliptic/ec":136,"./elliptic/eddsa":139,"./elliptic/utils":143,brorand:100,dup:71}],130:[function(require,module,exports){arguments[4][72][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:72}],131:[function(require,module,exports){arguments[4][73][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:73,inherits:257}],132:[function(require,module,exports){arguments[4][74][0].apply(exports,arguments)},{"./base":130,"./edwards":131,"./mont":133,"./short":134,dup:74}],133:[function(require,module,exports){arguments[4][75][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:75,inherits:257}],134:[function(require,module,exports){arguments[4][76][0].apply(exports,arguments)},{"../../elliptic":129,"../curve":132,"bn.js":99,dup:76,inherits:257}],135:[function(require,module,exports){arguments[4][77][0].apply(exports,arguments)},{"../elliptic":129,"./precomputed/secp256k1":142,dup:77,"hash.js":241}],136:[function(require,module,exports){arguments[4][78][0].apply(exports,arguments)},{"../../elliptic":129,"./key":137,"./signature":138,"bn.js":99,dup:78,"hmac-drbg":254}],137:[function(require,module,exports){arguments[4][79][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:79}],138:[function(require,module,exports){arguments[4][80][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:80}],139:[function(require,module,exports){arguments[4][81][0].apply(exports,arguments)},{"../../elliptic":129,"./key":140,"./signature":141,dup:81,"hash.js":241}],140:[function(require,module,exports){arguments[4][82][0].apply(exports,arguments)},{"../../elliptic":129,dup:82}],141:[function(require,module,exports){arguments[4][83][0].apply(exports,arguments)},{"../../elliptic":129,"bn.js":99,dup:83}],142:[function(require,module,exports){arguments[4][84][0].apply(exports,arguments)},{dup:84}],143:[function(require,module,exports){arguments[4][85][0].apply(exports,arguments)},{"bn.js":99,dup:85,"minimalistic-assert":272,"minimalistic-crypto-utils":273}],144:[function(require,module,exports){module.exports={_from:"elliptic@^6.0.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/browserify-sign/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.0.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.0.0",saveSpec:null,fetchSpec:"^6.0.0"},_requiredBy:["/browserify-sign"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_spec:"elliptic@^6.0.0",_where:"/home/chris/dev/eth-lightwallet/node_modules/browserify-sign",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],145:[function(require,module,exports){"use strict";function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding))throw new Error("Unknown encoding: "+encoding)}function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2,this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3,this.charLength=this.charReceived?3:0}var Buffer=require("buffer").Buffer,isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.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}},StringDecoder=exports.StringDecoder=function(encoding){switch(this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(encoding),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=base64DetectIncompleteChar;break;default:return void(this.write=passThroughWrite)}this.charBuffer=new Buffer(6),this.charReceived=0,this.charLength=0};StringDecoder.prototype.write=function(buffer){for(var charStr="";this.charLength;){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;if(buffer.copy(this.charBuffer,this.charReceived,0,available),this.charReceived+=available,this.charReceived=55296&&charCode<=56319)){if(this.charReceived=this.charLength=0,0===buffer.length)return charStr;break}this.charLength+=this.surrogateSize,charStr=""}this.detectIncompleteChar(buffer);var end=buffer.length;this.charLength&&(buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end),end-=this.charReceived),charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1,charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;return this.charLength+=size,this.charReceived+=size,this.charBuffer.copy(this.charBuffer,size,0,size),buffer.copy(this.charBuffer,0,0,size),charStr.substring(0,end)}return charStr},StringDecoder.prototype.detectIncompleteChar=function(buffer){for(var i=buffer.length>=3?3:buffer.length;i>0;i--){var c=buffer[buffer.length-i];if(1==i&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i},StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length&&(res=this.write(buffer)),this.charReceived){var cr=this.charReceived,buf=this.charBuffer,enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res}},{buffer:149}],146:[function(require,module,exports){"use strict";var basex=require("base-x");module.exports=basex("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":22}],147:[function(require,module,exports){"use strict";module.exports=function(a,b){if("function"==typeof a.compare)return a.compare(b);if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(length){return+length!=length&&(length=0),Buffer.alloc(+length)}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}var indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;jremaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128==(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!=0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isnan(val){return val!==val}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:function(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(arr){return arr.__proto__=Buffer.prototype,arr},Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array, +"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)},Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;iremaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len)<0&&(start=0):start>len&&(start=len),end<0?(end+=len)<0&&(end=0):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,byteLength|=0,!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0)}var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0);var i;if("number"==typeof val)for(i=start;i>>2),i=0,j=0;i>5]|=128<>>9<<4)]=len;for(var a=1732584193,b=-271733879,c=-1732584194,d=271733878,i=0;i>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}function bit_rol(num,cnt){return num<>>32-cnt}var makeHash=require("./make-hash");module.exports=function(buf){return makeHash(buf,core_md5)}},{"./make-hash":170}],172:[function(require,module,exports){"use strict";function Hmac(alg,key){Base.call(this,"digest"),"string"==typeof key&&(key=Buffer.from(key));var blocksize="sha512"===alg||"sha384"===alg?128:64;if(this._alg=alg,this._key=key,key.length>blocksize){key=("rmd160"===alg?new RIPEMD160:sha(alg)).update(key).digest()}else key.lengthblocksize?key=alg(key):key.length>>8^255&sx^99,SBOX[x]=sx,INV_SBOX[sx]=x;var x2=d[x],x4=d[x2],x8=d[x4],t=257*d[sx]^16843008*sx;SUB_MIX_0[x]=t<<24|t>>>8,SUB_MIX_1[x]=t<<16|t>>>16,SUB_MIX_2[x]=t<<8|t>>>24,SUB_MIX_3[x]=t;var t=16843009*x8^65537*x4^257*x2^16843008*x;INV_SUB_MIX_0[sx]=t<<24|t>>>8,INV_SUB_MIX_1[sx]=t<<16|t>>>16,INV_SUB_MIX_2[sx]=t<<8|t>>>24,INV_SUB_MIX_3[sx]=t,x?(x=x2^d[d[d[x8^x2]]],xi^=d[d[xi]]):x=xi=1}}();var RCON=[0,1,2,4,8,16,32,64,128,27,54],AES=C_algo.AES=BlockCipher.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var key=this._keyPriorReset=this._key,keyWords=key.words,keySize=key.sigBytes/4,nRounds=this._nRounds=keySize+6,ksRows=4*(nRounds+1),keySchedule=this._keySchedule=[],ksRow=0;ksRow6&&ksRow%keySize==4&&(t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t]):(t=t<<8|t>>>24,t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t],t^=RCON[ksRow/keySize|0]<<24),keySchedule[ksRow]=keySchedule[ksRow-keySize]^t}for(var invKeySchedule=this._invKeySchedule=[],invKsRow=0;invKsRow>>24]]^INV_SUB_MIX_1[SBOX[t>>>16&255]]^INV_SUB_MIX_2[SBOX[t>>>8&255]]^INV_SUB_MIX_3[SBOX[255&t]]}}},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX)},decryptBlock:function(M,offset){var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t,this._doCryptBlock(M,offset,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX);var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t},_doCryptBlock:function(M,offset,keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX){for(var nRounds=this._nRounds,s0=M[offset]^keySchedule[0],s1=M[offset+1]^keySchedule[1],s2=M[offset+2]^keySchedule[2],s3=M[offset+3]^keySchedule[3],ksRow=4,round=1;round>>24]^SUB_MIX_1[s1>>>16&255]^SUB_MIX_2[s2>>>8&255]^SUB_MIX_3[255&s3]^keySchedule[ksRow++],t1=SUB_MIX_0[s1>>>24]^SUB_MIX_1[s2>>>16&255]^SUB_MIX_2[s3>>>8&255]^SUB_MIX_3[255&s0]^keySchedule[ksRow++],t2=SUB_MIX_0[s2>>>24]^SUB_MIX_1[s3>>>16&255]^SUB_MIX_2[s0>>>8&255]^SUB_MIX_3[255&s1]^keySchedule[ksRow++],t3=SUB_MIX_0[s3>>>24]^SUB_MIX_1[s0>>>16&255]^SUB_MIX_2[s1>>>8&255]^SUB_MIX_3[255&s2]^keySchedule[ksRow++];s0=t0,s1=t1,s2=t2,s3=t3}var t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&255]<<16|SBOX[s2>>>8&255]<<8|SBOX[255&s3])^keySchedule[ksRow++],t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&255]<<16|SBOX[s3>>>8&255]<<8|SBOX[255&s0])^keySchedule[ksRow++],t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&255]<<16|SBOX[s0>>>8&255]<<8|SBOX[255&s1])^keySchedule[ksRow++],t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&255]<<16|SBOX[s1>>>8&255]<<8|SBOX[255&s2])^keySchedule[ksRow++];M[offset]=t0,M[offset+1]=t1,M[offset+2]=t2,M[offset+3]=t3},keySize:8});C.AES=BlockCipher._createHelper(AES)}(),CryptoJS.AES})},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],176:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){CryptoJS.lib.Cipher||function(undefined){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm,C_enc=C.enc,Base64=(C_enc.Utf8,C_enc.Base64),C_algo=C.algo,EvpKDF=C_algo.EvpKDF,Cipher=C_lib.Cipher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),createEncryptor:function(key,cfg){return this.create(this._ENC_XFORM_MODE,key,cfg)},createDecryptor:function(key,cfg){return this.create(this._DEC_XFORM_MODE,key,cfg)},init:function(xformMode,key,cfg){this.cfg=this.cfg.extend(cfg),this._xformMode=xformMode,this._key=key,this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this),this._doReset()},process:function(dataUpdate){return this._append(dataUpdate),this._process()},finalize:function(dataUpdate){return dataUpdate&&this._append(dataUpdate),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(key){return"string"==typeof key?PasswordBasedCipher:SerializableCipher}return function(cipher){return{encrypt:function(message,key,cfg){return selectCipherStrategy(key).encrypt(cipher,message,key,cfg)},decrypt:function(ciphertext,key,cfg){return selectCipherStrategy(key).decrypt(cipher,ciphertext,key,cfg)}}}}()}),C_mode=(C_lib.StreamCipher=Cipher.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),C.mode={}),BlockCipherMode=C_lib.BlockCipherMode=Base.extend({createEncryptor:function(cipher,iv){return this.Encryptor.create(cipher,iv)},createDecryptor:function(cipher,iv){return this.Decryptor.create(cipher,iv)},init:function(cipher,iv){this._cipher=cipher,this._iv=iv}}),CBC=C_mode.CBC=function(){function xorBlock(words,offset,blockSize){var iv=this._iv;if(iv){var block=iv;this._iv=undefined}else var block=this._prevBlock;for(var i=0;i>>2];data.sigBytes-=nPaddingBytes}},CipherParams=(C_lib.BlockCipher=Cipher.extend({cfg:Cipher.cfg.extend({mode:CBC,padding:Pkcs7}),reset:function(){Cipher.reset.call(this);var cfg=this.cfg,iv=cfg.iv,mode=cfg.mode;if(this._xformMode==this._ENC_XFORM_MODE)var modeCreator=mode.createEncryptor;else{var modeCreator=mode.createDecryptor;this._minBufferSize=1}this._mode=modeCreator.call(mode,this,iv&&iv.words)},_doProcessBlock:function(words,offset){this._mode.processBlock(words,offset)},_doFinalize:function(){var padding=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){padding.pad(this._data,this.blockSize);var finalProcessedBlocks=this._process(!0)}else{var finalProcessedBlocks=this._process(!0);padding.unpad(finalProcessedBlocks)}return finalProcessedBlocks},blockSize:4}),C_lib.CipherParams=Base.extend({init:function(cipherParams){this.mixIn(cipherParams)},toString:function(formatter){return(formatter||this.formatter).stringify(this)}})),C_format=C.format={},OpenSSLFormatter=C_format.OpenSSL={stringify:function(cipherParams){var ciphertext=cipherParams.ciphertext,salt=cipherParams.salt;if(salt)var wordArray=WordArray.create([1398893684,1701076831]).concat(salt).concat(ciphertext);else var wordArray=ciphertext;return wordArray.toString(Base64)},parse:function(openSSLStr){var ciphertext=Base64.parse(openSSLStr),ciphertextWords=ciphertext.words;if(1398893684==ciphertextWords[0]&&1701076831==ciphertextWords[1]){var salt=WordArray.create(ciphertextWords.slice(2,4));ciphertextWords.splice(0,4),ciphertext.sigBytes-=16}return CipherParams.create({ciphertext:ciphertext,salt:salt})}},SerializableCipher=C_lib.SerializableCipher=Base.extend({cfg:Base.extend({format:OpenSSLFormatter}),encrypt:function(cipher,message,key,cfg){cfg=this.cfg.extend(cfg);var encryptor=cipher.createEncryptor(key,cfg),ciphertext=encryptor.finalize(message),cipherCfg=encryptor.cfg;return CipherParams.create({ciphertext:ciphertext,key:key,iv:cipherCfg.iv,algorithm:cipher,mode:cipherCfg.mode,padding:cipherCfg.padding,blockSize:cipher.blockSize,formatter:cfg.format})},decrypt:function(cipher,ciphertext,key,cfg){return cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format),cipher.createDecryptor(key,cfg).finalize(ciphertext.ciphertext)},_parse:function(ciphertext,format){return"string"==typeof ciphertext?format.parse(ciphertext,this):ciphertext}}),C_kdf=C.kdf={},OpenSSLKdf=C_kdf.OpenSSL={execute:function(password,keySize,ivSize,salt){salt||(salt=WordArray.random(8));var key=EvpKDF.create({keySize:keySize+ivSize}).compute(password,salt),iv=WordArray.create(key.words.slice(keySize),4*ivSize);return key.sigBytes=4*keySize,CipherParams.create({key:key,iv:iv,salt:salt})}},PasswordBasedCipher=C_lib.PasswordBasedCipher=SerializableCipher.extend({cfg:SerializableCipher.cfg.extend({kdf:OpenSSLKdf}),encrypt:function(cipher,message,password,cfg){cfg=this.cfg.extend(cfg);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize);cfg.iv=derivedParams.iv;var ciphertext=SerializableCipher.encrypt.call(this,cipher,message,derivedParams.key,cfg);return ciphertext.mixIn(derivedParams),ciphertext},decrypt:function(cipher,ciphertext,password,cfg){cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize,ciphertext.salt);return cfg.iv=derivedParams.iv,SerializableCipher.decrypt.call(this,cipher,ciphertext,derivedParams.key,cfg)}})}()})},{"./core":177}],177:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory():"function"==typeof define&&define.amd?define([],factory):root.CryptoJS=factory()}(void 0,function(){var CryptoJS=CryptoJS||function(Math,undefined){var create=Object.create||function(){function F(){}return function(obj){var subtype;return F.prototype=obj,subtype=new F,F.prototype=null,subtype}}(),C={},C_lib=C.lib={},Base=C_lib.Base=function(){return{extend:function(overrides){var subtype=create(this);return overrides&&subtype.mixIn(overrides),subtype.hasOwnProperty("init")&&this.init!==subtype.init||(subtype.init=function(){subtype.$super.init.apply(this,arguments)}),subtype.init.prototype=subtype,subtype.$super=this,subtype},create:function(){var instance=this.extend();return instance.init.apply(instance,arguments),instance},init:function(){},mixIn:function(properties){for(var propertyName in properties)properties.hasOwnProperty(propertyName)&&(this[propertyName]=properties[propertyName]);properties.hasOwnProperty("toString")&&(this.toString=properties.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),WordArray=C_lib.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[],this.sigBytes=void 0!=sigBytes?sigBytes:4*words.length},toString:function(encoder){return(encoder||Hex).stringify(this)},concat:function(wordArray){var thisWords=this.words,thatWords=wordArray.words,thisSigBytes=this.sigBytes,thatSigBytes=wordArray.sigBytes;if(this.clamp(),thisSigBytes%4)for(var i=0;i>>2]>>>24-i%4*8&255;thisWords[thisSigBytes+i>>>2]|=thatByte<<24-(thisSigBytes+i)%4*8}else for(var i=0;i>>2]=thatWords[i>>>2];return this.sigBytes+=thatSigBytes,this},clamp:function(){var words=this.words,sigBytes=this.sigBytes;words[sigBytes>>>2]&=4294967295<<32-sigBytes%4*8,words.length=Math.ceil(sigBytes/4)},clone:function(){var clone=Base.clone.call(this);return clone.words=this.words.slice(0),clone},random:function(nBytes){for(var rcache,words=[],i=0;i>16)&mask,m_w=18e3*(65535&m_w)+(m_w>>16)&mask;var result=(m_z<<16)+m_w&mask;return result/=4294967296,(result+=.5)*(Math.random()>.5?1:-1)}}(4294967296*(rcache||Math.random()));rcache=987654071*_r(),words.push(4294967296*_r()|0)}return new WordArray.init(words,nBytes)}}),C_enc=C.enc={},Hex=C_enc.Hex={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,hexChars=[],i=0;i>>2]>>>24-i%4*8&255;hexChars.push((bite>>>4).toString(16)),hexChars.push((15&bite).toString(16))}return hexChars.join("")},parse:function(hexStr){for(var hexStrLength=hexStr.length,words=[],i=0;i>>3]|=parseInt(hexStr.substr(i,2),16)<<24-i%8*4;return new WordArray.init(words,hexStrLength/2)}},Latin1=C_enc.Latin1={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,latin1Chars=[],i=0;i>>2]>>>24-i%4*8&255;latin1Chars.push(String.fromCharCode(bite))}return latin1Chars.join("")},parse:function(latin1Str){for(var latin1StrLength=latin1Str.length,words=[],i=0;i>>2]|=(255&latin1Str.charCodeAt(i))<<24-i%4*8;return new WordArray.init(words,latin1StrLength)}},Utf8=C_enc.Utf8={stringify:function(wordArray){try{return decodeURIComponent(escape(Latin1.stringify(wordArray)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(utf8Str){return Latin1.parse(unescape(encodeURIComponent(utf8Str)))}},BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm=Base.extend({reset:function(){this._data=new WordArray.init,this._nDataBytes=0},_append:function(data){"string"==typeof data&&(data=Utf8.parse(data)),this._data.concat(data),this._nDataBytes+=data.sigBytes},_process:function(doFlush){var data=this._data,dataWords=data.words,dataSigBytes=data.sigBytes,blockSize=this.blockSize,blockSizeBytes=4*blockSize,nBlocksReady=dataSigBytes/blockSizeBytes;nBlocksReady=doFlush?Math.ceil(nBlocksReady):Math.max((0|nBlocksReady)-this._minBufferSize,0);var nWordsReady=nBlocksReady*blockSize,nBytesReady=Math.min(4*nWordsReady,dataSigBytes);if(nWordsReady){for(var offset=0;offset>>6-i%4*2;words[nBytes>>>2]|=(bits1|bits2)<<24-nBytes%4*8,nBytes++}return WordArray.create(words,nBytes)}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_enc=C.enc;C_enc.Base64={stringify:function(wordArray){var words=wordArray.words,sigBytes=wordArray.sigBytes,map=this._map;wordArray.clamp();for(var base64Chars=[],i=0;i>>2]>>>24-i%4*8&255,byte2=words[i+1>>>2]>>>24-(i+1)%4*8&255,byte3=words[i+2>>>2]>>>24-(i+2)%4*8&255,triplet=byte1<<16|byte2<<8|byte3,j=0;j<4&&i+.75*j>>6*(3-j)&63));var paddingChar=map.charAt(64);if(paddingChar)for(;base64Chars.length%4;)base64Chars.push(paddingChar);return base64Chars.join("")},parse:function(base64Str){var base64StrLength=base64Str.length,map=this._map,reverseMap=this._reverseMap;if(!reverseMap){reverseMap=this._reverseMap=[];for(var j=0;j>>8&16711935}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_enc=C.enc;C_enc.Utf16=C_enc.Utf16BE={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,utf16Chars=[],i=0;i>>2]>>>16-i%4*8&65535;utf16Chars.push(String.fromCharCode(codePoint))}return utf16Chars.join("")},parse:function(utf16Str){for(var utf16StrLength=utf16Str.length,words=[],i=0;i>>1]|=utf16Str.charCodeAt(i)<<16-i%2*16;return WordArray.create(words,2*utf16StrLength)}};C_enc.Utf16LE={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,utf16Chars=[],i=0;i>>2]>>>16-i%4*8&65535);utf16Chars.push(String.fromCharCode(codePoint))}return utf16Chars.join("")},parse:function(utf16Str){for(var utf16StrLength=utf16Str.length,words=[],i=0;i>>1]|=swapEndian(utf16Str.charCodeAt(i)<<16-i%2*16);return WordArray.create(words,2*utf16StrLength)}}}(),CryptoJS.enc.Utf16})},{"./core":177}],180:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha1"),require("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,C_algo=C.algo,MD5=C_algo.MD5,EvpKDF=C_algo.EvpKDF=Base.extend({cfg:Base.extend({keySize:4,hasher:MD5,iterations:1}),init:function(cfg){this.cfg=this.cfg.extend(cfg)},compute:function(password,salt){for(var cfg=this.cfg,hasher=cfg.hasher.create(),derivedKey=WordArray.create(),derivedKeyWords=derivedKey.words,keySize=cfg.keySize,iterations=cfg.iterations;derivedKeyWords.lengthhasherBlockSizeBytes&&(key=hasher.finalize(key)),key.clamp();for(var oKey=this._oKey=key.clone(),iKey=this._iKey=key.clone(),oKeyWords=oKey.words,iKeyWords=iKey.words,i=0;i>>2]|=typedArray[i]<<24-i%4*8;superInit.call(this,words,typedArrayByteLength)}else superInit.apply(this,arguments)}).prototype=WordArray}}(),CryptoJS.lib.WordArray})},{"./core":177}],185:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){ +"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){function FF(a,b,c,d,x,s,t){var n=a+(b&c|~b&d)+x+t;return(n<>>32-s)+b}function GG(a,b,c,d,x,s,t){var n=a+(b&d|c&~d)+x+t;return(n<>>32-s)+b}function HH(a,b,c,d,x,s,t){var n=a+(b^c^d)+x+t;return(n<>>32-s)+b}function II(a,b,c,d,x,s,t){var n=a+(c^(b|~d))+x+t;return(n<>>32-s)+b}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,T=[];!function(){for(var i=0;i<64;i++)T[i]=4294967296*Math.abs(Math.sin(i+1))|0}();var MD5=C_algo.MD5=Hasher.extend({_doReset:function(){this._hash=new WordArray.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(M,offset){for(var i=0;i<16;i++){var offset_i=offset+i,M_offset_i=M[offset_i];M[offset_i]=16711935&(M_offset_i<<8|M_offset_i>>>24)|4278255360&(M_offset_i<<24|M_offset_i>>>8)}var H=this._hash.words,M_offset_0=M[offset+0],M_offset_1=M[offset+1],M_offset_2=M[offset+2],M_offset_3=M[offset+3],M_offset_4=M[offset+4],M_offset_5=M[offset+5],M_offset_6=M[offset+6],M_offset_7=M[offset+7],M_offset_8=M[offset+8],M_offset_9=M[offset+9],M_offset_10=M[offset+10],M_offset_11=M[offset+11],M_offset_12=M[offset+12],M_offset_13=M[offset+13],M_offset_14=M[offset+14],M_offset_15=M[offset+15],a=H[0],b=H[1],c=H[2],d=H[3];a=FF(a,b,c,d,M_offset_0,7,T[0]),d=FF(d,a,b,c,M_offset_1,12,T[1]),c=FF(c,d,a,b,M_offset_2,17,T[2]),b=FF(b,c,d,a,M_offset_3,22,T[3]),a=FF(a,b,c,d,M_offset_4,7,T[4]),d=FF(d,a,b,c,M_offset_5,12,T[5]),c=FF(c,d,a,b,M_offset_6,17,T[6]),b=FF(b,c,d,a,M_offset_7,22,T[7]),a=FF(a,b,c,d,M_offset_8,7,T[8]),d=FF(d,a,b,c,M_offset_9,12,T[9]),c=FF(c,d,a,b,M_offset_10,17,T[10]),b=FF(b,c,d,a,M_offset_11,22,T[11]),a=FF(a,b,c,d,M_offset_12,7,T[12]),d=FF(d,a,b,c,M_offset_13,12,T[13]),c=FF(c,d,a,b,M_offset_14,17,T[14]),b=FF(b,c,d,a,M_offset_15,22,T[15]),a=GG(a,b,c,d,M_offset_1,5,T[16]),d=GG(d,a,b,c,M_offset_6,9,T[17]),c=GG(c,d,a,b,M_offset_11,14,T[18]),b=GG(b,c,d,a,M_offset_0,20,T[19]),a=GG(a,b,c,d,M_offset_5,5,T[20]),d=GG(d,a,b,c,M_offset_10,9,T[21]),c=GG(c,d,a,b,M_offset_15,14,T[22]),b=GG(b,c,d,a,M_offset_4,20,T[23]),a=GG(a,b,c,d,M_offset_9,5,T[24]),d=GG(d,a,b,c,M_offset_14,9,T[25]),c=GG(c,d,a,b,M_offset_3,14,T[26]),b=GG(b,c,d,a,M_offset_8,20,T[27]),a=GG(a,b,c,d,M_offset_13,5,T[28]),d=GG(d,a,b,c,M_offset_2,9,T[29]),c=GG(c,d,a,b,M_offset_7,14,T[30]),b=GG(b,c,d,a,M_offset_12,20,T[31]),a=HH(a,b,c,d,M_offset_5,4,T[32]),d=HH(d,a,b,c,M_offset_8,11,T[33]),c=HH(c,d,a,b,M_offset_11,16,T[34]),b=HH(b,c,d,a,M_offset_14,23,T[35]),a=HH(a,b,c,d,M_offset_1,4,T[36]),d=HH(d,a,b,c,M_offset_4,11,T[37]),c=HH(c,d,a,b,M_offset_7,16,T[38]),b=HH(b,c,d,a,M_offset_10,23,T[39]),a=HH(a,b,c,d,M_offset_13,4,T[40]),d=HH(d,a,b,c,M_offset_0,11,T[41]),c=HH(c,d,a,b,M_offset_3,16,T[42]),b=HH(b,c,d,a,M_offset_6,23,T[43]),a=HH(a,b,c,d,M_offset_9,4,T[44]),d=HH(d,a,b,c,M_offset_12,11,T[45]),c=HH(c,d,a,b,M_offset_15,16,T[46]),b=HH(b,c,d,a,M_offset_2,23,T[47]),a=II(a,b,c,d,M_offset_0,6,T[48]),d=II(d,a,b,c,M_offset_7,10,T[49]),c=II(c,d,a,b,M_offset_14,15,T[50]),b=II(b,c,d,a,M_offset_5,21,T[51]),a=II(a,b,c,d,M_offset_12,6,T[52]),d=II(d,a,b,c,M_offset_3,10,T[53]),c=II(c,d,a,b,M_offset_10,15,T[54]),b=II(b,c,d,a,M_offset_1,21,T[55]),a=II(a,b,c,d,M_offset_8,6,T[56]),d=II(d,a,b,c,M_offset_15,10,T[57]),c=II(c,d,a,b,M_offset_6,15,T[58]),b=II(b,c,d,a,M_offset_13,21,T[59]),a=II(a,b,c,d,M_offset_4,6,T[60]),d=II(d,a,b,c,M_offset_11,10,T[61]),c=II(c,d,a,b,M_offset_2,15,T[62]),b=II(b,c,d,a,M_offset_9,21,T[63]),H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32;var nBitsTotalH=Math.floor(nBitsTotal/4294967296),nBitsTotalL=nBitsTotal;dataWords[15+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotalH<<8|nBitsTotalH>>>24)|4278255360&(nBitsTotalH<<24|nBitsTotalH>>>8),dataWords[14+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotalL<<8|nBitsTotalL>>>24)|4278255360&(nBitsTotalL<<24|nBitsTotalL>>>8),data.sigBytes=4*(dataWords.length+1),this._process();for(var hash=this._hash,H=hash.words,i=0;i<4;i++){var H_i=H[i];H[i]=16711935&(H_i<<8|H_i>>>24)|4278255360&(H_i<<24|H_i>>>8)}return hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.MD5=Hasher._createHelper(MD5),C.HmacMD5=Hasher._createHmacHelper(MD5)}(Math),CryptoJS.MD5})},{"./core":177}],186:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.mode.CFB=function(){function generateKeystreamAndEncrypt(words,offset,blockSize,cipher){var iv=this._iv;if(iv){var keystream=iv.slice(0);this._iv=void 0}else var keystream=this._prevBlock;cipher.encryptBlock(keystream,0);for(var i=0;i>24&255)){var b1=word>>16&255,b2=word>>8&255,b3=255&word;255===b1?(b1=0,255===b2?(b2=0,255===b3?b3=0:++b3):++b2):++b1,word=0,word+=b1<<16,word+=b2<<8,word+=b3}else word+=1<<24;return word}function incCounter(counter){return 0===(counter[0]=incWord(counter[0]))&&(counter[1]=incWord(counter[1])),counter}var CTRGladman=CryptoJS.lib.BlockCipherMode.extend(),Encryptor=CTRGladman.Encryptor=CTRGladman.extend({processBlock:function(words,offset){var cipher=this._cipher,blockSize=cipher.blockSize,iv=this._iv,counter=this._counter;iv&&(counter=this._counter=iv.slice(0),this._iv=void 0),incCounter(counter);var keystream=counter.slice(0);cipher.encryptBlock(keystream,0);for(var i=0;i>>2]|=nPaddingBytes<<24-lastBytePos%4*8,data.sigBytes+=nPaddingBytes},unpad:function(data){var nPaddingBytes=255&data.words[data.sigBytes-1>>>2];data.sigBytes-=nPaddingBytes}},CryptoJS.pad.Ansix923})},{"./cipher-core":176,"./core":177}],192:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.Iso10126={pad:function(data,blockSize){var blockSizeBytes=4*blockSize,nPaddingBytes=blockSizeBytes-data.sigBytes%blockSizeBytes;data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes-1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes<<24],1))},unpad:function(data){var nPaddingBytes=255&data.words[data.sigBytes-1>>>2];data.sigBytes-=nPaddingBytes}},CryptoJS.pad.Iso10126})},{"./cipher-core":176,"./core":177}],193:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.Iso97971={pad:function(data,blockSize){data.concat(CryptoJS.lib.WordArray.create([2147483648],1)),CryptoJS.pad.ZeroPadding.pad(data,blockSize)},unpad:function(data){CryptoJS.pad.ZeroPadding.unpad(data),data.sigBytes--}},CryptoJS.pad.Iso97971})},{"./cipher-core":176,"./core":177}],194:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.NoPadding={pad:function(){},unpad:function(){}},CryptoJS.pad.NoPadding})},{"./cipher-core":176,"./core":177}],195:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return CryptoJS.pad.ZeroPadding={pad:function(data,blockSize){var blockSizeBytes=4*blockSize;data.clamp(),data.sigBytes+=blockSizeBytes-(data.sigBytes%blockSizeBytes||blockSizeBytes)},unpad:function(data){for(var dataWords=data.words,i=data.sigBytes-1;!(dataWords[i>>>2]>>>24-i%4*8&255);)i--;data.sigBytes=i+1}},CryptoJS.pad.ZeroPadding})},{"./cipher-core":176,"./core":177}],196:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha1"),require("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,C_algo=C.algo,SHA1=C_algo.SHA1,HMAC=C_algo.HMAC,PBKDF2=C_algo.PBKDF2=Base.extend({cfg:Base.extend({keySize:4,hasher:SHA1,iterations:1}),init:function(cfg){this.cfg=this.cfg.extend(cfg)},compute:function(password,salt){for(var cfg=this.cfg,hmac=HMAC.create(cfg.hasher,password),derivedKey=WordArray.create(),blockIndex=WordArray.create([1]),derivedKeyWords=derivedKey.words,blockIndexWords=blockIndex.words,keySize=cfg.keySize,iterations=cfg.iterations;derivedKeyWords.length>>0>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0>>0?1:0)|0,this._b=C[7]>>>0>>0?1:0;for(var i=0;i<8;i++){var gx=X[i]+C[i],ga=65535&gx,gb=gx>>>16,gh=((ga*ga>>>17)+ga*gb>>>15)+gb*gb,gl=((4294901760&gx)*gx|0)+((65535&gx)*gx|0);G[i]=gh^gl}X[0]=G[0]+(G[7]<<16|G[7]>>>16)+(G[6]<<16|G[6]>>>16)|0,X[1]=G[1]+(G[0]<<8|G[0]>>>24)+G[7]|0,X[2]=G[2]+(G[1]<<16|G[1]>>>16)+(G[0]<<16|G[0]>>>16)|0,X[3]=G[3]+(G[2]<<8|G[2]>>>24)+G[1]|0,X[4]=G[4]+(G[3]<<16|G[3]>>>16)+(G[2]<<16|G[2]>>>16)|0,X[5]=G[5]+(G[4]<<8|G[4]>>>24)+G[3]|0,X[6]=G[6]+(G[5]<<16|G[5]>>>16)+(G[4]<<16|G[4]>>>16)|0,X[7]=G[7]+(G[6]<<8|G[6]>>>24)+G[5]|0}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,S=[],C_=[],G=[],RabbitLegacy=C_algo.RabbitLegacy=StreamCipher.extend({_doReset:function(){var K=this._key.words,iv=this.cfg.iv,X=this._X=[K[0],K[3]<<16|K[2]>>>16,K[1],K[0]<<16|K[3]>>>16,K[2],K[1]<<16|K[0]>>>16,K[3],K[2]<<16|K[1]>>>16],C=this._C=[K[2]<<16|K[2]>>>16,4294901760&K[0]|65535&K[1],K[3]<<16|K[3]>>>16,4294901760&K[1]|65535&K[2],K[0]<<16|K[0]>>>16,4294901760&K[2]|65535&K[3],K[1]<<16|K[1]>>>16,4294901760&K[3]|65535&K[0]];this._b=0;for(var i=0;i<4;i++)nextState.call(this);for(var i=0;i<8;i++)C[i]^=X[i+4&7];if(iv){var IV=iv.words,IV_0=IV[0],IV_1=IV[1],i0=16711935&(IV_0<<8|IV_0>>>24)|4278255360&(IV_0<<24|IV_0>>>8),i2=16711935&(IV_1<<8|IV_1>>>24)|4278255360&(IV_1<<24|IV_1>>>8),i1=i0>>>16|4294901760&i2,i3=i2<<16|65535&i0;C[0]^=i0,C[1]^=i1,C[2]^=i2,C[3]^=i3,C[4]^=i0,C[5]^=i1,C[6]^=i2,C[7]^=i3;for(var i=0;i<4;i++)nextState.call(this)}},_doProcessBlock:function(M,offset){var X=this._X;nextState.call(this),S[0]=X[0]^X[5]>>>16^X[3]<<16,S[1]=X[2]^X[7]>>>16^X[5]<<16,S[2]=X[4]^X[1]>>>16^X[7]<<16,S[3]=X[6]^X[3]>>>16^X[1]<<16;for(var i=0;i<4;i++)S[i]=16711935&(S[i]<<8|S[i]>>>24)|4278255360&(S[i]<<24|S[i]>>>8),M[offset+i]^=S[i]},blockSize:4,ivSize:2});C.RabbitLegacy=StreamCipher._createHelper(RabbitLegacy)}(),CryptoJS.RabbitLegacy})},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],198:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function nextState(){for(var X=this._X,C=this._C,i=0;i<8;i++)C_[i]=C[i];C[0]=C[0]+1295307597+this._b|0,C[1]=C[1]+3545052371+(C[0]>>>0>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0>>0?1:0)|0,this._b=C[7]>>>0>>0?1:0;for(var i=0;i<8;i++){var gx=X[i]+C[i],ga=65535&gx,gb=gx>>>16,gh=((ga*ga>>>17)+ga*gb>>>15)+gb*gb,gl=((4294901760&gx)*gx|0)+((65535&gx)*gx|0);G[i]=gh^gl}X[0]=G[0]+(G[7]<<16|G[7]>>>16)+(G[6]<<16|G[6]>>>16)|0,X[1]=G[1]+(G[0]<<8|G[0]>>>24)+G[7]|0,X[2]=G[2]+(G[1]<<16|G[1]>>>16)+(G[0]<<16|G[0]>>>16)|0,X[3]=G[3]+(G[2]<<8|G[2]>>>24)+G[1]|0,X[4]=G[4]+(G[3]<<16|G[3]>>>16)+(G[2]<<16|G[2]>>>16)|0,X[5]=G[5]+(G[4]<<8|G[4]>>>24)+G[3]|0,X[6]=G[6]+(G[5]<<16|G[5]>>>16)+(G[4]<<16|G[4]>>>16)|0,X[7]=G[7]+(G[6]<<8|G[6]>>>24)+G[5]|0}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,S=[],C_=[],G=[],Rabbit=C_algo.Rabbit=StreamCipher.extend({_doReset:function(){for(var K=this._key.words,iv=this.cfg.iv,i=0;i<4;i++)K[i]=16711935&(K[i]<<8|K[i]>>>24)|4278255360&(K[i]<<24|K[i]>>>8);var X=this._X=[K[0],K[3]<<16|K[2]>>>16,K[1],K[0]<<16|K[3]>>>16,K[2],K[1]<<16|K[0]>>>16,K[3],K[2]<<16|K[1]>>>16],C=this._C=[K[2]<<16|K[2]>>>16,4294901760&K[0]|65535&K[1],K[3]<<16|K[3]>>>16,4294901760&K[1]|65535&K[2],K[0]<<16|K[0]>>>16,4294901760&K[2]|65535&K[3],K[1]<<16|K[1]>>>16,4294901760&K[3]|65535&K[0]];this._b=0;for(var i=0;i<4;i++)nextState.call(this);for(var i=0;i<8;i++)C[i]^=X[i+4&7];if(iv){var IV=iv.words,IV_0=IV[0],IV_1=IV[1],i0=16711935&(IV_0<<8|IV_0>>>24)|4278255360&(IV_0<<24|IV_0>>>8),i2=16711935&(IV_1<<8|IV_1>>>24)|4278255360&(IV_1<<24|IV_1>>>8),i1=i0>>>16|4294901760&i2,i3=i2<<16|65535&i0;C[0]^=i0,C[1]^=i1,C[2]^=i2,C[3]^=i3,C[4]^=i0,C[5]^=i1,C[6]^=i2,C[7]^=i3;for(var i=0;i<4;i++)nextState.call(this)}},_doProcessBlock:function(M,offset){var X=this._X;nextState.call(this),S[0]=X[0]^X[5]>>>16^X[3]<<16,S[1]=X[2]^X[7]>>>16^X[5]<<16,S[2]=X[4]^X[1]>>>16^X[7]<<16,S[3]=X[6]^X[3]>>>16^X[1]<<16;for(var i=0;i<4;i++)S[i]=16711935&(S[i]<<8|S[i]>>>24)|4278255360&(S[i]<<24|S[i]>>>8),M[offset+i]^=S[i]},blockSize:4,ivSize:2});C.Rabbit=StreamCipher._createHelper(Rabbit)}(),CryptoJS.Rabbit})},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],199:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function generateKeystreamWord(){for(var S=this._S,i=this._i,j=this._j,keystreamWord=0,n=0;n<4;n++){i=(i+1)%256,j=(j+S[i])%256;var t=S[i];S[i]=S[j],S[j]=t,keystreamWord|=S[(S[i]+S[j])%256]<<24-8*n}return this._i=i,this._j=j,keystreamWord}var C=CryptoJS,C_lib=C.lib,StreamCipher=C_lib.StreamCipher,C_algo=C.algo,RC4=C_algo.RC4=StreamCipher.extend({_doReset:function(){for(var key=this._key,keyWords=key.words,keySigBytes=key.sigBytes,S=this._S=[],i=0;i<256;i++)S[i]=i;for(var i=0,j=0;i<256;i++){var keyByteIndex=i%keySigBytes,keyByte=keyWords[keyByteIndex>>>2]>>>24-keyByteIndex%4*8&255;j=(j+S[i]+keyByte)%256;var t=S[i];S[i]=S[j],S[j]=t}this._i=this._j=0},_doProcessBlock:function(M,offset){M[offset]^=generateKeystreamWord.call(this)},keySize:8,ivSize:0});C.RC4=StreamCipher._createHelper(RC4);var RC4Drop=C_algo.RC4Drop=RC4.extend({cfg:RC4.cfg.extend({drop:192}),_doReset:function(){RC4._doReset.call(this);for(var i=this.cfg.drop;i>0;i--)generateKeystreamWord.call(this)}});C.RC4Drop=StreamCipher._createHelper(RC4Drop)}(),CryptoJS.RC4})},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],200:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){function f1(x,y,z){return x^y^z}function f2(x,y,z){return x&y|~x&z}function f3(x,y,z){return(x|~y)^z}function f4(x,y,z){return x&z|y&~z}function f5(x,y,z){return x^(y|~z)}function rotl(x,n){return x<>>32-n}var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,_zl=WordArray.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),_zr=WordArray.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),_sl=WordArray.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),_sr=WordArray.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),_hl=WordArray.create([0,1518500249,1859775393,2400959708,2840853838]),_hr=WordArray.create([1352829926,1548603684,1836072691,2053994217,0]),RIPEMD160=C_algo.RIPEMD160=Hasher.extend({_doReset:function(){this._hash=WordArray.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(M,offset){for(var i=0;i<16;i++){var offset_i=offset+i,M_offset_i=M[offset_i];M[offset_i]=16711935&(M_offset_i<<8|M_offset_i>>>24)|4278255360&(M_offset_i<<24|M_offset_i>>>8)}var al,bl,cl,dl,el,ar,br,cr,dr,er,H=this._hash.words,hl=_hl.words,hr=_hr.words,zl=_zl.words,zr=_zr.words,sl=_sl.words,sr=_sr.words;ar=al=H[0],br=bl=H[1],cr=cl=H[2],dr=dl=H[3],er=el=H[4];for(var t,i=0;i<80;i+=1)t=al+M[offset+zl[i]]|0,t+=i<16?f1(bl,cl,dl)+hl[0]:i<32?f2(bl,cl,dl)+hl[1]:i<48?f3(bl,cl,dl)+hl[2]:i<64?f4(bl,cl,dl)+hl[3]:f5(bl,cl,dl)+hl[4],t|=0,t=rotl(t,sl[i]),t=t+el|0,al=el,el=dl,dl=rotl(cl,10),cl=bl,bl=t,t=ar+M[offset+zr[i]]|0,t+=i<16?f5(br,cr,dr)+hr[0]:i<32?f4(br,cr,dr)+hr[1]:i<48?f3(br,cr,dr)+hr[2]:i<64?f2(br,cr,dr)+hr[3]:f1(br,cr,dr)+hr[4],t|=0,t=rotl(t,sr[i]),t=t+er|0,ar=er,er=dr,dr=rotl(cr,10),cr=br,br=t;t=H[1]+cl+dr|0,H[1]=H[2]+dl+er|0,H[2]=H[3]+el+ar|0,H[3]=H[4]+al+br|0,H[4]=H[0]+bl+cr|0,H[0]=t},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[14+(nBitsLeft+64>>>9<<4)]=16711935&(nBitsTotal<<8|nBitsTotal>>>24)|4278255360&(nBitsTotal<<24|nBitsTotal>>>8),data.sigBytes=4*(dataWords.length+1),this._process();for(var hash=this._hash,H=hash.words,i=0;i<5;i++){var H_i=H[i];H[i]=16711935&(H_i<<8|H_i>>>24)|4278255360&(H_i<<24|H_i>>>8)}return hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.RIPEMD160=Hasher._createHelper(RIPEMD160),C.HmacRIPEMD160=Hasher._createHmacHelper(RIPEMD160)}(Math),CryptoJS.RIPEMD160})},{"./core":177}],201:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,W=[],SHA1=C_algo.SHA1=Hasher.extend({_doReset:function(){this._hash=new WordArray.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],i=0;i<80;i++){if(i<16)W[i]=0|M[offset+i];else{var n=W[i-3]^W[i-8]^W[i-14]^W[i-16];W[i]=n<<1|n>>>31}var t=(a<<5|a>>>27)+e+W[i];t+=i<20?1518500249+(b&c|~b&d):i<40?1859775393+(b^c^d):i<60?(b&c|b&d|c&d)-1894007588:(b^c^d)-899497514,e=d,d=c,c=b<<30|b>>>2,b=a,a=t}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[14+(nBitsLeft+64>>>9<<4)]=Math.floor(nBitsTotal/4294967296),dataWords[15+(nBitsLeft+64>>>9<<4)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA1=Hasher._createHelper(SHA1),C.HmacSHA1=Hasher._createHmacHelper(SHA1)}(),CryptoJS.SHA1})},{"./core":177}],202:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_algo=C.algo,SHA256=C_algo.SHA256,SHA224=C_algo.SHA224=SHA256.extend({_doReset:function(){this._hash=new WordArray.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var hash=SHA256._doFinalize.call(this);return hash.sigBytes-=4,hash}});C.SHA224=SHA256._createHelper(SHA224),C.HmacSHA224=SHA256._createHmacHelper(SHA224)}(),CryptoJS.SHA224})},{"./core":177,"./sha256":203}],203:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){ +"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,H=[],K=[];!function(){function getFractionalBits(n){return 4294967296*(n-(0|n))|0}for(var n=2,nPrime=0;nPrime<64;)(function(n){for(var sqrtN=Math.sqrt(n),factor=2;factor<=sqrtN;factor++)if(!(n%factor))return!1;return!0})(n)&&(nPrime<8&&(H[nPrime]=getFractionalBits(Math.pow(n,.5))),K[nPrime]=getFractionalBits(Math.pow(n,1/3)),nPrime++),n++}();var W=[],SHA256=C_algo.SHA256=Hasher.extend({_doReset:function(){this._hash=new WordArray.init(H.slice(0))},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],f=H[5],g=H[6],h=H[7],i=0;i<64;i++){if(i<16)W[i]=0|M[offset+i];else{var gamma0x=W[i-15],gamma0=(gamma0x<<25|gamma0x>>>7)^(gamma0x<<14|gamma0x>>>18)^gamma0x>>>3,gamma1x=W[i-2],gamma1=(gamma1x<<15|gamma1x>>>17)^(gamma1x<<13|gamma1x>>>19)^gamma1x>>>10;W[i]=gamma0+W[i-7]+gamma1+W[i-16]}var ch=e&f^~e&g,maj=a&b^a&c^b&c,sigma0=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),sigma1=(e<<26|e>>>6)^(e<<21|e>>>11)^(e<<7|e>>>25),t1=h+sigma1+ch+K[i]+W[i],t2=sigma0+maj;h=g,g=f,f=e,e=d+t1|0,d=c,c=b,b=a,a=t1+t2|0}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0,H[5]=H[5]+f|0,H[6]=H[6]+g|0,H[7]=H[7]+h|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[14+(nBitsLeft+64>>>9<<4)]=Math.floor(nBitsTotal/4294967296),dataWords[15+(nBitsLeft+64>>>9<<4)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA256=Hasher._createHelper(SHA256),C.HmacSHA256=Hasher._createHmacHelper(SHA256)}(Math),CryptoJS.SHA256})},{"./core":177}],204:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(Math){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_x64=C.x64,X64Word=C_x64.Word,C_algo=C.algo,RHO_OFFSETS=[],PI_INDEXES=[],ROUND_CONSTANTS=[];!function(){for(var x=1,y=0,t=0;t<24;t++){RHO_OFFSETS[x+5*y]=(t+1)*(t+2)/2%64;var newX=y%5,newY=(2*x+3*y)%5;x=newX,y=newY}for(var x=0;x<5;x++)for(var y=0;y<5;y++)PI_INDEXES[x+5*y]=y+(2*x+3*y)%5*5;for(var LFSR=1,i=0;i<24;i++){for(var roundConstantMsw=0,roundConstantLsw=0,j=0;j<7;j++){if(1&LFSR){var bitPosition=(1<>>24)|4278255360&(M2i<<24|M2i>>>8),M2i1=16711935&(M2i1<<8|M2i1>>>24)|4278255360&(M2i1<<24|M2i1>>>8);var lane=state[i];lane.high^=M2i1,lane.low^=M2i}for(var round=0;round<24;round++){for(var x=0;x<5;x++){for(var tMsw=0,tLsw=0,y=0;y<5;y++){var lane=state[x+5*y];tMsw^=lane.high,tLsw^=lane.low}var Tx=T[x];Tx.high=tMsw,Tx.low=tLsw}for(var x=0;x<5;x++)for(var Tx4=T[(x+4)%5],Tx1=T[(x+1)%5],Tx1Msw=Tx1.high,Tx1Lsw=Tx1.low,tMsw=Tx4.high^(Tx1Msw<<1|Tx1Lsw>>>31),tLsw=Tx4.low^(Tx1Lsw<<1|Tx1Msw>>>31),y=0;y<5;y++){var lane=state[x+5*y];lane.high^=tMsw,lane.low^=tLsw}for(var laneIndex=1;laneIndex<25;laneIndex++){var lane=state[laneIndex],laneMsw=lane.high,laneLsw=lane.low,rhoOffset=RHO_OFFSETS[laneIndex];if(rhoOffset<32)var tMsw=laneMsw<>>32-rhoOffset,tLsw=laneLsw<>>32-rhoOffset;else var tMsw=laneLsw<>>64-rhoOffset,tLsw=laneMsw<>>64-rhoOffset;var TPiLane=T[PI_INDEXES[laneIndex]];TPiLane.high=tMsw,TPiLane.low=tLsw}var T0=T[0],state0=state[0];T0.high=state0.high,T0.low=state0.low;for(var x=0;x<5;x++)for(var y=0;y<5;y++){var laneIndex=x+5*y,lane=state[laneIndex],TLane=T[laneIndex],Tx1Lane=T[(x+1)%5+5*y],Tx2Lane=T[(x+2)%5+5*y];lane.high=TLane.high^~Tx1Lane.high&Tx2Lane.high,lane.low=TLane.low^~Tx1Lane.low&Tx2Lane.low}var lane=state[0],roundConstant=ROUND_CONSTANTS[round];lane.high^=roundConstant.high,lane.low^=roundConstant.low}},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsLeft=(this._nDataBytes,8*data.sigBytes),blockSizeBits=32*this.blockSize;dataWords[nBitsLeft>>>5]|=1<<24-nBitsLeft%32,dataWords[(Math.ceil((nBitsLeft+1)/blockSizeBits)*blockSizeBits>>>5)-1]|=128,data.sigBytes=4*dataWords.length,this._process();for(var state=this._state,outputLengthBytes=this.cfg.outputLength/8,outputLengthLanes=outputLengthBytes/8,hashWords=[],i=0;i>>24)|4278255360&(laneMsw<<24|laneMsw>>>8),laneLsw=16711935&(laneLsw<<8|laneLsw>>>24)|4278255360&(laneLsw<<24|laneLsw>>>8),hashWords.push(laneLsw),hashWords.push(laneMsw)}return new WordArray.init(hashWords,outputLengthBytes)},clone:function(){for(var clone=Hasher.clone.call(this),state=clone._state=this._state.slice(0),i=0;i<25;i++)state[i]=state[i].clone();return clone}});C.SHA3=Hasher._createHelper(SHA3),C.HmacSHA3=Hasher._createHmacHelper(SHA3)}(Math),CryptoJS.SHA3})},{"./core":177,"./x64-core":208}],205:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core"),require("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){var C=CryptoJS,C_x64=C.x64,X64Word=C_x64.Word,X64WordArray=C_x64.WordArray,C_algo=C.algo,SHA512=C_algo.SHA512,SHA384=C_algo.SHA384=SHA512.extend({_doReset:function(){this._hash=new X64WordArray.init([new X64Word.init(3418070365,3238371032),new X64Word.init(1654270250,914150663),new X64Word.init(2438529370,812702999),new X64Word.init(355462360,4144912697),new X64Word.init(1731405415,4290775857),new X64Word.init(2394180231,1750603025),new X64Word.init(3675008525,1694076839),new X64Word.init(1203062813,3204075428)])},_doFinalize:function(){var hash=SHA512._doFinalize.call(this);return hash.sigBytes-=16,hash}});C.SHA384=SHA512._createHelper(SHA384),C.HmacSHA384=SHA512._createHmacHelper(SHA384)}(),CryptoJS.SHA384})},{"./core":177,"./sha512":206,"./x64-core":208}],206:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function X64Word_create(){return X64Word.create.apply(X64Word,arguments)}var C=CryptoJS,C_lib=C.lib,Hasher=C_lib.Hasher,C_x64=C.x64,X64Word=C_x64.Word,X64WordArray=C_x64.WordArray,C_algo=C.algo,K=[X64Word_create(1116352408,3609767458),X64Word_create(1899447441,602891725),X64Word_create(3049323471,3964484399),X64Word_create(3921009573,2173295548),X64Word_create(961987163,4081628472),X64Word_create(1508970993,3053834265),X64Word_create(2453635748,2937671579),X64Word_create(2870763221,3664609560),X64Word_create(3624381080,2734883394),X64Word_create(310598401,1164996542),X64Word_create(607225278,1323610764),X64Word_create(1426881987,3590304994),X64Word_create(1925078388,4068182383),X64Word_create(2162078206,991336113),X64Word_create(2614888103,633803317),X64Word_create(3248222580,3479774868),X64Word_create(3835390401,2666613458),X64Word_create(4022224774,944711139),X64Word_create(264347078,2341262773),X64Word_create(604807628,2007800933),X64Word_create(770255983,1495990901),X64Word_create(1249150122,1856431235),X64Word_create(1555081692,3175218132),X64Word_create(1996064986,2198950837),X64Word_create(2554220882,3999719339),X64Word_create(2821834349,766784016),X64Word_create(2952996808,2566594879),X64Word_create(3210313671,3203337956),X64Word_create(3336571891,1034457026),X64Word_create(3584528711,2466948901),X64Word_create(113926993,3758326383),X64Word_create(338241895,168717936),X64Word_create(666307205,1188179964),X64Word_create(773529912,1546045734),X64Word_create(1294757372,1522805485),X64Word_create(1396182291,2643833823),X64Word_create(1695183700,2343527390),X64Word_create(1986661051,1014477480),X64Word_create(2177026350,1206759142),X64Word_create(2456956037,344077627),X64Word_create(2730485921,1290863460),X64Word_create(2820302411,3158454273),X64Word_create(3259730800,3505952657),X64Word_create(3345764771,106217008),X64Word_create(3516065817,3606008344),X64Word_create(3600352804,1432725776),X64Word_create(4094571909,1467031594),X64Word_create(275423344,851169720),X64Word_create(430227734,3100823752),X64Word_create(506948616,1363258195),X64Word_create(659060556,3750685593),X64Word_create(883997877,3785050280),X64Word_create(958139571,3318307427),X64Word_create(1322822218,3812723403),X64Word_create(1537002063,2003034995),X64Word_create(1747873779,3602036899),X64Word_create(1955562222,1575990012),X64Word_create(2024104815,1125592928),X64Word_create(2227730452,2716904306),X64Word_create(2361852424,442776044),X64Word_create(2428436474,593698344),X64Word_create(2756734187,3733110249),X64Word_create(3204031479,2999351573),X64Word_create(3329325298,3815920427),X64Word_create(3391569614,3928383900),X64Word_create(3515267271,566280711),X64Word_create(3940187606,3454069534),X64Word_create(4118630271,4000239992),X64Word_create(116418474,1914138554),X64Word_create(174292421,2731055270),X64Word_create(289380356,3203993006),X64Word_create(460393269,320620315),X64Word_create(685471733,587496836),X64Word_create(852142971,1086792851),X64Word_create(1017036298,365543100),X64Word_create(1126000580,2618297676),X64Word_create(1288033470,3409855158),X64Word_create(1501505948,4234509866),X64Word_create(1607167915,987167468),X64Word_create(1816402316,1246189591)],W=[];!function(){for(var i=0;i<80;i++)W[i]=X64Word_create()}();var SHA512=C_algo.SHA512=Hasher.extend({_doReset:function(){this._hash=new X64WordArray.init([new X64Word.init(1779033703,4089235720),new X64Word.init(3144134277,2227873595),new X64Word.init(1013904242,4271175723),new X64Word.init(2773480762,1595750129),new X64Word.init(1359893119,2917565137),new X64Word.init(2600822924,725511199),new X64Word.init(528734635,4215389547),new X64Word.init(1541459225,327033209)])},_doProcessBlock:function(M,offset){for(var H=this._hash.words,H0=H[0],H1=H[1],H2=H[2],H3=H[3],H4=H[4],H5=H[5],H6=H[6],H7=H[7],H0h=H0.high,H0l=H0.low,H1h=H1.high,H1l=H1.low,H2h=H2.high,H2l=H2.low,H3h=H3.high,H3l=H3.low,H4h=H4.high,H4l=H4.low,H5h=H5.high,H5l=H5.low,H6h=H6.high,H6l=H6.low,H7h=H7.high,H7l=H7.low,ah=H0h,al=H0l,bh=H1h,bl=H1l,ch=H2h,cl=H2l,dh=H3h,dl=H3l,eh=H4h,el=H4l,fh=H5h,fl=H5l,gh=H6h,gl=H6l,hh=H7h,hl=H7l,i=0;i<80;i++){var Wi=W[i];if(i<16)var Wih=Wi.high=0|M[offset+2*i],Wil=Wi.low=0|M[offset+2*i+1];else{var gamma0x=W[i-15],gamma0xh=gamma0x.high,gamma0xl=gamma0x.low,gamma0h=(gamma0xh>>>1|gamma0xl<<31)^(gamma0xh>>>8|gamma0xl<<24)^gamma0xh>>>7,gamma0l=(gamma0xl>>>1|gamma0xh<<31)^(gamma0xl>>>8|gamma0xh<<24)^(gamma0xl>>>7|gamma0xh<<25),gamma1x=W[i-2],gamma1xh=gamma1x.high,gamma1xl=gamma1x.low,gamma1h=(gamma1xh>>>19|gamma1xl<<13)^(gamma1xh<<3|gamma1xl>>>29)^gamma1xh>>>6,gamma1l=(gamma1xl>>>19|gamma1xh<<13)^(gamma1xl<<3|gamma1xh>>>29)^(gamma1xl>>>6|gamma1xh<<26),Wi7=W[i-7],Wi7h=Wi7.high,Wi7l=Wi7.low,Wi16=W[i-16],Wi16h=Wi16.high,Wi16l=Wi16.low,Wil=gamma0l+Wi7l,Wih=gamma0h+Wi7h+(Wil>>>0>>0?1:0),Wil=Wil+gamma1l,Wih=Wih+gamma1h+(Wil>>>0>>0?1:0),Wil=Wil+Wi16l,Wih=Wih+Wi16h+(Wil>>>0>>0?1:0);Wi.high=Wih,Wi.low=Wil}var chh=eh&fh^~eh&gh,chl=el&fl^~el&gl,majh=ah&bh^ah&ch^bh&ch,majl=al&bl^al&cl^bl&cl,sigma0h=(ah>>>28|al<<4)^(ah<<30|al>>>2)^(ah<<25|al>>>7),sigma0l=(al>>>28|ah<<4)^(al<<30|ah>>>2)^(al<<25|ah>>>7),sigma1h=(eh>>>14|el<<18)^(eh>>>18|el<<14)^(eh<<23|el>>>9),sigma1l=(el>>>14|eh<<18)^(el>>>18|eh<<14)^(el<<23|eh>>>9),Ki=K[i],Kih=Ki.high,Kil=Ki.low,t1l=hl+sigma1l,t1h=hh+sigma1h+(t1l>>>0>>0?1:0),t1l=t1l+chl,t1h=t1h+chh+(t1l>>>0>>0?1:0),t1l=t1l+Kil,t1h=t1h+Kih+(t1l>>>0>>0?1:0),t1l=t1l+Wil,t1h=t1h+Wih+(t1l>>>0>>0?1:0),t2l=sigma0l+majl,t2h=sigma0h+majh+(t2l>>>0>>0?1:0);hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,el=dl+t1l|0,eh=dh+t1h+(el>>>0
>>0?1:0)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,al=t1l+t2l|0,ah=t1h+t2h+(al>>>0>>0?1:0)|0}H0l=H0.low=H0l+al,H0.high=H0h+ah+(H0l>>>0>>0?1:0),H1l=H1.low=H1l+bl,H1.high=H1h+bh+(H1l>>>0>>0?1:0),H2l=H2.low=H2l+cl,H2.high=H2h+ch+(H2l>>>0>>0?1:0),H3l=H3.low=H3l+dl,H3.high=H3h+dh+(H3l>>>0
>>0?1:0),H4l=H4.low=H4l+el,H4.high=H4h+eh+(H4l>>>0>>0?1:0),H5l=H5.low=H5l+fl,H5.high=H5h+fh+(H5l>>>0>>0?1:0),H6l=H6.low=H6l+gl,H6.high=H6h+gh+(H6l>>>0>>0?1:0),H7l=H7.low=H7l+hl,H7.high=H7h+hh+(H7l>>>0>>0?1:0)},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[30+(nBitsLeft+128>>>10<<5)]=Math.floor(nBitsTotal/4294967296),dataWords[31+(nBitsLeft+128>>>10<<5)]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash.toX32()},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone},blockSize:32});C.SHA512=Hasher._createHelper(SHA512),C.HmacSHA512=Hasher._createHmacHelper(SHA512)}(),CryptoJS.SHA512})},{"./core":177,"./x64-core":208}],207:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory,undef){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core"),require("./enc-base64"),require("./md5"),require("./evpkdf"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(){function exchangeLR(offset,mask){var t=(this._lBlock>>>offset^this._rBlock)&mask;this._rBlock^=t,this._lBlock^=t<>>offset^this._lBlock)&mask;this._lBlock^=t,this._rBlock^=t<>>5]>>>31-keyBitPos%32&1}for(var subKeys=this._subKeys=[],nSubKey=0;nSubKey<16;nSubKey++){for(var subKey=subKeys[nSubKey]=[],bitShift=BIT_SHIFTS[nSubKey],i=0;i<24;i++)subKey[i/6|0]|=keyBits[(PC2[i]-1+bitShift)%28]<<31-i%6,subKey[4+(i/6|0)]|=keyBits[28+(PC2[i+24]-1+bitShift)%28]<<31-i%6;subKey[0]=subKey[0]<<1|subKey[0]>>>31;for(var i=1;i<7;i++)subKey[i]=subKey[i]>>>4*(i-1)+3;subKey[7]=subKey[7]<<5|subKey[7]>>>27}for(var invSubKeys=this._invSubKeys=[],i=0;i<16;i++)invSubKeys[i]=subKeys[15-i]},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._subKeys)},decryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._invSubKeys)},_doCryptBlock:function(M,offset,subKeys){this._lBlock=M[offset],this._rBlock=M[offset+1],exchangeLR.call(this,4,252645135),exchangeLR.call(this,16,65535),exchangeRL.call(this,2,858993459),exchangeRL.call(this,8,16711935),exchangeLR.call(this,1,1431655765);for(var round=0;round<16;round++){for(var subKey=subKeys[round],lBlock=this._lBlock,rBlock=this._rBlock,f=0,i=0;i<8;i++)f|=SBOX_P[i][((rBlock^subKey[i])&SBOX_MASK[i])>>>0];this._lBlock=rBlock,this._rBlock=lBlock^f}var t=this._lBlock;this._lBlock=this._rBlock,this._rBlock=t,exchangeLR.call(this,1,1431655765),exchangeRL.call(this,8,16711935),exchangeRL.call(this,2,858993459),exchangeLR.call(this,16,65535),exchangeLR.call(this,4,252645135),M[offset]=this._lBlock,M[offset+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});C.DES=BlockCipher._createHelper(DES);var TripleDES=C_algo.TripleDES=BlockCipher.extend({_doReset:function(){var key=this._key,keyWords=key.words;this._des1=DES.createEncryptor(WordArray.create(keyWords.slice(0,2))),this._des2=DES.createEncryptor(WordArray.create(keyWords.slice(2,4))),this._des3=DES.createEncryptor(WordArray.create(keyWords.slice(4,6)))},encryptBlock:function(M,offset){this._des1.encryptBlock(M,offset),this._des2.decryptBlock(M,offset),this._des3.encryptBlock(M,offset)},decryptBlock:function(M,offset){this._des3.decryptBlock(M,offset),this._des2.encryptBlock(M,offset),this._des1.decryptBlock(M,offset)},keySize:6,ivSize:2,blockSize:2});C.TripleDES=BlockCipher._createHelper(TripleDES)}(),CryptoJS.TripleDES})},{"./cipher-core":176,"./core":177,"./enc-base64":178,"./evpkdf":180,"./md5":185}],208:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root,factory){"object"===(void 0===exports?"undefined":_typeof(exports))?module.exports=exports=factory(require("./core")):"function"==typeof define&&define.amd?define(["./core"],factory):factory(root.CryptoJS)}(void 0,function(CryptoJS){return function(undefined){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,X32WordArray=C_lib.WordArray,C_x64=C.x64={};C_x64.Word=Base.extend({init:function(high,low){this.high=high,this.low=low}}),C_x64.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[],this.sigBytes=void 0!=sigBytes?sigBytes:8*words.length},toX32:function(){for(var x64Words=this.words,x64WordsLength=x64Words.length,x32Words=[],i=0;i0;count--)inputOff+=this._buffer(data,inputOff),outputOff+=this._flushBuffer(out,outputOff);return inputOff+=this._buffer(data,inputOff),out},Cipher.prototype.final=function(buffer){var first;buffer&&(first=this.update(buffer));var last;return last="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),first?first.concat(last):last},Cipher.prototype._pad=function(buffer,off){if(0===off)return!1;for(;off>>1];kL=utils.r28shl(kL,shift),kR=utils.r28shl(kR,shift),utils.pc2(kL,kR,state.keys,i)}},DES.prototype._update=function(inp,inOff,out,outOff){var state=this._desState,l=utils.readUInt32BE(inp,inOff),r=utils.readUInt32BE(inp,inOff+4);utils.ip(l,r,state.tmp,0),l=state.tmp[0],r=state.tmp[1],"encrypt"===this.type?this._encrypt(state,l,r,state.tmp,0):this._decrypt(state,l,r,state.tmp,0),l=state.tmp[0],r=state.tmp[1],utils.writeUInt32BE(out,l,outOff),utils.writeUInt32BE(out,r,outOff+4)},DES.prototype._pad=function(buffer,off){for(var value=buffer.length-off,i=off;i>>0,l=t}utils.rip(r,l,out,off)},DES.prototype._decrypt=function(state,lStart,rStart,out,off){for(var l=rStart,r=lStart,i=state.keys.length-2;i>=0;i-=2){var keyL=state.keys[i],keyR=state.keys[i+1];utils.expand(l,state.tmp,0),keyL^=state.tmp[0],keyR^=state.tmp[1];var s=utils.substitute(keyL,keyR),f=utils.permute(s),t=l;l=(r^f)>>>0,r=t}utils.rip(l,r,out,off)}},{"../des":209,inherits:257,"minimalistic-assert":272}],213:[function(require,module,exports){"use strict";function EDEState(type,key){assert.equal(key.length,24,"Invalid key length");var k1=key.slice(0,8),k2=key.slice(8,16),k3=key.slice(16,24);this.ciphers="encrypt"===type?[DES.create({type:"encrypt",key:k1}),DES.create({type:"decrypt",key:k2}),DES.create({type:"encrypt",key:k3})]:[DES.create({type:"decrypt",key:k3}),DES.create({type:"encrypt",key:k2}),DES.create({type:"decrypt",key:k1})]}function EDE(options){Cipher.call(this,options);var state=new EDEState(this.type,this.options.key);this._edeState=state}var assert=require("minimalistic-assert"),inherits=require("inherits"),des=require("../des"),Cipher=des.Cipher,DES=des.DES;inherits(EDE,Cipher),module.exports=EDE,EDE.create=function(options){return new EDE(options)},EDE.prototype._update=function(inp,inOff,out,outOff){var state=this._edeState;state.ciphers[0]._update(inp,inOff,out,outOff),state.ciphers[1]._update(out,outOff,out,outOff),state.ciphers[2]._update(out,outOff,out,outOff)},EDE.prototype._pad=DES.prototype._pad,EDE.prototype._unpad=DES.prototype._unpad},{"../des":209,inherits:257,"minimalistic-assert":272}],214:[function(require,module,exports){"use strict";exports.readUInt32BE=function(bytes,off){return(bytes[0+off]<<24|bytes[1+off]<<16|bytes[2+off]<<8|bytes[3+off])>>>0},exports.writeUInt32BE=function(bytes,value,off){bytes[0+off]=value>>>24,bytes[1+off]=value>>>16&255,bytes[2+off]=value>>>8&255,bytes[3+off]=255&value},exports.ip=function(inL,inR,out,off){for(var outL=0,outR=0,i=6;i>=0;i-=2){for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>>j+i&1;for(var j=0;j<=24;j+=8)outL<<=1,outL|=inL>>>j+i&1}for(var i=6;i>=0;i-=2){for(var j=1;j<=25;j+=8)outR<<=1,outR|=inR>>>j+i&1;for(var j=1;j<=25;j+=8)outR<<=1,outR|=inL>>>j+i&1}out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.rip=function(inL,inR,out,off){for(var outL=0,outR=0,i=0;i<4;i++)for(var j=24;j>=0;j-=8)outL<<=1,outL|=inR>>>j+i&1,outL<<=1,outL|=inL>>>j+i&1;for(var i=4;i<8;i++)for(var j=24;j>=0;j-=8)outR<<=1,outR|=inR>>>j+i&1,outR<<=1,outR|=inL>>>j+i&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.pc1=function(inL,inR,out,off){for(var outL=0,outR=0,i=7;i>=5;i--){for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>j+i&1;for(var j=0;j<=24;j+=8)outL<<=1,outL|=inL>>j+i&1}for(var j=0;j<=24;j+=8)outL<<=1,outL|=inR>>j+i&1;for(var i=1;i<=3;i++){for(var j=0;j<=24;j+=8)outR<<=1,outR|=inR>>j+i&1;for(var j=0;j<=24;j+=8)outR<<=1,outR|=inL>>j+i&1}for(var j=0;j<=24;j+=8)outR<<=1,outR|=inL>>j+i&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.r28shl=function(num,shift){return num<>>28-shift};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];exports.pc2=function(inL,inR,out,off){for(var outL=0,outR=0,len=pc2table.length>>>1,i=0;i>>pc2table[i]&1;for(var i=len;i>>pc2table[i]&1;out[off+0]=outL>>>0,out[off+1]=outR>>>0},exports.expand=function(r,out,off){var outL=0,outR=0;outL=(1&r)<<5|r>>>27;for(var i=23;i>=15;i-=4)outL<<=6,outL|=r>>>i&63;for(var i=11;i>=3;i-=4)outR|=r>>>i&63,outR<<=6;outR|=(31&r)<<1|r>>>31,out[off+0]=outL>>>0,out[off+1]=outR>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];exports.substitute=function(inL,inR){for(var out=0,i=0;i<4;i++){var b=inL>>>18-6*i&63,sb=sTable[64*i+b];out<<=4,out|=sb}for(var i=0;i<4;i++){var b=inR>>>18-6*i&63,sb=sTable[256+64*i+b];out<<=4,out|=sb}return out>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];exports.permute=function(num){for(var out=0,i=0;i>>permuteTable[i]&1;return out>>>0},exports.padSplit=function(num,size,group){for(var str=num.toString(2);str.lengthbits;)num.ishrn(1);if(num.isEven()&&num.iadd(ONE),num.testn(1)||num.iadd(TWO),gen.cmp(TWO)){if(!gen.cmp(FIVE))for(;num.mod(TEN).cmp(THREE);)num.iadd(FOUR)}else for(;num.mod(TWENTYFOUR).cmp(ELEVEN);)num.iadd(FOUR);if(n2=num.shrn(1),simpleSieve(n2)&&simpleSieve(num)&&fermatTest(n2)&&fermatTest(num)&&millerRabin.test(n2)&&millerRabin.test(num))return num}}var randomBytes=require("randombytes");module.exports=findPrime,findPrime.simpleSieve=simpleSieve,findPrime.fermatTest=fermatTest;var BN=require("bn.js"),TWENTYFOUR=new BN(24),MillerRabin=require("miller-rabin"),millerRabin=new MillerRabin,ONE=new BN(1),TWO=new BN(2),FIVE=new BN(5),TEN=(new BN(16),new BN(8),new BN(10)),THREE=new BN(3),ELEVEN=(new BN(7),new BN(11)),FOUR=new BN(4),primes=(new BN(12),null)},{"bn.js":99,"miller-rabin":271,randombytes:296}],218:[function(require,module,exports){module.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],219:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.hmacDRBG=require("./elliptic/hmac-drbg"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec")},{"../package.json":233,"./elliptic/curve":222,"./elliptic/curves":225,"./elliptic/ec":226,"./elliptic/hmac-drbg":229,"./elliptic/utils":231,brorand:100}],220:[function(require,module,exports){"use strict";function BaseCurve(type,conf){this.type=type,this.p=new bn(conf.p,16),this.red=conf.prime?bn.red(conf.prime):bn.mont(this.p),this.zero=new bn(0).toRed(this.red),this.one=new bn(1).toRed(this.red),this.two=new bn(2).toRed(this.red),this.n=conf.n&&new bn(conf.n,16),this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4)}function BasePoint(curve,type){this.curve=curve,this.type=type,this.precomputed=null}var bn=require("bn.js"),elliptic=require("../../elliptic"),getNAF=elliptic.utils.getNAF,getJSF=elliptic.utils.getJSF,assert=elliptic.utils.assert;module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(p,k){assert(p.precomputed);var doubles=p._getDoubles(),naf=getNAF(k,1),I=(1<=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}for(var a=this.jpoint(null,null,null),b=this.jpoint(null,null,null),i=I;i>0;i--){for(var j=0;j=0;i--){for(var k=0;i>=0&&0===naf[i];i--)k++;if(i>=0&&k++,acc=acc.dblp(k),i<0)break;var z=naf[i];assert(0!==z),acc="affine"===p.type?z>0?acc.mixedAdd(wnd[z-1>>1]):acc.mixedAdd(wnd[-z-1>>1].neg()):z>0?acc.add(wnd[z-1>>1]):acc.add(wnd[-z-1>>1].neg())}return"affine"===p.type?acc.toP():acc},BaseCurve.prototype._wnafMulAdd=function(defW,points,coeffs,len){for(var wndWidth=this._wnafT1,wnd=this._wnafT2,naf=this._wnafT3,max=0,i=0;i=1;i-=2){var a=i-1,b=i;if(1===wndWidth[a]&&1===wndWidth[b]){var comb=[points[a],null,null,points[b]];0===points[a].y.cmp(points[b].y)?(comb[1]=points[a].add(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg())):0===points[a].y.cmp(points[b].y.redNeg())?(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].add(points[b].neg())):(comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg()));var index=[-3,-1,-5,-7,0,7,5,1,3],jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max),naf[a]=new Array(max),naf[b]=new Array(max);for(var j=0;j=0;i--){for(var k=0;i>=0;){for(var zero=!0,j=0;j=0&&k++,acc=acc.dblp(k),i<0)break;for(var j=0;j0?p=wnd[j][z-1>>1]:z<0&&(p=wnd[j][-z-1>>1].neg()),acc="affine"===p.type?acc.mixedAdd(p):acc.add(p))}}for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)},BasePoint.prototype._getDoubles=function(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var doubles=[this],acc=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),g=d.redAdd(b),f=g.redSub(c),h=d.redSub(b),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projDbl=function(){var nx,ny,nz,b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var e=this.curve._mulA(c),f=e.redAdd(d);if(this.zOne)nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)),ny=f.redMul(e.redSub(d)),nz=f.redSqr().redSub(f).redSub(f);else{var h=this.z.redSqr(),j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j),ny=f.redMul(e.redSub(d)),nz=f.redMul(j)}}else{var e=c.redAdd(d),h=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j),ny=this.curve._mulC(e).redMul(c.redISub(d)),nz=e.redMul(j)}return this.curve.point(nx,ny,nz)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),c=this.t.redMul(this.curve.dd).redMul(p.t),d=this.z.redMul(p.z.redAdd(p.z)),e=b.redSub(a),f=d.redSub(c),g=d.redAdd(c),h=b.redAdd(a),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projAdd=function(p){var ny,nz,a=this.z.redMul(p.z),b=a.redSqr(),c=this.x.redMul(p.x),d=this.y.redMul(p.y),e=this.curve.d.redMul(c).redMul(d),f=b.redSub(e),g=b.redAdd(e),tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),nx=a.redMul(f).redMul(tmp);return this.curve.twisted?(ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c))),nz=f.redMul(g)):(ny=a.redMul(g).redMul(d.redSub(c)),nz=this.curve._mulC(f).redMul(g)),this.curve.point(nx,ny,nz)},Point.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},Point.prototype.mul=function(k){return this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2)},Point.prototype.normalize=function(){if(this.zOne)return this;var zi=this.z.redInvm();return this.x=this.x.redMul(zi),this.y=this.y.redMul(zi),this.t&&(this.t=this.t.redMul(zi)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},{"../../elliptic":219,"../curve":222,"bn.js":232,inherits:257}],222:[function(require,module,exports){arguments[4][74][0].apply(exports,arguments)},{"./base":220,"./edwards":221,"./mont":223,"./short":224,dup:74}],223:[function(require,module,exports){"use strict";function MontCurve(conf){Base.call(this,"mont",conf),this.a=new bn(conf.a,16).toRed(this.red),this.b=new bn(conf.b,16).toRed(this.red),this.i4=new bn(4).toRed(this.red).redInvm(),this.two=new bn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective"),null===x&&null===z?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bn(x,16),this.z=new bn(z,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var curve=require("../curve"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(point){var x=point.normalize().x,x2=x.redSqr(),rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);return 0===rhs.redSqrt().redSqr().cmp(rhs)},inherits(Point,Base.BasePoint),MontCurve.prototype.point=function(x,z){return new Point(this,x,z)},MontCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)}, +Point.prototype.precompute=function(){},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var a=this.x.redAdd(this.z),aa=a.redSqr(),b=this.x.redSub(this.z),bb=b.redSqr(),c=aa.redSub(bb),nx=aa.redMul(bb),nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(p,diff){var a=this.x.redAdd(this.z),b=this.x.redSub(this.z),c=p.x.redAdd(p.z),d=p.x.redSub(p.z),da=d.redMul(a),cb=c.redMul(b),nx=diff.z.redMul(da.redAdd(cb).redSqr()),nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)},Point.prototype.mul=function(k){for(var t=k.clone(),a=this,b=this.curve.point(null,null),c=this,bits=[];0!==t.cmpn(0);t.ishrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--)0===bits[i]?(a=a.diffAdd(b,c),b=b.dbl()):(b=a.diffAdd(b,c),a=a.dbl());return b},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":222,"bn.js":232,inherits:257}],224:[function(require,module,exports){"use strict";function ShortCurve(conf){Base.call(this,"short",conf),this.a=new bn(conf.a,16).toRed(this.red),this.b=new bn(conf.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(conf),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine"),null===x&&null===y?(this.x=null,this.y=null,this.inf=!0):(this.x=new bn(x,16),this.y=new bn(y,16),isRed&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian"),null===x&&null===y&&null===z?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bn(0)):(this.x=new bn(x,16),this.y=new bn(y,16),this.z=new bn(z,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,assert=elliptic.utils.assert;inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(conf){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var beta,lambda;if(conf.beta)beta=new bn(conf.beta,16).toRed(this.red);else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1],beta=beta.toRed(this.red)}if(conf.lambda)lambda=new bn(conf.lambda,16);else{var lambdas=this._getEndoRoots(this.n);0===this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))?lambda=lambdas[0]:(lambda=lambdas[1],assert(0===this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))))}var basis;return basis=conf.basis?conf.basis.map(function(vec){return{a:new bn(vec.a,16),b:new bn(vec.b,16)}}):this._getEndoBasis(lambda),{beta:beta,lambda:lambda,basis:basis}}},ShortCurve.prototype._getEndoRoots=function(num){var red=num===this.p?this.red:bn.mont(num),tinv=new bn(2).toRed(red).redInvm(),ntinv=tinv.redNeg(),s=new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv);return[ntinv.redAdd(s).fromRed(),ntinv.redSub(s).fromRed()]},ShortCurve.prototype._getEndoBasis=function(lambda){for(var a0,b0,a1,b1,a2,b2,prevR,r,x,aprxSqrt=this.n.shrn(Math.floor(this.n.bitLength()/2)),u=lambda,v=this.n.clone(),x1=new bn(1),y1=new bn(0),x2=new bn(0),y2=new bn(1),i=0;0!==u.cmpn(0);){var q=v.div(u);r=v.sub(q.mul(u)),x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0)a0=prevR.neg(),b0=x1,a1=r.neg(),b1=x;else if(a1&&2==++i)break;prevR=r,v=u,u=r,x2=x1,x1=x,y2=y1,y1=y}a2=r.neg(),b2=x;var len1=a1.sqr().add(b1.sqr());return a2.sqr().add(b2.sqr()).cmp(len1)>=0&&(a2=a0,b2=b0),a1.sign&&(a1=a1.neg(),b1=b1.neg()),a2.sign&&(a2=a2.neg(),b2=b2.neg()),[{a:a1,b:b1},{a:a2,b:b2}]},ShortCurve.prototype._endoSplit=function(k){var basis=this.endo.basis,v1=basis[0],v2=basis[1],c1=v2.b.mul(k).divRound(this.n),c2=v1.b.neg().mul(k).divRound(this.n),p1=c1.mul(v1.a),p2=c2.mul(v2.a),q1=c1.mul(v1.b),q2=c2.mul(v2.b);return{k1:k.sub(p1).sub(p2),k2:q1.add(q2).neg()}},ShortCurve.prototype.pointFromX=function(odd,x){x=new bn(x,16),x.red||(x=x.toRed(this.red));var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),y=y2.redSqrt(),isOdd=y.fromRed().isOdd();return(odd&&!isOdd||!odd&&isOdd)&&(y=y.redNeg()),this.point(x,y)},ShortCurve.prototype.validate=function(point){if(point.inf)return!0;var x=point.x,y=point.y,ax=this.a.redMul(x),rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return 0===y.redSqr().redISub(rhs).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(points,coeffs){for(var npoints=this._endoWnafT1,ncoeffs=this._endoWnafT2,i=0;i":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(0===this.x.cmp(p.x))return this.curve.point(null,null);var c=this.y.redSub(p.y);0!==c.cmpn(0)&&(c=c.redMul(this.x.redSub(p.x).redInvm()));var nx=c.redSqr().redISub(this.x).redISub(p.x),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.dbl=function(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(0===ys1.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,x2=this.x.redSqr(),dyinv=ys1.redInvm(),c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv),nx=c.redSqr().redISub(this.x.redAdd(this.x)),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(k){return k=new bn(k,16),this._hasDoubles(k)?this.curve._fixedNafMul(this,k):this.curve.endo?this.curve._endoWnafMulAdd([this],[k]):this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];return this.curve.endo?this.curve._endoWnafMulAdd(points,coeffs):this.curve._wnafMulAdd(1,points,coeffs,2)},Point.prototype.eq=function(p){return this===p||this.inf===p.inf&&(this.inf||0===this.x.cmp(p.x)&&0===this.y.cmp(p.y))},Point.prototype.neg=function(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed,negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(x,y,z){return new JPoint(this,x,y,z)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm(),zinv2=zinv.redSqr(),ax=this.x.redMul(zinv2),ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr(),z2=this.z.redSqr(),u1=this.x.redMul(pz2),u2=p.x.redMul(z2),s1=this.y.redMul(pz2.redMul(p.z)),s2=p.y.redMul(z2.redMul(this.z)),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mixedAdd=function(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr(),u1=this.x,u2=p.x.redMul(z2),s1=this.y,s2=p.y.redMul(z2).redMul(this.z),h=u1.redSub(u2),r=s1.redSub(s2);if(0===h.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.dblp=function(pow){if(0===pow)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,i=0;i":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":219,"../curve":222,"bn.js":232,inherits:257}],225:[function(require,module,exports){"use strict";function PresetCurve(options){"short"===options.type?this.curve=new elliptic.curve.short(options):"edwards"===options.type?this.curve=new elliptic.curve.edwards(options):this.curve=new elliptic.curve.mont(options),this.g=this.curve.g,this.n=this.curve.n,this.hash=options.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,get:function(){var curve=new PresetCurve(options);return Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,value:curve}),curve}})}var curves=exports,hash=require("hash.js"),elliptic=require("../elliptic"),assert=elliptic.utils.assert;curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"../elliptic":219,"./precomputed/secp256k1":230,"hash.js":241}],226:[function(require,module,exports){"use strict";function EC(options){if(!(this instanceof EC))return new EC(options);"string"==typeof options&&(assert(elliptic.curves.hasOwnProperty(options),"Unknown curve "+options),options=elliptic.curves[options]),options instanceof elliptic.curves.PresetCurve&&(options={curve:options}),this.curve=options.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=options.curve.g,this.g.precompute(options.curve.n.bitLength()+1),this.hash=options.hash||options.curve.hash}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(options){return new KeyPair(this,options)},EC.prototype.keyFromPrivate=function(priv,enc){return KeyPair.fromPrivate(this,priv,enc)},EC.prototype.keyFromPublic=function(pub,enc){return KeyPair.fromPublic(this,pub,enc)},EC.prototype.genKeyPair=function(options){options||(options={});for(var drbg=new elliptic.hmacDRBG({hash:this.hash,pers:options.pers,entropy:options.entropy||elliptic.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),bytes=this.n.byteLength(),ns2=this.n.sub(new bn(2));;){var priv=new bn(drbg.generate(bytes));if(!(priv.cmp(ns2)>0))return priv.iaddn(1),this.keyFromPrivate(priv)}},EC.prototype._truncateToN=function(msg,truncOnly){var delta=8*msg.byteLength()-this.n.bitLength();return delta>0&&(msg=msg.shrn(delta)),!truncOnly&&msg.cmp(this.n)>=0?msg.sub(this.n):msg},EC.prototype.sign=function(msg,key,enc,options){"object"===(void 0===enc?"undefined":_typeof(enc))&&(options=enc,enc=null),options||(options={}),key=this.keyFromPrivate(key,enc),msg=this._truncateToN(new bn(msg,16));for(var bytes=this.n.byteLength(),bkey=key.getPrivate().toArray(),i=bkey.length;i<21;i++)bkey.unshift(0);for(var nonce=msg.toArray(),i=nonce.length;i=0)){var kp=this.g.mul(k);if(!kp.isInfinity()){var kpX=kp.getX(),r=kpX.mod(this.n);if(0!==r.cmpn(0)){var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n);if(0!==s.cmpn(0)){options.canonical&&s.cmp(this.nh)>0&&(s=this.n.sub(s));var recoveryParam=(kp.getY().isOdd()?1:0)|(0!==kpX.cmp(r)?2:0);return new Signature({r:r,s:s,recoveryParam:recoveryParam})}}}}}},EC.prototype.verify=function(msg,signature,key,enc){msg=this._truncateToN(new bn(msg,16)),key=this.keyFromPublic(key,enc),signature=new Signature(signature,"hex");var r=signature.r,s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var sinv=s.invm(this.n),u1=sinv.mul(msg).mod(this.n),u2=sinv.mul(r).mod(this.n),p=this.g.mulAdd(u1,key.getPublic(),u2);return!p.isInfinity()&&0===p.getX().mod(this.n).cmp(r)},EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits"),signature=new Signature(signature,enc);var n=this.n,e=new bn(msg),r=signature.r,s=signature.s,isYOdd=1&j,isSecondKey=j>>1;if(r.cmp(this.curve.p.mod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");r=this.curve.pointFromX(isYOdd,r);var eNeg=e.neg().mod(n),rInv=signature.r.invm(n);return r.mul(s).add(this.g.mul(eNeg)).mul(rInv)},EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){if(signature=new Signature(signature,enc),null!==signature.recoveryParam)return signature.recoveryParam;for(var i=0;i<4;i++){if(this.recoverPubKey(e,signature,i).eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":219,"./key":227,"./signature":228,"bn.js":232}],227:[function(require,module,exports){"use strict";function KeyPair(ec,options){this.ec=ec,this.priv=null,this.pub=null,options.priv&&this._importPrivate(options.priv,options.privEnc),options.pub&&this._importPublic(options.pub,options.pubEnc)}var bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=KeyPair,KeyPair.fromPublic=function(ec,pub,enc){return pub instanceof KeyPair?pub:new KeyPair(ec,{pub:pub,pubEnc:enc})},KeyPair.fromPrivate=function(ec,priv,enc){return priv instanceof KeyPair?priv:new KeyPair(ec,{priv:priv,privEnc:enc})},KeyPair.prototype.validate=function(){var pub=this.getPublic();return pub.isInfinity()?{result:!1,reason:"Invalid public key"}:pub.validate()?pub.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(compact,enc){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof compact&&(enc=compact,compact=null),!enc)return this.pub;for(var len=this.ec.curve.p.byteLength(),x=this.pub.getX().toArray(),i=x.length;i"}},{"../../elliptic":219,"bn.js":232}],228:[function(require,module,exports){"use strict";function Signature(options,enc){if(options instanceof Signature)return options;this._importDER(options,enc)||(assert(options.r&&options.s,"Signature without r or s"),this.r=new bn(options.r,16),this.s=new bn(options.s,16),null!==options.recoveryParam?this.recoveryParam=options.recoveryParam:this.recoveryParam=null)}var bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=Signature,Signature.prototype._importDER=function(data,enc){if(data=utils.toArray(data,enc),data.length<6||48!==data[0]||2!==data[2])return!1;if(1+data[1]>data.length)return!1;var rlen=data[3];if(rlen>=128)return!1;if(4+rlen+2>=data.length)return!1;if(2!==data[4+rlen])return!1;var slen=data[5+rlen];return!(slen>=128)&&(!(4+rlen+2+slen>data.length)&&(this.r=new bn(data.slice(4,4+rlen)),this.s=new bn(data.slice(4+rlen+2,4+rlen+2+slen)),this.recoveryParam=null,!0))},Signature.prototype.toDER=function(enc){var r=this.r.toArray(),s=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&s[0]&&(s=[0].concat(s));var total=r.length+s.length+4,res=[48,total,2,r.length];return res=res.concat(r,[2,s.length],s),utils.encode(res,enc)}},{"../../elliptic":219,"bn.js":232}],229:[function(require,module,exports){"use strict";function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash,this.predResist=!!options.predResist,this.outLen=this.hash.outSize,this.minEntropy=options.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc),nonce=utils.toArray(options.nonce,options.nonceEnc),pers=utils.toArray(options.pers,options.persEnc);assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(entropy,nonce,pers)}var hash=require("hash.js"),elliptic=require("../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=HmacDRBG,HmacDRBG.prototype._init=function(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(entropy.concat(add||[])),this.reseed=1},HmacDRBG.prototype.generate=function(len,enc,add,addEnc){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof enc&&(addEnc=add,add=enc,enc=null),add&&(add=utils.toArray(add,addEnc),this._update(add));for(var temp=[];temp.length>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}return res}function zero2(word){return 1===word.length?"0"+word:word}function toHex(msg){for(var res="",i=0;i=0;){var z;if(k.isOdd()){var mod=k.andln(ws-1);z=mod>(ws>>1)-1?(ws>>1)-mod:mod,k.isubn(z)}else z=0;naf.push(z);for(var shift=0!==k.cmpn(0)&&0===k.andln(ws-1)?w+1:1,i=1;i0||k2.cmpn(-d2)>0;){var m14=k1.andln(3)+d1&3,m24=k2.andln(3)+d2&3;3===m14&&(m14=-1),3===m24&&(m24=-1);var u1;if(0==(1&m14))u1=0;else{var m8=k1.andln(7)+d1&7;u1=3!==m8&&5!==m8||2!==m24?m14:-m14}jsf[0].push(u1);var u2;if(0==(1&m24))u2=0;else{var m8=k2.andln(7)+d2&7;u2=3!==m8&&5!==m8||2!==m14?m24:-m24}jsf[1].push(u2),2*d1===u1+1&&(d1=1-d1),2*d2===u2+1&&(d2=1-d2),k1.ishrn(1),k2.ishrn(1)}return jsf}var utils=exports;utils.assert=function(val,msg){if(!val)throw new Error(msg||"Assertion failed")},utils.toArray=toArray,utils.zero2=zero2,utils.toHex=toHex,utils.encode=function(arr,enc){return"hex"===enc?toHex(arr):arr},utils.getNAF=getNAF,utils.getJSF=getJSF},{}],232:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(module,exports){function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){ +if(null!==number&&"object"===(void 0===number?"undefined":_typeof(number))&&Array.isArray(number.words))return number;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==base&&"be"!==base||(endian=base,base=10),null!==number&&this._init(number||0,base||10,endian||"be")}function parseHex(str,start,end){for(var r=0,len=Math.min(str.length,end),i=start;i=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:15&c}return r}function parseBase(str,start,end,mul){for(var r=0,len=Math.min(str.length,end),i=start;i=49?c-49+10:c>=17?c-17+10:c}return r}function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(m){if("string"==typeof m){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else this.m=m,this.prime=null}function Mont(m){Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).ishln(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.sign=!0,this.minv=this.minv.mod(this.r)}"object"===(void 0===module?"undefined":_typeof(module))?module.exports=BN:exports.BN=BN,BN.BN=BN,BN.wordSize=26,BN.prototype._init=function(number,base,endian){if("number"==typeof number)return this._initNumber(number,base,endian);if("object"===(void 0===number?"undefined":_typeof(number)))return this._initArray(number,base,endian);"hex"===base&&(base=16),assert(base===(0|base)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;"-"===number[0]&&start++,16===base?this._parseHex(number,start):this._parseBase(number,base,start),"-"===number[0]&&(this.sign=!0),this.strip(),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initNumber=function(number,base,endian){number<0&&(this.sign=!0,number=-number),number<67108864?(this.words=[67108863&number],this.length=1):number<4503599627370496?(this.words=[67108863&number,number/67108864&67108863],this.length=2):(assert(number<9007199254740992),this.words=[67108863&number,number/67108864&67108863,1],this.length=3),"le"===endian&&this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert("number"==typeof number.length),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<>>26-off&67108863,off+=24,off>=26&&(off-=26,j++)}else if("le"===endian)for(var i=0,j=0;i>>26-off&67108863,off+=24,off>=26&&(off-=26,j++)}return this.strip()},BN.prototype._parseHex=function(number,start){this.length=Math.ceil((number.length-start)/6),this.words=new Array(this.length);for(var i=0;i=start;i-=6){var w=parseHex(number,i,i+6);this.words[j]|=w<>>26-off&4194303,off+=24,off>=26&&(off-=26,j++)}if(i+6!==start){var w=parseHex(number,start,i+6);this.words[j]|=w<>>26-off&4194303}this.strip()},BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;for(var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0,i=start;i1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},BN.prototype.inspect=function(){return(this.red?""};var zeros=["","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"],groupSizes=[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],groupBases=[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];BN.prototype.toString=function(base,padding){if(16===(base=base||10)||"hex"===base){for(var out="",off=0,padding=0|padding||1,carry=0,i=0;i>>24-off&16777215,out=0!==carry||i!==this.length-1?zeros[6-word.length]+word+out:word+out,off+=2,off>=26&&(off-=26,i--)}for(0!==carry&&(out=carry.toString(16)+out);out.length%padding!=0;)out="0"+out;return this.sign&&(out="-"+out),out}if(base===(0|base)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base],out="",c=this.clone();for(c.sign=!1;0!==c.cmpn(0);){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase),out=0!==c.cmpn(0)?zeros[groupSize-r.length]+r+out:r+out}return 0===this.cmpn(0)&&(out="0"+out),this.sign&&(out="-"+out),out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toArray=function(endian){this.strip();var res=new Array(this.byteLength());res[0]=0;var q=this.clone();if("le"!==endian)for(var i=0;0!==q.cmpn(0);i++){var b=q.andln(255);q.ishrn(8),res[res.length-i-1]=b}else for(var i=0;0!==q.cmpn(0);i++){var b=q.andln(255);q.ishrn(8),res[i]=b}return res},Math.clz32?BN.prototype._countBits=function(w){return 32-Math.clz32(w)}:BN.prototype._countBits=function(w){var t=w,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function(w){if(0===w)return 26;var t=w,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function(){var hi=0,w=this.words[this.length-1],hi=this._countBits(w);return 26*(this.length-1)+hi},BN.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var r=0,i=0;inum.length?this.clone().ior(num):num.clone().ior(this)},BN.prototype.iand=function(num){this.sign=this.sign&&num.sign;var b;b=this.length>num.length?num:this;for(var i=0;inum.length?this.clone().iand(num):num.clone().iand(this)},BN.prototype.ixor=function(num){this.sign=this.sign||num.sign;var a,b;this.length>num.length?(a=this,b=num):(a=num,b=this);for(var i=0;inum.length?this.clone().ixor(num):num.clone().ixor(this)},BN.prototype.setn=function(bit,val){assert("number"==typeof bit&&bit>=0);for(var off=bit/26|0,wbit=bit%26;this.length<=off;)this.words[this.length++]=0;return this.words[off]=val?this.words[off]|1<num.length?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>>26}for(;0!==carry&&i>>26}if(this.length=a.length,0!==carry)this.words[this.length]=carry,this.length++;else if(a!==this)for(;inum.length?this.clone().iadd(num):num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.sign){num.sign=!1;var r=this.iadd(num);return num.sign=!0,r._normSign()}if(this.sign)return this.sign=!1,this.iadd(num),this.sign=!0,this._normSign();var cmp=this.cmp(num);if(0===cmp)return this.sign=!1,this.length=1,this.words[0]=0,this;var a,b;cmp>0?(a=this,b=num):(a=num,b=this);for(var carry=0,i=0;i>26,this.words[i]=67108863&r}for(;0!==carry&&i>26,this.words[i]=67108863&r}if(0===carry&&i>>26,rword=67108863&carry,maxJ=Math.min(k,num.length-1),j=Math.max(0,k-this.length+1);j<=maxJ;j++){var i=k-j,a=0|this.words[i],b=0|num.words[j],r=a*b,lo=67108863&r;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=67108863&lo,ncarry=ncarry+(lo>>>26)|0}out.words[k]=rword,carry=ncarry}return 0!==carry?out.words[k]=carry:out.length--,out.strip()},BN.prototype._bigMulTo=function(num,out){out.sign=num.sign!==this.sign,out.length=this.length+num.length;for(var carry=0,hncarry=0,k=0;k>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}return 0!==carry?out.words[k]=carry:out.length--,out.strip()},BN.prototype.mulTo=function(num,out){return this.length+num.length<63?this._smallMulTo(num,out):this._bigMulTo(num,out)},BN.prototype.mul=function(num){var out=new BN(null);return out.words=new Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.imul=function(num){if(0===this.cmpn(0)||0===num.cmpn(0))return this.words[0]=0,this.length=1,this;var tlen=this.length,nlen=num.length;this.sign=num.sign!==this.sign,this.length=this.length+num.length,this.words[this.length-1]=0;for(var k=this.length-2;k>=0;k--){for(var carry=0,rword=0,maxJ=Math.min(k,nlen-1),j=Math.max(0,k-tlen+1);j<=maxJ;j++){var i=k-j,a=this.words[i],b=num.words[j],r=a*b,lo=67108863&r;carry+=r/67108864|0,lo+=rword,rword=67108863&lo,carry+=lo>>>26}this.words[k]=rword,this.words[k+1]+=carry,carry=0}for(var carry=0,i=1;i>>26}return this.strip()},BN.prototype.imuln=function(num){assert("number"==typeof num);for(var carry=0,i=0;i>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i]=67108863&lo}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.mul(this)},BN.prototype.ishln=function(bits){assert("number"==typeof bits&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r;if(0!==r){for(var carry=0,i=0;i>>26-r}carry&&(this.words[i]=carry,this.length++)}if(0!==s){for(var i=this.length-1;i>=0;i--)this.words[i+s]=this.words[i];for(var i=0;i=0);var h;h=hint?(hint-hint%26)/26:0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<s){this.length-=s;for(var i=0;i=0&&(0!==carry||i>=h);i--){var word=this.words[i];this.words[i]=carry<<26-r|word>>>r,carry=word&mask}return maskedWords&&0!==carry&&(maskedWords.words[maskedWords.length++]=carry),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.testn=function(bit){assert("number"==typeof bit&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<=0);var r=bits%26,s=(bits-r)/26;if(assert(!this.sign,"imaskn works only with positive numbers"),0!==r&&s++,this.length=Math.min(s,this.length),0!==r){var mask=67108863^67108863>>>r<=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},BN.prototype.isubn=function(num){if(assert("number"==typeof num),num<0)return this.iaddn(-num);if(this.sign)return this.sign=!1,this.iaddn(num),this.sign=!0,this;this.words[0]-=num;for(var i=0;i>26)-(right/67108864|0),this.words[i+shift]=67108863&w}for(;i>26,this.words[i+shift]=67108863&w}if(0===carry)return this.strip();assert(-1===carry),carry=0;for(var i=0;i>26,this.words[i]=67108863&w}return this.sign=!0,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1];0!==(shift=26-this._countBits(bhi))&&(b=b.shln(shift),a.ishln(shift),bhi=b.words[b.length-1]);var q,m=a.length-b.length;if("mod"!==mode){q=new BN(null),q.length=m+1,q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=67108864*a.words[b.length+j]+a.words[b.length+j-1];for(qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);a.sign;)qj--,a.sign=!1,a._ishlnsubmul(b,1,j),0!==a.cmpn(0)&&(a.sign=!a.sign);q&&(q.words[j]=qj)}return q&&q.strip(),a.strip(),"div"!==mode&&0!==shift&&a.ishrn(shift),{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode){if(assert(0!==num.cmpn(0)),this.sign&&!num.sign){var div,mod,res=this.neg().divmod(num,mode);return"mod"!==mode&&(div=res.div.neg()),"div"!==mode&&(mod=0===res.mod.cmpn(0)?res.mod:num.sub(res.mod)),{div:div,mod:mod}}if(!this.sign&&num.sign){var div,res=this.divmod(num.neg(),mode);return"mod"!==mode&&(div=res.div.neg()),{div:div,mod:res.mod}}return this.sign&&num.sign?this.neg().divmod(num.neg(),mode):num.length>this.length||this.cmp(num)<0?{div:new BN(0),mod:this}:1===num.length?"div"===mode?{div:this.divn(num.words[0]),mod:null}:"mod"===mode?{div:null,mod:new BN(this.modn(num.words[0]))}:{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}:this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div").div},BN.prototype.mod=function(num){return this.divmod(num,"mod").mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(0===dm.mod.cmpn(0))return dm.div;var mod=dm.div.sign?dm.mod.isub(num):dm.mod,half=num.shrn(1),r2=num.andln(1),cmp=mod.cmp(half);return cmp<0||1===r2&&0===cmp?dm.div:dm.div.sign?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);for(var p=(1<<26)%num,acc=0,i=this.length-1;i>=0;i--)acc=(p*acc+this.words[i])%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);for(var carry=0,i=this.length-1;i>=0;i--){var w=this.words[i]+67108864*carry;this.words[i]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(!p.sign),assert(0!==p.cmpn(0));var x=this,y=p.clone();x=x.sign?x.mod(p):x.clone();for(var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;x.isEven()&&y.isEven();)x.ishrn(1),y.ishrn(1),++g;for(var yp=y.clone(),xp=x.clone();0!==x.cmpn(0);){for(;x.isEven();)x.ishrn(1),A.isEven()&&B.isEven()?(A.ishrn(1),B.ishrn(1)):(A.iadd(yp).ishrn(1),B.isub(xp).ishrn(1));for(;y.isEven();)y.ishrn(1),C.isEven()&&D.isEven()?(C.ishrn(1),D.ishrn(1)):(C.iadd(yp).ishrn(1),D.isub(xp).ishrn(1));x.cmp(y)>=0?(x.isub(y),A.isub(C),B.isub(D)):(y.isub(x),C.isub(A),D.isub(B))}return{a:C,b:D,gcd:y.ishln(g)}},BN.prototype._invmp=function(p){assert(!p.sign),assert(0!==p.cmpn(0));var a=this,b=p.clone();a=a.sign?a.mod(p):a.clone();for(var x1=new BN(1),x2=new BN(0),delta=b.clone();a.cmpn(1)>0&&b.cmpn(1)>0;){for(;a.isEven();)a.ishrn(1),x1.isEven()?x1.ishrn(1):x1.iadd(delta).ishrn(1);for(;b.isEven();)b.ishrn(1),x2.isEven()?x2.ishrn(1):x2.iadd(delta).ishrn(1);a.cmp(b)>=0?(a.isub(b),x1.isub(x2)):(b.isub(a),x2.isub(x1))}return 0===a.cmpn(1)?x1:x2},BN.prototype.gcd=function(num){if(0===this.cmpn(0))return num.clone();if(0===num.cmpn(0))return this.clone();var a=this.clone(),b=num.clone();a.sign=!1,b.sign=!1;for(var shift=0;a.isEven()&&b.isEven();shift++)a.ishrn(1),b.ishrn(1);for(;;){for(;a.isEven();)a.ishrn(1);for(;b.isEven();)b.ishrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(0===r||0===b.cmpn(1))break;a.isub(b)}return b.ishln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.mod(num)},BN.prototype.isEven=function(){return 0==(1&this.words[0])},BN.prototype.isOdd=function(){return 1==(1&this.words[0])},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert("number"==typeof bit);var r=bit%26,s=(bit-r)/26,q=1<>>26,w&=67108863,this.words[i]=w}return 0!==carry&&(this.words[i]=carry,this.length++),this},BN.prototype.cmpn=function(num){var sign=num<0;if(sign&&(num=-num),this.sign&&!sign)return-1;if(!this.sign&&sign)return 1;num&=67108863,this.strip();var res;if(this.length>1)res=1;else{var w=this.words[0];res=w===num?0:wnum.length)return 1;if(this.length=0;i--){var a=this.words[i],b=num.words[i];if(a!==b){ab&&(res=1);break}}return res},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(!this.sign,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=new Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var rlen,r=num;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen0?r.isub(this.p):r.strip(),r},MPrime.prototype.split=function(input,out){input.ishrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function(input,output){for(var outLen=Math.min(input.length,9),i=0;i>>22,prev=next}input.words[i-10]=prev>>>22,input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;for(var hi,lo=0,i=0;i>>=26,num.words[i]=lo,carry=hi}return 0!==carry&&(num.words[num.length++]=carry),num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if("k256"===name)prime=new K256;else if("p224"===name)prime=new P224;else if("p192"===name)prime=new P192;else{if("p25519"!==name)throw new Error("Unknown prime "+name);prime=new P25519}return primes[name]=prime,prime},Red.prototype._verify1=function(a){assert(!a.sign,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert(!a.sign&&!b.sign,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.mod(this.m)._forceRed(this)},Red.prototype.neg=function(a){var r=a.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);return res.cmp(this.m)>=0&&res.isub(this.m),res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);return res.cmp(this.m)>=0&&res.isub(this.m),res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);return res.cmpn(0)<0&&res.iadd(this.m),res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);return res.cmpn(0)<0&&res.iadd(this.m),res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.shln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a)},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(0===a.cmpn(0))return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2==1),3===mod3){var pow=this.m.add(new BN(1)).ishrn(2),r=this.pow(a,pow);return r}for(var q=this.m.subn(1),s=0;0!==q.cmpn(0)&&0===q.andln(1);)s++,q.ishrn(1);assert(0!==q.cmpn(0));var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).ishrn(1),z=this.m.bitLength();for(z=new BN(2*z*z).toRed(this);0!==this.pow(z,lpow).cmp(nOne);)z.redIAdd(nOne);for(var c=this.pow(z,q),r=this.pow(a,q.addn(1).ishrn(1)),t=this.pow(a,q),m=s;0!==t.cmp(one);){for(var tmp=t,i=0;0!==tmp.cmp(one);i++)tmp=tmp.redSqr();assert(i=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.mul=function(a,b){if(0===a.cmpn(0)||0===b.cmpn(0))return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).ishrn(this.shift),res=u;return u.cmp(this.m)>=0?res=u.isub(this.m):u.cmpn(0)<0&&(res=u.iadd(this.m)),res._forceRed(this)},Mont.prototype.invm=function(a){return this.imod(a._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===module||module,void 0)},{}],233:[function(require,module,exports){module.exports={_from:"elliptic@^3.1.0",_id:"elliptic@3.1.0",_inBundle:!1,_integrity:"sha1-whaC73YnabVqdCAWCRBdoR1fYMw=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^3.1.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^3.1.0",saveSpec:null,fetchSpec:"^3.1.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz",_shasum:"c21682ef762769b56a74201609105da11d5f60cc",_spec:"elliptic@^3.1.0",_where:"/home/chris/dev/eth-lightwallet",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^2.0.3",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},version:"3.1.0"}},{}],234:[function(require,module,exports){module.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072, +d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},{}],235:[function(require,module,exports){(function(Buffer){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var ethUtil=require("ethereumjs-util"),fees=require("ethereum-common/params.json"),BN=ethUtil.BN,N_DIV_2=new BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),Transaction=function(){function Transaction(data){_classCallCheck(this,Transaction),data=data||{};var fields=[{name:"nonce",length:32,allowLess:!0,default:new Buffer([])},{name:"gasPrice",length:32,allowLess:!0,default:new Buffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new Buffer([])},{name:"to",allowZero:!0,length:20,default:new Buffer([])},{name:"value",length:32,allowLess:!0,default:new Buffer([])},{name:"data",alias:"input",allowZero:!0,default:new Buffer([])},{name:"v",allowZero:!0,default:new Buffer([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])}];ethUtil.defineProperties(this,fields,data),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var sigV=ethUtil.bufferToInt(this.v),chainId=Math.floor((sigV-35)/2);chainId<0&&(chainId=0),this._chainId=chainId||data.chainId||0,this._homestead=!0}return Transaction.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},Transaction.prototype.hash=function(includeSignature){void 0===includeSignature&&(includeSignature=!0);var items=void 0;if(includeSignature)items=this.raw;else if(this._chainId>0){var raw=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,items=this.raw,this.raw=raw}else items=this.raw.slice(0,6);return ethUtil.rlphash(items)},Transaction.prototype.getChainId=function(){return this._chainId},Transaction.prototype.getSenderAddress=function(){if(this._from)return this._from;var pubkey=this.getSenderPublicKey();return this._from=ethUtil.publicToAddress(pubkey),this._from},Transaction.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},Transaction.prototype.verifySignature=function(){var msgHash=this.hash(!1);if(this._homestead&&1===new BN(this.s).cmp(N_DIV_2))return!1;try{var v=ethUtil.bufferToInt(this.v);this._chainId>0&&(v-=2*this._chainId+8),this._senderPubKey=ethUtil.ecrecover(msgHash,v,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},Transaction.prototype.sign=function(privateKey){var msgHash=this.hash(!1),sig=ethUtil.ecsign(msgHash,privateKey);this._chainId>0&&(sig.v+=2*this._chainId+8),Object.assign(this,sig)},Transaction.prototype.getDataFee=function(){for(var data=this.raw[5],cost=new BN(0),i=0;i0&&errors.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===stringError||!1===stringError?0===errors.length:errors.join(" ")},Transaction}();module.exports=Transaction}).call(this,require("buffer").Buffer)},{buffer:149,"ethereum-common/params.json":234,"ethereumjs-util":236}],236:[function(require,module,exports){(function(Buffer){"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return void 0===obj?"undefined":_typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":void 0===obj?"undefined":_typeof2(obj)},createKeccakHash=require("keccak"),secp256k1=require("secp256k1"),assert=require("assert"),rlp=require("rlp"),BN=require("bn.js"),createHash=require("create-hash");Object.assign(exports,require("ethjs-util")),exports.MAX_INTEGER=new BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),exports.TWO_POW256=new BN("10000000000000000000000000000000000000000000000000000000000000000",16),exports.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",exports.SHA3_NULL=Buffer.from(exports.SHA3_NULL_S,"hex"),exports.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",exports.SHA3_RLP_ARRAY=Buffer.from(exports.SHA3_RLP_ARRAY_S,"hex"),exports.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",exports.SHA3_RLP=Buffer.from(exports.SHA3_RLP_S,"hex"),exports.BN=BN,exports.rlp=rlp,exports.secp256k1=secp256k1,exports.zeros=function(bytes){return Buffer.allocUnsafe(bytes).fill(0)},exports.setLengthLeft=exports.setLength=function(msg,length,right){var buf=exports.zeros(length);return msg=exports.toBuffer(msg),right?msg.length0&&"0"===first.toString();)a=a.slice(1),first=a[0];return a},exports.toBuffer=function(v){if(!Buffer.isBuffer(v))if(Array.isArray(v))v=Buffer.from(v);else if("string"==typeof v)v=exports.isHexString(v)?Buffer.from(exports.padToEven(exports.stripHexPrefix(v)),"hex"):Buffer.from(v);else if("number"==typeof v)v=exports.intToBuffer(v);else if(null===v||void 0===v)v=Buffer.allocUnsafe(0);else{if(!v.toArray)throw new Error("invalid type");v=Buffer.from(v.toArray())}return v},exports.bufferToInt=function(buf){return new BN(exports.toBuffer(buf)).toNumber()},exports.bufferToHex=function(buf){return buf=exports.toBuffer(buf),"0x"+buf.toString("hex")},exports.fromSigned=function(num){return new BN(num).fromTwos(256)},exports.toUnsigned=function(num){return Buffer.from(num.toTwos(256).toArray())},exports.sha3=function(a,bits){return a=exports.toBuffer(a),bits||(bits=256),createKeccakHash("keccak"+bits).update(a).digest()},exports.sha256=function(a){return a=exports.toBuffer(a),createHash("sha256").update(a).digest()},exports.ripemd160=function(a,padded){a=exports.toBuffer(a);var hash=createHash("rmd160").update(a).digest();return!0===padded?exports.setLength(hash,32):hash},exports.rlphash=function(a){return exports.sha3(rlp.encode(a))},exports.isValidPrivate=function(privateKey){return secp256k1.privateKeyVerify(privateKey)},exports.isValidPublic=function(publicKey,sanitize){return 64===publicKey.length?secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]),publicKey])):!!sanitize&&secp256k1.publicKeyVerify(publicKey)},exports.pubToAddress=exports.publicToAddress=function(pubKey,sanitize){return pubKey=exports.toBuffer(pubKey),sanitize&&64!==pubKey.length&&(pubKey=secp256k1.publicKeyConvert(pubKey,!1).slice(1)),assert(64===pubKey.length),exports.sha3(pubKey).slice(-20)};var privateToPublic=exports.privateToPublic=function(privateKey){return privateKey=exports.toBuffer(privateKey),secp256k1.publicKeyCreate(privateKey,!1).slice(1)};exports.importPublic=function(publicKey){return publicKey=exports.toBuffer(publicKey),64!==publicKey.length&&(publicKey=secp256k1.publicKeyConvert(publicKey,!1).slice(1)),publicKey},exports.ecsign=function(msgHash,privateKey){var sig=secp256k1.sign(msgHash,privateKey),ret={};return ret.r=sig.signature.slice(0,32),ret.s=sig.signature.slice(32,64),ret.v=sig.recovery+27,ret},exports.hashPersonalMessage=function(message){var prefix=exports.toBuffer("Ethereum Signed Message:\n"+message.length.toString());return exports.sha3(Buffer.concat([prefix,message]))},exports.ecrecover=function(msgHash,v,r,s){var signature=Buffer.concat([exports.setLength(r,32),exports.setLength(s,32)],64),recovery=v-27;if(0!==recovery&&1!==recovery)throw new Error("Invalid signature v value");var senderPubKey=secp256k1.recover(msgHash,signature,recovery);return secp256k1.publicKeyConvert(senderPubKey,!1).slice(1)},exports.toRpcSig=function(v,r,s){if(27!==v&&28!==v)throw new Error("Invalid recovery id");return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r,32),exports.setLengthLeft(s,32),exports.toBuffer(v-27)]))},exports.fromRpcSig=function(sig){if(sig=exports.toBuffer(sig),65!==sig.length)throw new Error("Invalid signature length");var v=sig[64];return v<27&&(v+=27),{v:v,r:sig.slice(0,32),s:sig.slice(32,64)}},exports.privateToAddress=function(privateKey){return exports.publicToAddress(privateToPublic(privateKey))},exports.isValidAddress=function(address){return/^0x[0-9a-fA-F]{40}$/i.test(address)},exports.toChecksumAddress=function(address){address=exports.stripHexPrefix(address).toLowerCase();for(var hash=exports.sha3(address).toString("hex"),ret="0x",i=0;i=8?ret+=address[i].toUpperCase():ret+=address[i];return ret},exports.isValidChecksumAddress=function(address){return exports.isValidAddress(address)&&exports.toChecksumAddress(address)===address},exports.generateAddress=function(from,nonce){return from=exports.toBuffer(from),nonce=new BN(nonce),nonce=nonce.isZero()?null:Buffer.from(nonce.toArray()),exports.rlphash([from,nonce]).slice(-20)},exports.isPrecompiled=function(address){var a=exports.unpad(address);return 1===a.length&&a[0]>0&&a[0]<5},exports.addHexPrefix=function(str){return"string"!=typeof str?str:exports.isHexPrefixed(str)?str:"0x"+str},exports.isValidSignature=function(v,r,s,homestead){var SECP256K1_N_DIV_2=new BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),SECP256K1_N=new BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===r.length&&32===s.length&&((27===v||28===v)&&(r=new BN(r),s=new BN(s),!(r.isZero()||r.gt(SECP256K1_N)||s.isZero()||s.gt(SECP256K1_N))&&(!1!==homestead||1!==new BN(s).cmp(SECP256K1_N_DIV_2))))},exports.baToJSON=function(ba){if(Buffer.isBuffer(ba))return"0x"+ba.toString("hex");if(ba instanceof Array){for(var array=[],i=0;i=v.length,"The field "+field.name+" must not have more "+field.length+" bytes")):field.allowZero&&0===v.length||!field.length||assert(field.length===v.length,"The field "+field.name+" must have byte length of "+field.length),self.raw[i]=v}self._fields.push(field.name),Object.defineProperty(self,field.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),field.default&&(self[field.name]=field.default),field.alias&&Object.defineProperty(self,field.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})}),data)if("string"==typeof data&&(data=Buffer.from(exports.stripHexPrefix(data),"hex")),Buffer.isBuffer(data)&&(data=rlp.decode(data)),Array.isArray(data)){if(data.length>self._fields.length)throw new Error("wrong number of fields in data");data.forEach(function(d,i){self[self._fields[i]]=exports.toBuffer(d)})}else{if("object"!==(void 0===data?"undefined":_typeof(data)))throw new Error("invalid data");var keys=Object.keys(data);fields.forEach(function(field){-1!==keys.indexOf(field.name)&&(self[field.name]=data[field.name]),-1!==keys.indexOf(field.alias)&&(self[field.alias]=data[field.alias])})}}}).call(this,require("buffer").Buffer)},{assert:21,"bn.js":99,buffer:149,"create-hash":169,"ethjs-util":237,keccak:261,rlp:312,secp256k1:315}],237:[function(require,module,exports){(function(Buffer){"use strict";function padToEven(value){var a=value;if("string"!=typeof a)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+(void 0===a?"undefined":_typeof(a))+", while padToEven.");return a.length%2&&(a="0"+a),a}function intToHex(i){return"0x"+padToEven(i.toString(16))}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex.slice(2),"hex")}function getBinarySize(str){if("string"!=typeof str)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+(void 0===str?"undefined":_typeof(str))+"'.");return Buffer.byteLength(str,"utf8")}function arrayContainsArray(superset,subset,some){if(!0!==Array.isArray(superset))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+(void 0===superset?"undefined":_typeof(superset))+"'");if(!0!==Array.isArray(subset))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+(void 0===subset?"undefined":_typeof(subset))+"'");return subset[Boolean(some)&&"some"||"every"](function(value){return superset.indexOf(value)>=0})}function toUtf8(hex){return new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g,"")),"hex").toString("utf8")}function toAscii(hex){var str="",i=0,l=hex.length;for("0x"===hex.substring(0,2)&&(i=2);i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],239:[function(require,module,exports){"use strict";function EVP_BytesToKey(password,salt,keyBits,ivLen){if(Buffer.isBuffer(password)||(password=Buffer.from(password,"binary")),salt&&(Buffer.isBuffer(salt)||(salt=Buffer.from(salt,"binary")),8!==salt.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var keyLen=keyBits/8,key=Buffer.alloc(keyLen),iv=Buffer.alloc(ivLen||0),tmp=Buffer.alloc(0);keyLen>0||ivLen>0;){var hash=new MD5;hash.update(tmp),hash.update(password),salt&&hash.update(salt),tmp=hash.digest();var used=0;if(keyLen>0){var keyStart=key.length-keyLen;used=Math.min(keyLen,tmp.length),tmp.copy(key,keyStart,0,used),keyLen-=used}if(used0){var ivStart=iv.length-ivLen,length=Math.min(ivLen,tmp.length-used);tmp.copy(iv,ivStart,used,used+length),ivLen-=length}}return tmp.fill(0),{key:key,iv:iv}}var Buffer=require("safe-buffer").Buffer,MD5=require("md5.js");module.exports=EVP_BytesToKey},{"md5.js":269,"safe-buffer":313}],240:[function(require,module,exports){(function(Buffer){"use strict";function HashBase(blockSize){Transform.call(this),this._block=new Buffer(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var Transform=require("stream").Transform;require("inherits")(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{"buffer"!==encoding&&(chunk=new Buffer(chunk,encoding)),this.update(chunk)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this._digest())}catch(err){error=err}callback(error)},HashBase.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&"string"!=typeof data)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");Buffer.isBuffer(data)||(data=new Buffer(data,encoding||"binary"));for(var block=this._block,offset=0;this._blockOffset+data.length-offset>=this._blockSize;){for(var i=this._blockOffset;i0;++j)this._length[j]+=carry,(carry=this._length[j]/4294967296|0)>0&&(this._length[j]-=4294967296*carry);return this},HashBase.prototype._update=function(data){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var digest=this._digest();return void 0!==encoding&&(digest=digest.toString(encoding)),digest},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase}).call(this,require("buffer").Buffer)},{buffer:149,inherits:257,stream:345}],241:[function(require,module,exports){"use strict";var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.sha384=hash.sha.sha384,hash.sha512=hash.sha.sha512,hash.ripemd160=hash.ripemd.ripemd160},{"./hash/common":242,"./hash/hmac":243,"./hash/ripemd":244,"./hash/sha":245,"./hash/utils":252}],242:[function(require,module,exports){"use strict";function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var utils=require("./utils"),assert=require("minimalistic-assert");exports.BlockHash=BlockHash,BlockHash.prototype.update=function(msg,enc){if(msg=utils.toArray(msg,enc),this.pending?this.pending=this.pending.concat(msg):this.pending=msg,this.pendingTotal+=msg.length,this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length),0===this.pending.length&&(this.pending=null),msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i>>24&255,res[i++]=len>>>16&255,res[i++]=len>>>8&255,res[i++]=255&len}else for(res[i++]=255&len,res[i++]=len>>>8&255,res[i++]=len>>>16&255,res[i++]=len>>>24&255,res[i++]=0,res[i++]=0,res[i++]=0,res[i++]=0,t=8;tthis.blockSize&&(key=(new this.Hash).update(key).digest()),assert(key.length<=this.blockSize);for(var i=key.length;i>>3}function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}var utils=require("../utils"),rotr32=utils.rotr32;exports.ft_1=ft_1,exports.ch32=ch32,exports.maj32=maj32,exports.p32=p32,exports.s0_256=s0_256,exports.s1_256=s1_256,exports.g0_256=g0_256,exports.g1_256=g1_256},{"../utils":252}],252:[function(require,module,exports){"use strict";function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if("string"==typeof msg)if(enc){if("hex"===enc)for(msg=msg.replace(/[^a-z0-9]+/gi,""),msg.length%2!=0&&(msg="0"+msg),i=0;i>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}else for(i=0;i>>24|w>>>8&65280|w<<8&16711680|(255&w)<<24)>>>0}function toHex32(msg,endian){for(var res="",i=0;i>>0}return res}function split32(msg,endian){for(var res=new Array(4*msg.length),i=0,k=0;i>>24,res[k+1]=m>>>16&255,res[k+2]=m>>>8&255,res[k+3]=255&m):(res[k+3]=m>>>24,res[k+2]=m>>>16&255,res[k+1]=m>>>8&255,res[k]=255&m)}return res}function rotr32(w,b){return w>>>b|w<<32-b}function rotl32(w,b){return w<>>32-b}function sum32(a,b){return a+b>>>0}function sum32_3(a,b,c){return a+b+c>>>0}function sum32_4(a,b,c,d){return a+b+c+d>>>0}function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}function sum64(buf,pos,ah,al){var bh=buf[pos],bl=buf[pos+1],lo=al+bl>>>0,hi=(lo>>0,buf[pos+1]=lo}function sum64_hi(ah,al,bh,bl){return(al+bl>>>0>>0}function sum64_lo(ah,al,bh,bl){return al+bl>>>0}function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0,lo=al;return lo=lo+bl>>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0}function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){return al+bl+cl+dl>>>0}function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0,lo=al;return lo=lo+bl>>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0,carry+=lo>>0}function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){return al+bl+cl+dl+el>>>0}function rotr64_hi(ah,al,num){return(al<<32-num|ah>>>num)>>>0}function rotr64_lo(ah,al,num){return(ah<<32-num|al>>>num)>>>0}function shr64_hi(ah,al,num){return ah>>>num}function shr64_lo(ah,al,num){return(ah<<32-num|al>>>num)>>>0}var assert=require("minimalistic-assert"),inherits=require("inherits");exports.inherits=inherits,exports.toArray=toArray,exports.toHex=toHex,exports.htonl=htonl,exports.toHex32=toHex32,exports.zero2=zero2,exports.zero8=zero8,exports.join32=join32,exports.split32=split32,exports.rotr32=rotr32,exports.rotl32=rotl32,exports.sum32=sum32,exports.sum32_3=sum32_3,exports.sum32_4=sum32_4,exports.sum32_5=sum32_5,exports.sum64=sum64,exports.sum64_hi=sum64_hi,exports.sum64_lo=sum64_lo,exports.sum64_4_hi=sum64_4_hi,exports.sum64_4_lo=sum64_4_lo,exports.sum64_5_hi=sum64_5_hi,exports.sum64_5_lo=sum64_5_lo,exports.rotr64_hi=rotr64_hi,exports.rotr64_lo=rotr64_lo,exports.shr64_hi=shr64_hi,exports.shr64_lo=shr64_lo},{inherits:253,"minimalistic-assert":272}],253:[function(require,module,exports){"use strict";"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],254:[function(require,module,exports){"use strict";function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash,this.predResist=!!options.predResist,this.outLen=this.hash.outSize,this.minEntropy=options.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex"),nonce=utils.toArray(options.nonce,options.nonceEnc||"hex"),pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(entropy,nonce,pers)}var hash=require("hash.js"),utils=require("minimalistic-crypto-utils"),assert=require("minimalistic-assert");module.exports=HmacDRBG,HmacDRBG.prototype._init=function(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(entropy.concat(add||[])),this._reseed=1},HmacDRBG.prototype.generate=function(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof enc&&(addEnc=add,add=enc,enc=null),add&&(add=utils.toArray(add,addEnc||"hex"),this._update(add));for(var temp=[];temp.length>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],256:[function(require,module,exports){"use strict";var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i>>31),hi=hi4^(hi1<<1|lo1>>>31),t1slo0=s[0]^lo,t1shi0=s[1]^hi,t1slo5=s[10]^lo,t1shi5=s[11]^hi,t1slo10=s[20]^lo,t1shi10=s[21]^hi,t1slo15=s[30]^lo,t1shi15=s[31]^hi,t1slo20=s[40]^lo,t1shi20=s[41]^hi;lo=lo0^(lo2<<1|hi2>>>31),hi=hi0^(hi2<<1|lo2>>>31);var t1slo1=s[2]^lo,t1shi1=s[3]^hi,t1slo6=s[12]^lo,t1shi6=s[13]^hi,t1slo11=s[22]^lo,t1shi11=s[23]^hi,t1slo16=s[32]^lo,t1shi16=s[33]^hi,t1slo21=s[42]^lo,t1shi21=s[43]^hi;lo=lo1^(lo3<<1|hi3>>>31),hi=hi1^(hi3<<1|lo3>>>31);var t1slo2=s[4]^lo,t1shi2=s[5]^hi,t1slo7=s[14]^lo,t1shi7=s[15]^hi,t1slo12=s[24]^lo,t1shi12=s[25]^hi,t1slo17=s[34]^lo,t1shi17=s[35]^hi,t1slo22=s[44]^lo,t1shi22=s[45]^hi;lo=lo2^(lo4<<1|hi4>>>31),hi=hi2^(hi4<<1|lo4>>>31);var t1slo3=s[6]^lo,t1shi3=s[7]^hi,t1slo8=s[16]^lo,t1shi8=s[17]^hi,t1slo13=s[26]^lo,t1shi13=s[27]^hi,t1slo18=s[36]^lo,t1shi18=s[37]^hi,t1slo23=s[46]^lo,t1shi23=s[47]^hi;lo=lo3^(lo0<<1|hi0>>>31),hi=hi3^(hi0<<1|lo0>>>31);var t1slo4=s[8]^lo,t1shi4=s[9]^hi,t1slo9=s[18]^lo,t1shi9=s[19]^hi,t1slo14=s[28]^lo,t1shi14=s[29]^hi,t1slo19=s[38]^lo,t1shi19=s[39]^hi,t1slo24=s[48]^lo,t1shi24=s[49]^hi,t2slo0=t1slo0,t2shi0=t1shi0,t2slo16=t1shi5<<4|t1slo5>>>28,t2shi16=t1slo5<<4|t1shi5>>>28,t2slo7=t1slo10<<3|t1shi10>>>29,t2shi7=t1shi10<<3|t1slo10>>>29,t2slo23=t1shi15<<9|t1slo15>>>23,t2shi23=t1slo15<<9|t1shi15>>>23,t2slo14=t1slo20<<18|t1shi20>>>14,t2shi14=t1shi20<<18|t1slo20>>>14,t2slo10=t1slo1<<1|t1shi1>>>31,t2shi10=t1shi1<<1|t1slo1>>>31,t2slo1=t1shi6<<12|t1slo6>>>20,t2shi1=t1slo6<<12|t1shi6>>>20,t2slo17=t1slo11<<10|t1shi11>>>22,t2shi17=t1shi11<<10|t1slo11>>>22,t2slo8=t1shi16<<13|t1slo16>>>19,t2shi8=t1slo16<<13|t1shi16>>>19,t2slo24=t1slo21<<2|t1shi21>>>30,t2shi24=t1shi21<<2|t1slo21>>>30,t2slo20=t1shi2<<30|t1slo2>>>2,t2shi20=t1slo2<<30|t1shi2>>>2,t2slo11=t1slo7<<6|t1shi7>>>26,t2shi11=t1shi7<<6|t1slo7>>>26,t2slo2=t1shi12<<11|t1slo12>>>21,t2shi2=t1slo12<<11|t1shi12>>>21,t2slo18=t1slo17<<15|t1shi17>>>17,t2shi18=t1shi17<<15|t1slo17>>>17,t2slo9=t1shi22<<29|t1slo22>>>3,t2shi9=t1slo22<<29|t1shi22>>>3,t2slo5=t1slo3<<28|t1shi3>>>4,t2shi5=t1shi3<<28|t1slo3>>>4,t2slo21=t1shi8<<23|t1slo8>>>9,t2shi21=t1slo8<<23|t1shi8>>>9,t2slo12=t1slo13<<25|t1shi13>>>7,t2shi12=t1shi13<<25|t1slo13>>>7,t2slo3=t1slo18<<21|t1shi18>>>11,t2shi3=t1shi18<<21|t1slo18>>>11,t2slo19=t1shi23<<24|t1slo23>>>8,t2shi19=t1slo23<<24|t1shi23>>>8,t2slo15=t1slo4<<27|t1shi4>>>5,t2shi15=t1shi4<<27|t1slo4>>>5,t2slo6=t1slo9<<20|t1shi9>>>12,t2shi6=t1shi9<<20|t1slo9>>>12,t2slo22=t1shi14<<7|t1slo14>>>25,t2shi22=t1slo14<<7|t1shi14>>>25,t2slo13=t1slo19<<8|t1shi19>>>24,t2shi13=t1shi19<<8|t1slo19>>>24,t2slo4=t1slo24<<14|t1shi24>>>18,t2shi4=t1shi24<<14|t1slo24>>>18;s[0]=t2slo0^~t2slo1&t2slo2,s[1]=t2shi0^~t2shi1&t2shi2,s[10]=t2slo5^~t2slo6&t2slo7,s[11]=t2shi5^~t2shi6&t2shi7,s[20]=t2slo10^~t2slo11&t2slo12,s[21]=t2shi10^~t2shi11&t2shi12,s[30]=t2slo15^~t2slo16&t2slo17,s[31]=t2shi15^~t2shi16&t2shi17,s[40]=t2slo20^~t2slo21&t2slo22,s[41]=t2shi20^~t2shi21&t2shi22,s[2]=t2slo1^~t2slo2&t2slo3,s[3]=t2shi1^~t2shi2&t2shi3,s[12]=t2slo6^~t2slo7&t2slo8,s[13]=t2shi6^~t2shi7&t2shi8,s[22]=t2slo11^~t2slo12&t2slo13,s[23]=t2shi11^~t2shi12&t2shi13,s[32]=t2slo16^~t2slo17&t2slo18,s[33]=t2shi16^~t2shi17&t2shi18,s[42]=t2slo21^~t2slo22&t2slo23,s[43]=t2shi21^~t2shi22&t2shi23,s[4]=t2slo2^~t2slo3&t2slo4,s[5]=t2shi2^~t2shi3&t2shi4,s[14]=t2slo7^~t2slo8&t2slo9,s[15]=t2shi7^~t2shi8&t2shi9,s[24]=t2slo12^~t2slo13&t2slo14,s[25]=t2shi12^~t2shi13&t2shi14,s[34]=t2slo17^~t2slo18&t2slo19,s[35]=t2shi17^~t2shi18&t2shi19,s[44]=t2slo22^~t2slo23&t2slo24,s[45]=t2shi22^~t2shi23&t2shi24,s[6]=t2slo3^~t2slo4&t2slo0,s[7]=t2shi3^~t2shi4&t2shi0,s[16]=t2slo8^~t2slo9&t2slo5,s[17]=t2shi8^~t2shi9&t2shi5,s[26]=t2slo13^~t2slo14&t2slo10,s[27]=t2shi13^~t2shi14&t2shi10,s[36]=t2slo18^~t2slo19&t2slo15,s[37]=t2shi18^~t2shi19&t2shi15,s[46]=t2slo23^~t2slo24&t2slo20,s[47]=t2shi23^~t2shi24&t2shi20,s[8]=t2slo4^~t2slo0&t2slo1,s[9]=t2shi4^~t2shi0&t2shi1,s[18]=t2slo9^~t2slo5&t2slo6,s[19]=t2shi9^~t2shi5&t2shi6,s[28]=t2slo14^~t2slo10&t2slo11,s[29]=t2shi14^~t2shi10&t2shi11,s[38]=t2slo19^~t2slo15&t2slo16,s[39]=t2shi19^~t2shi15&t2shi16,s[48]=t2slo24^~t2slo20&t2slo21,s[49]=t2shi24^~t2shi20&t2shi21,s[0]^=P1600_ROUND_CONSTANTS[2*round],s[1]^=P1600_ROUND_CONSTANTS[2*round+1]}}},{}],266:[function(require,module,exports){"use strict";function Keccak(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}var Buffer=require("safe-buffer").Buffer,keccakState=require("./keccak-state-unroll") +;Keccak.prototype.initialize=function(rate,capacity){for(var i=0;i<50;++i)this.state[i]=0;this.blockSize=rate/8,this.count=0,this.squeezing=!1},Keccak.prototype.absorb=function(data){for(var i=0;i>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return output},Keccak.prototype.copy=function(dest){for(var i=0;i<50;++i)dest.state[i]=this.state[i];dest.blockSize=this.blockSize,dest.count=this.count,dest.squeezing=this.squeezing},module.exports=Keccak},{"./keccak-state-unroll":265,"safe-buffer":313}],267:[function(require,module,exports){arguments[4][253][0].apply(exports,arguments)},{dup:253}],268:[function(require,module,exports){(function(global){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};(function(){function addMapEntry(map,pair){return map.set(pair[0],pair[1]),map}function addSetEntry(set,value){return set.add(value),set}function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,setter,iteratee,accumulator){for(var index=-1,length=null==array?0:array.length;++index-1}function arrayIncludesWith(array,value,comparator){for(var index=-1,length=null==array?0:array.length;++index-1;);return index}function charsEndIndex(strSymbols,chrSymbols){for(var index=strSymbols.length;index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1;);return index}function countHolders(array,placeholder){for(var length=array.length,result=0;length--;)array[length]===placeholder&&++result;return result}function escapeStringChar(chr){return"\\"+stringEscapes[chr]}function getValue(object,key){return null==object?undefined:object[key]}function hasUnicode(string){return reHasUnicode.test(string)}function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}function iteratorToArray(iterator){for(var data,result=[];!(data=iterator.next()).done;)result.push(data.value);return result}function mapToArray(map){var index=-1,result=Array(map.size);return map.forEach(function(value,key){result[++index]=[key,value]}),result}function overArg(func,transform){return function(arg){return func(transform(arg))}}function replaceHolders(array,placeholder){for(var index=-1,length=array.length,resIndex=0,result=[];++index>>1,wrapFlags=[["ary",WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]],argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g,reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source),reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source),reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/,reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /,reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,reEscapeChar=/\\(\\)?/g,reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,reFlags=/\w*$/,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsHostCtor=/^\[object .+?Constructor\]$/,reIsOctal=/^0o[0-7]+$/i,reIsUint=/^(?:0|[1-9]\d*)$/,reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,reNoMatch=/($^)/,reUnescapedString=/['\n\r\u2028\u2029\\]/g,rsComboRange="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",rsBreakRange="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsLower="[a-z\\xdf-\\xf6\\xf8-\\xff]",rsMisc="[^\\ud800-\\udfff"+rsBreakRange+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="[A-Z\\xc0-\\xd6\\xd8-\\xde]",rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",reOptMod="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",rsOptJoin="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",rsRegional,rsSurrPair].join("|")+")[\\ufe0e\\ufe0f]?"+reOptMod+")*",rsSeq="[\\ufe0e\\ufe0f]?"+reOptMod+rsOptJoin,rsEmoji="(?:"+["[\\u2700-\\u27bf]",rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+["[^\\ud800-\\udfff]"+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,"[\\ud800-\\udfff]"].join("|")+")",reApos=RegExp("['’]","g"),reComboMark=RegExp(rsCombo,"g"),reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g"),reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[rsBreak,rsUpper,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+(?:['’](?:d|ll|m|re|s|t|ve))?",rsUpper+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",rsEmoji].join("|"),"g"),reHasUnicode=RegExp("[\\u200d\\ud800-\\udfff"+rsComboRange+"\\ufe0e\\ufe0f]"),reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,contextProps=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],templateCounter=-1,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"},htmlUnescapes={"&":"&","<":"<",">":">",""":'"',"'":"'"},stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},freeParseFloat=parseFloat,freeParseInt=parseInt,freeGlobal="object"==(void 0===global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),freeExports="object"==(void 0===exports?"undefined":_typeof(exports))&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==(void 0===module?"undefined":_typeof(module))&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,freeProcess=moduleExports&&freeGlobal.process,nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsArrayBuffer=nodeUtil&&nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,asciiSize=baseProperty("length"),deburrLetter=basePropertyOf(deburredLetters),escapeHtmlChar=basePropertyOf(htmlEscapes),unescapeHtmlChar=basePropertyOf(htmlUnescapes),_=function runInContext(context){function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper)return value;if(hasOwnProperty.call(value,"__wrapped__"))return wrapperClone(value)}return new LodashWrapper(value)}function baseLodash(){}function LodashWrapper(value,chainAll){this.__wrapped__=value,this.__actions__=[],this.__chain__=!!chainAll,this.__index__=0,this.__values__=undefined}function LazyWrapper(value){this.__wrapped__=value,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=MAX_ARRAY_LENGTH,this.__views__=[]}function lazyClone(){var result=new LazyWrapper(this.__wrapped__);return result.__actions__=copyArray(this.__actions__),result.__dir__=this.__dir__,result.__filtered__=this.__filtered__,result.__iteratees__=copyArray(this.__iteratees__),result.__takeCount__=this.__takeCount__,result.__views__=copyArray(this.__views__),result}function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1,result.__filtered__=!0}else result=this.clone(),result.__dir__*=-1;return result}function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length)return baseWrapperValue(array,this.__actions__);var result=[];outer:for(;length--&&resIndex-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?(++this.size,data.push([key,value])):data[index][1]=value,this}function MapCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index=lower?number:lower)),number}function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer&&(result=object?customizer(value,key,object,stack):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return copyArray(value,result)}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value))return cloneBuffer(value,isDeep);if(tag==objectTag||tag==argsTag||isFunc&&!object){if(result=isFlat||isFunc?{}:initCloneObject(value),!isDeep)return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=initCloneByTag(value,tag,baseClone,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result);var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys,props=isArr?undefined:keysFunc(value);return arrayEach(props||value,function(subValue,key){props&&(key=subValue,subValue=value[key]),assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))}),result}function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}function baseConformsTo(object,source,props){var length=props.length;if(null==object)return!length;for(object=Object(object);length--;){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value))return!1}return!0}function baseDelay(func,wait,args){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=!0,length=array.length,result=[],valuesLength=values.length;if(!length)return result;iteratee&&(values=arrayMap(values,baseUnary(iteratee))),comparator?(includes=arrayIncludesWith,isCommon=!1):values.length>=LARGE_ARRAY_SIZE&&(includes=cacheHas,isCommon=!1,values=new SetCache(values));outer:for(;++indexlength?0:length+start),end=end===undefined||end>length?length:toInteger(end),end<0&&(end+=length),end=start>end?0:toLength(end);start0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=castPath(path,object);for(var index=0,length=path.length;null!=object&&indexother}function baseHas(object,key){return null!=object&&hasOwnProperty.call(object,key)}function baseHasIn(object,key){return null!=object&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:for(;++index-1;)seen!==array&&splice.call(seen,fromIndex,1),splice.call(array,fromIndex,1);return array}function basePullAt(array,indexes){for(var length=array?indexes.length:0,lastIndex=length-1;length--;){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;isIndex(index)?splice.call(array,index,1):baseUnset(array,index)}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){for(var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);length--;)result[fromRight?length:++index]=start,start+=step;return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER)return result;do{n%2&&(result+=string),(n=nativeFloor(n/2))&&(string+=string)}while(n);return result}function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}function baseSample(collection){return arraySample(values(collection))}function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))}function baseSet(object,path,value,customizer){if(!isObject(object))return object;path=castPath(path,object);for(var index=-1,length=path.length,lastIndex=length-1,nested=object;null!=nested&&++indexlength?0:length+start),end=end>length?length:end,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index>>1,computed=array[mid];null!==computed&&!isSymbol(computed)&&(retHighest?computed<=value:computed=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set)return setToArray(set);isCommon=!1,includes=cacheHas,seen=new SetCache}else seen=iteratee?[]:result;outer:for(;++index=length?array:baseSlice(array,start,end)}function cloneBuffer(buffer,isDeep){if(isDeep)return buffer.slice();var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);return buffer.copy(result),result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);return new Uint8Array(result).set(new Uint8Array(arrayBuffer)),result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneMap(map,isDeep,cloneFunc){return arrayReduce(isDeep?cloneFunc(mapToArray(map),CLONE_DEEP_FLAG):mapToArray(map),addMapEntry,new map.constructor)}function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));return result.lastIndex=regexp.lastIndex,result}function cloneSet(set,isDeep,cloneFunc){return arrayReduce(isDeep?cloneFunc(setToArray(set),CLONE_DEEP_FLAG):setToArray(set),addSetEntry,new set.constructor)}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=null===value,valIsReflexive=value===value,valIsSymbol=isSymbol(value),othIsDefined=other!==undefined,othIsNull=null===other,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive)return 1;if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value=ordersLength)return result;return result*("desc"==orders[index]?-1:1)}}return object.index-other.index}function composeArgs(args,partials,holders,isCurried){for(var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;++leftIndex1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;for(customizer=assigner.length>3&&"function"==typeof customizer?(length--,customizer):undefined,guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?undefined:customizer,length=1),object=Object(object);++index-1?iterable[iteratee?collection[index]:index]:undefined}}function createFlow(fromRight){return flatRest(function(funcs){var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;for(fromRight&&funcs.reverse();index--;){var func=funcs[index];if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);if(prereq&&!wrapper&&"wrapper"==getFuncName(func))var wrapper=new LodashWrapper([],!0)}for(index=wrapper?index:length;++index1&&args.reverse(),isAry&&aryarrLength))return!1;var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=!0,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;for(stack.set(array,other),stack.set(other,array);++index1?"& ":"")+details[lastIndex],details=details.join(length>2?", ":" "),source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isIndex(value,length){return!!(length=null==length?MAX_SAFE_INTEGER:length)&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(undefined,arguments)}}function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;for(size=size===undefined?length:size;++index=this.__values__.length;return{done:done,value:done?undefined:this.__values__[this.__index__++]}}function wrapperToIterator(){return this}function wrapperPlant(value){for(var result,parent=this;parent instanceof baseLodash;){var clone=wrapperClone(parent);clone.__index__=0,clone.__values__=undefined,result?previous.__wrapped__=clone:result=clone;var previous=clone;parent=parent.__wrapped__}return previous.__wrapped__=value,result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;return this.__actions__.length&&(wrapped=new LazyWrapper(this)),wrapped=wrapped.reverse(),wrapped.__actions__.push({func:thru,args:[reverse],thisArg:undefined}),new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;return guard&&isIterateeCall(collection,predicate,guard)&&(predicate=undefined),func(collection,getIteratee(predicate,3))}function filter(collection,predicate){return(isArray(collection)?arrayFilter:baseFilter)(collection,getIteratee(predicate,3))}function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){return depth=depth===undefined?1:toInteger(depth),baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){return(isArray(collection)?arrayEach:baseEach)(collection,getIteratee(iteratee,3))}function forEachRight(collection,iteratee){return(isArray(collection)?arrayEachRight:baseEachRight)(collection,getIteratee(iteratee,3))}function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection),fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;return fromIndex<0&&(fromIndex=nativeMax(length+fromIndex,0)),isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}function map(collection,iteratee){return(isArray(collection)?arrayMap:baseMap)(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){return null==collection?[]:(isArray(iteratees)||(iteratees=null==iteratees?[]:[iteratees]),orders=guard?undefined:orders,isArray(orders)||(orders=null==orders?[]:[orders]),baseOrderBy(collection,iteratees,orders))}function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection,predicate){return(isArray(collection)?arrayFilter:baseFilter)(collection,negate(getIteratee(predicate,3)))}function sample(collection){return(isArray(collection)?arraySample:baseSample)(collection)}function sampleSize(collection,n,guard){return n=(guard?isIterateeCall(collection,n,guard):n===undefined)?1:toInteger(n),(isArray(collection)?arraySampleSize:baseSampleSize)(collection,n)}function shuffle(collection){return(isArray(collection)?arrayShuffle:baseShuffle)(collection)}function size(collection){if(null==collection)return 0;if(isArrayLike(collection))return isString(collection)?stringSize(collection):collection.length;var tag=getTag(collection);return tag==mapTag||tag==setTag?collection.size:baseKeys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;return guard&&isIterateeCall(collection,predicate,guard)&&(predicate=undefined),func(collection,getIteratee(predicate,3))}function after(n,func){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return n=toInteger(n),function(){if(--n<1)return func.apply(this,arguments)}}function ary(func,n,guard){return n=guard?undefined:n,n=func&&null==n?func.length:n,createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return n=toInteger(n),function(){return--n>0&&(result=func.apply(this,arguments)),n<=1&&(func=undefined),result}}function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);return result.placeholder=curry.placeholder,result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);return result.placeholder=curryRight.placeholder,result}function debounce(func,wait,options){function invokeFunc(time){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=undefined,lastInvokeTime=time,result=func.apply(thisArg,args)}function leadingEdge(time){return lastInvokeTime=time,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,result=wait-timeSinceLastCall;return maxing?nativeMin(result,maxWait-timeSinceLastInvoke):result}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){return timerId=undefined,trailing&&lastArgs?invokeFunc(time):(lastArgs=lastThis=undefined,result)}function cancel(){timerId!==undefined&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);if(lastArgs=arguments,lastThis=this,lastCallTime=time,isInvoking){if(timerId===undefined)return leadingEdge(lastCallTime);if(maxing)return timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===undefined&&(timerId=setTimeout(timerExpired,wait)),result}var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return wait=toNumber(wait)||0,isObject(options)&&(leading=!!options.leading,maxing="maxWait"in options,maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait,trailing="trailing"in options?!!options.trailing:trailing),debounced.cancel=cancel,debounced.flush=flush,debounced}function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}function memoize(func,resolver){if("function"!=typeof func||null!=resolver&&"function"!=typeof resolver)throw new TypeError(FUNC_ERROR_TEXT);var memoized=function memoized(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result)||cache,result};return memoized.cache=new(memoize.Cache||MapCache),memoized}function negate(predicate){if("function"!=typeof predicate)throw new TypeError(FUNC_ERROR_TEXT);return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}function once(func){return before(2,func)}function rest(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=start===undefined?start:toInteger(start),baseRest(func,start)}function spread(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=null==start?0:nativeMax(toInteger(start),0),baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);return array&&arrayPush(otherArgs,array),apply(func,this,otherArgs)})}function throttle(func,wait,options){var leading=!0,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return isObject(options)&&(leading="leading"in options?!!options.leading:leading,trailing="trailing"in options?!!options.trailing:trailing),debounce(func,wait,{leading:leading,maxWait:wait,trailing:trailing})}function unary(func){return ary(func,1)}function wrap(value,wrapper){return partial(castFunction(wrapper),value)}function castArray(){if(!arguments.length)return[];var value=arguments[0];return isArray(value)?value:[value]}function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}function cloneWith(value,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseClone(value,CLONE_SYMBOLS_FLAG,customizer)}function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}function cloneDeepWith(value,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer)}function conformsTo(object,source){return null==source||baseConformsTo(object,source,keys(source))}function eq(value,other){return value===other||value!==value&&other!==other}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return!0===value||!1===value||isObjectLike(value)&&baseGetTag(value)==boolTag}function isElement(value){return isObjectLike(value)&&1===value.nodeType&&!isPlainObject(value)}function isEmpty(value){if(null==value)return!0;if(isArrayLike(value)&&(isArray(value)||"string"==typeof value||"function"==typeof value.splice||isBuffer(value)||isTypedArray(value)||isArguments(value)))return!value.length;var tag=getTag(value);if(tag==mapTag||tag==setTag)return!value.size;if(isPrototype(value))return!baseKeys(value).length;for(var key in value)if(hasOwnProperty.call(value,key))return!1;return!0}function isEqual(value,other){return baseIsEqual(value,other)}function isEqualWith(value,other,customizer){customizer="function"==typeof customizer?customizer:undefined;var result=customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}function isError(value){if(!isObjectLike(value))return!1;var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||"string"==typeof value.message&&"string"==typeof value.name&&!isPlainObject(value)}function isFinite(value){return"number"==typeof value&&nativeIsFinite(value)}function isFunction(value){if(!isObject(value))return!1;var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}function isInteger(value){return"number"==typeof value&&value==toInteger(value)}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=void 0===value?"undefined":_typeof(value);return null!=value&&("object"==type||"function"==type)}function isObjectLike(value){return null!=value&&"object"==(void 0===value?"undefined":_typeof(value))}function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){return customizer="function"==typeof customizer?customizer:undefined,baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value))throw new Error(CORE_ERROR_TEXT);return baseIsNative(value)}function isNull(value){return null===value}function isNil(value){return null==value}function isNumber(value){return"number"==typeof value||isObjectLike(value)&&baseGetTag(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag)return!1;var proto=getPrototype(value);if(null===proto)return!0;var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return"function"==typeof Ctor&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}function isString(value){return"string"==typeof value||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}function isSymbol(value){return"symbol"==(void 0===value?"undefined":_typeof(value))||isObjectLike(value)&&baseGetTag(value)==symbolTag}function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}function toArray(value){if(!value)return[];if(isArrayLike(value))return isString(value)?stringToArray(value):copyArray(value);if(symIterator&&value[symIterator])return iteratorToArray(value[symIterator]());var tag=getTag(value);return(tag==mapTag?mapToArray:tag==setTag?setToArray:values)(value)}function toFinite(value){if(!value)return 0===value?value:0;if((value=toNumber(value))===INFINITY||value===-INFINITY){return(value<0?-1:1)*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){ +var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):0===value?value:0}function toString(value){return null==value?"":baseToString(value)}function create(prototype,properties){var result=baseCreate(prototype);return null==properties?result:baseAssign(result,properties)}function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return null==object?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return null==object?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return null==object?[]:baseFunctions(object,keys(object))}function functionsIn(object){return null==object?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=null==object?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return null!=object&&hasPath(object,path,baseHas)}function hasIn(object,path){return null!=object&&hasPath(object,path,baseHasIn)}function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,!0):baseKeysIn(object)}function mapKeys(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)}),result}function mapValues(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))}),result}function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}function pickBy(object,predicate){if(null==object)return{};var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});return predicate=getIteratee(predicate),basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;for(length||(length=1,object=undefined);++indexupper){var temp=lower;lower=upper,upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){return(string=toString(string))&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string),target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),0,length);var end=position;return(position-=target.length)>=0&&string.slice(position,end)==target}function escape(string){return string=toString(string),string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){return string=toString(string),string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$&"):string}function pad(string,length,chars){string=toString(string),length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length)return string;var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string),length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength>>0)?(string=toString(string),string&&("string"==typeof separator||null!=separator&&!isRegExp(separator))&&!(separator=baseToString(separator))&&hasUnicode(string)?castSlice(stringToArray(string),0,limit):string.split(separator,limit)):[]}function startsWith(string,target,position){return string=toString(string),position=null==position?0:baseClamp(toInteger(position),0,string.length),target=baseToString(target),string.slice(position,position+target.length)==target}function template(string,options,guard){var settings=lodash.templateSettings;guard&&isIterateeCall(string,options,guard)&&(options=undefined),string=toString(string),options=assignInWith({},options,settings,customDefaultsAssignIn);var isEscaping,isEvaluating,imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys),index=0,interpolate=options.interpolate||reNoMatch,source="__p += '",reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g"),sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){return interpolateValue||(interpolateValue=esTemplateValue),source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar),escapeValue&&(isEscaping=!0,source+="' +\n__e("+escapeValue+") +\n'"),evaluateValue&&(isEvaluating=!0,source+="';\n"+evaluateValue+";\n__p += '"),interpolateValue&&(source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"),index=offset+match.length,match}),source+="';\n";var variable=options.variable;variable||(source="with (obj) {\n"+source+"\n}\n"),source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;"),source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});if(result.source=source,isError(result))throw result;return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrim,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars);return castSlice(strSymbols,charsStartIndex(strSymbols,chrSymbols),charsEndIndex(strSymbols,chrSymbols)+1).join("")}function trimEnd(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrimEnd,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string);return castSlice(strSymbols,0,charsEndIndex(strSymbols,stringToArray(chars))+1).join("")}function trimStart(string,chars,guard){if((string=toString(string))&&(guard||chars===undefined))return string.replace(reTrimStart,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string);return castSlice(strSymbols,charsStartIndex(strSymbols,stringToArray(chars))).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?toInteger(options.length):length,omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength)return string;var end=length-stringSize(omission);if(end<1)return omission;var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined)return result+omission;if(strSymbols&&(end+=result.length-end),isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;for(separator.global||(separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g")),separator.lastIndex=0;match=separator.exec(substring);)var newEnd=match.index;result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);index>-1&&(result=result.slice(0,index))}return result+omission}function unescape(string){return string=toString(string),string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}function words(string,pattern,guard){return string=toString(string),pattern=guard?undefined:pattern,pattern===undefined?hasUnicodeWord(string)?unicodeWords(string):asciiWords(string):string.match(pattern)||[]}function cond(pairs){var length=null==pairs?0:pairs.length,toIteratee=getIteratee();return pairs=length?arrayMap(pairs,function(pair){if("function"!=typeof pair[1])throw new TypeError(FUNC_ERROR_TEXT);return[toIteratee(pair[0]),pair[1]]}):[],baseRest(function(args){for(var index=-1;++indexMAX_SAFE_INTEGER)return[];var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee),n-=MAX_ARRAY_LENGTH;for(var result=baseTimes(length,iteratee);++index1?arrays[length-1]:undefined;return iteratee="function"==typeof iteratee?(arrays.pop(),iteratee):undefined,unzipWith(arrays,iteratee)}),wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};return!(length>1||this.__actions__.length)&&value instanceof LazyWrapper&&isIndex(start)?(value=value.slice(start,+start+(length?1:0)),value.__actions__.push({func:thru,args:[interceptor],thisArg:undefined}),new LodashWrapper(value,this.__chain__).thru(function(array){return length&&!array.length&&array.push(undefined),array})):this.thru(interceptor)}),countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?++result[key]:baseAssignValue(result,key,1)}),find=createFind(findIndex),findLast=createFind(findLastIndex),groupBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key].push(value):baseAssignValue(result,key,[value])}),invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc="function"==typeof path,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)}),result}),keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value)}),partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]}),sortBy=baseRest(function(collection,iteratees){if(null==collection)return[];var length=iteratees.length;return length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])?iteratees=[]:length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])&&(iteratees=[iteratees[0]]),baseOrderBy(collection,baseFlatten(iteratees,1),[])}),now=ctxNow||function(){return root.Date.now()},bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)}),bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)}),defer=baseRest(function(func,args){return baseDelay(func,1,args)}),delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});memoize.Cache=MapCache;var overArgs=castRest(function(func,transforms){transforms=1==transforms.length&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){for(var index=-1,length=nativeMin(args.length,funcsLength);++index=other}),isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")},isArray=Array.isArray,isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer,isBuffer=nativeIsBuffer||stubFalse,isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,lt=createRelationalOperation(baseLt),lte=createRelationalOperation(function(value,other){return value<=other}),assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source))return void copyObject(source,keys(source),object);for(var key in source)hasOwnProperty.call(source,key)&&assignValue(object,key,source[key])}),assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)}),assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)}),assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)}),at=flatRest(baseAt),defaults=baseRest(function(args){return args.push(undefined,customDefaultsAssignIn),apply(assignInWith,undefined,args)}),defaultsDeep=baseRest(function(args){return args.push(undefined,customDefaultsMerge),apply(mergeWith,undefined,args)}),invert=createInverter(function(result,value,key){result[value]=key},constant(identity)),invertBy=createInverter(function(result,value,key){hasOwnProperty.call(result,value)?result[value].push(key):result[value]=[key]},getIteratee),invoke=baseRest(baseInvoke),merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)}),mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)}),omit=flatRest(function(object,paths){var result={};if(null==object)return result;var isDeep=!1;paths=arrayMap(paths,function(path){return path=castPath(path,object),isDeep||(isDeep=path.length>1),path}),copyObject(object,getAllKeysIn(object),result),isDeep&&(result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone));for(var length=paths.length;length--;)baseUnset(result,paths[length]);return result}),pick=flatRest(function(object,paths){return null==object?{}:basePick(object,paths)}),toPairs=createToPairs(keys),toPairsIn=createToPairs(keysIn),camelCase=createCompounder(function(result,word,index){return word=word.toLowerCase(),result+(index?capitalize(word):word)}),kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()}),lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()}),lowerFirst=createCaseFirst("toLowerCase"),snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()}),startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word) +}),upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()}),upperFirst=createCaseFirst("toUpperCase"),attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}}),bindAll=flatRest(function(object,methodNames){return arrayEach(methodNames,function(key){key=toKey(key),baseAssignValue(object,key,bind(object[key],object))}),object}),flow=createFlow(),flowRight=createFlow(!0),method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}}),methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}}),over=createOver(arrayMap),overEvery=createOver(arrayEvery),overSome=createOver(arraySome),range=createRange(),rangeRight=createRange(!0),add=createMathOperation(function(augend,addend){return augend+addend},0),ceil=createRound("ceil"),divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1),floor=createRound("floor"),multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1),round=createRound("round"),subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);return lodash.after=after,lodash.ary=ary,lodash.assign=assign,lodash.assignIn=assignIn,lodash.assignInWith=assignInWith,lodash.assignWith=assignWith,lodash.at=at,lodash.before=before,lodash.bind=bind,lodash.bindAll=bindAll,lodash.bindKey=bindKey,lodash.castArray=castArray,lodash.chain=chain,lodash.chunk=chunk,lodash.compact=compact,lodash.concat=concat,lodash.cond=cond,lodash.conforms=conforms,lodash.constant=constant,lodash.countBy=countBy,lodash.create=create,lodash.curry=curry,lodash.curryRight=curryRight,lodash.debounce=debounce,lodash.defaults=defaults,lodash.defaultsDeep=defaultsDeep,lodash.defer=defer,lodash.delay=delay,lodash.difference=difference,lodash.differenceBy=differenceBy,lodash.differenceWith=differenceWith,lodash.drop=drop,lodash.dropRight=dropRight,lodash.dropRightWhile=dropRightWhile,lodash.dropWhile=dropWhile,lodash.fill=fill,lodash.filter=filter,lodash.flatMap=flatMap,lodash.flatMapDeep=flatMapDeep,lodash.flatMapDepth=flatMapDepth,lodash.flatten=flatten,lodash.flattenDeep=flattenDeep,lodash.flattenDepth=flattenDepth,lodash.flip=flip,lodash.flow=flow,lodash.flowRight=flowRight,lodash.fromPairs=fromPairs,lodash.functions=functions,lodash.functionsIn=functionsIn,lodash.groupBy=groupBy,lodash.initial=initial,lodash.intersection=intersection,lodash.intersectionBy=intersectionBy,lodash.intersectionWith=intersectionWith,lodash.invert=invert,lodash.invertBy=invertBy,lodash.invokeMap=invokeMap,lodash.iteratee=iteratee,lodash.keyBy=keyBy,lodash.keys=keys,lodash.keysIn=keysIn,lodash.map=map,lodash.mapKeys=mapKeys,lodash.mapValues=mapValues,lodash.matches=matches,lodash.matchesProperty=matchesProperty,lodash.memoize=memoize,lodash.merge=merge,lodash.mergeWith=mergeWith,lodash.method=method,lodash.methodOf=methodOf,lodash.mixin=mixin,lodash.negate=negate,lodash.nthArg=nthArg,lodash.omit=omit,lodash.omitBy=omitBy,lodash.once=once,lodash.orderBy=orderBy,lodash.over=over,lodash.overArgs=overArgs,lodash.overEvery=overEvery,lodash.overSome=overSome,lodash.partial=partial,lodash.partialRight=partialRight,lodash.partition=partition,lodash.pick=pick,lodash.pickBy=pickBy,lodash.property=property,lodash.propertyOf=propertyOf,lodash.pull=pull,lodash.pullAll=pullAll,lodash.pullAllBy=pullAllBy,lodash.pullAllWith=pullAllWith,lodash.pullAt=pullAt,lodash.range=range,lodash.rangeRight=rangeRight,lodash.rearg=rearg,lodash.reject=reject,lodash.remove=remove,lodash.rest=rest,lodash.reverse=reverse,lodash.sampleSize=sampleSize,lodash.set=set,lodash.setWith=setWith,lodash.shuffle=shuffle,lodash.slice=slice,lodash.sortBy=sortBy,lodash.sortedUniq=sortedUniq,lodash.sortedUniqBy=sortedUniqBy,lodash.split=split,lodash.spread=spread,lodash.tail=tail,lodash.take=take,lodash.takeRight=takeRight,lodash.takeRightWhile=takeRightWhile,lodash.takeWhile=takeWhile,lodash.tap=tap,lodash.throttle=throttle,lodash.thru=thru,lodash.toArray=toArray,lodash.toPairs=toPairs,lodash.toPairsIn=toPairsIn,lodash.toPath=toPath,lodash.toPlainObject=toPlainObject,lodash.transform=transform,lodash.unary=unary,lodash.union=union,lodash.unionBy=unionBy,lodash.unionWith=unionWith,lodash.uniq=uniq,lodash.uniqBy=uniqBy,lodash.uniqWith=uniqWith,lodash.unset=unset,lodash.unzip=unzip,lodash.unzipWith=unzipWith,lodash.update=update,lodash.updateWith=updateWith,lodash.values=values,lodash.valuesIn=valuesIn,lodash.without=without,lodash.words=words,lodash.wrap=wrap,lodash.xor=xor,lodash.xorBy=xorBy,lodash.xorWith=xorWith,lodash.zip=zip,lodash.zipObject=zipObject,lodash.zipObjectDeep=zipObjectDeep,lodash.zipWith=zipWith,lodash.entries=toPairs,lodash.entriesIn=toPairsIn,lodash.extend=assignIn,lodash.extendWith=assignInWith,mixin(lodash,lodash),lodash.add=add,lodash.attempt=attempt,lodash.camelCase=camelCase,lodash.capitalize=capitalize,lodash.ceil=ceil,lodash.clamp=clamp,lodash.clone=clone,lodash.cloneDeep=cloneDeep,lodash.cloneDeepWith=cloneDeepWith,lodash.cloneWith=cloneWith,lodash.conformsTo=conformsTo,lodash.deburr=deburr,lodash.defaultTo=defaultTo,lodash.divide=divide,lodash.endsWith=endsWith,lodash.eq=eq,lodash.escape=escape,lodash.escapeRegExp=escapeRegExp,lodash.every=every,lodash.find=find,lodash.findIndex=findIndex,lodash.findKey=findKey,lodash.findLast=findLast,lodash.findLastIndex=findLastIndex,lodash.findLastKey=findLastKey,lodash.floor=floor,lodash.forEach=forEach,lodash.forEachRight=forEachRight,lodash.forIn=forIn,lodash.forInRight=forInRight,lodash.forOwn=forOwn,lodash.forOwnRight=forOwnRight,lodash.get=get,lodash.gt=gt,lodash.gte=gte,lodash.has=has,lodash.hasIn=hasIn,lodash.head=head,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.inRange=inRange,lodash.invoke=invoke,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isArrayBuffer=isArrayBuffer,lodash.isArrayLike=isArrayLike,lodash.isArrayLikeObject=isArrayLikeObject,lodash.isBoolean=isBoolean,lodash.isBuffer=isBuffer,lodash.isDate=isDate,lodash.isElement=isElement,lodash.isEmpty=isEmpty,lodash.isEqual=isEqual,lodash.isEqualWith=isEqualWith,lodash.isError=isError,lodash.isFinite=isFinite,lodash.isFunction=isFunction,lodash.isInteger=isInteger,lodash.isLength=isLength,lodash.isMap=isMap,lodash.isMatch=isMatch,lodash.isMatchWith=isMatchWith,lodash.isNaN=isNaN,lodash.isNative=isNative,lodash.isNil=isNil,lodash.isNull=isNull,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isObjectLike=isObjectLike,lodash.isPlainObject=isPlainObject,lodash.isRegExp=isRegExp,lodash.isSafeInteger=isSafeInteger,lodash.isSet=isSet,lodash.isString=isString,lodash.isSymbol=isSymbol,lodash.isTypedArray=isTypedArray,lodash.isUndefined=isUndefined,lodash.isWeakMap=isWeakMap,lodash.isWeakSet=isWeakSet,lodash.join=join,lodash.kebabCase=kebabCase,lodash.last=last,lodash.lastIndexOf=lastIndexOf,lodash.lowerCase=lowerCase,lodash.lowerFirst=lowerFirst,lodash.lt=lt,lodash.lte=lte,lodash.max=max,lodash.maxBy=maxBy,lodash.mean=mean,lodash.meanBy=meanBy,lodash.min=min,lodash.minBy=minBy,lodash.stubArray=stubArray,lodash.stubFalse=stubFalse,lodash.stubObject=stubObject,lodash.stubString=stubString,lodash.stubTrue=stubTrue,lodash.multiply=multiply,lodash.nth=nth,lodash.noConflict=noConflict,lodash.noop=noop,lodash.now=now,lodash.pad=pad,lodash.padEnd=padEnd,lodash.padStart=padStart,lodash.parseInt=parseInt,lodash.random=random,lodash.reduce=reduce,lodash.reduceRight=reduceRight,lodash.repeat=repeat,lodash.replace=replace,lodash.result=result,lodash.round=round,lodash.runInContext=runInContext,lodash.sample=sample,lodash.size=size,lodash.snakeCase=snakeCase,lodash.some=some,lodash.sortedIndex=sortedIndex,lodash.sortedIndexBy=sortedIndexBy,lodash.sortedIndexOf=sortedIndexOf,lodash.sortedLastIndex=sortedLastIndex,lodash.sortedLastIndexBy=sortedLastIndexBy,lodash.sortedLastIndexOf=sortedLastIndexOf,lodash.startCase=startCase,lodash.startsWith=startsWith,lodash.subtract=subtract,lodash.sum=sum,lodash.sumBy=sumBy,lodash.template=template,lodash.times=times,lodash.toFinite=toFinite,lodash.toInteger=toInteger,lodash.toLength=toLength,lodash.toLower=toLower,lodash.toNumber=toNumber,lodash.toSafeInteger=toSafeInteger,lodash.toString=toString,lodash.toUpper=toUpper,lodash.trim=trim,lodash.trimEnd=trimEnd,lodash.trimStart=trimStart,lodash.truncate=truncate,lodash.unescape=unescape,lodash.uniqueId=uniqueId,lodash.upperCase=upperCase,lodash.upperFirst=upperFirst,lodash.each=forEach,lodash.eachRight=forEachRight,lodash.first=head,mixin(lodash,function(){var source={};return baseForOwn(lodash,function(func,methodName){hasOwnProperty.call(lodash.prototype,methodName)||(source[methodName]=func)}),source}(),{chain:!1}),lodash.VERSION="4.17.4",arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash}),arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();return result.__filtered__?result.__takeCount__=nativeMin(n,result.__takeCount__):result.__views__.push({size:nativeMin(n,MAX_ARRAY_LENGTH),type:methodName+(result.__dir__<0?"Right":"")}),result},LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}}),arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||3==type;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();return result.__iteratees__.push({iteratee:getIteratee(iteratee,3),type:type}),result.__filtered__=result.__filtered__||isFilter,result}}),arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}}),arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}}),LazyWrapper.prototype.compact=function(){return this.filter(identity)},LazyWrapper.prototype.find=function(predicate){return this.filter(predicate).head()},LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)},LazyWrapper.prototype.invokeMap=baseRest(function(path,args){return"function"==typeof path?new LazyWrapper(this):this.map(function(value){return baseInvoke(value,path,args)})}),LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)))},LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);var result=this;return result.__filtered__&&(start>0||end<0)?new LazyWrapper(result):(start<0?result=result.takeRight(-start):start&&(result=result.drop(start)),end!==undefined&&(end=toInteger(end),result=end<0?result.dropRight(-end):result.take(end-start)),result)},LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()},LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)},baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+("last"==methodName?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);lodashFunc&&(lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value),interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};useLazy&&checkIteratee&&"function"==typeof iteratee&&1!=iteratee.length&&(isLazy=useLazy=!1);var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);return result.__actions__.push({func:thru,args:[interceptor],thisArg:undefined}),new LodashWrapper(result,chainAll)}return isUnwrapped&&onlyLazy?func.apply(this,args):(result=this.thru(interceptor),isUnwrapped?isTaker?result.value()[0]:result.value():result)})}),arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}}),baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"";(realNames[key]||(realNames[key]=[])).push({name:methodName,func:lodashFunc})}}),realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{name:"wrapper",func:undefined}],LazyWrapper.prototype.clone=lazyClone,LazyWrapper.prototype.reverse=lazyReverse,LazyWrapper.prototype.value=lazyValue,lodash.prototype.at=wrapperAt,lodash.prototype.chain=wrapperChain,lodash.prototype.commit=wrapperCommit,lodash.prototype.next=wrapperNext,lodash.prototype.plant=wrapperPlant,lodash.prototype.reverse=wrapperReverse,lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue,lodash.prototype.first=lodash.prototype.head,symIterator&&(lodash.prototype[symIterator]=wrapperToIterator),lodash}();"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd?(root._=_,define(function(){return _})):freeModule?((freeModule.exports=_)._=_,freeExports._=_):root._=_}).call(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],269:[function(require,module,exports){(function(Buffer){"use strict";function MD5(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(x,n){return x<>>32-n}function fnF(a,b,c,d,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+b|0}function fnG(a,b,c,d,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+b|0}function fnH(a,b,c,d,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+b|0}function fnI(a,b,c,d,m,k,s){return rotl(a+(c^(b|~d))+m+k|0,s)+b|0}var inherits=require("inherits"),HashBase=require("hash-base"),ARRAY16=new Array(16);inherits(MD5,HashBase),MD5.prototype._update=function(){for(var M=ARRAY16,i=0;i<16;++i)M[i]=this._block.readInt32LE(4*i);var a=this._a,b=this._b,c=this._c,d=this._d;a=fnF(a,b,c,d,M[0],3614090360,7),d=fnF(d,a,b,c,M[1],3905402710,12),c=fnF(c,d,a,b,M[2],606105819,17),b=fnF(b,c,d,a,M[3],3250441966,22),a=fnF(a,b,c,d,M[4],4118548399,7),d=fnF(d,a,b,c,M[5],1200080426,12),c=fnF(c,d,a,b,M[6],2821735955,17),b=fnF(b,c,d,a,M[7],4249261313,22),a=fnF(a,b,c,d,M[8],1770035416,7),d=fnF(d,a,b,c,M[9],2336552879,12),c=fnF(c,d,a,b,M[10],4294925233,17),b=fnF(b,c,d,a,M[11],2304563134,22),a=fnF(a,b,c,d,M[12],1804603682,7),d=fnF(d,a,b,c,M[13],4254626195,12),c=fnF(c,d,a,b,M[14],2792965006,17),b=fnF(b,c,d,a,M[15],1236535329,22),a=fnG(a,b,c,d,M[1],4129170786,5),d=fnG(d,a,b,c,M[6],3225465664,9),c=fnG(c,d,a,b,M[11],643717713,14),b=fnG(b,c,d,a,M[0],3921069994,20),a=fnG(a,b,c,d,M[5],3593408605,5),d=fnG(d,a,b,c,M[10],38016083,9),c=fnG(c,d,a,b,M[15],3634488961,14),b=fnG(b,c,d,a,M[4],3889429448,20),a=fnG(a,b,c,d,M[9],568446438,5),d=fnG(d,a,b,c,M[14],3275163606,9),c=fnG(c,d,a,b,M[3],4107603335,14),b=fnG(b,c,d,a,M[8],1163531501,20),a=fnG(a,b,c,d,M[13],2850285829,5),d=fnG(d,a,b,c,M[2],4243563512,9),c=fnG(c,d,a,b,M[7],1735328473,14),b=fnG(b,c,d,a,M[12],2368359562,20),a=fnH(a,b,c,d,M[5],4294588738,4),d=fnH(d,a,b,c,M[8],2272392833,11),c=fnH(c,d,a,b,M[11],1839030562,16),b=fnH(b,c,d,a,M[14],4259657740,23),a=fnH(a,b,c,d,M[1],2763975236,4),d=fnH(d,a,b,c,M[4],1272893353,11),c=fnH(c,d,a,b,M[7],4139469664,16),b=fnH(b,c,d,a,M[10],3200236656,23),a=fnH(a,b,c,d,M[13],681279174,4),d=fnH(d,a,b,c,M[0],3936430074,11),c=fnH(c,d,a,b,M[3],3572445317,16),b=fnH(b,c,d,a,M[6],76029189,23),a=fnH(a,b,c,d,M[9],3654602809,4),d=fnH(d,a,b,c,M[12],3873151461,11),c=fnH(c,d,a,b,M[15],530742520,16),b=fnH(b,c,d,a,M[2],3299628645,23),a=fnI(a,b,c,d,M[0],4096336452,6),d=fnI(d,a,b,c,M[7],1126891415,10),c=fnI(c,d,a,b,M[14],2878612391,15),b=fnI(b,c,d,a,M[5],4237533241,21),a=fnI(a,b,c,d,M[12],1700485571,6),d=fnI(d,a,b,c,M[3],2399980690,10),c=fnI(c,d,a,b,M[10],4293915773,15),b=fnI(b,c,d,a,M[1],2240044497,21),a=fnI(a,b,c,d,M[8],1873313359,6),d=fnI(d,a,b,c,M[15],4264355552,10),c=fnI(c,d,a,b,M[6],2734768916,15),b=fnI(b,c,d,a,M[13],1309151649,21),a=fnI(a,b,c,d,M[4],4149444226,6),d=fnI(d,a,b,c,M[11],3174756917,10),c=fnI(c,d,a,b,M[2],718787259,15),b=fnI(b,c,d,a,M[9],3951481745,21),this._a=this._a+a|0,this._b=this._b+b|0,this._c=this._c+c|0,this._d=this._d+d|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=new Buffer(16);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer},module.exports=MD5}).call(this,require("buffer").Buffer)},{buffer:149,"hash-base":270,inherits:257}],270:[function(require,module,exports){"use strict";function throwIfNotStringOrBuffer(val,prefix){if(!Buffer.isBuffer(val)&&"string"!=typeof val)throw new TypeError(prefix+" must be a string or a buffer")}function HashBase(blockSize){Transform.call(this),this._block=Buffer.allocUnsafe(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var Buffer=require("safe-buffer").Buffer,Transform=require("stream").Transform;require("inherits")(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this.digest())}catch(err){error=err}callback(error)},HashBase.prototype.update=function(data,encoding){if(throwIfNotStringOrBuffer(data,"Data"),this._finalized)throw new Error("Digest already called");Buffer.isBuffer(data)||(data=Buffer.from(data,encoding));for(var block=this._block,offset=0;this._blockOffset+data.length-offset>=this._blockSize;){for(var i=this._blockOffset;i0;++j)this._length[j]+=carry,(carry=this._length[j]/4294967296|0)>0&&(this._length[j]-=4294967296*carry);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var digest=this._digest();void 0!==encoding&&(digest=digest.toString(encoding)),this._block.fill(0),this._blockOffset=0;for(var i=0;i<4;++i)this._length[i]=0;return digest},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase},{inherits:257,"safe-buffer":313,stream:345}],271:[function(require,module,exports){"use strict";function MillerRabin(rand){this.rand=rand||new brorand.Rand}var bn=require("bn.js"),brorand=require("brorand");module.exports=MillerRabin,MillerRabin.create=function(rand){return new MillerRabin(rand)},MillerRabin.prototype._randbelow=function(n){var len=n.bitLength(),min_bytes=Math.ceil(len/8);do{var a=new bn(this.rand.generate(min_bytes))}while(a.cmp(n)>=0);return a},MillerRabin.prototype._randrange=function(start,stop){var size=stop.sub(start);return start.add(this._randbelow(size))},MillerRabin.prototype.test=function(n,k,cb){var len=n.bitLength(),red=bn.mont(n),rone=new bn(1).toRed(red);k||(k=Math.max(1,len/48|0));for(var n1=n.subn(1),s=0;!n1.testn(s);s++);for(var d=n.shrn(s),rn1=n1.toRed(red);k>0;k--){var a=this._randrange(new bn(2),n1);cb&&cb(a);var x=a.toRed(red).redPow(d);if(0!==x.cmp(rone)&&0!==x.cmp(rn1)){for(var i=1;i0;k--){var a=this._randrange(new bn(2),n1),g=n.gcd(a);if(0!==g.cmpn(1))return g;var x=a.toRed(red).redPow(d);if(0!==x.cmp(rone)&&0!==x.cmp(rn1)){for(var i=1;i>8,lo=255&c;hi?res.push(hi,lo):res.push(lo)}return res}function zero2(word){return 1===word.length?"0"+word:word}function toHex(msg){for(var res="",i=0;i=6?"utf-8":"binary"}module.exports=defaultEncoding}).call(this,require("_process"))},{_process:285}],282:[function(require,module,exports){"use strict";var MAX_ALLOC=Math.pow(2,30)-1;module.exports=function(iterations,keylen){if("number"!=typeof iterations)throw new TypeError("Iterations not a number");if(iterations<0)throw new TypeError("Bad iterations");if("number"!=typeof keylen)throw new TypeError("Key length not a number");if(keylen<0||keylen>MAX_ALLOC||keylen!==keylen)throw new TypeError("Bad key length")}},{}],283:[function(require,module,exports){"use strict";function Hmac(alg,key,saltLen){var hash=getDigest(alg),blocksize="sha512"===alg||"sha384"===alg?128:64;key.length>blocksize?key=hash(key):key.length1)for(var i=1;i=msg.length){status++;break}var ps=msg.slice(2,i-1);msg.slice(i-1,i);if(("0002"!==p1.toString("hex")&&!reverse||"0001"!==p1.toString("hex")&&reverse)&&status++,ps.length<8&&status++,status)throw new Error("decryption error");return msg.slice(i)}function compare(a,b){a=new Buffer(a),b=new Buffer(b);var dif=0,len=a.length;a.length!==b.length&&(dif++,len=Math.min(a.length,b.length));for(var i=-1;++ik||new bn(enc).cmp(key.modulus)>=0)throw new Error("decryption error");var msg;msg=reverse?withPublic(new bn(enc),key):crt(enc,key);var zBuffer=new Buffer(k-msg.length);if(zBuffer.fill(0),msg=Buffer.concat([zBuffer,msg],k),4===padding)return oaep(key,msg);if(1===padding)return pkcs1(key,msg,reverse);if(3===padding)return msg;throw new Error("unknown padding")}}).call(this,require("buffer").Buffer)},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,buffer:149,"create-hash":169,"parse-asn1":278}],289:[function(require,module,exports){(function(Buffer){"use strict";function oaep(key,msg){var k=key.modulus.byteLength(),mLen=msg.length,iHash=createHash("sha1").update(new Buffer("")).digest(),hLen=iHash.length,hLen2=2*hLen;if(mLen>k-hLen2-2)throw new Error("message too long");var ps=new Buffer(k-mLen-hLen2-2);ps.fill(0);var dblen=k-hLen-1,seed=randomBytes(hLen),maskedDb=xor(Buffer.concat([iHash,ps,new Buffer([1]),msg],dblen),mgf(seed,dblen)),maskedSeed=xor(seed,mgf(maskedDb,hLen));return new bn(Buffer.concat([new Buffer([0]),maskedSeed,maskedDb],k))}function pkcs1(key,msg,reverse){var mLen=msg.length,k=key.modulus.byteLength();if(mLen>k-11)throw new Error("message too long");var ps;return reverse?(ps=new Buffer(k-mLen-3),ps.fill(255)):ps=nonZero(k-mLen-3),new bn(Buffer.concat([new Buffer([0,reverse?1:2]),ps,new Buffer([0]),msg],k))}function nonZero(len,crypto){for(var num,out=new Buffer(len),i=0,cache=randomBytes(2*len),cur=0;i=0)throw new Error("data too long for modulus")}return reverse?crt(paddedMsg,key):withPublic(paddedMsg,key)}}).call(this,require("buffer").Buffer)},{"./mgf":287,"./withPublic":290,"./xor":291,"bn.js":99,"browserify-rsa":122,buffer:149,"create-hash":169,"parse-asn1":278,randombytes:296}],290:[function(require,module,exports){(function(Buffer){"use strict";function withPublic(paddedMsg,key){return new Buffer(paddedMsg.toRed(bn.mont(key.modulus)).redPow(new bn(key.publicExponent)).fromRed().toArray())}var bn=require("bn.js");module.exports=withPublic}).call(this,require("buffer").Buffer)},{"bn.js":99,buffer:149}],291:[function(require,module,exports){"use strict";module.exports=function(a,b){for(var len=a.length,i=-1;++i1&&(result=parts[0]+"@",string=parts[1]),string=string.replace(regexSeparators,"."),result+map(string.split("."),fn).join(".")}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function basicToDigit(codePoint){return codePoint-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for(basic=input.lastIndexOf(delimiter),basic<0&&(basic=0),j=0;j=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index=inputLength&&error("invalid-input"),digit=basicToDigit(input.charCodeAt(index++)),(digit>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(digitfloor(maxInt/baseMinusT)&&error("overflow"),w*=baseMinusT;out=output.length+1,bias=adapt(i-oldi,out,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(input=ucs2decode(input),inputLength=input.length,n=initialN,delta=0,bias=initialBias,j=0;j=n&¤tValuefloor((maxInt-delta)/handledCPCountPlusOne)&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;jmaxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;if(punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode},"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],293:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],294:[function(require,module,exports){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i65536)throw new Error("requested too many random bytes");var rawBytes=new global.Uint8Array(size);size>0&&crypto.getRandomValues(rawBytes);var bytes=Buffer.from(rawBytes.buffer);return"function"==typeof cb?process.nextTick(function(){cb(null,bytes)}):bytes}var Buffer=require("safe-buffer").Buffer,crypto=global.crypto||global.msCrypto;crypto&&crypto.getRandomValues?module.exports=randomBytes:module.exports=oldBrowser}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:285,"safe-buffer":313}],297:[function(require,module,exports){"use strict";module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":298}],298:[function(require,module,exports){"use strict";function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),options&&!1===options.readable&&(this.readable=!1),options&&!1===options.writable&&(this.writable=!1),this.allowHalfOpen=!0,options&&!1===options.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||processNextTick(onEndNT,this)}function onEndNT(self){self.end()}var processNextTick=require("process-nextick-args"),objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0?("string"==typeof chunk||state.objectMode||Object.getPrototypeOf(chunk)===Buffer.prototype||(chunk=_uint8ArrayToBuffer(chunk)),addToFront?state.endEmitted?stream.emit("error",new Error("stream.unshift() after end event")):addChunk(stream,state,chunk,!0):state.ended?stream.emit("error",new Error("stream.push() after EOF")):(state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||0!==chunk.length?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1))):addToFront||(state.reading=!1)}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){state.flowing&&0===state.length&&!state.sync?(stream.emit("data",chunk),stream.read(0)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;return _isUint8Array(chunk)||"string"==typeof chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return n<=0||0===state.length&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}function onEofChunk(stream,state){if(!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,emitReadable(stream)}}function emitReadable(stream){var state=stream._readableState;state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,state.sync?processNextTick(emitReadable_,stream):emitReadable_(stream))}function emitReadable_(stream){debug("emit readable"),stream.emit("readable"),flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,processNextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(var len=state.length;!state.reading&&!state.flowing&&!state.ended&&state.length=state.length?(ret=state.decoder?state.buffer.join(""):1===state.buffer.length?state.buffer.head.data:state.buffer.concat(state.length),state.buffer.clear()):ret=fromListPartial(n,state.buffer,state.decoder),ret}function fromListPartial(n,list,hasStrings){var ret;return nstr.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),0===(n-=nb)){nb===str.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=str.slice(nb));break}++c}return list.length-=c,ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n),p=list.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),0===(n-=nb)){nb===buf.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=buf.slice(nb));break}++c}return list.length-=c,ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');state.endEmitted||(state.ended=!0,processNextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1, +stream.emit("end"))}function indexOf(xs,x){for(var i=0,l=xs.length;i=state.highWaterMark||state.ended))return debug("read: emitReadable",state.length,state.ended),0===state.length&&state.ended?endReadable(this):emitReadable(this),null;if(0===(n=howMuchToRead(n,state))&&state.ended)return 0===state.length&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(0===state.length||state.length-n0?fromList(n,state):null,null===ret?(state.needReadable=!0,n=0):state.length-=n,0===state.length&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),null!==ret&&this.emit("data",ret),ret},Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(dest,pipeOpts){function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&!1===unpipeInfo.hasUnpiped&&(unpipeInfo.hasUnpiped=!0,cleanup())}function onend(){debug("onend"),dest.end()}function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain()}function ondata(chunk){debug("ondata"),increasedAwaitDrain=!1,!1!==dest.write(chunk)||increasedAwaitDrain||((1===state.pipesCount&&state.pipes===dest||state.pipesCount>1&&-1!==indexOf(state.pipes,dest))&&!cleanedUp&&(debug("false write response, pause",src._readableState.awaitDrain),src._readableState.awaitDrain++,increasedAwaitDrain=!0),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),0===EElistenerCount(dest,"error")&&dest.emit("error",er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||!1!==pipeOpts.end)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:unpipe;state.endEmitted?processNextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1,increasedAwaitDrain=!1;return src.on("data",ondata),prependListener(dest,"error",onerror),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(0===state.pipesCount)return this;if(1===state.pipesCount)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){},destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream),WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(_){}}();var realHasInstance;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return!!realHasInstance.call(this,object)||object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,isBuf=_isUint8Array(chunk)&&!state.objectMode;return isBuf&&!Buffer.isBuffer(chunk)&&(chunk=_uint8ArrayToBuffer(chunk)),"function"==typeof encoding&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),"function"!=typeof cb&&(cb=nop),state.ended?writeAfterEnd(this,cb):(isBuf||validChunk(this,state,chunk,cb))&&(state.pendingcb++,ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.finished||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);return this._writableState.defaultEncoding=encoding,this},Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,chunk=null,encoding=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!==chunk&&void 0!==chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||endWritable(this,state,cb)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){this.end(),cb(err)}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":298,"./internal/streams/destroy":304,"./internal/streams/stream":305,_process:285,"core-util-is":151,inherits:306,"process-nextick-args":284,"safe-buffer":313,"util-deprecate":353}],303:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function copyBuffer(src,target,offset){src.copy(target,offset)}var Buffer=require("safe-buffer").Buffer;module.exports=function(){function BufferList(){_classCallCheck(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};0===this.length&&(this.tail=entry),this.head=entry,++this.length},BufferList.prototype.shift=function(){if(0!==this.length){var ret=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},BufferList.prototype.clear=function(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},BufferList.prototype.concat=function(n){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var ret=Buffer.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret},BufferList}()},{"safe-buffer":313}],304:[function(require,module,exports){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed)return void(cb?cb(err):!err||this._writableState&&this._writableState.errorEmitted||processNextTick(emitErrorNT,this,err));this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err){!cb&&err?(processNextTick(emitErrorNT,_this,err),_this._writableState&&(_this._writableState.errorEmitted=!0)):cb&&cb(err)})}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.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(self,err){self.emit("error",err)}var processNextTick=require("process-nextick-args");module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":284}],305:[function(require,module,exports){"use strict";module.exports=require("events").EventEmitter},{events:238}],306:[function(require,module,exports){arguments[4][253][0].apply(exports,arguments)},{dup:253}],307:[function(require,module,exports){"use strict";module.exports=require("./readable").PassThrough},{"./readable":308}],308:[function(require,module,exports){"use strict";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")},{"./lib/_stream_duplex.js":298,"./lib/_stream_passthrough.js":299,"./lib/_stream_readable.js":300,"./lib/_stream_transform.js":301,"./lib/_stream_writable.js":302}],309:[function(require,module,exports){"use strict";module.exports=require("./readable").Transform},{"./readable":308}],310:[function(require,module,exports){"use strict";module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":302}],311:[function(require,module,exports){(function(Buffer){"use strict";function RIPEMD160(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(x,n){return x<>>32-n}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0}var inherits=require("inherits"),HashBase=require("hash-base");inherits(RIPEMD160,HashBase),RIPEMD160.prototype._update=function(){for(var m=new Array(16),i=0;i<16;++i)m[i]=this._block.readInt32LE(4*i);var al=this._a,bl=this._b,cl=this._c,dl=this._d,el=this._e;al=fn1(al,bl,cl,dl,el,m[0],0,11),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[1],0,14),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[2],0,15),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[3],0,12),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[4],0,5),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[5],0,8),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[6],0,7),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[7],0,9),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[8],0,11),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[9],0,13),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[10],0,14),cl=rotl(cl,10),el=fn1(el,al,bl,cl,dl,m[11],0,15),bl=rotl(bl,10),dl=fn1(dl,el,al,bl,cl,m[12],0,6),al=rotl(al,10),cl=fn1(cl,dl,el,al,bl,m[13],0,7),el=rotl(el,10),bl=fn1(bl,cl,dl,el,al,m[14],0,9),dl=rotl(dl,10),al=fn1(al,bl,cl,dl,el,m[15],0,8),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[7],1518500249,7),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[4],1518500249,6),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[13],1518500249,8),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[1],1518500249,13),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[10],1518500249,11),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[6],1518500249,9),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[15],1518500249,7),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[3],1518500249,15),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[12],1518500249,7),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[0],1518500249,12),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[9],1518500249,15),bl=rotl(bl,10),dl=fn2(dl,el,al,bl,cl,m[5],1518500249,9),al=rotl(al,10),cl=fn2(cl,dl,el,al,bl,m[2],1518500249,11),el=rotl(el,10),bl=fn2(bl,cl,dl,el,al,m[14],1518500249,7),dl=rotl(dl,10),al=fn2(al,bl,cl,dl,el,m[11],1518500249,13),cl=rotl(cl,10),el=fn2(el,al,bl,cl,dl,m[8],1518500249,12),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[3],1859775393,11),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[10],1859775393,13),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[14],1859775393,6),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[4],1859775393,7),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[9],1859775393,14),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[15],1859775393,9),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[8],1859775393,13),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[1],1859775393,15),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[2],1859775393,14),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[7],1859775393,8),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[0],1859775393,13),al=rotl(al,10),cl=fn3(cl,dl,el,al,bl,m[6],1859775393,6),el=rotl(el,10),bl=fn3(bl,cl,dl,el,al,m[13],1859775393,5),dl=rotl(dl,10),al=fn3(al,bl,cl,dl,el,m[11],1859775393,12),cl=rotl(cl,10),el=fn3(el,al,bl,cl,dl,m[5],1859775393,7),bl=rotl(bl,10),dl=fn3(dl,el,al,bl,cl,m[12],1859775393,5),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[1],2400959708,11),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[9],2400959708,12),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[11],2400959708,14),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[10],2400959708,15),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[0],2400959708,14),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[8],2400959708,15),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[12],2400959708,9),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[4],2400959708,8),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[13],2400959708,9),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[3],2400959708,14),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[7],2400959708,5),el=rotl(el,10),bl=fn4(bl,cl,dl,el,al,m[15],2400959708,6),dl=rotl(dl,10),al=fn4(al,bl,cl,dl,el,m[14],2400959708,8),cl=rotl(cl,10),el=fn4(el,al,bl,cl,dl,m[5],2400959708,6),bl=rotl(bl,10),dl=fn4(dl,el,al,bl,cl,m[6],2400959708,5),al=rotl(al,10),cl=fn4(cl,dl,el,al,bl,m[2],2400959708,12),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[4],2840853838,9),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[0],2840853838,15),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[5],2840853838,5),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[9],2840853838,11),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[7],2840853838,6),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[12],2840853838,8),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[2],2840853838,13),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[10],2840853838,12),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[14],2840853838,5),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[1],2840853838,12),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[3],2840853838,13),dl=rotl(dl,10),al=fn5(al,bl,cl,dl,el,m[8],2840853838,14),cl=rotl(cl,10),el=fn5(el,al,bl,cl,dl,m[11],2840853838,11),bl=rotl(bl,10),dl=fn5(dl,el,al,bl,cl,m[6],2840853838,8),al=rotl(al,10),cl=fn5(cl,dl,el,al,bl,m[15],2840853838,5),el=rotl(el,10),bl=fn5(bl,cl,dl,el,al,m[13],2840853838,6),dl=rotl(dl,10);var ar=this._a,br=this._b,cr=this._c,dr=this._d,er=this._e;ar=fn5(ar,br,cr,dr,er,m[5],1352829926,8),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[14],1352829926,9),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[7],1352829926,9),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[0],1352829926,11),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[9],1352829926,13),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[2],1352829926,15),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[11],1352829926,15),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[4],1352829926,5),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[13],1352829926,7),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[6],1352829926,7),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[15],1352829926,8),cr=rotl(cr,10),er=fn5(er,ar,br,cr,dr,m[8],1352829926,11),br=rotl(br,10),dr=fn5(dr,er,ar,br,cr,m[1],1352829926,14),ar=rotl(ar,10),cr=fn5(cr,dr,er,ar,br,m[10],1352829926,14),er=rotl(er,10),br=fn5(br,cr,dr,er,ar,m[3],1352829926,12),dr=rotl(dr,10),ar=fn5(ar,br,cr,dr,er,m[12],1352829926,6),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[6],1548603684,9),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[11],1548603684,13),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[3],1548603684,15),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[7],1548603684,7),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[0],1548603684,12),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[13],1548603684,8),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[5],1548603684,9),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[10],1548603684,11),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[14],1548603684,7),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[15],1548603684,7),cr=rotl(cr,10),er=fn4(er,ar,br,cr,dr,m[8],1548603684,12),br=rotl(br,10),dr=fn4(dr,er,ar,br,cr,m[12],1548603684,7),ar=rotl(ar,10),cr=fn4(cr,dr,er,ar,br,m[4],1548603684,6),er=rotl(er,10),br=fn4(br,cr,dr,er,ar,m[9],1548603684,15),dr=rotl(dr,10),ar=fn4(ar,br,cr,dr,er,m[1],1548603684,13),cr=rotl(cr,10), +er=fn4(er,ar,br,cr,dr,m[2],1548603684,11),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[15],1836072691,9),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[5],1836072691,7),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[1],1836072691,15),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[3],1836072691,11),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[7],1836072691,8),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[14],1836072691,6),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[6],1836072691,6),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[9],1836072691,14),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[11],1836072691,12),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[8],1836072691,13),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[12],1836072691,5),ar=rotl(ar,10),cr=fn3(cr,dr,er,ar,br,m[2],1836072691,14),er=rotl(er,10),br=fn3(br,cr,dr,er,ar,m[10],1836072691,13),dr=rotl(dr,10),ar=fn3(ar,br,cr,dr,er,m[0],1836072691,13),cr=rotl(cr,10),er=fn3(er,ar,br,cr,dr,m[4],1836072691,7),br=rotl(br,10),dr=fn3(dr,er,ar,br,cr,m[13],1836072691,5),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[8],2053994217,15),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[6],2053994217,5),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[4],2053994217,8),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[1],2053994217,11),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[3],2053994217,14),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[11],2053994217,14),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[15],2053994217,6),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[0],2053994217,14),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[5],2053994217,6),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[12],2053994217,9),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[2],2053994217,12),er=rotl(er,10),br=fn2(br,cr,dr,er,ar,m[13],2053994217,9),dr=rotl(dr,10),ar=fn2(ar,br,cr,dr,er,m[9],2053994217,12),cr=rotl(cr,10),er=fn2(er,ar,br,cr,dr,m[7],2053994217,5),br=rotl(br,10),dr=fn2(dr,er,ar,br,cr,m[10],2053994217,15),ar=rotl(ar,10),cr=fn2(cr,dr,er,ar,br,m[14],2053994217,8),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[12],0,8),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[15],0,5),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[10],0,12),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[4],0,9),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[1],0,12),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[5],0,5),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[8],0,14),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[7],0,6),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[6],0,8),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[2],0,13),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[13],0,6),dr=rotl(dr,10),ar=fn1(ar,br,cr,dr,er,m[14],0,5),cr=rotl(cr,10),er=fn1(er,ar,br,cr,dr,m[0],0,15),br=rotl(br,10),dr=fn1(dr,er,ar,br,cr,m[3],0,13),ar=rotl(ar,10),cr=fn1(cr,dr,er,ar,br,m[9],0,11),er=rotl(er,10),br=fn1(br,cr,dr,er,ar,m[11],0,11),dr=rotl(dr,10);var t=this._b+cl+dr|0;this._b=this._c+dl+er|0,this._c=this._d+el+ar|0,this._d=this._e+al+br|0,this._e=this._a+bl+cr|0,this._a=t},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=new Buffer(20);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer.writeInt32LE(this._e,16),buffer},module.exports=RIPEMD160}).call(this,require("buffer").Buffer)},{buffer:149,"hash-base":240,inherits:257}],312:[function(require,module,exports){(function(Buffer){"use strict";function safeParseInt(v,base){if("00"===v.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(v,base)}function encodeLength(len,offset){if(len<56)return new Buffer([len+offset]);var hexLength=intToHex(len),lLength=hexLength.length/2,firstByte=intToHex(offset+55+lLength);return new Buffer(firstByte+hexLength,"hex")}function _decode(input){var length,llength,data,innerRemainder,d,decoded=[],firstByte=input[0];if(firstByte<=127)return{data:input.slice(0,1),remainder:input.slice(1)};if(firstByte<=183){if(length=firstByte-127,data=128===firstByte?new Buffer([]):input.slice(1,length),2===length&&data[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:data,remainder:input.slice(length)}}if(firstByte<=191){if(llength=firstByte-182,length=safeParseInt(input.slice(1,llength).toString("hex"),16),data=input.slice(llength,length+llength),data.lengthinput.length)throw new Error("invalid rlp: total length is larger than the data");if(innerRemainder=input.slice(llength,totalLength),0===innerRemainder.length)throw new Error("invalid rlp, List has a invalid length");for(;innerRemainder.length;)d=_decode(innerRemainder),decoded.push(d.data),innerRemainder=d.remainder;return{data:decoded,remainder:input.slice(totalLength)}}function isHexPrefixed(str){return"0x"===str.slice(0,2)}function stripHexPrefix(str){return"string"!=typeof str?str:isHexPrefixed(str)?str.slice(2):str}function intToHex(i){var hex=i.toString(16);return hex.length%2&&(hex="0"+hex),hex}function padToEven(a){return a.length%2&&(a="0"+a),a}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex,"hex")}function toBuffer(v){if(!Buffer.isBuffer(v))if("string"==typeof v)v=isHexPrefixed(v)?new Buffer(padToEven(stripHexPrefix(v)),"hex"):new Buffer(v);else if("number"==typeof v)v=v?intToBuffer(v):new Buffer([]);else if(null===v||void 0===v)v=new Buffer([]);else{if(!v.toArray)throw new Error("invalid type");v=new Buffer(v.toArray())}return v}var assert=require("assert");exports.encode=function(input){if(input instanceof Array){for(var output=[],i=0;i=64;){var u,i,j,t1,t2,a=h0,b=h1,c=h2,d=h3,e=h4,f=h5,g=h6,h=h7;for(i=0;i<16;i++)j=off+4*i,w[i]=(255&p[j])<<24|(255&p[j+1])<<16|(255&p[j+2])<<8|255&p[j+3];for(i=16;i<64;i++)u=w[i-2],t1=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,u=w[i-15],t2=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,w[i]=(t1+w[i-7]|0)+(t2+w[i-16]|0)|0;for(i=0;i<64;i++)t1=(((e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7))+(e&f^~e&g)|0)+(h+(K[i]+w[i]|0)|0)|0,t2=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&b^a&c^b&c)|0,h=g,g=f,f=e,e=d+t1|0,d=c,c=b,b=a,a=t1+t2|0;h0=h0+a|0,h1=h1+b|0,h2=h2+c|0,h3=h3+d|0,h4=h4+e|0,h5=h5+f|0,h6=h6+g|0,h7=h7+h|0,off+=64,len-=64}}var 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],h0=1779033703,h1=3144134277,h2=1013904242,h3=2773480762,h4=1359893119,h5=2600822924,h6=528734635,h7=1541459225,w=new Array(64);blocks(m);var i,bytesLeft=m.length%64,bitLenHi=m.length/536870912|0,bitLenLo=m.length<<3,numZeros=bytesLeft<56?56:120,p=m.slice(m.length-bytesLeft,m.length);for(p.push(128),i=bytesLeft+1;i>>24&255),p.push(bitLenHi>>>16&255),p.push(bitLenHi>>>8&255),p.push(bitLenHi>>>0&255),p.push(bitLenLo>>>24&255),p.push(bitLenLo>>>16&255),p.push(bitLenLo>>>8&255),p.push(bitLenLo>>>0&255),blocks(p),[h0>>>24&255,h0>>>16&255,h0>>>8&255,h0>>>0&255,h1>>>24&255,h1>>>16&255,h1>>>8&255,h1>>>0&255,h2>>>24&255,h2>>>16&255,h2>>>8&255,h2>>>0&255,h3>>>24&255,h3>>>16&255,h3>>>8&255,h3>>>0&255,h4>>>24&255,h4>>>16&255,h4>>>8&255,h4>>>0&255,h5>>>24&255,h5>>>16&255,h5>>>8&255,h5>>>0&255,h6>>>24&255,h6>>>16&255,h6>>>8&255,h6>>>0&255,h7>>>24&255,h7>>>16&255,h7>>>8&255,h7>>>0&255]}function PBKDF2_HMAC_SHA256_OneIter(password,salt,dkLen){function incrementCounter(){for(var i=innerLen-1;i>=innerLen-4;i--){if(++inner[i]<=255)return;inner[i]=0}}password=password.length<=64?password:SHA256(password);var i,innerLen=64+salt.length+4,inner=new Array(innerLen),outerKey=new Array(64),dk=[];for(i=0;i<64;i++)inner[i]=54;for(i=0;i=32;)incrementCounter(),dk=dk.concat(SHA256(outerKey.concat(SHA256(inner)))),dkLen-=32;return dkLen>0&&(incrementCounter(),dk=dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0,dkLen))),dk}function salsaXOR(tmp,B,bin,bout){var u,i,j0=tmp[0]^B[bin++],j1=tmp[1]^B[bin++],j2=tmp[2]^B[bin++],j3=tmp[3]^B[bin++],j4=tmp[4]^B[bin++],j5=tmp[5]^B[bin++],j6=tmp[6]^B[bin++],j7=tmp[7]^B[bin++],j8=tmp[8]^B[bin++],j9=tmp[9]^B[bin++],j10=tmp[10]^B[bin++],j11=tmp[11]^B[bin++],j12=tmp[12]^B[bin++],j13=tmp[13]^B[bin++],j14=tmp[14]^B[bin++],j15=tmp[15]^B[bin++],x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15;for(i=0;i<8;i+=2)u=x0+x12,x4^=u<<7|u>>>25,u=x4+x0,x8^=u<<9|u>>>23,u=x8+x4,x12^=u<<13|u>>>19,u=x12+x8,x0^=u<<18|u>>>14,u=x5+x1,x9^=u<<7|u>>>25,u=x9+x5,x13^=u<<9|u>>>23,u=x13+x9,x1^=u<<13|u>>>19,u=x1+x13,x5^=u<<18|u>>>14,u=x10+x6,x14^=u<<7|u>>>25,u=x14+x10,x2^=u<<9|u>>>23,u=x2+x14,x6^=u<<13|u>>>19,u=x6+x2,x10^=u<<18|u>>>14,u=x15+x11,x3^=u<<7|u>>>25,u=x3+x15,x7^=u<<9|u>>>23,u=x7+x3,x11^=u<<13|u>>>19,u=x11+x7,x15^=u<<18|u>>>14,u=x0+x3,x1^=u<<7|u>>>25,u=x1+x0,x2^=u<<9|u>>>23,u=x2+x1,x3^=u<<13|u>>>19,u=x3+x2,x0^=u<<18|u>>>14,u=x5+x4,x6^=u<<7|u>>>25,u=x6+x5,x7^=u<<9|u>>>23,u=x7+x6,x4^=u<<13|u>>>19,u=x4+x7,x5^=u<<18|u>>>14,u=x10+x9,x11^=u<<7|u>>>25,u=x11+x10,x8^=u<<9|u>>>23,u=x8+x11,x9^=u<<13|u>>>19,u=x9+x8,x10^=u<<18|u>>>14,u=x15+x14,x12^=u<<7|u>>>25,u=x12+x15,x13^=u<<9|u>>>23,u=x13+x12,x14^=u<<13|u>>>19,u=x14+x13,x15^=u<<18|u>>>14;B[bout++]=tmp[0]=x0+j0|0,B[bout++]=tmp[1]=x1+j1|0,B[bout++]=tmp[2]=x2+j2|0,B[bout++]=tmp[3]=x3+j3|0,B[bout++]=tmp[4]=x4+j4|0,B[bout++]=tmp[5]=x5+j5|0,B[bout++]=tmp[6]=x6+j6|0,B[bout++]=tmp[7]=x7+j7|0,B[bout++]=tmp[8]=x8+j8|0,B[bout++]=tmp[9]=x9+j9|0,B[bout++]=tmp[10]=x10+j10|0,B[bout++]=tmp[11]=x11+j11|0,B[bout++]=tmp[12]=x12+j12|0,B[bout++]=tmp[13]=x13+j13|0,B[bout++]=tmp[14]=x14+j14|0,B[bout++]=tmp[15]=x15+j15|0}function blockCopy(dst,di,src,si,len){for(;len--;)dst[di++]=src[si++]}function blockXOR(dst,di,src,si,len){for(;len--;)dst[di++]^=src[si++]}function blockMix(tmp,B,bin,bout,r){blockCopy(tmp,0,B,bin+16*(2*r-1),16);for(var i=0;i<2*r;i+=2)salsaXOR(tmp,B,bin+16*i,bout+8*i),salsaXOR(tmp,B,bin+16*i+16,bout+8*i+16*r)}function integerify(B,bi,r){return B[bi+16*(2*r-1)]}function stringToUTF8Bytes(s){for(var arr=[],i=0;i127&&c<2048?(arr.push(c>>6|192),arr.push(63&c|128)):(arr.push(c>>12|224),arr.push(c>>6&63|128),arr.push(63&c|128))}return arr}function bytesToHex(p){for(var enc="0123456789abcdef".split(""),len=p.length,arr=[],i=0;i>>4&15]),arr.push(enc[p[i]>>>0&15]);return arr.join("")}function bytesToBase64(p){for(var a,b,c,t,enc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),len=p.length,arr=[],i=0;i>>18&63]),arr.push(enc[t>>>12&63]),arr.push(enc[t>>>6&63]),arr.push(enc[t>>>0&63]);return len%3>0&&(arr[arr.length-1]="=",len%3==1&&(arr[arr.length-2]="=")),arr.join("")}function smixStart(pos){for(var i=0;i<32*r;i++){var j=pos+4*i;XY[xi+i]=(255&B[j+3])<<24|(255&B[j+2])<<16|(255&B[j+1])<<8|(255&B[j+0])<<0}}function smixStep1(start,end){for(var i=start;i>>0&255,B[pos+4*i+1]=j>>>8&255,B[pos+4*i+2]=j>>>16&255,B[pos+4*i+3]=j>>>24&255}}function interruptedFor(start,end,step,fn,donefn){!function performStep(){nextTick(function(){fn(start,start+step4)throw new Error("scrypt: incorrect number of arguments");var opts=logN;if(callback=r,void 0===(logN=opts.logN)){if(void 0===opts.N)throw new Error("scrypt: missing N parameter");if(opts.N<2||opts.N>-1>>>0)throw new Error("scrypt: N is out of range");if(0!=(opts.N&opts.N-1))throw new Error("scrypt: N is not a power of 2");logN=Math.log(opts.N)/Math.LN2}p=opts.p||1,r=opts.r,dkLen=opts.dkLen||32,interruptStep=opts.interruptStep||0,encoding=opts.encoding}if(p<1)throw new Error("scrypt: invalid p");if(r<=0)throw new Error("scrypt: invalid r");if(logN<1||logN>31)throw new Error("scrypt: logN must be between 1 and 31");var XY,V,B,tmp,N=1<>>0;if(r*p>=1<<30||r>(-1>>>0)/128/p||r>(-1>>>0)/256||N>(-1>>>0)/128/r)throw new Error("scrypt: parameters are too large");"string"==typeof password&&(password=stringToUTF8Bytes(password)),"string"==typeof salt&&(salt=stringToUTF8Bytes(salt)),"undefined"!=typeof Int32Array?(XY=new Int32Array(64*r),V=new Int32Array(32*N*r),tmp=new Int32Array(16)):(XY=[],V=[],tmp=new Array(16)),B=PBKDF2_HMAC_SHA256_OneIter(password,salt,128*p*r);var xi=0,yi=32*r,nextTick="undefined"!=typeof setImmediate?setImmediate:setTimeout;"function"==typeof interruptStep&&(encoding=callback,callback=interruptStep,interruptStep=1e3),interruptStep<=0?function(){for(var i=0;i=y)throw RangeError(message)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":258}],317:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer,bip66=require("bip66"),EC_PRIVKEY_EXPORT_DER_COMPRESSED=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),ZERO_BUFFER_32=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);exports.privateKeyExport=function(privateKey,publicKey,compressed){var result=Buffer.from(compressed?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);return privateKey.copy(result,compressed?8:9),publicKey.copy(result,compressed?181:214),result},exports.privateKeyImport=function(privateKey){var length=privateKey.length,index=0;if(!(length2||length1?privateKey[index+lenb-2]<<8:0);if(index+=lenb,!(length32||length1&&0===r[posR]&&!(128&r[posR+1]);--lenR,++posR);for(var s=Buffer.concat([Buffer.from([0]),sigObj.s]),lenS=33,posS=0;lenS>1&&0===s[posS]&&!(128&s[posS+1]);--lenS,++posS);return bip66.encode(r.slice(posR),s.slice(posS))},exports.signatureImport=function(sig){var r=Buffer.from(ZERO_BUFFER_32),s=Buffer.from(ZERO_BUFFER_32);try{var sigObj=bip66.decode(sig);if(33===sigObj.r.length&&0===sigObj.r[0]&&(sigObj.r=sigObj.r.slice(1)),sigObj.r.length>32)throw new Error("R length is too long");if(33===sigObj.s.length&&0===sigObj.s[0]&&(sigObj.s=sigObj.s.slice(1)),sigObj.s.length>32)throw new Error("S length is too long")}catch(err){return}return sigObj.r.copy(r,32-sigObj.r.length),sigObj.s.copy(s,32-sigObj.s.length),{r:r,s:s}},exports.signatureImportLax=function(sig){var r=Buffer.from(ZERO_BUFFER_32),s=Buffer.from(ZERO_BUFFER_32),length=sig.length,index=0;if(48===sig[index++]){var lenbyte=sig[index++];if(!(128&lenbyte&&(index+=lenbyte-128)>length)&&2===sig[index++]){var rlen=sig[index++];if(128&rlen){if(lenbyte=rlen-128,index+lenbyte>length)return;for(;lenbyte>0&&0===sig[index];index+=1,lenbyte-=1);for(rlen=0;lenbyte>0;index+=1,lenbyte-=1)rlen=(rlen<<8)+sig[index]}if(!(rlen>length-index)){var rindex=index;if(index+=rlen,2===sig[index++]){var slen=sig[index++];if(128&slen){if(lenbyte=slen-128,index+lenbyte>length)return;for(;lenbyte>0&&0===sig[index];index+=1,lenbyte-=1);for(slen=0;lenbyte>0;index+=1,lenbyte-=1)slen=(slen<<8)+sig[index]}if(!(slen>length-index)){var sindex=index;for(index+=slen;rlen>0&&0===sig[rindex];rlen-=1,rindex+=1);if(!(rlen>32)){var rvalue=sig.slice(rindex,rindex+rlen);for(rvalue.copy(r,32-rvalue.length);slen>0&&0===sig[sindex];slen-=1,sindex+=1);if(!(slen>32)){var svalue=sig.slice(sindex,sindex+slen);return svalue.copy(s,32-svalue.length),{r:r,s:s}}}}}}}}}},{bip66:25,"safe-buffer":313}],318:[function(require,module,exports){"use strict";function loadCompressedPublicKey(first,xBuffer){var x=new BN(xBuffer);if(x.cmp(ecparams.p)>=0)return null;x=x.toRed(ecparams.red);var y=x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt();return 3===first!==y.isOdd()&&(y=y.redNeg()),ec.keyPair({pub:{x:x,y:y}})}function loadUncompressedPublicKey(first,xBuffer,yBuffer){var x=new BN(xBuffer),y=new BN(yBuffer);if(x.cmp(ecparams.p)>=0||y.cmp(ecparams.p)>=0)return null;if(x=x.toRed(ecparams.red),y=y.toRed(ecparams.red),(6===first||7===first)&&y.isOdd()!==(7===first))return null;var x3=x.redSqr().redIMul(x);return y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()?ec.keyPair({pub:{x:x,y:y}}):null}function loadPublicKey(publicKey){var first=publicKey[0];switch(first){case 2:case 3:return 33!==publicKey.length?null:loadCompressedPublicKey(first,publicKey.slice(1,33));case 4:case 6:case 7:return 65!==publicKey.length?null:loadUncompressedPublicKey(first,publicKey.slice(1,33),publicKey.slice(33,65));default:return null}}var Buffer=require("safe-buffer").Buffer,createHash=require("create-hash"),BN=require("bn.js"),EC=require("elliptic").ec,messages=require("../messages.json"),ec=new EC("secp256k1"),ecparams=ec.curve;exports.privateKeyVerify=function(privateKey){var bn=new BN(privateKey);return bn.cmp(ecparams.n)<0&&!bn.isZero()},exports.privateKeyExport=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,!0))},exports.privateKeyTweakAdd=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0)throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(bn.iadd(new BN(privateKey)),bn.cmp(ecparams.n)>=0&&bn.isub(ecparams.n),bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return bn.toArrayLike(Buffer,"be",32)},exports.privateKeyTweakMul=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0||bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return bn.imul(new BN(privateKey)),bn.cmp(ecparams.n)&&(bn=bn.umod(ecparams.n)),bn.toArrayLike(Buffer,"be",32)},exports.publicKeyCreate=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,!0))},exports.publicKeyConvert=function(publicKey,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return Buffer.from(pair.getPublic(compressed,!0))},exports.publicKeyVerify=function(publicKey){return null!==loadPublicKey(publicKey)},exports.publicKeyTweakAdd=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);if(tweak=new BN(tweak),tweak.cmp(ecparams.n)>=0)throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return Buffer.from(ecparams.g.mul(tweak).add(pair.pub).encode(!0,compressed))},exports.publicKeyTweakMul=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);if(tweak=new BN(tweak),tweak.cmp(ecparams.n)>=0||tweak.isZero())throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return Buffer.from(pair.pub.mul(tweak).encode(!0,compressed))},exports.publicKeyCombine=function(publicKeys,compressed){for(var pairs=new Array(publicKeys.length),i=0;i=0||s.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);var result=Buffer.from(signature);return 1===s.cmp(ec.nh)&&ecparams.n.sub(s).toArrayLike(Buffer,"be",32).copy(result,32),result},exports.signatureExport=function(signature){var r=signature.slice(0,32),s=signature.slice(32,64);if(new BN(r).cmp(ecparams.n)>=0||new BN(s).cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);return{r:r,s:s}},exports.signatureImport=function(sigObj){var r=new BN(sigObj.r);r.cmp(ecparams.n)>=0&&(r=new BN(0));var s=new BN(sigObj.s);return s.cmp(ecparams.n)>=0&&(s=new BN(0)),Buffer.concat([r.toArrayLike(Buffer,"be",32),s.toArrayLike(Buffer,"be",32)])},exports.sign=function(message,privateKey,noncefn,data){if("function"==typeof noncefn){var getNonce=noncefn;noncefn=function(counter){var nonce=getNonce(message,privateKey,null,data,counter);if(!Buffer.isBuffer(nonce)||32!==nonce.length)throw new Error(messages.ECDSA_SIGN_FAIL);return new BN(nonce)}}var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.ECDSA_SIGN_FAIL);var result=ec.sign(message,privateKey,{canonical:!0,k:noncefn,pers:data});return{signature:Buffer.concat([result.r.toArrayLike(Buffer,"be",32),result.s.toArrayLike(Buffer,"be",32)]),recovery:result.recoveryParam}},exports.verify=function(message,signature,publicKey){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)},sigr=new BN(sigObj.r),sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);if(1===sigs.cmp(ec.nh)||sigr.isZero()||sigs.isZero())return!1;var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(message,sigObj,{x:pair.pub.x,y:pair.pub.y})},exports.recover=function(message,signature,recovery,compressed){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)},sigr=new BN(sigObj.r),sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);try{if(sigr.isZero()||sigs.isZero())throw new Error;var point=ec.recoverPubKey(message,sigObj,recovery);return Buffer.from(point.encode(!0,compressed))}catch(err){throw new Error(messages.ECDSA_RECOVER_FAIL)}},exports.ecdh=function(publicKey,privateKey){var shared=exports.ecdhUnsafe(publicKey,privateKey,!0);return createHash("sha256").update(shared).digest()},exports.ecdhUnsafe=function(publicKey,privateKey,compressed){var pair=loadPublicKey(publicKey);if(null===pair)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);var scalar=new BN(privateKey);if(scalar.cmp(ecparams.n)>=0||scalar.isZero())throw new Error(messages.ECDH_FAIL);return Buffer.from(pair.pub.mul(scalar).encode(!0,compressed))}},{"../messages.json":320,"bn.js":99,"create-hash":169,elliptic:321,"safe-buffer":313}],319:[function(require,module,exports){"use strict";function initCompressedValue(value,defaultValue){return void 0===value?defaultValue:(assert.isBoolean(value,messages.COMPRESSED_TYPE_INVALID),value)}var assert=require("./assert"),der=require("./der"),messages=require("./messages.json");module.exports=function(secp256k1){return{privateKeyVerify:function(privateKey){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),32===privateKey.length&&secp256k1.privateKeyVerify(privateKey)},privateKeyExport:function(privateKey,compressed){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0);var publicKey=secp256k1.privateKeyExport(privateKey,compressed);return der.privateKeyExport(privateKey,publicKey,compressed)},privateKeyImport:function(privateKey){if(assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),(privateKey=der.privateKeyImport(privateKey))&&32===privateKey.length&&secp256k1.privateKeyVerify(privateKey))return privateKey;throw new Error(messages.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyTweakAdd:function(privateKey,tweak){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),secp256k1.privateKeyTweakAdd(privateKey,tweak)},privateKeyTweakMul:function(privateKey,tweak){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID), +assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),secp256k1.privateKeyTweakMul(privateKey,tweak)},publicKeyCreate:function(privateKey,compressed){return assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID),assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyCreate(privateKey,compressed)},publicKeyConvert:function(publicKey,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyConvert(publicKey,compressed)},publicKeyVerify:function(publicKey){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),secp256k1.publicKeyVerify(publicKey)},publicKeyTweakAdd:function(publicKey,tweak,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyTweakAdd(publicKey,tweak,compressed)},publicKeyTweakMul:function(publicKey,tweak,compressed){return assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID),assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID),assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID),assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID),compressed=initCompressedValue(compressed,!0),secp256k1.publicKeyTweakMul(publicKey,tweak,compressed)},publicKeyCombine:function(publicKeys,compressed){assert.isArray(publicKeys,messages.EC_PUBLIC_KEYS_TYPE_INVALID),assert.isLengthGTZero(publicKeys,messages.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=this._finalSize&&(this._update(this._block),this._block.fill(0));var bits=8*this._len;if(bits<=4294967295)this._block.writeUInt32BE(bits,this._blockSize-4);else{var lowBits=4294967295&bits,highBits=(bits-lowBits)/4294967296;this._block.writeUInt32BE(highBits,this._blockSize-8),this._block.writeUInt32BE(lowBits,this._blockSize-4)}this._update(this._block);var hash=this._hash();return enc?hash.toString(enc):hash},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},module.exports=Hash},{"safe-buffer":313}],338:[function(require,module,exports){"use strict";var _exports=module.exports=function(algorithm){algorithm=algorithm.toLowerCase();var Algorithm=_exports[algorithm];if(!Algorithm)throw new Error(algorithm+" is not supported (we accept pull requests)");return new Algorithm};_exports.sha=require("./sha"),_exports.sha1=require("./sha1"),_exports.sha224=require("./sha224"),_exports.sha256=require("./sha256"),_exports.sha384=require("./sha384"),_exports.sha512=require("./sha512")},{"./sha":339,"./sha1":340,"./sha224":341,"./sha256":342,"./sha384":343,"./sha512":344}],339:[function(require,module,exports){"use strict";function Sha(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);inherits(Sha,Hash),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=W[i-3]^W[i-8]^W[i-14]^W[i-16];for(var j=0;j<80;++j){var s=~~(j/20),t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha},{"./hash":337,inherits:257,"safe-buffer":313}],340:[function(require,module,exports){"use strict";function Sha1(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl1(num){return num<<1|num>>>31}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);inherits(Sha1,Hash),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=rotl1(W[i-3]^W[i-8]^W[i-14]^W[i-16]);for(var j=0;j<80;++j){var s=~~(j/20),t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha1.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha1},{"./hash":337,inherits:257,"safe-buffer":313}],341:[function(require,module,exports){"use strict";function Sha224(){this.init(),this._w=W,Hash.call(this,64,56)}var inherits=require("inherits"),Sha256=require("./sha256"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(64);inherits(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var H=Buffer.allocUnsafe(28);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H},module.exports=Sha224},{"./hash":337,"./sha256":342,inherits:257,"safe-buffer":313}],342:[function(require,module,exports){"use strict";function Sha256(){this.init(),this._w=W,Hash.call(this,64,56)}function ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x){return(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10)}function sigma1(x){return(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7)}function gamma0(x){return(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3}function gamma1(x){return(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,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],W=new Array(64);inherits(Sha256,Hash),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(M){for(var W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,f=0|this._f,g=0|this._g,h=0|this._h,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<64;++i)W[i]=gamma1(W[i-2])+W[i-7]+gamma0(W[i-15])+W[i-16]|0;for(var j=0;j<64;++j){var T1=h+sigma1(e)+ch(e,f,g)+K[j]+W[j]|0,T2=sigma0(a)+maj(a,b,c)|0;h=g,g=f,f=e,e=d+T1|0,d=c,c=b,b=a,a=T1+T2|0}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0,this._f=f+this._f|0,this._g=g+this._g|0,this._h=h+this._h|0},Sha256.prototype._hash=function(){var H=Buffer.allocUnsafe(32);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H.writeInt32BE(this._h,28),H},module.exports=Sha256},{"./hash":337,inherits:257,"safe-buffer":313}],343:[function(require,module,exports){"use strict";function Sha384(){this.init(),this._w=W,Hash.call(this,128,112)}var inherits=require("inherits"),SHA512=require("./sha512"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(160);inherits(Sha384,SHA512),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}var H=Buffer.allocUnsafe(48);return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),H},module.exports=Sha384},{"./hash":337,"./sha512":344,inherits:257,"safe-buffer":313}],344:[function(require,module,exports){"use strict";function Sha512(){this.init(),this._w=W,Hash.call(this,128,112)}function Ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x,xl){return(x>>>28|xl<<4)^(xl>>>2|x<<30)^(xl>>>7|x<<25)}function sigma1(x,xl){return(x>>>14|xl<<18)^(x>>>18|xl<<14)^(xl>>>9|x<<23)}function Gamma0(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^x>>>7}function Gamma0l(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^(x>>>7|xl<<25)}function Gamma1(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^x>>>6}function Gamma1l(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^(x>>>6|xl<<26)}function getCarry(a,b){return a>>>0>>0?1:0}var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W=new Array(160);inherits(Sha512,Hash),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(M){for(var W=this._w,ah=0|this._ah,bh=0|this._bh,ch=0|this._ch,dh=0|this._dh,eh=0|this._eh,fh=0|this._fh,gh=0|this._gh,hh=0|this._hh,al=0|this._al,bl=0|this._bl,cl=0|this._cl,dl=0|this._dl,el=0|this._el,fl=0|this._fl,gl=0|this._gl,hl=0|this._hl,i=0;i<32;i+=2)W[i]=M.readInt32BE(4*i),W[i+1]=M.readInt32BE(4*i+4);for(;i<160;i+=2){var xh=W[i-30],xl=W[i-30+1],gamma0=Gamma0(xh,xl),gamma0l=Gamma0l(xl,xh);xh=W[i-4],xl=W[i-4+1];var gamma1=Gamma1(xh,xl),gamma1l=Gamma1l(xl,xh),Wi7h=W[i-14],Wi7l=W[i-14+1],Wi16h=W[i-32],Wi16l=W[i-32+1],Wil=gamma0l+Wi7l|0,Wih=gamma0+Wi7h+getCarry(Wil,gamma0l)|0;Wil=Wil+gamma1l|0,Wih=Wih+gamma1+getCarry(Wil,gamma1l)|0,Wil=Wil+Wi16l|0,Wih=Wih+Wi16h+getCarry(Wil,Wi16l)|0,W[i]=Wih,W[i+1]=Wil}for(var j=0;j<160;j+=2){Wih=W[j],Wil=W[j+1];var majh=maj(ah,bh,ch),majl=maj(al,bl,cl),sigma0h=sigma0(ah,al),sigma0l=sigma0(al,ah),sigma1h=sigma1(eh,el),sigma1l=sigma1(el,eh),Kih=K[j],Kil=K[j+1],chh=Ch(eh,fh,gh),chl=Ch(el,fl,gl),t1l=hl+sigma1l|0,t1h=hh+sigma1h+getCarry(t1l,hl)|0;t1l=t1l+chl|0,t1h=t1h+chh+getCarry(t1l,chl)|0,t1l=t1l+Kil|0,t1h=t1h+Kih+getCarry(t1l,Kil)|0,t1l=t1l+Wil|0,t1h=t1h+Wih+getCarry(t1l,Wil)|0;var t2l=sigma0l+majl|0,t2h=sigma0h+majh+getCarry(t2l,sigma0l)|0;hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,el=dl+t1l|0,eh=dh+t1h+getCarry(el,dl)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,al=t1l+t2l|0,ah=t1h+t2h+getCarry(al,t1l)|0}this._al=this._al+al|0,this._bl=this._bl+bl|0,this._cl=this._cl+cl|0,this._dl=this._dl+dl|0,this._el=this._el+el|0,this._fl=this._fl+fl|0,this._gl=this._gl+gl|0,this._hl=this._hl+hl|0,this._ah=this._ah+ah+getCarry(this._al,al)|0,this._bh=this._bh+bh+getCarry(this._bl,bl)|0,this._ch=this._ch+ch+getCarry(this._cl,cl)|0,this._dh=this._dh+dh+getCarry(this._dl,dl)|0,this._eh=this._eh+eh+getCarry(this._el,el)|0,this._fh=this._fh+fh+getCarry(this._fl,fl)|0,this._gh=this._gh+gh+getCarry(this._gl,gl)|0,this._hh=this._hh+hh+getCarry(this._hl,hl)|0},Sha512.prototype._hash=function(){function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}var H=Buffer.allocUnsafe(64);return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),H},module.exports=Sha512},{"./hash":337,inherits:257,"safe-buffer":313}],345:[function(require,module,exports){"use strict";function Stream(){EE.call(this)}module.exports=Stream;var EE=require("events").EventEmitter;require("inherits")(Stream,EE),Stream.Readable=require("readable-stream/readable.js"),Stream.Writable=require("readable-stream/writable.js"),Stream.Duplex=require("readable-stream/duplex.js"),Stream.Transform=require("readable-stream/transform.js"),Stream.PassThrough=require("readable-stream/passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(dest,options){function ondata(chunk){dest.writable&&!1===dest.write(chunk)&&source.pause&&source.pause()}function ondrain(){source.readable&&source.resume&&source.resume()}function onend(){didOnEnd||(didOnEnd=!0,dest.end())}function onclose(){didOnEnd||(didOnEnd=!0,"function"==typeof dest.destroy&&dest.destroy())}function onerror(er){if(cleanup(),0===EE.listenerCount(this,"error"))throw er}function cleanup(){source.removeListener("data",ondata),dest.removeListener("drain",ondrain),source.removeListener("end",onend),source.removeListener("close",onclose),source.removeListener("error",onerror),dest.removeListener("error",onerror),source.removeListener("end",cleanup),source.removeListener("close",cleanup),dest.removeListener("close",cleanup)}var source=this;source.on("data",ondata),dest.on("drain",ondrain),dest._isStdio||options&&!1===options.end||(source.on("end",onend),source.on("close",onclose));var didOnEnd=!1;return source.on("error",onerror),dest.on("error",onerror),source.on("end",cleanup),source.on("close",cleanup),dest.on("close",cleanup),dest.emit("pipe",source),dest}},{events:238,inherits:257,"readable-stream/duplex.js":297,"readable-stream/passthrough.js":307,"readable-stream/readable.js":308,"readable-stream/transform.js":309,"readable-stream/writable.js":310}],346:[function(require,module,exports){"use strict";function _normalizeEncoding(enc){if(!enc)return"utf8";for(var retried;;)switch(enc){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 enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if("string"!=typeof nenc&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(nb)}function utf8CheckByte(byte){return byte<=127?0:byte>>5==6?2:byte>>4==14?3:byte>>3==30?4:-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0?(nb>0&&(self.lastNeed=nb-1),nb):--j=0?(nb>0&&(self.lastNeed=nb-2),nb):--j=0?(nb>0&&(2===nb?nb=0:self.lastNeed=nb-3),nb):0)}function utf8CheckExtraBytes(self,buf,p){if(128!=(192&buf[0]))return self.lastNeed=0,"�".repeat(p);if(self.lastNeed>1&&buf.length>1){if(128!=(192&buf[1]))return self.lastNeed=1,"�".repeat(p+1);if(self.lastNeed>2&&buf.length>2&&128!=(192&buf[2]))return self.lastNeed=2,"�".repeat(p+2)}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);return void 0!==r?r:this.lastNeed<=buf.length?(buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(buf.copy(this.lastChar,p,0,buf.length),void(this.lastNeed-=buf.length))}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"�".repeat(this.lastTotal-this.lastNeed):r}function utf16Text(buf,i){if((buf.length-i)%2==0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;return 0===n?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(encoding){switch((encoding=""+encoding)&&encoding.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}};exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(buf){if(0===buf.length)return"" +;var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(buf)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i>24&255,x[i+1]=h>>16&255,x[i+2]=h>>8&255,x[i+3]=255&h,x[i+4]=l>>24&255,x[i+5]=l>>16&255,x[i+6]=l>>8&255,x[i+7]=255&l}function vn(x,xi,y,yi,n){var i,d=0;for(i=0;i>>8)-1}function crypto_verify_16(x,xi,y,yi){return vn(x,xi,y,yi,16)}function crypto_verify_32(x,xi,y,yi){return vn(x,xi,y,yi,32)}function core_salsa20(o,p,k,c){for(var u,j0=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,j1=255&k[0]|(255&k[1])<<8|(255&k[2])<<16|(255&k[3])<<24,j2=255&k[4]|(255&k[5])<<8|(255&k[6])<<16|(255&k[7])<<24,j3=255&k[8]|(255&k[9])<<8|(255&k[10])<<16|(255&k[11])<<24,j4=255&k[12]|(255&k[13])<<8|(255&k[14])<<16|(255&k[15])<<24,j5=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,j6=255&p[0]|(255&p[1])<<8|(255&p[2])<<16|(255&p[3])<<24,j7=255&p[4]|(255&p[5])<<8|(255&p[6])<<16|(255&p[7])<<24,j8=255&p[8]|(255&p[9])<<8|(255&p[10])<<16|(255&p[11])<<24,j9=255&p[12]|(255&p[13])<<8|(255&p[14])<<16|(255&p[15])<<24,j10=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,j11=255&k[16]|(255&k[17])<<8|(255&k[18])<<16|(255&k[19])<<24,j12=255&k[20]|(255&k[21])<<8|(255&k[22])<<16|(255&k[23])<<24,j13=255&k[24]|(255&k[25])<<8|(255&k[26])<<16|(255&k[27])<<24,j14=255&k[28]|(255&k[29])<<8|(255&k[30])<<16|(255&k[31])<<24,j15=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;x0=x0+j0|0,x1=x1+j1|0,x2=x2+j2|0,x3=x3+j3|0,x4=x4+j4|0,x5=x5+j5|0,x6=x6+j6|0,x7=x7+j7|0,x8=x8+j8|0,x9=x9+j9|0,x10=x10+j10|0,x11=x11+j11|0,x12=x12+j12|0,x13=x13+j13|0,x14=x14+j14|0,x15=x15+j15|0,o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x1>>>0&255,o[5]=x1>>>8&255,o[6]=x1>>>16&255,o[7]=x1>>>24&255,o[8]=x2>>>0&255,o[9]=x2>>>8&255,o[10]=x2>>>16&255,o[11]=x2>>>24&255,o[12]=x3>>>0&255,o[13]=x3>>>8&255,o[14]=x3>>>16&255,o[15]=x3>>>24&255,o[16]=x4>>>0&255,o[17]=x4>>>8&255,o[18]=x4>>>16&255,o[19]=x4>>>24&255,o[20]=x5>>>0&255,o[21]=x5>>>8&255,o[22]=x5>>>16&255,o[23]=x5>>>24&255,o[24]=x6>>>0&255,o[25]=x6>>>8&255,o[26]=x6>>>16&255,o[27]=x6>>>24&255,o[28]=x7>>>0&255,o[29]=x7>>>8&255,o[30]=x7>>>16&255,o[31]=x7>>>24&255,o[32]=x8>>>0&255,o[33]=x8>>>8&255,o[34]=x8>>>16&255,o[35]=x8>>>24&255,o[36]=x9>>>0&255,o[37]=x9>>>8&255,o[38]=x9>>>16&255,o[39]=x9>>>24&255,o[40]=x10>>>0&255,o[41]=x10>>>8&255,o[42]=x10>>>16&255,o[43]=x10>>>24&255,o[44]=x11>>>0&255,o[45]=x11>>>8&255,o[46]=x11>>>16&255,o[47]=x11>>>24&255,o[48]=x12>>>0&255,o[49]=x12>>>8&255,o[50]=x12>>>16&255,o[51]=x12>>>24&255,o[52]=x13>>>0&255,o[53]=x13>>>8&255,o[54]=x13>>>16&255,o[55]=x13>>>24&255,o[56]=x14>>>0&255,o[57]=x14>>>8&255,o[58]=x14>>>16&255,o[59]=x14>>>24&255,o[60]=x15>>>0&255,o[61]=x15>>>8&255,o[62]=x15>>>16&255,o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){for(var u,j0=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,j1=255&k[0]|(255&k[1])<<8|(255&k[2])<<16|(255&k[3])<<24,j2=255&k[4]|(255&k[5])<<8|(255&k[6])<<16|(255&k[7])<<24,j3=255&k[8]|(255&k[9])<<8|(255&k[10])<<16|(255&k[11])<<24,j4=255&k[12]|(255&k[13])<<8|(255&k[14])<<16|(255&k[15])<<24,j5=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,j6=255&p[0]|(255&p[1])<<8|(255&p[2])<<16|(255&p[3])<<24,j7=255&p[4]|(255&p[5])<<8|(255&p[6])<<16|(255&p[7])<<24,j8=255&p[8]|(255&p[9])<<8|(255&p[10])<<16|(255&p[11])<<24,j9=255&p[12]|(255&p[13])<<8|(255&p[14])<<16|(255&p[15])<<24,j10=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,j11=255&k[16]|(255&k[17])<<8|(255&k[18])<<16|(255&k[19])<<24,j12=255&k[20]|(255&k[21])<<8|(255&k[22])<<16|(255&k[23])<<24,j13=255&k[24]|(255&k[25])<<8|(255&k[26])<<16|(255&k[27])<<24,j14=255&k[28]|(255&k[29])<<8|(255&k[30])<<16|(255&k[31])<<24,j15=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x5>>>0&255,o[5]=x5>>>8&255,o[6]=x5>>>16&255,o[7]=x5>>>24&255,o[8]=x10>>>0&255,o[9]=x10>>>8&255,o[10]=x10>>>16&255,o[11]=x10>>>24&255,o[12]=x15>>>0&255,o[13]=x15>>>8&255,o[14]=x15>>>16&255,o[15]=x15>>>24&255,o[16]=x6>>>0&255,o[17]=x6>>>8&255,o[18]=x6>>>16&255,o[19]=x6>>>24&255,o[20]=x7>>>0&255,o[21]=x7>>>8&255,o[22]=x7>>>16&255,o[23]=x7>>>24&255,o[24]=x8>>>0&255,o[25]=x8>>>8&255,o[26]=x8>>>16&255,o[27]=x8>>>24&255,o[28]=x9>>>0&255,o[29]=x9>>>8&255,o[30]=x9>>>16&255,o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var u,i,z=new Uint8Array(16),x=new Uint8Array(64);for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];for(;b>=64;){for(crypto_core_salsa20(x,z,k,sigma),i=0;i<64;i++)c[cpos+i]=m[mpos+i]^x[i];for(u=1,i=8;i<16;i++)u=u+(255&z[i])|0,z[i]=255&u,u>>>=8;b-=64,cpos+=64,mpos+=64}if(b>0)for(crypto_core_salsa20(x,z,k,sigma),i=0;i=64;){for(crypto_core_salsa20(x,z,k,sigma),i=0;i<64;i++)c[cpos+i]=x[i];for(u=1,i=8;i<16;i++)u=u+(255&z[i])|0,z[i]=255&u,u>>>=8;b-=64,cpos+=64}if(b>0)for(crypto_core_salsa20(x,z,k,sigma),i=0;i>16&1),m[i-1]&=65535;m[15]=t[15]-32767-(m[14]>>16&1),b=m[15]>>16&1,m[14]&=65535,sel25519(t,m,1-b)}for(i=0;i<16;i++)o[2*i]=255&t[i],o[2*i+1]=t[i]>>8}function neq25519(a,b){var c=new Uint8Array(32),d=new Uint8Array(32);return pack25519(c,a),pack25519(d,b),crypto_verify_32(c,0,d,0)}function par25519(a){var d=new Uint8Array(32);return pack25519(d,a),1&d[0]}function unpack25519(o,n){var i;for(i=0;i<16;i++)o[i]=n[2*i]+(n[2*i+1]<<8);o[15]&=32767}function A(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]+b[i]}function Z(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]-b[i]}function M(o,a,b){var v,c,t0=0,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,t9=0,t10=0,t11=0,t12=0,t13=0,t14=0,t15=0,t16=0,t17=0,t18=0,t19=0,t20=0,t21=0,t22=0,t23=0,t24=0,t25=0,t26=0,t27=0,t28=0,t29=0,t30=0,b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];v=a[0],t0+=v*b0,t1+=v*b1,t2+=v*b2,t3+=v*b3,t4+=v*b4,t5+=v*b5,t6+=v*b6,t7+=v*b7,t8+=v*b8,t9+=v*b9,t10+=v*b10,t11+=v*b11,t12+=v*b12,t13+=v*b13,t14+=v*b14,t15+=v*b15,v=a[1],t1+=v*b0,t2+=v*b1,t3+=v*b2,t4+=v*b3,t5+=v*b4,t6+=v*b5,t7+=v*b6,t8+=v*b7,t9+=v*b8,t10+=v*b9,t11+=v*b10,t12+=v*b11,t13+=v*b12,t14+=v*b13,t15+=v*b14,t16+=v*b15,v=a[2],t2+=v*b0,t3+=v*b1,t4+=v*b2,t5+=v*b3,t6+=v*b4,t7+=v*b5,t8+=v*b6,t9+=v*b7,t10+=v*b8,t11+=v*b9,t12+=v*b10,t13+=v*b11,t14+=v*b12,t15+=v*b13,t16+=v*b14,t17+=v*b15,v=a[3],t3+=v*b0,t4+=v*b1,t5+=v*b2,t6+=v*b3,t7+=v*b4,t8+=v*b5,t9+=v*b6,t10+=v*b7,t11+=v*b8,t12+=v*b9,t13+=v*b10,t14+=v*b11,t15+=v*b12,t16+=v*b13,t17+=v*b14,t18+=v*b15,v=a[4],t4+=v*b0,t5+=v*b1,t6+=v*b2,t7+=v*b3,t8+=v*b4,t9+=v*b5,t10+=v*b6,t11+=v*b7,t12+=v*b8,t13+=v*b9,t14+=v*b10,t15+=v*b11,t16+=v*b12,t17+=v*b13,t18+=v*b14,t19+=v*b15,v=a[5],t5+=v*b0,t6+=v*b1,t7+=v*b2,t8+=v*b3,t9+=v*b4,t10+=v*b5,t11+=v*b6,t12+=v*b7,t13+=v*b8,t14+=v*b9,t15+=v*b10,t16+=v*b11,t17+=v*b12,t18+=v*b13,t19+=v*b14,t20+=v*b15,v=a[6],t6+=v*b0,t7+=v*b1,t8+=v*b2,t9+=v*b3,t10+=v*b4,t11+=v*b5,t12+=v*b6,t13+=v*b7,t14+=v*b8,t15+=v*b9,t16+=v*b10,t17+=v*b11,t18+=v*b12,t19+=v*b13,t20+=v*b14,t21+=v*b15,v=a[7],t7+=v*b0,t8+=v*b1,t9+=v*b2,t10+=v*b3,t11+=v*b4,t12+=v*b5,t13+=v*b6,t14+=v*b7,t15+=v*b8,t16+=v*b9,t17+=v*b10,t18+=v*b11,t19+=v*b12,t20+=v*b13,t21+=v*b14,t22+=v*b15,v=a[8],t8+=v*b0,t9+=v*b1,t10+=v*b2,t11+=v*b3,t12+=v*b4,t13+=v*b5,t14+=v*b6,t15+=v*b7,t16+=v*b8,t17+=v*b9,t18+=v*b10,t19+=v*b11,t20+=v*b12,t21+=v*b13,t22+=v*b14,t23+=v*b15,v=a[9],t9+=v*b0,t10+=v*b1,t11+=v*b2,t12+=v*b3,t13+=v*b4,t14+=v*b5,t15+=v*b6,t16+=v*b7,t17+=v*b8,t18+=v*b9,t19+=v*b10,t20+=v*b11,t21+=v*b12,t22+=v*b13,t23+=v*b14,t24+=v*b15,v=a[10],t10+=v*b0,t11+=v*b1,t12+=v*b2,t13+=v*b3,t14+=v*b4,t15+=v*b5,t16+=v*b6,t17+=v*b7,t18+=v*b8,t19+=v*b9,t20+=v*b10,t21+=v*b11,t22+=v*b12,t23+=v*b13,t24+=v*b14,t25+=v*b15,v=a[11],t11+=v*b0,t12+=v*b1,t13+=v*b2,t14+=v*b3,t15+=v*b4,t16+=v*b5,t17+=v*b6,t18+=v*b7,t19+=v*b8,t20+=v*b9,t21+=v*b10,t22+=v*b11;t23+=v*b12,t24+=v*b13,t25+=v*b14,t26+=v*b15,v=a[12],t12+=v*b0,t13+=v*b1,t14+=v*b2,t15+=v*b3,t16+=v*b4,t17+=v*b5,t18+=v*b6,t19+=v*b7,t20+=v*b8,t21+=v*b9,t22+=v*b10,t23+=v*b11,t24+=v*b12,t25+=v*b13,t26+=v*b14,t27+=v*b15,v=a[13],t13+=v*b0,t14+=v*b1,t15+=v*b2,t16+=v*b3,t17+=v*b4,t18+=v*b5,t19+=v*b6,t20+=v*b7,t21+=v*b8,t22+=v*b9,t23+=v*b10,t24+=v*b11,t25+=v*b12,t26+=v*b13,t27+=v*b14,t28+=v*b15,v=a[14],t14+=v*b0,t15+=v*b1,t16+=v*b2,t17+=v*b3,t18+=v*b4,t19+=v*b5,t20+=v*b6,t21+=v*b7,t22+=v*b8,t23+=v*b9,t24+=v*b10,t25+=v*b11,t26+=v*b12,t27+=v*b13,t28+=v*b14,t29+=v*b15,v=a[15],t15+=v*b0,t16+=v*b1,t17+=v*b2,t18+=v*b3,t19+=v*b4,t20+=v*b5,t21+=v*b6,t22+=v*b7,t23+=v*b8,t24+=v*b9,t25+=v*b10,t26+=v*b11,t27+=v*b12,t28+=v*b13,t29+=v*b14,t30+=v*b15,t0+=38*t16,t1+=38*t17,t2+=38*t18,t3+=38*t19,t4+=38*t20,t5+=38*t21,t6+=38*t22,t7+=38*t23,t8+=38*t24,t9+=38*t25,t10+=38*t26,t11+=38*t27,t12+=38*t28,t13+=38*t29,t14+=38*t30,c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-65536*c,v=t1+c+65535,c=Math.floor(v/65536),t1=v-65536*c,v=t2+c+65535,c=Math.floor(v/65536),t2=v-65536*c,v=t3+c+65535,c=Math.floor(v/65536),t3=v-65536*c,v=t4+c+65535,c=Math.floor(v/65536),t4=v-65536*c,v=t5+c+65535,c=Math.floor(v/65536),t5=v-65536*c,v=t6+c+65535,c=Math.floor(v/65536),t6=v-65536*c,v=t7+c+65535,c=Math.floor(v/65536),t7=v-65536*c,v=t8+c+65535,c=Math.floor(v/65536),t8=v-65536*c,v=t9+c+65535,c=Math.floor(v/65536),t9=v-65536*c,v=t10+c+65535,c=Math.floor(v/65536),t10=v-65536*c,v=t11+c+65535,c=Math.floor(v/65536),t11=v-65536*c,v=t12+c+65535,c=Math.floor(v/65536),t12=v-65536*c,v=t13+c+65535,c=Math.floor(v/65536),t13=v-65536*c,v=t14+c+65535,c=Math.floor(v/65536),t14=v-65536*c,v=t15+c+65535,c=Math.floor(v/65536),t15=v-65536*c,t0+=c-1+37*(c-1),c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-65536*c,v=t1+c+65535,c=Math.floor(v/65536),t1=v-65536*c,v=t2+c+65535,c=Math.floor(v/65536),t2=v-65536*c,v=t3+c+65535,c=Math.floor(v/65536),t3=v-65536*c,v=t4+c+65535,c=Math.floor(v/65536),t4=v-65536*c,v=t5+c+65535,c=Math.floor(v/65536),t5=v-65536*c,v=t6+c+65535,c=Math.floor(v/65536),t6=v-65536*c,v=t7+c+65535,c=Math.floor(v/65536),t7=v-65536*c,v=t8+c+65535,c=Math.floor(v/65536),t8=v-65536*c,v=t9+c+65535,c=Math.floor(v/65536),t9=v-65536*c,v=t10+c+65535,c=Math.floor(v/65536),t10=v-65536*c,v=t11+c+65535,c=Math.floor(v/65536),t11=v-65536*c,v=t12+c+65535,c=Math.floor(v/65536),t12=v-65536*c,v=t13+c+65535,c=Math.floor(v/65536),t13=v-65536*c,v=t14+c+65535,c=Math.floor(v/65536),t14=v-65536*c,v=t15+c+65535,c=Math.floor(v/65536),t15=v-65536*c,t0+=c-1+37*(c-1),o[0]=t0,o[1]=t1,o[2]=t2,o[3]=t3,o[4]=t4,o[5]=t5,o[6]=t6,o[7]=t7,o[8]=t8,o[9]=t9,o[10]=t10,o[11]=t11,o[12]=t12;o[13]=t13,o[14]=t14,o[15]=t15}function S(o,a){M(o,a,a)}function inv25519(o,i){var a,c=gf();for(a=0;a<16;a++)c[a]=i[a];for(a=253;a>=0;a--)S(c,c),2!==a&&4!==a&&M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function pow2523(o,i){var a,c=gf();for(a=0;a<16;a++)c[a]=i[a];for(a=250;a>=0;a--)S(c,c),1!==a&&M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function crypto_scalarmult(q,n,p){var r,i,z=new Uint8Array(32),x=new Float64Array(80),a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf();for(i=0;i<31;i++)z[i]=n[i];for(z[31]=127&n[31]|64,z[0]&=248,unpack25519(x,p),i=0;i<16;i++)b[i]=x[i],d[i]=a[i]=c[i]=0;for(a[0]=d[0]=1,i=254;i>=0;--i)r=z[i>>>3]>>>(7&i)&1,sel25519(a,b,r),sel25519(c,d,r),A(e,a,c),Z(a,a,c),A(c,b,d),Z(b,b,d),S(d,e),S(f,a),M(a,c,a),M(c,b,e),A(e,a,c),Z(a,a,c),S(b,a),Z(c,d,f),M(a,c,_121665),A(a,a,d),M(c,c,a),M(a,d,f),M(d,b,x),S(b,e),sel25519(a,b,r),sel25519(c,d,r);for(i=0;i<16;i++)x[i+16]=a[i],x[i+32]=c[i],x[i+48]=b[i],x[i+64]=d[i];var x32=x.subarray(32),x16=x.subarray(16);return inv25519(x32,x32),M(x16,x16,x32),pack25519(q,x16),0}function crypto_scalarmult_base(q,n){return crypto_scalarmult(q,n,_9)}function crypto_box_keypair(y,x){return randombytes(x,32),crypto_scalarmult_base(y,x)}function crypto_box_beforenm(k,y,x){var s=new Uint8Array(32);return crypto_scalarmult(s,x,y),crypto_core_hsalsa20(k,_0,s,sigma)}function crypto_box(c,m,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_afternm(c,m,d,n,k)}function crypto_box_open(m,c,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_open_afternm(m,c,d,n,k)}function crypto_hashblocks_hl(hh,hl,m,n){for(var bh0,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bl0,bl1,bl2,bl3,bl4,bl5,bl6,bl7,th,tl,i,j,h,l,a,b,c,d,wh=new Int32Array(16),wl=new Int32Array(16),ah0=hh[0],ah1=hh[1],ah2=hh[2],ah3=hh[3],ah4=hh[4],ah5=hh[5],ah6=hh[6],ah7=hh[7],al0=hl[0],al1=hl[1],al2=hl[2],al3=hl[3],al4=hl[4],al5=hl[5],al6=hl[6],al7=hl[7],pos=0;n>=128;){for(i=0;i<16;i++)j=8*i+pos,wh[i]=m[j+0]<<24|m[j+1]<<16|m[j+2]<<8|m[j+3],wl[i]=m[j+4]<<24|m[j+5]<<16|m[j+6]<<8|m[j+7];for(i=0;i<80;i++)if(bh0=ah0,bh1=ah1,bh2=ah2,bh3=ah3,bh4=ah4,bh5=ah5,bh6=ah6,bh7=ah7,bl0=al0,bl1=al1,bl2=al2,bl3=al3,bl4=al4,bl5=al5,bl6=al6,bl7=al7,h=ah7,l=al7,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=(ah4>>>14|al4<<18)^(ah4>>>18|al4<<14)^(al4>>>9|ah4<<23),l=(al4>>>14|ah4<<18)^(al4>>>18|ah4<<14)^(ah4>>>9|al4<<23),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=ah4&ah5^~ah4&ah6,l=al4&al5^~al4&al6,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=K[2*i],l=K[2*i+1],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=wh[i%16],l=wl[i%16],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,th=65535&c|d<<16,tl=65535&a|b<<16,h=th,l=tl,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=(ah0>>>28|al0<<4)^(al0>>>2|ah0<<30)^(al0>>>7|ah0<<25),l=(al0>>>28|ah0<<4)^(ah0>>>2|al0<<30)^(ah0>>>7|al0<<25),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,h=ah0&ah1^ah0&ah2^ah1&ah2,l=al0&al1^al0&al2^al1&al2,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh7=65535&c|d<<16,bl7=65535&a|b<<16,h=bh3,l=bl3,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=th,l=tl,a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh3=65535&c|d<<16,bl3=65535&a|b<<16,ah1=bh0,ah2=bh1,ah3=bh2,ah4=bh3,ah5=bh4,ah6=bh5,ah7=bh6,ah0=bh7,al1=bl0,al2=bl1,al3=bl2,al4=bl3,al5=bl4,al6=bl5,al7=bl6,al0=bl7,i%16==15)for(j=0;j<16;j++)h=wh[j],l=wl[j],a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=wh[(j+9)%16],l=wl[(j+9)%16],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,th=wh[(j+1)%16],tl=wl[(j+1)%16],h=(th>>>1|tl<<31)^(th>>>8|tl<<24)^th>>>7,l=(tl>>>1|th<<31)^(tl>>>8|th<<24)^(tl>>>7|th<<25),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,th=wh[(j+14)%16],tl=wl[(j+14)%16],h=(th>>>19|tl<<13)^(tl>>>29|th<<3)^th>>>6,l=(tl>>>19|th<<13)^(th>>>29|tl<<3)^(tl>>>6|th<<26),a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,wh[j]=65535&c|d<<16,wl[j]=65535&a|b<<16;h=ah0,l=al0,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[0],l=hl[0],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[0]=ah0=65535&c|d<<16,hl[0]=al0=65535&a|b<<16,h=ah1,l=al1,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[1],l=hl[1],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[1]=ah1=65535&c|d<<16,hl[1]=al1=65535&a|b<<16,h=ah2,l=al2,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[2],l=hl[2],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[2]=ah2=65535&c|d<<16,hl[2]=al2=65535&a|b<<16,h=ah3,l=al3,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[3],l=hl[3],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[3]=ah3=65535&c|d<<16,hl[3]=al3=65535&a|b<<16,h=ah4,l=al4,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[4],l=hl[4],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[4]=ah4=65535&c|d<<16,hl[4]=al4=65535&a|b<<16,h=ah5,l=al5,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[5],l=hl[5],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[5]=ah5=65535&c|d<<16,hl[5]=al5=65535&a|b<<16,h=ah6,l=al6,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[6],l=hl[6],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[6]=ah6=65535&c|d<<16,hl[6]=al6=65535&a|b<<16,h=ah7,l=al7,a=65535&l,b=l>>>16,c=65535&h,d=h>>>16,h=hh[7],l=hl[7],a+=65535&l,b+=l>>>16,c+=65535&h,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[7]=ah7=65535&c|d<<16,hl[7]=al7=65535&a|b<<16,pos+=128,n-=128}return n}function crypto_hash(out,m,n){var i,hh=new Int32Array(8),hl=new Int32Array(8),x=new Uint8Array(256),b=n;for(hh[0]=1779033703,hh[1]=3144134277,hh[2]=1013904242,hh[3]=2773480762,hh[4]=1359893119,hh[5]=2600822924,hh[6]=528734635,hh[7]=1541459225,hl[0]=4089235720,hl[1]=2227873595,hl[2]=4271175723,hl[3]=1595750129,hl[4]=2917565137,hl[5]=725511199,hl[6]=4215389547,hl[7]=327033209,crypto_hashblocks_hl(hh,hl,m,n),n%=128,i=0;i=0;--i)b=s[i/8|0]>>(7&i)&1,cswap(p,q,b),add(q,p),add(p,p),cswap(p,q,b)}function scalarbase(p,s){var q=[gf(),gf(),gf(),gf()];set25519(q[0],X),set25519(q[1],Y),set25519(q[2],gf1),M(q[3],X,Y),scalarmult(p,q,s)}function crypto_sign_keypair(pk,sk,seeded){var i,d=new Uint8Array(64),p=[gf(),gf(),gf(),gf()];for(seeded||randombytes(sk,32),crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64,scalarbase(p,d),pack(pk,p),i=0;i<32;i++)sk[i+32]=pk[i];return 0}function modL(r,x){var carry,i,j,k;for(i=63;i>=32;--i){for(carry=0,j=i-32,k=i-12;j>8,x[j]-=256*carry;x[j]+=carry,x[i]=0}for(carry=0,j=0;j<32;j++)x[j]+=carry-(x[31]>>4)*L[j],carry=x[j]>>8,x[j]&=255;for(j=0;j<32;j++)x[j]-=carry*L[j];for(i=0;i<32;i++)x[i+1]+=x[i]>>8,r[i]=255&x[i]}function reduce(r){var i,x=new Float64Array(64);for(i=0;i<64;i++)x[i]=r[i];for(i=0;i<64;i++)r[i]=0;modL(r,x)}function crypto_sign(sm,m,n,sk){var i,j,d=new Uint8Array(64),h=new Uint8Array(64),r=new Uint8Array(64),x=new Float64Array(64),p=[gf(),gf(),gf(),gf()];crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64;var smlen=n+64;for(i=0;i>7&&Z(r[0],gf0,r[0]),M(r[3],r[0],r[1]),0)}function crypto_sign_open(m,sm,n,pk){var i,t=new Uint8Array(32),h=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],q=[gf(),gf(),gf(),gf()];if(-1,n<64)return-1;if(unpackneg(q,pk))return-1;for(i=0;i>>13|t1<<3),t2=255&key[4]|(255&key[5])<<8,this.r[2]=7939&(t1>>>10|t2<<6),t3=255&key[6]|(255&key[7])<<8,this.r[3]=8191&(t2>>>7|t3<<9),t4=255&key[8]|(255&key[9])<<8,this.r[4]=255&(t3>>>4|t4<<12),this.r[5]=t4>>>1&8190,t5=255&key[10]|(255&key[11])<<8,this.r[6]=8191&(t4>>>14|t5<<2),t6=255&key[12]|(255&key[13])<<8,this.r[7]=8065&(t5>>>11|t6<<5),t7=255&key[14]|(255&key[15])<<8,this.r[8]=8191&(t6>>>8|t7<<8),this.r[9]=t7>>>5&127,this.pad[0]=255&key[16]|(255&key[17])<<8,this.pad[1]=255&key[18]|(255&key[19])<<8,this.pad[2]=255&key[20]|(255&key[21])<<8,this.pad[3]=255&key[22]|(255&key[23])<<8,this.pad[4]=255&key[24]|(255&key[25])<<8,this.pad[5]=255&key[26]|(255&key[27])<<8,this.pad[6]=255&key[28]|(255&key[29])<<8,this.pad[7]=255&key[30]|(255&key[31])<<8};poly1305.prototype.blocks=function(m,mpos,bytes){for(var t0,t1,t2,t3,t4,t5,t6,t7,c,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,hibit=this.fin?0:2048,h0=this.h[0],h1=this.h[1],h2=this.h[2],h3=this.h[3],h4=this.h[4],h5=this.h[5],h6=this.h[6],h7=this.h[7],h8=this.h[8],h9=this.h[9],r0=this.r[0],r1=this.r[1],r2=this.r[2],r3=this.r[3],r4=this.r[4],r5=this.r[5],r6=this.r[6],r7=this.r[7],r8=this.r[8],r9=this.r[9];bytes>=16;)t0=255&m[mpos+0]|(255&m[mpos+1])<<8,h0+=8191&t0,t1=255&m[mpos+2]|(255&m[mpos+3])<<8,h1+=8191&(t0>>>13|t1<<3),t2=255&m[mpos+4]|(255&m[mpos+5])<<8,h2+=8191&(t1>>>10|t2<<6),t3=255&m[mpos+6]|(255&m[mpos+7])<<8,h3+=8191&(t2>>>7|t3<<9),t4=255&m[mpos+8]|(255&m[mpos+9])<<8,h4+=8191&(t3>>>4|t4<<12),h5+=t4>>>1&8191,t5=255&m[mpos+10]|(255&m[mpos+11])<<8,h6+=8191&(t4>>>14|t5<<2),t6=255&m[mpos+12]|(255&m[mpos+13])<<8,h7+=8191&(t5>>>11|t6<<5),t7=255&m[mpos+14]|(255&m[mpos+15])<<8,h8+=8191&(t6>>>8|t7<<8),h9+=t7>>>5|hibit,c=0,d0=c,d0+=h0*r0,d0+=h1*(5*r9),d0+=h2*(5*r8),d0+=h3*(5*r7),d0+=h4*(5*r6),c=d0>>>13,d0&=8191,d0+=h5*(5*r5),d0+=h6*(5*r4),d0+=h7*(5*r3),d0+=h8*(5*r2),d0+=h9*(5*r1),c+=d0>>>13,d0&=8191,d1=c,d1+=h0*r1,d1+=h1*r0,d1+=h2*(5*r9),d1+=h3*(5*r8),d1+=h4*(5*r7),c=d1>>>13,d1&=8191,d1+=h5*(5*r6),d1+=h6*(5*r5),d1+=h7*(5*r4),d1+=h8*(5*r3),d1+=h9*(5*r2),c+=d1>>>13,d1&=8191,d2=c,d2+=h0*r2,d2+=h1*r1,d2+=h2*r0,d2+=h3*(5*r9),d2+=h4*(5*r8),c=d2>>>13,d2&=8191,d2+=h5*(5*r7),d2+=h6*(5*r6),d2+=h7*(5*r5),d2+=h8*(5*r4),d2+=h9*(5*r3),c+=d2>>>13,d2&=8191,d3=c,d3+=h0*r3,d3+=h1*r2,d3+=h2*r1,d3+=h3*r0,d3+=h4*(5*r9),c=d3>>>13,d3&=8191,d3+=h5*(5*r8),d3+=h6*(5*r7),d3+=h7*(5*r6),d3+=h8*(5*r5),d3+=h9*(5*r4),c+=d3>>>13,d3&=8191,d4=c,d4+=h0*r4,d4+=h1*r3,d4+=h2*r2,d4+=h3*r1,d4+=h4*r0,c=d4>>>13,d4&=8191,d4+=h5*(5*r9),d4+=h6*(5*r8),d4+=h7*(5*r7),d4+=h8*(5*r6),d4+=h9*(5*r5),c+=d4>>>13,d4&=8191,d5=c,d5+=h0*r5,d5+=h1*r4,d5+=h2*r3,d5+=h3*r2,d5+=h4*r1,c=d5>>>13,d5&=8191,d5+=h5*r0,d5+=h6*(5*r9),d5+=h7*(5*r8),d5+=h8*(5*r7),d5+=h9*(5*r6),c+=d5>>>13,d5&=8191,d6=c,d6+=h0*r6,d6+=h1*r5,d6+=h2*r4,d6+=h3*r3,d6+=h4*r2,c=d6>>>13,d6&=8191,d6+=h5*r1,d6+=h6*r0,d6+=h7*(5*r9),d6+=h8*(5*r8),d6+=h9*(5*r7),c+=d6>>>13,d6&=8191,d7=c,d7+=h0*r7,d7+=h1*r6,d7+=h2*r5,d7+=h3*r4,d7+=h4*r3,c=d7>>>13,d7&=8191,d7+=h5*r2,d7+=h6*r1,d7+=h7*r0,d7+=h8*(5*r9),d7+=h9*(5*r8),c+=d7>>>13,d7&=8191,d8=c,d8+=h0*r8,d8+=h1*r7,d8+=h2*r6,d8+=h3*r5,d8+=h4*r4,c=d8>>>13,d8&=8191,d8+=h5*r3,d8+=h6*r2,d8+=h7*r1,d8+=h8*r0,d8+=h9*(5*r9),c+=d8>>>13,d8&=8191,d9=c,d9+=h0*r9,d9+=h1*r8,d9+=h2*r7,d9+=h3*r6,d9+=h4*r5,c=d9>>>13,d9&=8191,d9+=h5*r4,d9+=h6*r3,d9+=h7*r2,d9+=h8*r1,d9+=h9*r0,c+=d9>>>13,d9&=8191,c=(c<<2)+c|0,c=c+d0|0,d0=8191&c,c>>>=13,d1+=c,h0=d0,h1=d1,h2=d2,h3=d3,h4=d4,h5=d5,h6=d6,h7=d7,h8=d8,h9=d9,mpos+=16,bytes-=16;this.h[0]=h0,this.h[1]=h1,this.h[2]=h2,this.h[3]=h3,this.h[4]=h4,this.h[5]=h5,this.h[6]=h6,this.h[7]=h7,this.h[8]=h8,this.h[9]=h9},poly1305.prototype.finish=function(mac,macpos){var c,mask,f,i,g=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(c=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=c,c=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*c,c=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=c,c=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=c,g[0]=this.h[0]+5,c=g[0]>>>13,g[0]&=8191,i=1;i<10;i++)g[i]=this.h[i]+c,c=g[i]>>>13,g[i]&=8191;for(g[9]-=8192,mask=(g[9]>>>15)-1,i=0;i<10;i++)g[i]&=mask;for(mask=~mask,i=0;i<10;i++)this.h[i]=this.h[i]&mask|g[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),f=this.h[0]+this.pad[0],this.h[0]=65535&f,i=1;i<8;i++)f=(this.h[i]+this.pad[i]|0)+(f>>>16)|0,this.h[i]=65535&f;mac[macpos+0]=this.h[0]>>>0&255,mac[macpos+1]=this.h[0]>>>8&255,mac[macpos+2]=this.h[1]>>>0&255,mac[macpos+3]=this.h[1]>>>8&255,mac[macpos+4]=this.h[2]>>>0&255,mac[macpos+5]=this.h[2]>>>8&255,mac[macpos+6]=this.h[3]>>>0&255,mac[macpos+7]=this.h[3]>>>8&255,mac[macpos+8]=this.h[4]>>>0&255,mac[macpos+9]=this.h[4]>>>8&255,mac[macpos+10]=this.h[5]>>>0&255,mac[macpos+11]=this.h[5]>>>8&255,mac[macpos+12]=this.h[6]>>>0&255,mac[macpos+13]=this.h[6]>>>8&255,mac[macpos+14]=this.h[7]>>>0&255,mac[macpos+15]=this.h[7]>>>8&255},poly1305.prototype.update=function(m,mpos,bytes){var i,want;if(this.leftover){for(want=16-this.leftover,want>bytes&&(want=bytes),i=0;i=16&&(want=bytes-bytes%16,this.blocks(m,mpos,want),mpos+=want,bytes-=want),bytes){for(i=0;i=0},nacl.sign.keyPair=function(){var pk=new Uint8Array(32),sk=new Uint8Array(64);return crypto_sign_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.sign.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),64!==secretKey.length)throw new Error("bad secret key size");for(var pk=new Uint8Array(32),i=0;i>8&255]>CACHE_THRESHOLD&&(cache[cp]=ret)),ret}function fromData(next,cp,needFeature){var hash=65280&cp,dunit=UChar.udata[hash]||{},f=dunit[cp];return f?new UChar(cp,f):new UChar(cp,DEFAULT_FEATURE)}function fromCpOnly(next,cp,needFeature){return needFeature?next(cp,needFeature):new UChar(cp,null)}function fromRuleBasedJamo(next,cp,needFeature){var j;if(cp=55296&&cp<=56319},UChar.isLowSurrogate=function(cp){return cp>=56320&&cp<=57343},UChar.prototype.prepFeature=function(){this.feature||(this.feature=UChar.fromCharCode(this.codepoint,!0).feature)},UChar.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var x=this.codepoint-65536;return String.fromCharCode(Math.floor(x/1024)+55296,x%1024+56320)},UChar.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},UChar.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},UChar.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},UChar.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},UChar.prototype.getComposite=function(following){if(this.prepFeature(),!this.feature[2])return null;var cp=this.feature[2][following.codepoint];return cp?UChar.fromCharCode(cp):null};var UCharIterator=function(str){this.str=str,this.cursor=0};UCharIterator.prototype.next=function(){if(this.str&&this.cursor0;--inspt){var uchar2=this.resBuf[inspt-1],cc2=uchar2.getCanonicalClass();if(cc2<=cc)break}this.resBuf.splice(inspt,0,uchar)}while(0!==cc);return this.resBuf.shift()};var CompIterator=function(it){this.it=it,this.procBuf=[],this.resBuf=[],this.lastClass=null};CompIterator.prototype.next=function(){for(;0===this.resBuf.length;){var uchar=this.it.next();if(!uchar){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=uchar.getCanonicalClass(),this.procBuf.push(uchar);else{var starter=this.procBuf[0],composite=starter.getComposite(uchar),cc=uchar.getCanonicalClass();composite&&(this.lastClass",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],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");Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===url?"undefined":_typeof(url)));var queryIndex=url.indexOf("?"),splitter=-1!==queryIndex&&queryIndex127?newpart+="x":newpart+=part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest="/"+notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),ipv6Hostname||(this.hostname=punycode.toASCII(this.hostname));var p=this.port?":"+this.port:"",h=this.hostname||"";this.host=h+p,this.href+=this.host,ipv6Hostname&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==rest[0]&&(rest="/"+rest))}if(!unsafeProtocol[lowerProto])for(var i=0,l=autoEscape.length;i0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return result.search=relative.search,result.query=relative.query,util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.href=result.format(),result}if(!srcPath.length)return result.pathname=null,result.search?result.path="/"+result.search:result.path=null,result.href=result.format(),result;for(var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&("."===last||".."===last)||""===last,up=0,i=srcPath.length;i>=0;i--)last=srcPath[i],"."===last?srcPath.splice(i,1):".."===last?(srcPath.splice(i,1),up++):up&&(srcPath.splice(i,1),up--);if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift("..");!mustEndAbs||""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0)||srcPath.unshift(""),hasTrailingSlash&&"/"!==srcPath.join("/").substr(-1)&&srcPath.push("");var isAbsolute=""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0);if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return mustEndAbs=mustEndAbs||result.host&&srcPath.length,mustEndAbs&&!isAbsolute&&srcPath.unshift(""),srcPath.length?result.pathname=srcPath.join("/"):(result.pathname=null,result.path=null),util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result},Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);port&&(port=port[0],":"!==port&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)}},{"./util":351,punycode:292,querystring:295}],351:[function(require,module,exports){"use strict" -;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};module.exports={isString:function(arg){return"string"==typeof arg},isObject:function(arg){return"object"===(void 0===arg?"undefined":_typeof(arg))&&null!==arg},isNull:function(arg){return null===arg},isNullOrUndefined:function(arg){return null==arg}}},{}],352:[function(require,module,exports){(function(global){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root){function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value);return output}function checkScalarValue(codePoint){if(codePoint>=55296&&codePoint<=57343)throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if(0==(4294967168&codePoint))return stringFromCharCode(codePoint);var symbol="";return 0==(4294965248&codePoint)?symbol=stringFromCharCode(codePoint>>6&31|192):0==(4294901760&codePoint)?(checkScalarValue(codePoint),symbol=stringFromCharCode(codePoint>>12&15|224),symbol+=createByte(codePoint,6)):0==(4292870144&codePoint)&&(symbol=stringFromCharCode(codePoint>>18&7|240),symbol+=createByte(codePoint,12),symbol+=createByte(codePoint,6)),symbol+=stringFromCharCode(63&codePoint|128)}function utf8encode(string){for(var codePoint,codePoints=ucs2decode(string),length=codePoints.length,index=-1,byteString="";++index=byteCount)throw Error("Invalid byte index");var continuationByte=255&byteArray[byteIndex];if(byteIndex++,128==(192&continuationByte))return 63&continuationByte;throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1,byte2,byte3,byte4,codePoint;if(byteIndex>byteCount)throw Error("Invalid byte index");if(byteIndex==byteCount)return!1;if(byte1=255&byteArray[byteIndex],byteIndex++,0==(128&byte1))return byte1;if(192==(224&byte1)){if(byte2=readContinuationByte(),(codePoint=(31&byte1)<<6|byte2)>=128)return codePoint;throw Error("Invalid continuation byte")}if(224==(240&byte1)){if(byte2=readContinuationByte(),byte3=readContinuationByte(),(codePoint=(15&byte1)<<12|byte2<<6|byte3)>=2048)return checkScalarValue(codePoint),codePoint;throw Error("Invalid continuation byte")}if(240==(248&byte1)&&(byte2=readContinuationByte(),byte3=readContinuationByte(),byte4=readContinuationByte(),(codePoint=(7&byte1)<<18|byte2<<12|byte3<<6|byte4)>=65536&&codePoint<=1114111))return codePoint;throw Error("Invalid UTF-8 detected")}function utf8decode(byteString){byteArray=ucs2decode(byteString),byteCount=byteArray.length,byteIndex=0;for(var tmp,codePoints=[];!1!==(tmp=decodeSymbol());)codePoints.push(tmp);return ucs2encode(codePoints)}var freeExports="object"==(void 0===exports?"undefined":_typeof(exports))&&exports,freeModule="object"==(void 0===module?"undefined":_typeof(module))&&module&&module.exports==freeExports&&module,freeGlobal="object"==(void 0===global?"undefined":_typeof(global))&&global;freeGlobal.global!==freeGlobal&&freeGlobal.window!==freeGlobal||(root=freeGlobal);var byteArray,byteCount,byteIndex,stringFromCharCode=String.fromCharCode,utf8={version:"2.1.2",encode:utf8encode,decode:utf8decode};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return utf8});else if(freeExports&&!freeExports.nodeType)if(freeModule)freeModule.exports=utf8;else{var object={},hasOwnProperty=object.hasOwnProperty;for(var key in utf8)hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}else root.utf8=utf8}(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],353:[function(require,module,exports){(function(global){"use strict";function deprecate(fn,msg){function deprecated(){if(!warned){if(config("throwDeprecation"))throw new Error(msg);config("traceDeprecation")?console.trace(msg):console.warn(msg),warned=!0}return fn.apply(this,arguments)}if(config("noDeprecation"))return fn;var warned=!1;return deprecated}function config(name){try{if(!global.localStorage)return!1}catch(_){return!1}var val=global.localStorage[name];return null!=val&&"true"===String(val).toLowerCase()}module.exports=deprecate}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],354:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};module.exports=function(arg){return arg&&"object"===(void 0===arg?"undefined":_typeof(arg))&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],355:[function(require,module,exports){(function(process,global){"use strict";function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)){base=" [Function"+(value.name?": "+value.name:"")+"]"}if(isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(recurseTimes<0)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n"))):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;return output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"===(void 0===arg?"undefined":_typeof(arg))}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"===(void 0===arg?"undefined":_typeof(arg))&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"===(void 0===arg?"undefined":_typeof(arg))||void 0===arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i2&&"0x"===value.substr(0,2)&&(value=value.substr(2)),value=CryptoJS.enc.Hex.parse(value)),sha3(value,{outputLength:256}).toString()}},{"crypto-js":184,"crypto-js/sha3":205}],372:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},BigNumber=require("bignumber.js"),sha3=require("./sha3.js"),utf8=require("utf8"),unitMap={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},padLeft=function(string,chars,sign){return new Array(chars-string.length+1).join(sign||"0")+string},padRight=function(string,chars,sign){return string+new Array(chars-string.length+1).join(sign||"0")},toUtf8=function(hex){var str="",i=0,l=hex.length;for("0x"===hex.substring(0,2)&&(i=2);i7&&address[i].toUpperCase()!==address[i]||parseInt(addressHash[i],16)<=7&&address[i].toLowerCase()!==address[i])return!1;return!0},toChecksumAddress=function(address){if(void 0===address)return"";address=address.toLowerCase().replace("0x","");for(var addressHash=sha3(address),checksumAddress="0x",i=0;i7?checksumAddress+=address[i].toUpperCase():checksumAddress+=address[i];return checksumAddress},toAddress=function(address){return isStrictAddress(address)?address:/^[0-9a-f]{40}$/.test(address)?"0x"+address:"0x"+padLeft(toHex(address).substr(2),40)},isBigNumber=function(object){return object instanceof BigNumber||object&&object.constructor&&"BigNumber"===object.constructor.name},isString=function(object){return"string"==typeof object||object&&object.constructor&&"String"===object.constructor.name},isFunction=function(object){return"function"==typeof object},isObject=function(object){return null!==object&&!Array.isArray(object)&&"object"===(void 0===object?"undefined":_typeof(object))},isBoolean=function(object){return"boolean"==typeof object},isArray=function(object){return Array.isArray(object)},isJson=function(str){try{return!!JSON.parse(str)}catch(e){return!1}},isBloom=function(bloom){return!!/^(0x)?[0-9a-f]{512}$/i.test(bloom)&&!(!/^(0x)?[0-9a-f]{512}$/.test(bloom)&&!/^(0x)?[0-9A-F]{512}$/.test(bloom))},isTopic=function(topic){return!!/^(0x)?[0-9a-f]{64}$/i.test(topic)&&!(!/^(0x)?[0-9a-f]{64}$/.test(topic)&&!/^(0x)?[0-9A-F]{64}$/.test(topic))};module.exports={padLeft:padLeft,padRight:padRight,toHex:toHex,toDecimal:toDecimal,fromDecimal:fromDecimal,toUtf8:toUtf8,toAscii:toAscii,fromUtf8:fromUtf8,fromAscii:fromAscii,transformToFullName:transformToFullName,extractDisplayName:extractDisplayName,extractTypeName:extractTypeName,toWei:toWei,fromWei:fromWei,toBigNumber:toBigNumber,toTwosComplement:toTwosComplement,toAddress:toAddress,isBigNumber:isBigNumber,isStrictAddress:isStrictAddress,isAddress:isAddress,isChecksumAddress:isChecksumAddress,toChecksumAddress:toChecksumAddress,isFunction:isFunction,isString:isString,isObject:isObject,isBoolean:isBoolean,isArray:isArray,isJson:isJson,isBloom:isBloom,isTopic:isTopic}},{"./sha3.js":371,"bignumber.js":24,utf8:352}]},{},[1])(1)}); +;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};module.exports={isString:function(arg){return"string"==typeof arg},isObject:function(arg){return"object"===(void 0===arg?"undefined":_typeof(arg))&&null!==arg},isNull:function(arg){return null===arg},isNullOrUndefined:function(arg){return null==arg}}},{}],352:[function(require,module,exports){(function(global){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(root){function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value);return output}function checkScalarValue(codePoint){if(codePoint>=55296&&codePoint<=57343)throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if(0==(4294967168&codePoint))return stringFromCharCode(codePoint);var symbol="";return 0==(4294965248&codePoint)?symbol=stringFromCharCode(codePoint>>6&31|192):0==(4294901760&codePoint)?(checkScalarValue(codePoint),symbol=stringFromCharCode(codePoint>>12&15|224),symbol+=createByte(codePoint,6)):0==(4292870144&codePoint)&&(symbol=stringFromCharCode(codePoint>>18&7|240),symbol+=createByte(codePoint,12),symbol+=createByte(codePoint,6)),symbol+=stringFromCharCode(63&codePoint|128)}function utf8encode(string){for(var codePoint,codePoints=ucs2decode(string),length=codePoints.length,index=-1,byteString="";++index=byteCount)throw Error("Invalid byte index");var continuationByte=255&byteArray[byteIndex];if(byteIndex++,128==(192&continuationByte))return 63&continuationByte;throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1,byte2,byte3,byte4,codePoint;if(byteIndex>byteCount)throw Error("Invalid byte index");if(byteIndex==byteCount)return!1;if(byte1=255&byteArray[byteIndex],byteIndex++,0==(128&byte1))return byte1;if(192==(224&byte1)){if(byte2=readContinuationByte(),(codePoint=(31&byte1)<<6|byte2)>=128)return codePoint;throw Error("Invalid continuation byte")}if(224==(240&byte1)){if(byte2=readContinuationByte(),byte3=readContinuationByte(),(codePoint=(15&byte1)<<12|byte2<<6|byte3)>=2048)return checkScalarValue(codePoint),codePoint;throw Error("Invalid continuation byte")}if(240==(248&byte1)&&(byte2=readContinuationByte(),byte3=readContinuationByte(),byte4=readContinuationByte(),(codePoint=(7&byte1)<<18|byte2<<12|byte3<<6|byte4)>=65536&&codePoint<=1114111))return codePoint;throw Error("Invalid UTF-8 detected")}function utf8decode(byteString){byteArray=ucs2decode(byteString),byteCount=byteArray.length,byteIndex=0;for(var tmp,codePoints=[];!1!==(tmp=decodeSymbol());)codePoints.push(tmp);return ucs2encode(codePoints)}var freeExports="object"==(void 0===exports?"undefined":_typeof(exports))&&exports,freeModule="object"==(void 0===module?"undefined":_typeof(module))&&module&&module.exports==freeExports&&module,freeGlobal="object"==(void 0===global?"undefined":_typeof(global))&&global;freeGlobal.global!==freeGlobal&&freeGlobal.window!==freeGlobal||(root=freeGlobal);var byteArray,byteCount,byteIndex,stringFromCharCode=String.fromCharCode,utf8={version:"2.1.2",encode:utf8encode,decode:utf8decode};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return utf8});else if(freeExports&&!freeExports.nodeType)if(freeModule)freeModule.exports=utf8;else{var object={},hasOwnProperty=object.hasOwnProperty;for(var key in utf8)hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}else root.utf8=utf8}(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],353:[function(require,module,exports){(function(global){"use strict";function deprecate(fn,msg){function deprecated(){if(!warned){if(config("throwDeprecation"))throw new Error(msg);config("traceDeprecation")?console.trace(msg):console.warn(msg),warned=!0}return fn.apply(this,arguments)}if(config("noDeprecation"))return fn;var warned=!1;return deprecated}function config(name){try{if(!global.localStorage)return!1}catch(_){return!1}var val=global.localStorage[name];return null!=val&&"true"===String(val).toLowerCase()}module.exports=deprecate}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],354:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};module.exports=function(arg){return arg&&"object"===(void 0===arg?"undefined":_typeof(arg))&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],355:[function(require,module,exports){(function(process,global){"use strict";function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)){base=" [Function"+(value.name?": "+value.name:"")+"]"}if(isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(recurseTimes<0)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n"))):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;return output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"===(void 0===arg?"undefined":_typeof(arg))}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"===(void 0===arg?"undefined":_typeof(arg))&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"===(void 0===arg?"undefined":_typeof(arg))||void 0===arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i2&&"0x"===value.substr(0,2)&&(value=value.substr(2)),value=CryptoJS.enc.Hex.parse(value)),sha3(value,{outputLength:256}).toString()}},{"crypto-js":183,"crypto-js/sha3":204}],372:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},BigNumber=require("bignumber.js"),sha3=require("./sha3.js"),utf8=require("utf8"),unitMap={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},padLeft=function(string,chars,sign){return new Array(chars-string.length+1).join(sign||"0")+string},padRight=function(string,chars,sign){return string+new Array(chars-string.length+1).join(sign||"0")},toUtf8=function(hex){var str="",i=0,l=hex.length;for("0x"===hex.substring(0,2)&&(i=2);i7&&address[i].toUpperCase()!==address[i]||parseInt(addressHash[i],16)<=7&&address[i].toLowerCase()!==address[i])return!1;return!0},toChecksumAddress=function(address){if(void 0===address)return"";address=address.toLowerCase().replace("0x","");for(var addressHash=sha3(address),checksumAddress="0x",i=0;i7?checksumAddress+=address[i].toUpperCase():checksumAddress+=address[i];return checksumAddress},toAddress=function(address){return isStrictAddress(address)?address:/^[0-9a-f]{40}$/.test(address)?"0x"+address:"0x"+padLeft(toHex(address).substr(2),40)},isBigNumber=function(object){return object instanceof BigNumber||object&&object.constructor&&"BigNumber"===object.constructor.name},isString=function(object){return"string"==typeof object||object&&object.constructor&&"String"===object.constructor.name},isFunction=function(object){return"function"==typeof object},isObject=function(object){return null!==object&&!Array.isArray(object)&&"object"===(void 0===object?"undefined":_typeof(object))},isBoolean=function(object){return"boolean"==typeof object},isArray=function(object){return Array.isArray(object)},isJson=function(str){try{return!!JSON.parse(str)}catch(e){return!1}},isBloom=function(bloom){return!!/^(0x)?[0-9a-f]{512}$/i.test(bloom)&&!(!/^(0x)?[0-9a-f]{512}$/.test(bloom)&&!/^(0x)?[0-9A-F]{512}$/.test(bloom))},isTopic=function(topic){return!!/^(0x)?[0-9a-f]{64}$/i.test(topic)&&!(!/^(0x)?[0-9a-f]{64}$/.test(topic)&&!/^(0x)?[0-9A-F]{64}$/.test(topic))};module.exports={padLeft:padLeft,padRight:padRight,toHex:toHex,toDecimal:toDecimal,fromDecimal:fromDecimal,toUtf8:toUtf8,toAscii:toAscii,fromUtf8:fromUtf8,fromAscii:fromAscii,transformToFullName:transformToFullName,extractDisplayName:extractDisplayName,extractTypeName:extractTypeName,toWei:toWei,fromWei:fromWei,toBigNumber:toBigNumber,toTwosComplement:toTwosComplement,toAddress:toAddress,isBigNumber:isBigNumber,isStrictAddress:isStrictAddress,isAddress:isAddress,isChecksumAddress:isChecksumAddress,toChecksumAddress:toChecksumAddress,isFunction:isFunction,isString:isString,isObject:isObject,isBoolean:isBoolean,isArray:isArray,isJson:isJson,isBloom:isBloom,isTopic:isTopic}},{"./sha3.js":371,"bignumber.js":24,utf8:352}]},{},[1])(1)});