diff --git a/bitcore-lib.js b/bitcore-lib.js index 405b3200..9b644a1a 100644 --- a/bitcore-lib.js +++ b/bitcore-lib.js @@ -152,7 +152,7 @@ Address._transformObject = function(data) { $.checkArgument(data.hash || data.hashBuffer, 'Must provide a `hash` or `hashBuffer` property'); $.checkArgument(data.type, 'Must provide a `type` property'); return { - hashBuffer: data.hash ? new Buffer(data.hash, 'hex') : data.hashBuffer, + hashBuffer: data.hash ? Buffer.from(data.hash, 'hex') : data.hashBuffer, network: Networks.get(data.network) || Networks.defaultNetwork, type: data.type }; @@ -305,7 +305,7 @@ function decodeCashAddress(address) { var prefix, encodedPayload; - if (pieces.length == 2) { + if (pieces.length === 2) { prefix = pieces[0]; encodedPayload = pieces[1]; } else { @@ -350,7 +350,7 @@ function decodeCashAddress(address) { var type = getType(versionByte); - var network = Networks.get(prefix, 'prefix'); + var network = Networks.get(prefix); //console.log('[address.js.336:network:]',network); //TODO var info = {}; @@ -362,7 +362,7 @@ function decodeCashAddress(address) { info.network = network; info.type = type; return info; -}; +} @@ -379,24 +379,30 @@ Address._transformString = function(data, network, type) { if (typeof(data) !== 'string') { throw new TypeError('data parameter supplied is not a string.'); } + if (data.length < 34){ + throw new Error('Invalid Address string provided'); + } data = data.trim(); - var addressBuffer; var networkObj = Networks.get(network); - var info; - try { - addressBuffer = Base58Check.decode(data); - } catch (e) { - info = decodeCashAddress(data); - if (!info.network || (networkObj && networkObj.prefix !== info.network.prefix)) { + if (network && !networkObj) { + throw new TypeError('Unknown network'); + } + + if (data.length > 35){ + var info = decodeCashAddress(data); + if (!info.network || (networkObj && networkObj.name !== info.network.name)) { throw new TypeError('Address has mismatched network type.'); } + if (!info.type || (type && type !== info.type)) { + throw new TypeError('Address has mismatched type.'); + } return info; + } else { + var addressBuffer = Base58Check.decode(data); + // Legacy addr + return Address._transformBuffer(addressBuffer, network, type); } - - // Legacy addr - info = Address._transformBuffer(addressBuffer, network, type); - return info; }; @@ -510,7 +516,7 @@ Address.fromObject = function fromObject(obj) { JSUtil.isHexa(obj.hash), 'Unexpected hash property, "' + obj.hash + '", expected to be hex.' ); - var hashBuffer = new Buffer(obj.hash, 'hex'); + var hashBuffer = Buffer.from(obj.hash, 'hex'); return new Address(hashBuffer, obj.network, obj.type); }; @@ -594,16 +600,6 @@ Address.prototype.toObject = Address.prototype.toJSON = function toObject() { }; }; -/** - * Will return a the base58 (legacy) string representation of the address - * - * @returns {string} Bitcoin address - */ -Address.prototype.toString = function() { - //console.log('Warning: Using deprecated bitcoin cash address type. Replace to .toCashAddress'); - return Base58Check.encode(this.toBuffer()); -}; - /** * Will return a string formatted for the console * @@ -627,7 +623,14 @@ Address.prototype.toCashBuffer = function() { return buf; }; - +/** + * Will return a the base58 (legacy) string representation of the address + * + * @returns {string} Bitcoin address + */ +Address.prototype.toLegacyAddress = function () { + return Base58Check.encode(this.toBuffer()); +}; /** * Will return a cashaddr representation of the address. Always return lower case @@ -637,7 +640,7 @@ Address.prototype.toCashBuffer = function() { */ -Address.prototype.toCashAddress = function() { +Address.prototype.toCashAddress = function(stripPrefix) { function getTypeBits(type) { switch (type) { case 'pubkeyhash': @@ -679,15 +682,25 @@ Address.prototype.toCashAddress = function() { var payloadData = convertBits([versionByte].concat(arr), 8, 5); var checksumData = prefixData.concat(payloadData).concat(eight0); var payload = payloadData.concat(checksumToArray(polymod(checksumData))); - return this.network.prefix+ ':' + base32.encode(payload); + if(stripPrefix === true) { + return base32.encode(payload); + } else { + return this.network.prefix+ ':' + base32.encode(payload); + } }; +/** + * Will return a string representation of the address (defaults to CashAddr format) + * + * @returns {string} address + */ +Address.prototype.toString = Address.prototype.toCashAddress; /*** * Retrieves the the length in bits of the encoded hash from its bit * representation within the version byte. * - * @param {number} versionByte + * @param {number} versionByte */ function getHashSize(versionByte) { switch (versionByte & 7) { @@ -734,7 +747,7 @@ function checksumToArray(checksum) { * @param {Array} data Array of 5-bit integers over which the checksum is to be computed. */ var GENERATOR = _.map( - [0x98f2bc8e61, 0x79b76d99e2, 0xf33e5fb3c4, 0xae2eabe2a8, 0x1e4f43e470], function(x){ + [0x98f2bc8e61, 0x79b76d99e2, 0xf33e5fb3c4, 0xae2eabe2a8, 0x1e4f43e470], function(x){ return new BN(x); } ); @@ -887,7 +900,7 @@ Block.fromBuffer = function fromBuffer(buf) { * @returns {Block} - A hex encoded string of the block */ Block.fromString = function fromString(str) { - var buf = new Buffer(str, 'hex'); + var buf = Buffer.from(str, 'hex'); return Block.fromBuffer(buf); }; @@ -897,7 +910,7 @@ Block.fromString = function fromString(str) { */ Block.fromRawBlock = function fromRawBlock(data) { if (!BufferUtil.isBuffer(data)) { - data = new Buffer(data, 'binary'); + data = Buffer.from(data, 'binary'); } var br = BufferReader(data); br.pos = Block.Values.START_OF_BLOCK; @@ -1045,7 +1058,7 @@ Block.prototype.inspect = function inspect() { Block.Values = { START_OF_BLOCK: 8, // Start of block in raw block data - NULL_HASH: new Buffer('0000000000000000000000000000000000000000000000000000000000000000', 'hex') + NULL_HASH: Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex') }; module.exports = Block; @@ -1125,10 +1138,10 @@ BlockHeader._fromObject = function _fromObject(data) { var prevHash = data.prevHash; var merkleRoot = data.merkleRoot; if (_.isString(data.prevHash)) { - prevHash = BufferUtil.reverse(new Buffer(data.prevHash, 'hex')); + prevHash = BufferUtil.reverse(Buffer.from(data.prevHash, 'hex')); } if (_.isString(data.merkleRoot)) { - merkleRoot = BufferUtil.reverse(new Buffer(data.merkleRoot, 'hex')); + merkleRoot = BufferUtil.reverse(Buffer.from(data.merkleRoot, 'hex')); } var info = { hash: data.hash, @@ -1158,7 +1171,7 @@ BlockHeader.fromObject = function fromObject(obj) { */ BlockHeader.fromRawBlock = function fromRawBlock(data) { if (!BufferUtil.isBuffer(data)) { - data = new Buffer(data, 'binary'); + data = Buffer.from(data, 'binary'); } var br = BufferReader(data); br.pos = BlockHeader.Constants.START_OF_HEADER; @@ -1180,7 +1193,7 @@ BlockHeader.fromBuffer = function fromBuffer(buf) { * @returns {BlockHeader} - An instance of block header */ BlockHeader.fromString = function fromString(str) { - var buf = new Buffer(str, 'hex'); + var buf = Buffer.from(str, 'hex'); return BlockHeader.fromBuffer(buf); }; @@ -1464,7 +1477,7 @@ MerkleBlock.prototype.toBufferWriter = function toBufferWriter(bw) { bw.writeUInt32LE(this.numTransactions); bw.writeVarintNum(this.hashes.length); for (var i = 0; i < this.hashes.length; i++) { - bw.write(new Buffer(this.hashes[i], 'hex')); + bw.write(Buffer.from(this.hashes[i], 'hex')); } bw.writeVarintNum(this.flags.length); for (i = 0; i < this.flags.length; i++) { @@ -1580,7 +1593,7 @@ MerkleBlock.prototype._traverseMerkleTree = function traverseMerkleTree(depth, p if(depth === 0 && isParentOfMatch) { opts.txs.push(hash); } - return new Buffer(hash, 'hex'); + return Buffer.from(hash, 'hex'); } else { var left = this._traverseMerkleTree(depth-1, pos*2, opts); var right = left; @@ -1631,7 +1644,7 @@ MerkleBlock.prototype.hasTransaction = function hasTransaction(tx) { var hash = tx; if(tx instanceof Transaction) { // We need to reverse the id hash for the lookup - hash = BufferUtil.reverse(new Buffer(tx.id, 'hex')).toString('hex'); + hash = BufferUtil.reverse(Buffer.from(tx.id, 'hex')).toString('hex'); } var txs = []; @@ -1683,7 +1696,7 @@ var $ = require('../util/preconditions'); var _ = require('lodash'); var reversebuf = function(buf) { - var buf2 = new Buffer(buf.length); + var buf2 = Buffer.alloc(buf.length); for (var i = 0; i < buf.length; i++) { buf2[i] = buf[buf.length - 1 - i]; } @@ -1720,7 +1733,7 @@ BN.fromBuffer = function(buf, opts) { BN.fromSM = function(buf, opts) { var ret; if (buf.length === 0) { - return BN.fromBuffer(new Buffer([0])); + return BN.fromBuffer(Buffer.from([0])); } var endian = 'big'; @@ -1751,7 +1764,7 @@ BN.prototype.toBuffer = function(opts) { if (opts && opts.size) { hex = this.toString(16, 2); var natlen = hex.length / 2; - buf = new Buffer(hex, 'hex'); + buf = Buffer.from(hex, 'hex'); if (natlen === opts.size) { buf = buf; @@ -1762,7 +1775,7 @@ BN.prototype.toBuffer = function(opts) { } } else { hex = this.toString(16, 2); - buf = new Buffer(hex, 'hex'); + buf = Buffer.from(hex, 'hex'); } if (typeof opts !== 'undefined' && opts.endian === 'little') { @@ -1777,19 +1790,19 @@ BN.prototype.toSMBigEndian = function() { if (this.cmp(BN.Zero) === -1) { buf = this.neg().toBuffer(); if (buf[0] & 0x80) { - buf = Buffer.concat([new Buffer([0x80]), buf]); + buf = Buffer.concat([Buffer.from([0x80]), buf]); } else { buf[0] = buf[0] | 0x80; } } else { buf = this.toBuffer(); if (buf[0] & 0x80) { - buf = Buffer.concat([new Buffer([0x00]), buf]); + buf = Buffer.concat([Buffer.from([0x00]), buf]); } } if (buf.length === 1 & buf[0] === 0) { - buf = new Buffer([]); + buf = Buffer.from([]); } return buf; }; @@ -1850,24 +1863,12 @@ BN.prototype.toScriptNumBuffer = function() { }); }; -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) { - var rbuf = new Buffer(size); + var rbuf = Buffer.alloc(size); for (var i = 0; i < buf.length; i++) { rbuf[rbuf.length - 1 - i] = buf[buf.length - 1 - i]; } @@ -1965,17 +1966,17 @@ ECDSA.prototype.deterministicK = function(badrs) { if (_.isUndefined(badrs)) { badrs = 0; } - var v = new Buffer(32); + var v = Buffer.alloc(32); v.fill(0x01); - var k = new Buffer(32); + var k = Buffer.alloc(32); k.fill(0x00); var x = this.privkey.bn.toBuffer({ size: 32 }); var hashbuf = this.endian === 'little' ? BufferUtil.reverse(this.hashbuf) : this.hashbuf - k = Hash.sha256hmac(Buffer.concat([v, new Buffer([0x00]), x, hashbuf]), k); + k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x00]), x, hashbuf]), k); v = Hash.sha256hmac(v, k); - k = Hash.sha256hmac(Buffer.concat([v, new Buffer([0x01]), x, hashbuf]), k); + k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x01]), x, hashbuf]), k); v = Hash.sha256hmac(v, k); v = Hash.sha256hmac(v, k); var T = BN.fromBuffer(v); @@ -1983,7 +1984,7 @@ ECDSA.prototype.deterministicK = function(badrs) { // also explained in 3.2, we must ensure T is in the proper range (0, N) for (var i = 0; i < badrs || !(T.lt(N) && T.gt(BN.Zero)); i++) { - k = Hash.sha256hmac(Buffer.concat([v, new Buffer([0x00])]), k); + k = Hash.sha256hmac(Buffer.concat([v, Buffer.from([0x00])]), k); v = Hash.sha256hmac(v, k); v = Hash.sha256hmac(v, k); T = BN.fromBuffer(v); @@ -2076,7 +2077,7 @@ ECDSA.prototype.sigError = function() { ECDSA.toLowS = function(s) { //enforce low s //see BIP 62, "low S values in signatures" - if (s.gt(BN.fromBuffer(new Buffer('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0', 'hex')))) { + if (s.gt(BN.fromBuffer(Buffer.from('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0', 'hex')))) { s = Point.getN().sub(s); } return s; @@ -2238,20 +2239,20 @@ Hash.hmac = function(hashf, data, key) { if (key.length > blocksize) { key = hashf(key); } else if (key < blocksize) { - var fill = new Buffer(blocksize); + var fill = Buffer.alloc(blocksize); fill.fill(0); key.copy(fill); key = fill; } - var o_key = new Buffer(blocksize); + var o_key = Buffer.alloc(blocksize); o_key.fill(0x5c); - var i_key = new Buffer(blocksize); + var i_key = Buffer.alloc(blocksize); i_key.fill(0x36); - var o_key_pad = new Buffer(blocksize); - var i_key_pad = new Buffer(blocksize); + var o_key_pad = Buffer.alloc(blocksize); + var i_key_pad = Buffer.alloc(blocksize); for (var i = 0; i < blocksize; i++) { o_key_pad[i] = o_key[i] ^ key[i]; i_key_pad[i] = i_key[i] ^ key[i]; @@ -2415,9 +2416,9 @@ Point.pointToCompressed = function pointToCompressed(point) { var prefix; var odd = ybuf[ybuf.length - 1] % 2; if (odd) { - prefix = new Buffer([0x03]); + prefix = Buffer.from([0x03]); } else { - prefix = new Buffer([0x02]); + prefix = Buffer.from([0x02]); } return BufferUtil.concat([prefix, xbuf]); }; @@ -2458,7 +2459,7 @@ Random.getRandomBufferBrowser = function(size) { var bbuf = new Uint8Array(size); crypto.getRandomValues(bbuf); - var buf = new Buffer(bbuf); + var buf = Buffer.from(bbuf); return buf; }; @@ -2466,7 +2467,7 @@ Random.getRandomBufferBrowser = function(size) { /* insecure random bytes, but it never fails */ Random.getPseudoRandomBuffer = function(size) { var b32 = 0x100000000; - var b = new Buffer(size); + var b = Buffer.alloc(size); var r; for (var i = 0; i <= size; i++) { @@ -2570,7 +2571,7 @@ Signature.fromTxFormat = function(buf) { }; Signature.fromString = function(str) { - var buf = new Buffer(str, 'hex'); + var buf = Buffer.from(str, 'hex'); return Signature.fromDER(buf); }; @@ -2645,7 +2646,7 @@ Signature.prototype.toCompact = function(i, compressed) { if (compressed === false) { val = val - 4; } - var b1 = new Buffer([val]); + var b1 = Buffer.from([val]); var b2 = this.r.toBuffer({ size: 32 }); @@ -2662,8 +2663,8 @@ Signature.prototype.toBuffer = Signature.prototype.toDER = function() { var rneg = rnbuf[0] & 0x80 ? true : false; var sneg = snbuf[0] & 0x80 ? true : false; - var rbuf = rneg ? Buffer.concat([new Buffer([0x00]), rnbuf]) : rnbuf; - var sbuf = sneg ? Buffer.concat([new Buffer([0x00]), snbuf]) : snbuf; + var rbuf = rneg ? Buffer.concat([Buffer.from([0x00]), rnbuf]) : rnbuf; + var sbuf = sneg ? Buffer.concat([Buffer.from([0x00]), snbuf]) : snbuf; var rlength = rbuf.length; var slength = sbuf.length; @@ -2672,7 +2673,7 @@ Signature.prototype.toBuffer = Signature.prototype.toDER = function() { var sheader = 0x02; var header = 0x30; - var der = Buffer.concat([new Buffer([header, length, rheader, rlength]), rbuf, new Buffer([sheader, slength]), sbuf]); + var der = Buffer.concat([Buffer.from([header, length, rheader, rlength]), rbuf, Buffer.from([sheader, slength]), sbuf]); return der; }; @@ -2781,7 +2782,7 @@ Signature.prototype.hasDefinedHashtype = function() { return false; } // accept with or without Signature.SIGHASH_ANYONECANPAY by ignoring the bit - var temp = this.nhashtype & ~Signature.SIGHASH_ANYONECANPAY; + var temp = this.nhashtype & 0x1F if (temp < Signature.SIGHASH_ALL || temp > Signature.SIGHASH_SINGLE) { return false; } @@ -2790,7 +2791,7 @@ Signature.prototype.hasDefinedHashtype = function() { Signature.prototype.toTxFormat = function() { var derbuf = this.toDER(); - var buf = new Buffer(1); + var buf = Buffer.alloc(1); buf.writeUInt8(this.nhashtype, 0); return Buffer.concat([derbuf, buf]); }; @@ -2853,7 +2854,7 @@ Base58.decode = function(str) { if (typeof str !== 'string') { throw new Error('Input should be a string'); } - return new Buffer(bs58.decode(str)); + return Buffer.from(bs58.decode(str)); }; Base58.prototype.fromBuffer = function(buf) { @@ -2924,7 +2925,7 @@ Base58Check.decode = function(s) { if (typeof s !== 'string') throw new Error('Input must be a string'); - var buf = new Buffer(Base58.decode(s)); + var buf = Buffer.from(Base58.decode(s)); if (buf.length < 4) throw new Error("Input string too short"); @@ -2948,7 +2949,7 @@ Base58Check.checksum = function(buffer) { Base58Check.encode = function(buf) { if (!Buffer.isBuffer(buf)) throw new Error('Input must be a buffer'); - var checkedBuf = new Buffer(buf.length + 4); + var checkedBuf = Buffer.alloc(buf.length + 4); var hash = Base58Check.checksum(buf); buf.copy(checkedBuf); hash.copy(checkedBuf, buf.length); @@ -2998,12 +2999,12 @@ var BufferReader = function BufferReader(buf) { buf: buf }); } else if (_.isString(buf)) { - var b = new Buffer(buf, 'hex'); + var b = Buffer.from(buf, 'hex'); if (b.length * 2 != buf.length) throw new TypeError('Invalid hex string'); this.set({ - buf: b, + buf: b }); } else if (_.isObject(buf)) { var obj = buf; @@ -3163,7 +3164,7 @@ BufferReader.prototype.readVarintBN = function() { }; BufferReader.prototype.reverse = function() { - var buf = new Buffer(this.buf.length); + var buf = Buffer.alloc(this.buf.length); for (var i = 0; i < buf.length; i++) { buf[i] = this.buf[this.buf.length - 1 - i]; } @@ -3193,6 +3194,7 @@ var assert = require('assert'); var BufferWriter = function BufferWriter(obj) { if (!(this instanceof BufferWriter)) return new BufferWriter(obj); + this.bufLen = 0; if (obj) this.set(obj); else @@ -3201,6 +3203,7 @@ var BufferWriter = function BufferWriter(obj) { BufferWriter.prototype.set = function(obj) { this.bufs = obj.bufs || this.bufs || []; + this.bufLen = this.bufs.reduce(function(prev, buf){ return prev + buf.length; }, 0); return this; }; @@ -3209,58 +3212,60 @@ BufferWriter.prototype.toBuffer = function() { }; BufferWriter.prototype.concat = function() { - return Buffer.concat(this.bufs); + return Buffer.concat(this.bufs, this.bufLen); }; BufferWriter.prototype.write = function(buf) { assert(bufferUtil.isBuffer(buf)); this.bufs.push(buf); + this.bufLen += buf.length; return this; }; BufferWriter.prototype.writeReverse = function(buf) { assert(bufferUtil.isBuffer(buf)); this.bufs.push(bufferUtil.reverse(buf)); + this.bufLen += buf.length; return this; }; BufferWriter.prototype.writeUInt8 = function(n) { - var buf = new Buffer(1); + var buf = Buffer.alloc(1); buf.writeUInt8(n, 0); this.write(buf); return this; }; BufferWriter.prototype.writeUInt16BE = function(n) { - var buf = new Buffer(2); + var buf = Buffer.alloc(2); buf.writeUInt16BE(n, 0); this.write(buf); return this; }; BufferWriter.prototype.writeUInt16LE = function(n) { - var buf = new Buffer(2); + var buf = Buffer.alloc(2); buf.writeUInt16LE(n, 0); this.write(buf); return this; }; BufferWriter.prototype.writeUInt32BE = function(n) { - var buf = new Buffer(4); + var buf = Buffer.alloc(4); buf.writeUInt32BE(n, 0); this.write(buf); return this; }; BufferWriter.prototype.writeInt32LE = function(n) { - var buf = new Buffer(4); + var buf = Buffer.alloc(4); buf.writeInt32LE(n, 0); this.write(buf); return this; }; BufferWriter.prototype.writeUInt32LE = function(n) { - var buf = new Buffer(4); + var buf = Buffer.alloc(4); buf.writeUInt32LE(n, 0); this.write(buf); return this; @@ -3293,18 +3298,18 @@ BufferWriter.prototype.writeVarintBN = function(bn) { BufferWriter.varintBufNum = function(n) { var buf = undefined; if (n < 253) { - buf = new Buffer(1); + buf = Buffer.alloc(1); buf.writeUInt8(n, 0); } else if (n < 0x10000) { - buf = new Buffer(1 + 2); + buf = Buffer.alloc(1 + 2); buf.writeUInt8(253, 0); buf.writeUInt16LE(n, 1); } else if (n < 0x100000000) { - buf = new Buffer(1 + 4); + buf = Buffer.alloc(1 + 4); buf.writeUInt8(254, 0); buf.writeUInt32LE(n, 1); } else { - buf = new Buffer(1 + 8); + buf = Buffer.alloc(1 + 8); buf.writeUInt8(255, 0); buf.writeInt32LE(n & -1, 1); buf.writeUInt32LE(Math.floor(n / 0x100000000), 5); @@ -3316,14 +3321,14 @@ BufferWriter.varintBufBN = function(bn) { var buf = undefined; var n = bn.toNumber(); if (n < 253) { - buf = new Buffer(1); + buf = Buffer.alloc(1); buf.writeUInt8(n, 0); } else if (n < 0x10000) { - buf = new Buffer(1 + 2); + buf = Buffer.alloc(1 + 2); buf.writeUInt8(253, 0); buf.writeUInt16LE(n, 1); } else if (n < 0x100000000) { - buf = new Buffer(1 + 4); + buf = Buffer.alloc(1 + 4); buf.writeUInt8(254, 0); buf.writeUInt32LE(n, 1); } else { @@ -3370,7 +3375,7 @@ Varint.prototype.set = function(obj) { Varint.prototype.fromString = function(str) { this.set({ - buf: new Buffer(str, 'hex') + buf: Buffer.from(str, 'hex') }); return this; }; @@ -4147,7 +4152,7 @@ HDPrivateKey.prototype._buildFromBuffers = function(arg) { var network = Network.get(BufferUtil.integerFromBuffer(arg.version)); var xprivkey; xprivkey = Base58Check.encode(buffer.Buffer.concat(sequence)); - arg.xprivkey = new Buffer(xprivkey); + arg.xprivkey = Buffer.from(xprivkey); var privateKey = new PrivateKey(BN.fromBuffer(arg.privateKey), network); var publicKey = privateKey.toPublicKey(); @@ -4665,7 +4670,7 @@ HDPublicKey.prototype._buildFromBuffers = function(arg) { var xpubkey; xpubkey = Base58Check.encode(BufferUtil.concat(sequence)); - arg.xpubkey = new Buffer(xpubkey); + arg.xpubkey = Buffer.from(xpubkey); var publicKey = new PublicKey(arg.publicKey, {network: network}); var size = HDPublicKey.ParentFingerPrintSize; @@ -4908,29 +4913,29 @@ function addNetwork(data) { xprivkey: data.xprivkey, }); - var indexBy = data.indexBy || Object.keys(network); + var indexBy = data.indexBy || Object.keys(data); if (data.prefix) { - JSUtil.defineImmutable(network, { + _.extend(network, { prefix: data.prefix, prefixArray: prefixToArray(data.prefix), }); } if (data.networkMagic) { - JSUtil.defineImmutable(network, { + _.extend(network, { networkMagic: BufferUtil.integerAsBuffer(data.networkMagic) }); } if (data.port) { - JSUtil.defineImmutable(network, { + _.extend(network, { port: data.port }); } if (data.dnsSeeds) { - JSUtil.defineImmutable(network, { + _.extend(network, { dnsSeeds: data.dnsSeeds }); } @@ -5023,6 +5028,7 @@ var liveNetwork = { // network magic, port, prefix, and dnsSeeds are overloaded by enableRegtest var testNetwork = { name: 'testnet', + prefix: TESTNET.PREFIX, pubkeyhash: 0x6f, privatekey: 0xef, scripthash: 0xc4, @@ -5080,9 +5086,9 @@ Object.defineProperty(testnet, 'networkMagic', { configurable: false, get: function() { if (this.regtestEnabled) { - return REGTEST.NETWORK_MAGIC; + return BufferUtil.integerAsBuffer(REGTEST.NETWORK_MAGIC); } else { - return TESTNET.NETWORK_MAGIC; + return BufferUtil.integerAsBuffer(TESTNET.NETWORK_MAGIC); } } }); @@ -5213,7 +5219,7 @@ Opcode.prototype.toHex = function() { }; Opcode.prototype.toBuffer = function() { - return new Buffer(this.toHex(), 'hex'); + return Buffer.from(this.toHex(), 'hex'); }; Opcode.prototype.toNumber = function() { @@ -5299,9 +5305,9 @@ Opcode.map = { // splice ops OP_CAT: 126, - OP_SUBSTR: 127, - OP_LEFT: 128, - OP_RIGHT: 129, + OP_SPLIT: 127, + OP_NUM2BIN: 128, + OP_BIN2NUM: 129, OP_SIZE: 130, // bit logic @@ -5359,6 +5365,7 @@ Opcode.map = { OP_CHECKMULTISIGVERIFY: 175, OP_CHECKLOCKTIMEVERIFY: 177, + OP_CHECKSEQUENCEVERIFY: 178, // expansion OP_NOP1: 176, @@ -5517,7 +5524,7 @@ PrivateKey.prototype._classifyArguments = function(data, network) { info.network = Networks.get(data); } else if (typeof(data) === 'string'){ if (JSUtil.isHexa(data)) { - info.bn = new BN(new Buffer(data, 'hex')); + info.bn = new BN(Buffer.from(data, 'hex')); } else { info = PrivateKey._transformWIF(data, network); } @@ -5724,11 +5731,11 @@ PrivateKey.prototype.toWIF = function() { var buf; if (compressed) { - buf = Buffer.concat([new Buffer([network.privatekey]), + buf = Buffer.concat([Buffer.from([network.privatekey]), this.bn.toBuffer({size: 32}), - new Buffer([0x01])]); + Buffer.from([0x01])]); } else { - buf = Buffer.concat([new Buffer([network.privatekey]), + buf = Buffer.concat([Buffer.from([network.privatekey]), this.bn.toBuffer({size: 32})]); } @@ -5896,7 +5903,7 @@ PublicKey.prototype._classifyArgs = function(data, extra) { } else if (data.x && data.y) { info = PublicKey._transformObject(data); } else if (typeof(data) === 'string') { - info = PublicKey._transformDER(new Buffer(data, 'hex')); + info = PublicKey._transformDER(Buffer.from(data, 'hex')); } else if (PublicKey._isBuffer(data)) { info = PublicKey._transformDER(data); } else if (PublicKey._isPrivateKey(data)) { @@ -6078,7 +6085,7 @@ PublicKey.fromPoint = function(point, compressed) { * @returns {PublicKey} A new valid instance of PublicKey */ PublicKey.fromString = function(str, encoding) { - var buf = new Buffer(str, encoding || 'hex'); + var buf = Buffer.from(str, encoding || 'hex'); var info = PublicKey._transformDER(buf); return new PublicKey(info.point, { compressed: info.compressed @@ -6155,14 +6162,14 @@ PublicKey.prototype.toBuffer = PublicKey.prototype.toDER = function() { var prefix; if (!this.compressed) { - prefix = new Buffer([0x04]); + prefix = Buffer.from([0x04]); return Buffer.concat([prefix, xbuf, ybuf]); } else { var odd = ybuf[ybuf.length - 1] % 2; if (odd) { - prefix = new Buffer([0x03]); + prefix = Buffer.from([0x03]); } else { - prefix = new Buffer([0x02]); + prefix = Buffer.from([0x02]); } return Buffer.concat([prefix, xbuf]); } @@ -6229,6 +6236,7 @@ var Hash = require('../crypto/hash'); var Signature = require('../crypto/signature'); var PublicKey = require('../publickey'); + /** * Bitcoin transactions contain scripts. Each input has a script called the * scriptSig, and each output has a script called the scriptPubkey. To validate @@ -6261,11 +6269,13 @@ var Interpreter = function Interpreter(obj) { * to check signature validity for some opcodes like OP_CHECKSIG) * @param {number} nin - index of the transaction input containing the scriptSig verified. * @param {number} flags - evaluation flags. See Interpreter.SCRIPT_* constants + * @param {number} satoshisBN - amount in satoshis of the input to be verified (when FORKID signhash is used) * * Translated from bitcoind's VerifyScript */ -Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags) { +Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags, satoshisBN) { var Transaction = require('../transaction'); + if (_.isUndefined(tx)) { tx = new Transaction(); } @@ -6275,11 +6285,23 @@ Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags) if (_.isUndefined(flags)) { flags = 0; } + + // If FORKID is enabled, we also ensure strict encoding. + if (flags & Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID) { + flags |= Interpreter.SCRIPT_VERIFY_STRICTENC; + + // If FORKID is enabled, we need the input amount. + if (!satoshisBN) { + throw new Error('internal error - need satoshisBN to verify FORKID transactions'); + } + } + this.set({ script: scriptSig, tx: tx, nin: nin, - flags: flags + flags: flags, + satoshisBN: satoshisBN, }); var stackCopy; @@ -6304,7 +6326,8 @@ Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags) stack: stack, tx: tx, nin: nin, - flags: flags + flags: flags, + satoshisBN: satoshisBN, }); // evaluate scriptPubkey @@ -6348,7 +6371,8 @@ Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags) stack: stackCopy, tx: tx, nin: nin, - flags: flags + flags: flags, + satoshisBN: satoshisBN, }); // evaluate redeemScript @@ -6364,11 +6388,29 @@ Interpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, flags) if (!Interpreter.castToBool(stackCopy[stackCopy.length - 1])) { this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK'; return false; - } else { - return true; - } + } + } + + // The CLEANSTACK check is only performed after potential P2SH evaluation, + // as the non-P2SH evaluation of a P2SH script will obviously not result in + // a clean stack (the P2SH inputs remain). The same holds for witness + // evaluation. + if ((flags & Interpreter.SCRIPT_VERIFY_CLEANSTACK) != 0) { + // Disallow CLEANSTACK without P2SH, as otherwise a switch + // CLEANSTACK->P2SH+CLEANSTACK would be possible, which is not a + // softfork (and P2SH should be one). + if ((flags & Interpreter.SCRIPT_VERIFY_P2SH) == 0) { + throw new Error('internal error - CLEANSTACK without P2SH'); + } + + if (stackCopy.length != 1) { + this.errstr = 'SCRIPT_ERR_CLEANSTACK'; + return false; + } } + + return true; }; @@ -6389,6 +6431,7 @@ Interpreter.prototype.set = function(obj) { this.script = obj.script || this.script; this.tx = obj.tx || this.tx; this.nin = typeof obj.nin !== 'undefined' ? obj.nin : this.nin; + this.satoshisBN = obj.satoshisBN || this.satoshisBN; this.stack = obj.stack || this.stack; this.altstack = obj.altack || this.altstack; this.pc = typeof obj.pc !== 'undefined' ? obj.pc : this.pc; @@ -6399,10 +6442,11 @@ Interpreter.prototype.set = function(obj) { this.flags = typeof obj.flags !== 'undefined' ? obj.flags : this.flags; }; -Interpreter.true = new Buffer([1]); -Interpreter.false = new Buffer([]); +Interpreter.true = Buffer.from([1]); +Interpreter.false = Buffer.from([]); Interpreter.MAX_SCRIPT_ELEMENT_SIZE = 520; +Interpreter.MAXIMUM_ELEMENT_SIZE = 4; Interpreter.LOCKTIME_THRESHOLD = 500000000; Interpreter.LOCKTIME_THRESHOLD_BN = new BN(Interpreter.LOCKTIME_THRESHOLD); @@ -6449,9 +6493,71 @@ Interpreter.SCRIPT_VERIFY_MINIMALDATA = (1 << 6); // executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected. Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1 << 7); + +// Require that only a single stack element remains after evaluation. This +// changes the success criterion from "At least one stack element must +// remain, and when interpreted as a boolean, it must be true" to "Exactly +// one stack element must remain, and when interpreted as a boolean, it must +// be true". +// (softfork safe, BIP62 rule 6) +// Note: CLEANSTACK should never be used without P2SH or WITNESS. +Interpreter.SCRIPT_VERIFY_CLEANSTACK = (1 << 8), + // CLTV See BIP65 for details. Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1 << 9); +// support CHECKSEQUENCEVERIFY opcode +// +// See BIP112 for details +Interpreter.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY = (1 << 10); + +// Segwit script only: Require the argument of OP_IF/NOTIF to be exactly +// 0x01 or empty vector +// +Interpreter.SCRIPT_VERIFY_MINIMALIF = (1 << 13); + +// Signature(s) must be empty vector if an CHECK(MULTI)SIG operation failed +// +Interpreter.SCRIPT_VERIFY_NULLFAIL = (1 << 14); + +// Public keys in scripts must be compressed +Interpreter.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE = (1 << 15); + +// Do we accept signature using SIGHASH_FORKID +// +Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID = (1 << 16); + +// Do we accept activate replay protection using a different fork id. +// +Interpreter.SCRIPT_ENABLE_REPLAY_PROTECTION = (1 << 17); + +// Enable new opcodes. +// +Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES = (1 << 18); + + + +/* Below flags apply in the context of BIP 68*/ +/** + * If this flag set, CTxIn::nSequence is NOT interpreted as a relative + * lock-time. + */ +Interpreter.SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31); + +/** + * If CTxIn::nSequence encodes a relative lock-time and this flag is set, + * the relative lock-time has units of 512 seconds, otherwise it specifies + * blocks with a granularity of 1. + */ +Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22); + +/** + * If CTxIn::nSequence encodes a relative lock-time, this mask is applied to + * extract that lock-time from the sequence field. + */ +Interpreter.SEQUENCE_LOCKTIME_MASK = 0x0000ffff; + + Interpreter.castToBool = function(buf) { for (var i = 0; i < buf.length; i++) { if (buf[i] !== 0) { @@ -6470,6 +6576,13 @@ Interpreter.castToBool = function(buf) { */ Interpreter.prototype.checkSignatureEncoding = function(buf) { var sig; + + // Empty signature. Not strictly DER encoded, but allowed to provide a + // compact way to provide an invalid signature for use with CHECK(MULTI)SIG + if (buf.length == 0) { + return true; + } + if ((this.flags & (Interpreter.SCRIPT_VERIFY_DERSIG | Interpreter.SCRIPT_VERIFY_LOW_S | Interpreter.SCRIPT_VERIFY_STRICTENC)) !== 0 && !Signature.isTxDER(buf)) { this.errstr = 'SCRIPT_ERR_SIG_DER_INVALID_FORMAT'; return false; @@ -6480,12 +6593,26 @@ Interpreter.prototype.checkSignatureEncoding = function(buf) { return false; } } else if ((this.flags & Interpreter.SCRIPT_VERIFY_STRICTENC) !== 0) { + sig = Signature.fromTxFormat(buf); if (!sig.hasDefinedHashtype()) { this.errstr = 'SCRIPT_ERR_SIG_HASHTYPE'; return false; } + + if (!(this.flags & Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID) && + (sig.nhashtype & Signature.SIGHASH_FORKID)) { + this.errstr = 'SCRIPT_ERR_ILLEGAL_FORKID'; + return false; + } + + if ( (this.flags & Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID) && + !(sig.nhashtype & Signature.SIGHASH_FORKID)) { + this.errstr = 'SCRIPT_ERR_MUST_USE_FORKID'; + return false; + } } + return true; }; @@ -6500,6 +6627,93 @@ Interpreter.prototype.checkPubkeyEncoding = function(buf) { return true; }; + + +/** + * + * Check the buffer is minimally encoded (see https://github.com/bitcoincashorg/spec/blob/master/may-2018-reenabled-opcodes.md#op_bin2num) + * + * + */ + +Interpreter._isMinimallyEncoded = function(buf, nMaxNumSize) { + nMaxNumSize = nMaxNumSize || Interpreter.MAXIMUM_ELEMENT_SIZE; + if (buf.length > nMaxNumSize ) { + return false; + } + + if (buf.length > 0) { + // Check that the number is encoded with the minimum possible number + // of bytes. + // + // If the most-significant-byte - excluding the sign bit - is zero + // then we're not minimal. Note how this test also rejects the + // negative-zero encoding, 0x80. + if ((buf[buf.length-1] & 0x7f) == 0) { + // One exception: if there's more than one byte and the most + // significant bit of the second-most-significant-byte is set it + // would conflict with the sign bit. An example of this case is + // +-255, which encode to 0xff00 and 0xff80 respectively. + // (big-endian). + if (buf.length <= 1 || (buf[buf.length - 2] & 0x80) == 0) { + return false; + } + } + } + return true; +}; + +/** + * + * minimally encode the buffer content + * + * @param {number} nMaxNumSize (max allowed size) + */ +Interpreter._minimallyEncode = function(buf) { + if (buf.length == 0) { + return buf; + } + + // If the last byte is not 0x00 or 0x80, we are minimally encoded. + var last = buf[buf.length - 1]; + if (last & 0x7f) { + return buf; + } + + // If the script is one byte long, then we have a zero, which encodes as an + // empty array. + if (buf.length == 1) { + return Buffer.from(''); + } + + // If the next byte has it sign bit set, then we are minimaly encoded. + if (buf[buf.length - 2] & 0x80) { + return buf; + } + + // We are not minimally encoded, we need to figure out how much to trim. + for (var i = buf.length - 1; i > 0; i--) { + // We found a non zero byte, time to encode. + if (buf[i - 1] != 0) { + if (buf[i - 1] & 0x80) { + // We found a byte with it sign bit set so we need one more + // byte. + buf[i++] = last; + } else { + // the sign bit is clear, we can use it. + buf[i - 1] |= last; + } + + return buf.slice(0,i); + } + } + + // If we the whole thing is zeros, then we have a zero. + return Buffer.from(''); +} + + + /** * Based on bitcoind's EvalScript function, with the inner loop moved to * Interpreter.prototype.step() @@ -6584,11 +6798,109 @@ Interpreter.prototype.checkLockTime = function(nLockTime) { return true; } + +/** + * Checks a sequence parameter with the transaction's sequence. + * @param {BN} nSequence the sequence read from the script + * @return {boolean} true if the transaction's sequence is less than or equal to + * the transaction's sequence + */ +Interpreter.prototype.checkSequence = function(nSequence) { + + // Relative lock times are supported by comparing the passed in operand to + // the sequence number of the input. + var txToSequence = this.tx.inputs[this.nin].sequenceNumber; + + // Fail if the transaction's version number is not set high enough to + // trigger BIP 68 rules. + if (this.tx.version < 2) { + return false; + } + + // Sequence numbers with their most significant bit set are not consensus + // constrained. Testing that the transaction's sequence number do not have + // this bit set prevents using this property to get around a + // CHECKSEQUENCEVERIFY check. + if (txToSequence & SEQUENCE_LOCKTIME_DISABLE_FLAG) { + return false; + } + + // Mask off any bits that do not have consensus-enforced meaning before + // doing the integer comparisons + var nLockTimeMask = + Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG | Interpreter.SEQUENCE_LOCKTIME_MASK; + var txToSequenceMasked = new BN(txToSequence & nLockTimeMask); + var nSequenceMasked = nSequence.and(nLockTimeMask); + + // There are two kinds of nSequence: lock-by-blockheight and + // lock-by-blocktime, distinguished by whether nSequenceMasked < + // CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG. + // + // We want to compare apples to apples, so fail the script unless the type + // of nSequenceMasked being tested is the same as the nSequenceMasked in the + // transaction. + var SEQUENCE_LOCKTIME_TYPE_FLAG_BN = new BN(Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG); + + if (!((txToSequenceMasked.lt(SEQUENCE_LOCKTIME_TYPE_FLAG_BN) && + nSequenceMasked.lt(SEQUENCE_LOCKTIME_TYPE_FLAG_BN)) || + (txToSequenceMasked.gte(SEQUENCE_LOCKTIME_TYPE_FLAG_BN) && + nSequenceMasked.gte(SEQUENCE_LOCKTIME_TYPE_FLAG_BN)))) { + return false; + } + + // Now that we know we're comparing apples-to-apples, the comparison is a + // simple numeric one. + if (nSequenceMasked.gt(txToSequenceMasked)) { + return false; + } + return true; + } + /** * Based on the inner loop of bitcoind's EvalScript function * bitcoind commit: b5d1b1092998bc95313856d535c632ea5a8f9104 */ Interpreter.prototype.step = function() { + var self = this; + + function stacktop(i) { + return self.stack[self.stack.length +i]; + } + + function isOpcodeDisabled(opcode) { + switch (opcode) { + case Opcode.OP_INVERT: + case Opcode.OP_2MUL: + case Opcode.OP_2DIV: + case Opcode.OP_MUL: + case Opcode.OP_LSHIFT: + case Opcode.OP_RSHIFT: + + + + // Disabled opcodes. + return true; + + case Opcode.OP_DIV: + case Opcode.OP_MOD: + case Opcode.OP_SPLIT: + case Opcode.OP_CAT: + case Opcode.OP_AND: + case Opcode.OP_OR: + case Opcode.OP_XOR: + case Opcode.OP_BIN2NUM: + case Opcode.OP_NUM2BIN: + // Opcodes that have been reenabled. + if ((self.flags & Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES) == 0) { + return true; + } + + default: + break; + } + + return false; + } var fRequireMinimal = (this.flags & Interpreter.SCRIPT_VERIFY_MINIMALDATA) !== 0; @@ -6617,22 +6929,7 @@ Interpreter.prototype.step = function() { return false; } - - 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) { + if (isOpcodeDisabled(opcodenum)) { this.errstr = 'SCRIPT_ERR_DISABLED_OPCODE'; return false; } @@ -6735,8 +7032,57 @@ Interpreter.prototype.step = function() { } break; - case Opcode.OP_NOP1: case Opcode.OP_NOP3: + case Opcode.OP_CHECKSEQUENCEVERIFY: + + if (!(this.flags & Interpreter.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)) { + // not enabled; treat as a NOP3 + if (this.flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) { + this.errstr = 'SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS'; + return false; + } + break; + } + + if (this.stack.length < 1) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + + + // nSequence, like nLockTime, is a 32-bit unsigned + // integer field. See the comment in CHECKLOCKTIMEVERIFY + // regarding 5-byte numeric operands. + + var nSequence = BN.fromScriptNumBuffer(stacktop(-1), fRequireMinimal, 5); + + + // In the rare event that the argument may be < 0 due to + // some arithmetic being done first, you can always use + // 0 MAX CHECKSEQUENCEVERIFY. + if (nSequence.lt(new BN(0))) { + this.errstr = 'SCRIPT_ERR_NEGATIVE_LOCKTIME'; + return false; + } + + // To provide for future soft-fork extensibility, if the + // operand has the disabled lock-time flag set, + // CHECKSEQUENCEVERIFY behaves as a NOP. + if ((nSequence & + Interpreter.SEQUENCE_LOCKTIME_DISABLE_FLAG) != 0) { + break; + } + + // Actually compare the specified lock time with the transaction. + if (!this.checkSequence(nSequence)) { + this.errstr = 'SCRIPT_ERR_UNSATISFIED_LOCKTIME'; + return false; + } + break; + + + + case Opcode.OP_NOP1: case Opcode.OP_NOP4: case Opcode.OP_NOP5: case Opcode.OP_NOP6: @@ -6763,11 +7109,23 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_UNBALANCED_CONDITIONAL'; return false; } - buf = this.stack.pop(); + buf = stacktop(-1); + + if (this.flags & Interpreter.SCRIPT_VERIFY_MINIMALIF) { + if (buf.length > 1) { + this.errstr = 'SCRIPT_ERR_MINIMALIF'; + return false; + } + if (buf.length == 1 && buf[0]!=1) { + this.errstr = 'SCRIPT_ERR_MINIMALIF'; + return false; + } + } fValue = Interpreter.castToBool(buf); if (opcodenum === Opcode.OP_NOTIF) { fValue = !fValue; } + this.stack.pop(); } this.vfExec.push(fValue); } @@ -6801,7 +7159,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - 1]; + buf = stacktop(-1); fValue = Interpreter.castToBool(buf); if (fValue) { this.stack.pop(); @@ -6862,8 +7220,8 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf1 = this.stack[this.stack.length - 2]; - buf2 = this.stack[this.stack.length - 1]; + buf1 = stacktop(-2); + buf2 = stacktop(-1); this.stack.push(buf1); this.stack.push(buf2); } @@ -6876,9 +7234,9 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf1 = this.stack[this.stack.length - 3]; - buf2 = this.stack[this.stack.length - 2]; - var buf3 = this.stack[this.stack.length - 1]; + buf1 = stacktop(-3); + buf2 = stacktop(-2); + var buf3 = stacktop(-1); this.stack.push(buf1); this.stack.push(buf2); this.stack.push(buf3); @@ -6892,8 +7250,8 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf1 = this.stack[this.stack.length - 4]; - buf2 = this.stack[this.stack.length - 3]; + buf1 = stacktop(-4); + buf2 = stacktop(-3); this.stack.push(buf1); this.stack.push(buf2); } @@ -6932,7 +7290,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - 1]; + buf = stacktop(-1); fValue = Interpreter.castToBool(buf); if (fValue) { this.stack.push(buf); @@ -6966,7 +7324,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - this.stack.push(this.stack[this.stack.length - 1]); + this.stack.push(stacktop(-1)); } break; @@ -6988,7 +7346,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - this.stack.push(this.stack[this.stack.length - 2]); + this.stack.push(stacktop(-2)); } break; @@ -7001,7 +7359,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - 1]; + buf = stacktop(-1); bn = BN.fromScriptNumBuffer(buf, fRequireMinimal); n = bn.toNumber(); this.stack.pop(); @@ -7009,7 +7367,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - n - 1]; + buf = stacktop(-n-1); if (opcodenum === Opcode.OP_ROLL) { this.stack.splice(this.stack.length - n - 1, 1); } @@ -7026,9 +7384,9 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - x1 = this.stack[this.stack.length - 3]; - x2 = this.stack[this.stack.length - 2]; - var x3 = this.stack[this.stack.length - 1]; + x1 = stacktop(-3); + x2 = stacktop(-2); + var x3 = stacktop(-1); this.stack[this.stack.length - 3] = x2; this.stack[this.stack.length - 2] = x3; this.stack[this.stack.length - 1] = x1; @@ -7042,8 +7400,8 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - x1 = this.stack[this.stack.length - 2]; - x2 = this.stack[this.stack.length - 1]; + x1 = stacktop(-2); + x2 = stacktop(-1); this.stack[this.stack.length - 2] = x2; this.stack[this.stack.length - 1] = x1; } @@ -7056,7 +7414,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - this.stack.splice(this.stack.length - 2, 0, this.stack[this.stack.length - 1]); + this.stack.splice(this.stack.length - 2, 0, stacktop(-1)); } break; @@ -7068,15 +7426,58 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - bn = new BN(this.stack[this.stack.length - 1].length); + bn = new BN(stacktop(-1).length); this.stack.push(bn.toScriptNumBuffer()); } break; + // + // Bitwise logic + // + case Opcode.OP_AND: + case Opcode.OP_OR: + case Opcode.OP_XOR: + { + // (x1 x2 - out) + if (this.stack.length < 2) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + buf1 = stacktop(-2); + buf2 = stacktop(-1); + + // Inputs must be the same size + if (buf1.length !== buf2.length) { + this.errstr = 'SCRIPT_ERR_INVALID_OPERAND_SIZE'; + return false; + } + + // To avoid allocating, we modify vch1 in place. + switch (opcodenum) { + case Opcode.OP_AND: + for (var i = 0; i < buf1.length; i++) { + buf1[i] &= buf2[i]; + } + break; + case Opcode.OP_OR: + for (var i = 0; i < buf1.length; i++) { + buf1[i] |= buf2[i]; + } + break; + case Opcode.OP_XOR: + for (var i = 0; i < buf1.length; i++) { + buf1[i] ^= buf2[i]; + } + break; + default: + break; + } + + // And pop vch2. + this.stack.pop() + } + break; - // - // Bitwise logic - // case Opcode.OP_EQUAL: case Opcode.OP_EQUALVERIFY: //case Opcode.OP_NOTEQUAL: // use Opcode.OP_NUMNOTEQUAL @@ -7086,8 +7487,8 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf1 = this.stack[this.stack.length - 2]; - buf2 = this.stack[this.stack.length - 1]; + buf1 = stacktop(-2); + buf2 = stacktop(-1); var fEqual = buf1.toString('hex') === buf2.toString('hex'); this.stack.pop(); this.stack.pop(); @@ -7119,7 +7520,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - 1]; + buf = stacktop(-1); bn = BN.fromScriptNumBuffer(buf, fRequireMinimal); switch (opcodenum) { case Opcode.OP_1ADD: @@ -7151,6 +7552,8 @@ Interpreter.prototype.step = function() { case Opcode.OP_ADD: case Opcode.OP_SUB: + case Opcode.OP_MOD: + case Opcode.OP_DIV: case Opcode.OP_BOOLAND: case Opcode.OP_BOOLOR: case Opcode.OP_NUMEQUAL: @@ -7168,8 +7571,8 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - bn1 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 2], fRequireMinimal); - bn2 = BN.fromScriptNumBuffer(this.stack[this.stack.length - 1], fRequireMinimal); + bn1 = BN.fromScriptNumBuffer(stacktop(-2), fRequireMinimal); + bn2 = BN.fromScriptNumBuffer(stacktop(-1), fRequireMinimal); bn = new BN(0); switch (opcodenum) { @@ -7181,7 +7584,24 @@ Interpreter.prototype.step = function() { bn = bn1.sub(bn2); break; - // case Opcode.OP_BOOLAND: bn = (bn1 != bnZero && bn2 != bnZero); break; + case Opcode.OP_DIV: + // denominator must not be 0 + if (bn2 == 0) { + this.errstr = 'SCRIPT_ERR_DIV_BY_ZERO'; + return false; + } + bn = bn1.div(bn2); + break; + + case Opcode.OP_MOD: + // divisor must not be 0 + if (bn2 == 0) { + this.errstr = 'SCRIPT_ERR_DIV_BY_ZERO'; + return false; + } + bn = bn1.mod(bn2); + break; + case Opcode.OP_BOOLAND: bn = new BN(((bn1.cmp(BN.Zero) !== 0) && (bn2.cmp(BN.Zero) !== 0)) + 0); break; @@ -7231,7 +7651,7 @@ Interpreter.prototype.step = function() { if (opcodenum === Opcode.OP_NUMEQUALVERIFY) { // if (CastToBool(stacktop(-1))) - if (Interpreter.castToBool(this.stack[this.stack.length - 1])) { + if (Interpreter.castToBool(stacktop(-1))) { this.stack.pop(); } else { this.errstr = 'SCRIPT_ERR_NUMEQUALVERIFY'; @@ -7248,9 +7668,9 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - 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); + bn1 = BN.fromScriptNumBuffer(stacktop(-3), fRequireMinimal); + bn2 = BN.fromScriptNumBuffer(stacktop(-2), fRequireMinimal); + var bn3 = BN.fromScriptNumBuffer(stacktop(-1), fRequireMinimal); //bool fValue = (bn2 <= bn1 && bn1 < bn3); fValue = (bn2.cmp(bn1) <= 0) && (bn1.cmp(bn3) < 0); this.stack.pop(); @@ -7275,7 +7695,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - buf = this.stack[this.stack.length - 1]; + buf = stacktop(-1); //valtype vchHash((opcode == Opcode.OP_RIPEMD160 || // opcode == Opcode.OP_SHA1 || opcode == Opcode.OP_HASH160) ? 20 : 32); var bufHash; @@ -7311,8 +7731,13 @@ Interpreter.prototype.step = function() { return false; } - bufSig = this.stack[this.stack.length - 2]; - bufPubkey = this.stack[this.stack.length - 1]; + bufSig = stacktop(-2); + bufPubkey = stacktop(-1); + + if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) { + + return false; + } // Subset of script starting at the most recent codeseparator // CScript scriptCode(pbegincodehash, pend); @@ -7324,21 +7749,25 @@ Interpreter.prototype.step = function() { var tmpScript = new Script().add(bufSig); subscript.findAndDelete(tmpScript); - if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) { - return false; - } - try { sig = Signature.fromTxFormat(bufSig); pubkey = PublicKey.fromBuffer(bufPubkey, false); - fSuccess = this.tx.verifySignature(sig, pubkey, this.nin, subscript); + + fSuccess = this.tx.verifySignature(sig, pubkey, this.nin, subscript, this.satoshisBN, this.flags); } catch (e) { //invalid sig or pubkey fSuccess = false; } + if (!fSuccess && (this.flags & Interpreter.SCRIPT_VERIFY_NULLFAIL) && + bufSig.length) { + this.errstr = 'SCRIPT_ERR_NULLFAIL'; + return false; + } + this.stack.pop(); this.stack.pop(); + // stack.push_back(fSuccess ? vchTrue : vchFalse); this.stack.push(fSuccess ? Interpreter.true : Interpreter.false); if (opcodenum === Opcode.OP_CHECKSIGVERIFY) { @@ -7363,7 +7792,7 @@ Interpreter.prototype.step = function() { return false; } - var nKeysCount = BN.fromScriptNumBuffer(this.stack[this.stack.length - i], fRequireMinimal).toNumber(); + var nKeysCount = BN.fromScriptNumBuffer(stacktop(-i), fRequireMinimal).toNumber(); if (nKeysCount < 0 || nKeysCount > 20) { this.errstr = 'SCRIPT_ERR_PUBKEY_COUNT'; return false; @@ -7376,12 +7805,19 @@ Interpreter.prototype.step = function() { // int ikey = ++i; var ikey = ++i; i += nKeysCount; + + // ikey2 is the position of last non-signature item in + // the stack. Top stack item = 1. With + // SCRIPT_VERIFY_NULLFAIL, this is used for cleanup if + // operation fails. + var ikey2 = nKeysCount + 2; + if (this.stack.length < i) { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - var nSigsCount = BN.fromScriptNumBuffer(this.stack[this.stack.length - i], fRequireMinimal).toNumber(); + var nSigsCount = BN.fromScriptNumBuffer(stacktop(-i), fRequireMinimal).toNumber(); if (nSigsCount < 0 || nSigsCount > nKeysCount) { this.errstr = 'SCRIPT_ERR_SIG_COUNT'; return false; @@ -7401,18 +7837,19 @@ Interpreter.prototype.step = function() { // Drop the signatures, since there's no way for a signature to sign itself for (var k = 0; k < nSigsCount; k++) { - bufSig = this.stack[this.stack.length - isig - k]; + bufSig = stacktop(-isig-k); subscript.findAndDelete(new Script().add(bufSig)); } fSuccess = true; while (fSuccess && nSigsCount > 0) { // valtype& vchSig = stacktop(-isig); - bufSig = this.stack[this.stack.length - isig]; + bufSig = stacktop(-isig); // valtype& vchPubKey = stacktop(-ikey); - bufPubkey = this.stack[this.stack.length - ikey]; + bufPubkey = stacktop(-ikey); if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) { + return false; } @@ -7420,7 +7857,7 @@ Interpreter.prototype.step = function() { try { sig = Signature.fromTxFormat(bufSig); pubkey = PublicKey.fromBuffer(bufPubkey, false); - fOk = this.tx.verifySignature(sig, pubkey, this.nin, subscript); + fOk = this.tx.verifySignature(sig, pubkey, this.nin, subscript, this.satoshisBN, this.flags); } catch (e) { //invalid sig or pubkey fOk = false; @@ -7440,8 +7877,20 @@ Interpreter.prototype.step = function() { } } + // Clean up stack of actual arguments while (i-- > 1) { + if (!fSuccess && (this.flags & Interpreter.SCRIPT_VERIFY_NULLFAIL) && + !ikey2 && stacktop(-1).length) { + + this.errstr = 'SCRIPT_ERR_NULLFAIL'; + return false; + } + + if (ikey2 > 0) { + ikey2--; + } + this.stack.pop(); } @@ -7455,7 +7904,7 @@ Interpreter.prototype.step = function() { this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; return false; } - if ((this.flags & Interpreter.SCRIPT_VERIFY_NULLDUMMY) && this.stack[this.stack.length - 1].length) { + if ((this.flags & Interpreter.SCRIPT_VERIFY_NULLDUMMY) && stacktop(-1).length) { this.errstr = 'SCRIPT_ERR_SIG_NULLDUMMY'; return false; } @@ -7474,6 +7923,134 @@ Interpreter.prototype.step = function() { } break; + // + // Byte string operations + // + case Opcode.OP_CAT: { + + if (this.stack.length < 2) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + + buf1 = stacktop(-2); + buf2 = stacktop(-1); + if (buf1.length + buf2.length > Interpreter.MAX_SCRIPT_ELEMENT_SIZE) { + this.errstr = 'SCRIPT_ERR_PUSH_SIZE'; + return false; + } + this.stack[this.stack.length - 2] = Buffer.concat([buf1,buf2]); + this.stack.pop(); + } + break; + + case Opcode.OP_SPLIT: { + if (this.stack.length < 2) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + buf1 = stacktop(-2); + + // Make sure the split point is apropriate. + var position = BN.fromScriptNumBuffer(stacktop(-1), fRequireMinimal).toNumber(); + if (position < 0 || position > buf1.length) { + this.errstr = 'SCRIPT_ERR_INVALID_SPLIT_RANGE'; + return false; + } + + // Prepare the results in their own buffer as `data` + // will be invalidated. + // Copy buffer data, to slice it before + var n1 = Buffer.from(buf1); + + // Replace existing stack values by the new values. + this.stack[this.stack.length - 2] = n1.slice(0, position); + this.stack[this.stack.length - 1] = n1.slice(position); + } + break; + + // + // Conversion operations + // + case Opcode.OP_NUM2BIN: { + + // (in -- out) + if (this.stack.length < 2) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + + var size = BN.fromScriptNumBuffer(stacktop(-1), fRequireMinimal).toNumber(); + if (size > Interpreter.MAX_SCRIPT_ELEMENT_SIZE) { + this.errstr = 'SCRIPT_ERR_PUSH_SIZE'; + return false; + } + + this.stack.pop(); + var rawnum = stacktop(-1); + + // Try to see if we can fit that number in the number of + // byte requested. + rawnum=Interpreter._minimallyEncode(rawnum); + + if (rawnum.length > size) { + // We definitively cannot. + this.errstr = 'SCRIPT_ERR_IMPOSSIBLE_ENCODING'; + return false; + } + + // We already have an element of the right size, we + // don't need to do anything. + if (rawnum.length == size) { + this.stack[this.stack.length-1] = rawnum; + break; + } + + var signbit = 0x00; + if (rawnum.length > 0) { + signbit = rawnum[rawnum.length - 1] & 0x80; + rawnum[rawnum.length - 1] &= 0x7f; + } + + var num = Buffer.alloc(size); + rawnum.copy(num,0); + + var l = rawnum.length - 1; + while (l++ < size - 2) { + num[l]=0x00; + } + + num[l]=signbit; + + this.stack[this.stack.length-1] = num; + } + break; + + + + case Opcode.OP_BIN2NUM: { + // (in -- out) + if (this.stack.length < 1) { + this.errstr = 'SCRIPT_ERR_INVALID_STACK_OPERATION'; + return false; + } + + buf1 = stacktop(-1); + buf2 = Interpreter._minimallyEncode(buf1); + + this.stack[this.stack.length - 1] = buf2; + + // The resulting number must be a valid number. + if (!Interpreter._isMinimallyEncoded(buf2)) { + this.errstr = 'SCRIPT_ERR_INVALID_NUMBER_RANGE'; + return false; + } + } + break; + + + + default: this.errstr = 'SCRIPT_ERR_BAD_OPCODE'; return false; @@ -7634,7 +8211,7 @@ Script.fromASM = function(str) { var opcodenum = opcode.toNumber(); if (_.isUndefined(opcodenum)) { - var buf = new Buffer(tokens[i], 'hex'); + var buf = Buffer.from(tokens[i], 'hex'); script.chunks.push({ buf: buf, len: buf.length, @@ -7645,7 +8222,7 @@ Script.fromASM = function(str) { opcodenum === Opcode.OP_PUSHDATA2 || opcodenum === Opcode.OP_PUSHDATA4) { script.chunks.push({ - buf: new Buffer(tokens[i + 2], 'hex'), + buf: Buffer.from(tokens[i + 2], 'hex'), len: parseInt(tokens[i + 1]), opcodenum: opcodenum }); @@ -7682,7 +8259,7 @@ Script.fromString = function(str) { opcodenum = parseInt(token); if (opcodenum > 0 && opcodenum < Opcode.OP_PUSHDATA1) { script.chunks.push({ - buf: new Buffer(tokens[i + 1].slice(2), 'hex'), + buf: Buffer.from(tokens[i + 1].slice(2), 'hex'), len: opcodenum, opcodenum: opcodenum }); @@ -7697,7 +8274,7 @@ Script.fromString = function(str) { throw new Error('Pushdata data must start with 0x'); } script.chunks.push({ - buf: new Buffer(tokens[i + 2].slice(2), 'hex'), + buf: Buffer.from(tokens[i + 2].slice(2), 'hex'), len: parseInt(tokens[i + 1]), opcodenum: opcodenum }); @@ -7969,13 +8546,13 @@ Script.prototype.isDataOut = function() { Script.prototype.getData = function() { if (this.isDataOut() || this.isScriptHashOut()) { if (_.isUndefined(this.chunks[1])) { - return new Buffer(0); + return Buffer.alloc(0); } else { - return new Buffer(this.chunks[1].buf); + return Buffer.from(this.chunks[1].buf); } } if (this.isPublicKeyHashOut()) { - return new Buffer(this.chunks[2].buf); + return Buffer.from(this.chunks[2].buf); } throw new Error('Unrecognized script type to get data from'); }; @@ -8003,7 +8580,7 @@ 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.OP_RETURN_STANDARD_SIZE = 220; /** * @returns {object} The Script type if it is a known form, @@ -8178,6 +8755,7 @@ Script.prototype._addBuffer = function(buf, prepend) { return this; }; + Script.prototype.removeCodeseparators = function() { var chunks = []; for (var i = 0; i < this.chunks.length; i++) { @@ -8320,7 +8898,7 @@ Script.buildPublicKeyOut = function(pubkey) { Script.buildDataOut = function(data, encoding) { $.checkArgument(_.isUndefined(data) || _.isString(data) || BufferUtil.isBuffer(data)); if (_.isString(data)) { - data = new Buffer(data, encoding); + data = Buffer.from(data, encoding); } var s = new Script(); s.add(Opcode.OP_RETURN); @@ -9581,13 +10159,14 @@ var Hash = require('../crypto/hash'); var ECDSA = require('../crypto/ecdsa'); var $ = require('../util/preconditions'); var BufferUtil = require('../util/buffer'); +var Interpreter = require('../script/interpreter'); var _ = require('lodash'); var SIGHASH_SINGLE_BUG = '0000000000000000000000000000000000000000000000000000000000000001'; var BITS_64_ON = 'ffffffffffffffff'; - -var ENABLE_SIGHASH_FORKID = true; +// By default, we sign with sighash_forkid +var DEFAULT_SIGN_FLAGS = Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID; var sighashForForkId = function(transaction, sighashType, inputNumber, subscript, satoshisBN) { @@ -9597,8 +10176,6 @@ var sighashForForkId = function(transaction, sighashType, inputNumber, subscript 'For ForkId=0 signatures, satoshis or complete input must be provided' ); - - function GetForkId() { return 0; // In the UAHF, a fork id of 0 is used (see [4] REQ-6-2 NOTE 4) }; @@ -9723,21 +10300,33 @@ function getHash (w) { * @param {number} sighashType the type of the hash * @param {number} inputNumber the input index for the signature * @param {Script} subscript the script that will be signed - * @param {satoshisBN} sed in ForkId signatures. If not provided, outputs's amount is used. + * @param {satoshisBN} input's amount (for ForkId signatures) * */ -var sighash = function sighash(transaction, sighashType, inputNumber, subscript, satoshisBN) { +var sighash = function sighash(transaction, sighashType, inputNumber, subscript, satoshisBN, flags) { var Transaction = require('./transaction'); var Input = require('./input'); + if (_.isUndefined(flags)){ + flags = DEFAULT_SIGN_FLAGS; + } + // Copy transaction var txcopy = Transaction.shallowCopy(transaction); // Copy script subscript = new Script(subscript); + if (flags & Interpreter.SCRIPT_ENABLE_REPLAY_PROTECTION) { + // Legacy chain's value for fork id must be of the form 0xffxxxx. + // By xoring with 0xdead, we ensure that the value will be different + // from the original one, even if it already starts with 0xff. + var forkValue = sighashType >> 8; + var newForkValue = 0xff0000 | ( forkValue ^ 0xdead); + sighashType = (newForkValue << 8) | (sighashType & 0xff) + } - if ( ( sighashType & Signature.SIGHASH_FORKID) && ENABLE_SIGHASH_FORKID) { + if ( ( sighashType & Signature.SIGHASH_FORKID) && (flags & Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID) ) { return sighashForForkId(txcopy, sighashType, inputNumber, subscript, satoshisBN); } @@ -9771,7 +10360,7 @@ var sighash = function sighash(transaction, sighashType, inputNumber, subscript, // The SIGHASH_SINGLE bug. // https://bitcointalk.org/index.php?topic=260595.0 if (inputNumber >= txcopy.outputs.length) { - return new Buffer(SIGHASH_SINGLE_BUG, 'hex'); + return Buffer.from(SIGHASH_SINGLE_BUG, 'hex'); } txcopy.outputs.length = inputNumber + 1; @@ -9809,8 +10398,11 @@ var sighash = function sighash(transaction, sighashType, inputNumber, subscript, * @param {satoshisBN} input's amount * @return {Signature} */ -function sign(transaction, privateKey, sighashType, inputIndex, subscript, satoshisBN) { - var hashbuf = sighash(transaction, sighashType, inputIndex, subscript, satoshisBN); +function sign(transaction, privateKey, sighashType, inputIndex, subscript, satoshisBN, flags) { + var hashbuf = sighash(transaction, sighashType, inputIndex, subscript, satoshisBN, flags); + + + var sig = ECDSA.sign(hashbuf, privateKey, 'little').set({ nhashtype: sighashType }); @@ -9827,12 +10419,13 @@ function sign(transaction, privateKey, sighashType, inputIndex, subscript, satos * @param {number} inputIndex * @param {Script} subscript * @param {satoshisBN} input's amount + * @param {flags} verification flags * @return {boolean} */ -function verify(transaction, signature, publicKey, inputIndex, subscript, satoshisBN) { +function verify(transaction, signature, publicKey, inputIndex, subscript, satoshisBN, flags) { $.checkArgument(!_.isUndefined(transaction)); $.checkArgument(!_.isUndefined(signature) && !_.isUndefined(signature.nhashtype)); - var hashbuf = sighash(transaction, signature.nhashtype, inputIndex, subscript, satoshisBN); + var hashbuf = sighash(transaction, signature.nhashtype, inputIndex, subscript, satoshisBN, flags); return ECDSA.verify(hashbuf, signature, publicKey, 'little'); } @@ -9846,7 +10439,7 @@ module.exports = { }; }).call(this,require("buffer").Buffer) -},{"../crypto/bn":6,"../crypto/ecdsa":7,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../script":25,"../util/buffer":43,"../util/preconditions":46,"./input":29,"./output":35,"./transaction":38,"buffer":98,"lodash":156}],37:[function(require,module,exports){ +},{"../crypto/bn":6,"../crypto/ecdsa":7,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../script":25,"../script/interpreter":26,"../util/buffer":43,"../util/preconditions":46,"./input":29,"./output":35,"./transaction":38,"buffer":98,"lodash":156}],37:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -9884,7 +10477,7 @@ inherits(TransactionSignature, Signature); TransactionSignature.prototype._fromObject = function(arg) { this._checkObjectArgs(arg); this.publicKey = new PublicKey(arg.publicKey); - this.prevTxId = BufferUtil.isBuffer(arg.prevTxId) ? arg.prevTxId : new Buffer(arg.prevTxId, 'hex'); + this.prevTxId = BufferUtil.isBuffer(arg.prevTxId) ? arg.prevTxId : Buffer.from(arg.prevTxId, 'hex'); this.outputIndex = arg.outputIndex; this.inputIndex = arg.inputIndex; this.signature = (arg.signature instanceof Signature) ? arg.signature : @@ -10045,7 +10638,8 @@ var hashProperty = { configurable: false, enumerable: true, get: function() { - return new BufferReader(this._getHash()).readReverse().toString('hex'); + this._hash = new BufferReader(this._getHash()).readReverse().toString('hex'); + return this._hash; } }; Object.defineProperty(Transaction.prototype, 'hash', hashProperty); @@ -11055,8 +11649,8 @@ Transaction.prototype.isValidSignature = function(signature) { /** * @returns {bool} whether the signature is valid for this transaction input */ -Transaction.prototype.verifySignature = function(sig, pubkey, nin, subscript) { - return Sighash.verify(this, sig, pubkey, nin, subscript); +Transaction.prototype.verifySignature = function(sig, pubkey, nin, subscript, satoshisBN, flags) { + return Sighash.verify(this, sig, pubkey, nin, subscript, satoshisBN, flags); }; /** @@ -11715,7 +12309,7 @@ URI.prototype.toString = function() { return URL.format({ protocol: 'bitcoincash:', - host: this.address, + host: this.address.toString(true), query: query }); }; @@ -11844,7 +12438,7 @@ module.exports = { * @return {Buffer} */ copy: function(original) { - var buffer = new Buffer(original.length); + var buffer = Buffer.alloc(original.length); original.copy(buffer); return buffer; }, @@ -11909,7 +12503,7 @@ module.exports = { bytes.push((integer >> 16) & 0xff); bytes.push((integer >> 8) & 0xff); bytes.push(integer & 0xff); - return new Buffer(bytes); + return Buffer.from(bytes); }, /** @@ -11970,11 +12564,11 @@ module.exports = { hexToBuffer: function hexToBuffer(string) { assert(js.isHexa(string)); return new buffer.Buffer(string, 'hex'); - } + }, }; -module.exports.NULL_HASH = module.exports.fill(new Buffer(32), 0); -module.exports.EMPTY_BUFFER = new Buffer(0); +module.exports.NULL_HASH = module.exports.fill(Buffer.alloc(32), 0); +module.exports.EMPTY_BUFFER = Buffer.alloc(0); }).call(this,require("buffer").Buffer) },{"./js":45,"./preconditions":46,"assert":61,"buffer":98}],44:[function(require,module,exports){ @@ -27669,7 +28263,13 @@ utils.intFromLE = intFromLE; },{"bn.js":64,"minimalistic-assert":160,"minimalistic-crypto-utils":161}],133:[function(require,module,exports){ module.exports={ - "_from": "elliptic@=6.4.0", + "_args": [ + [ + "elliptic@6.4.0", + "/Users/ematiu/dev/bitcore-lib-cash" + ] + ], + "_from": "elliptic@6.4.0", "_id": "elliptic@6.4.0", "_inBundle": false, "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", @@ -27678,12 +28278,12 @@ 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": [ "/", @@ -27691,9 +28291,8 @@ module.exports={ "/create-ecdh" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", - "_spec": "elliptic@=6.4.0", - "_where": "/Users/ematiu/dev/cash-blib", + "_spec": "6.4.0", + "_where": "/Users/ematiu/dev/bitcore-lib-cash", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -27701,7 +28300,6 @@ module.exports={ "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, - "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -27711,7 +28309,6 @@ module.exports={ "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, - "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -54437,7 +55034,7 @@ exports.createContext = Script.createContext = function (context) { },{"indexof":152}],217:[function(require,module,exports){ module.exports={ "name": "bitcore-lib-cash", - "version": "0.16.3", + "version": "0.18.0", "description": "A pure and powerful JavaScript Bitcoin Cash library.", "author": "BitPay ", "main": "index.js", diff --git a/bitcore-lib.min.js b/bitcore-lib.min.js index c13c4421..2e23b510 100644 --- a/bitcore-lib.min.js +++ b/bitcore-lib.min.js @@ -1,19 +1,19 @@ -require=function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o"},n.prototype.toCashBuffer=function(){var t=new r([this.network[this.type]]);return r.concat([t,this.hashBuffer])},n.prototype.toCashAddress=function(){var t=[0,0,0,0,0,0,0,0],e=this.network.prefixArray.concat([0]),r=function(t){switch(t){case"pubkeyhash":return 0;case"scripthash":return 8;default:throw new Error("Invalid type:"+t)}}(this.type)+function(t){switch(8*t.length){case 160:return 0;case 192:return 1;case 224:return 2;case 256:return 3;case 320:return 4;case 384:return 5;case 448:return 6;case 512:return 7;default:throw new Error("Invalid hash size:"+t.length)}}(this.hashBuffer),n=Array.prototype.slice.call(this.hashBuffer,0),i=m([r].concat(n),8,5),s=e.concat(i).concat(t),u=i.concat(o(a(s)));return this.network.prefix+":"+y.encode(u)};var v=u.map([656907472481,522768456162,0xf33e5fb3c4,748107326120,130178868336],function(t){return new g(t)});e.exports=n;var _=t("./script")}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./encoding/base58check":13,"./errors":17,"./networks":21,"./publickey":24,"./script":25,"./util/base32":42,"./util/convertBits":44,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],2:[function(t,e,r){(function(r){"use strict";function n(t){return this instanceof n?(i.extend(this,n._from(t)),this):new n(t)}var i=t("lodash"),s=t("./blockheader"),o=t("../crypto/bn"),a=t("../util/buffer"),u=t("../encoding/bufferreader"),f=t("../encoding/bufferwriter"),c=t("../crypto/hash"),h=t("../transaction"),d=t("../util/preconditions");n.MAX_BLOCK_SIZE=1e6,n._from=function(t){var e={};if(a.isBuffer(t))e=n._fromBufferReader(u(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for Block");e=n._fromObject(t)}return e},n._fromObject=function(t){var e=[];return t.transactions.forEach(function(t){t instanceof h?e.push(t):e.push(h().fromObject(t))}),{header:s.fromObject(t.header),transactions:e}},n.fromObject=function(t){return new n(n._fromObject(t))},n._fromBufferReader=function(t){var e={};d.checkState(!t.finished(),"No block data received"),e.header=s.fromBufferReader(t);var r=t.readVarintNum();e.transactions=[];for(var n=0;n1;n=Math.floor((n+1)/2)){for(var i=0;i"},n.Values={START_OF_BLOCK:8,NULL_HASH:new r("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":28,"../util/buffer":43,"../util/preconditions":46,"./blockheader":3,buffer:98,lodash:156}],3:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../crypto/bn"),s=t("../util/buffer"),o=t("../encoding/bufferreader"),a=t("../encoding/bufferwriter"),u=t("../crypto/hash"),f=(t("../util/js"),t("../util/preconditions")),c=function t(e){if(!(this instanceof t))return new t(e);var r=t._from(e);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&f.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};c._from=function(t){var e={};if(s.isBuffer(t))e=c._fromBufferReader(o(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");e=c._fromObject(t)}return e},c._fromObject=function(t){f.checkArgument(t,"data is required");var e=t.prevHash,i=t.merkleRoot;return n.isString(t.prevHash)&&(e=s.reverse(new r(t.prevHash,"hex"))),n.isString(t.merkleRoot)&&(i=s.reverse(new r(t.merkleRoot,"hex"))),{hash:t.hash,version:t.version,prevHash:e,merkleRoot:i,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce}},c.fromObject=function(t){var e=c._fromObject(t);return new c(e)},c.fromRawBlock=function(t){s.isBuffer(t)||(t=new r(t,"binary"));var e=o(t);e.pos=c.Constants.START_OF_HEADER;var n=c._fromBufferReader(e);return new c(n)},c.fromBuffer=function(t){var e=c._fromBufferReader(o(t));return new c(e)},c.fromString=function(t){var e=new r(t,"hex");return c.fromBuffer(e)},c._fromBufferReader=function(t){var e={};return e.version=t.readInt32LE(),e.prevHash=t.read(32),e.merkleRoot=t.read(32),e.time=t.readUInt32LE(),e.bits=t.readUInt32LE(),e.nonce=t.readUInt32LE(),e},c.fromBufferReader=function(t){var e=c._fromBufferReader(t);return new c(e)},c.prototype.toObject=c.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:s.reverse(this.prevHash).toString("hex"),merkleRoot:s.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toString=function(){return this.toBuffer().toString("hex")},c.prototype.toBufferWriter=function(t){return t||(t=new a),t.writeInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},c.prototype.getTargetDifficulty=function(t){t=t||this.bits;for(var e=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)e=e.mul(new i(2));return e},c.prototype.getDifficulty=function(){var t=this.getTargetDifficulty(486604799).mul(new i(Math.pow(10,8))),e=this.getTargetDifficulty(),r=t.div(e).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},c.prototype._getHash=function(){var t=this.toBuffer();return u.sha256sha256(t)};var h={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(c.prototype,"id",h),Object.defineProperty(c.prototype,"hash",h),c.prototype.validTimestamp=function(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+c.Constants.MAX_TIME_OFFSET)},c.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return!(t.cmp(e)>0)},c.prototype.inspect=function(){return""},c.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=c}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],4:[function(t,e,r){e.exports=t("./block"),e.exports.BlockHeader=t("./blockheader"),e.exports.MerkleBlock=t("./merkleblock")},{"./block":2,"./blockheader":3,"./merkleblock":5}],5:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);var e={};if(o.isBuffer(t))e=n._fromBufferReader(a(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=t.header instanceof s?t.header:s.fromObject(t.header),e={header:r,numTransactions:t.numTransactions,hashes:t.hashes,flags:t.flags}}return i.extend(this,e),this._flagBitsUsed=0,this._hashesUsed=0,this}var i=t("lodash"),s=t("./blockheader"),o=t("../util/buffer"),a=t("../encoding/bufferreader"),u=t("../encoding/bufferwriter"),f=t("../crypto/hash"),c=(t("../util/js"),t("../transaction")),h=t("../errors"),d=t("../util/preconditions");n.fromBuffer=function(t){return n.fromBufferReader(a(t))},n.fromBufferReader=function(t){return new n(n._fromBufferReader(t))},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toBufferWriter=function(t){t||(t=new u),t.write(this.header.toBuffer()),t.writeUInt32LE(this.numTransactions),t.writeVarintNum(this.hashes.length);for(var e=0;ethis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new h.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length8*this.flags.length)return null;var s=this.flags[n.flagBitsUsed>>3]>>>(7&n.flagBitsUsed++)&1;if(0!==t&&s){var o=this._traverseMerkleTree(t-1,2*e,n),a=o;return 2*e+1=this.hashes.length)return null;var u=this.hashes[n.hashesUsed++];return 0===t&&s&&n.txs.push(u),new r(u,"hex")},n.prototype._calcTreeWidth=function(t){return this.numTransactions+(1<>t},n.prototype._calcTreeHeight=function(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},n.prototype.hasTransaction=function(t){d.checkArgument(!i.isUndefined(t),"tx cannot be undefined"),d.checkArgument(t instanceof c||"string"==typeof t,'Invalid tx given, tx must be a "string" or "Transaction"');var e=t;t instanceof c&&(e=o.reverse(new r(t.id,"hex")).toString("hex"));var n=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:n}),-1!==n.indexOf(e)},n._fromBufferReader=function(t){d.checkState(!t.finished(),"No merkleblock data received");var e={};e.header=s.fromBufferReader(t),e.numTransactions=t.readUInt32LE();var r=t.readVarintNum();e.hashes=[];for(var n=0;nt.size?e=n.trim(e,s):s0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(t,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.prototype.gt=function(t){return this.cmp(t)>0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.lt=function(t){return this.cmp(t)<0},n.trim=function(t,e){return t.slice(e-t.length,t.length)},n.pad=function(t,e,n){for(var i=new r(n),s=0;s>1,f=i.getN(),c=i.getG(),d=u?r.add(f):r,l=i.fromX(a,d);if(!l.mul(f).isInfinity())throw new Error("nR is not a valid curve point");var p=e.neg().umod(f),b=r.invm(f),g=l.mul(s).add(c.mul(p)).mul(b);return o.fromPoint(g,this.sig.compressed)},d.prototype.sigError=function(){if(!f.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,e=this.sig.s;if(!(t.gt(n.Zero)&&t.lt(i.getN())&&e.gt(n.Zero)&&e.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=i.getN(),o=e.invm(s),a=o.mul(r).umod(s),u=o.mul(t).umod(s),c=i.getG().mulAdd(a,this.pubkey.point,u);return c.isInfinity()?"p is infinity":0!==c.getX().umod(s).cmp(t)&&"Invalid signature"},d.toLowS=function(t){return t.gt(n.fromBuffer(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=i.getN().sub(t)),t},d.prototype._findSignature=function(t,e){var r,s,o,a,u=i.getN(),f=i.getG(),c=0;do{(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,s=f.mul(r),o=s.x.umod(u),a=r.invm(u).mul(e.add(t.mul(o))).umod(u)}while(o.cmp(n.Zero)<=0||a.cmp(n.Zero)<=0);return a=d.toLowS(a),{s:a,r:o}},d.prototype.sign=function(){var t=this.hashbuf,e=this.privkey,r=e.bn;h.checkState(t&&e&&r,new Error("invalid parameters")),h.checkState(f.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(t,this.endian?{endian:this.endian}:void 0),o=this._findSignature(r,i);return o.compressed=this.pubkey.compressed,this.sig=new s(o),this},d.prototype.signRandomK=function(){return this.randomK(),this.sign()},d.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},d.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},d.sign=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().sig},d.verify=function(t,e,r,n){return d().set({hashbuf:t,endian:n,sig:e,pubkey:r}).verify().verified},e.exports=d}).call(this,t("buffer").Buffer)},{"../publickey":24,"../util/buffer":43,"../util/preconditions":46,"./bn":6,"./hash":8,"./point":9,"./random":10,"./signature":11,buffer:98,lodash:156}],8:[function(t,e,r){(function(r){"use strict";var n=t("crypto"),i=t("../util/buffer"),s=t("../util/preconditions"),o=e.exports;o.sha1=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha1").update(t).digest()},o.sha1.blocksize=512,o.sha256=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha256").update(t).digest()},o.sha256.blocksize=512,o.sha256sha256=function(t){return s.checkArgument(i.isBuffer(t)),o.sha256(o.sha256(t))},o.ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("ripemd160").update(t).digest()},o.sha256ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha512").update(t).digest()},o.sha512.blocksize=1024,o.hmac=function(t,e,n){s.checkArgument(i.isBuffer(e)),s.checkArgument(i.isBuffer(n)),s.checkArgument(t.blocksize);var o=t.blocksize/8;if(n.length>o)n=t(n);else if(n>>=8)}return r},e.exports=i}).call(this,t("_process"),t("buffer").Buffer)},{_process:173,buffer:98,crypto:107}],11:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("lodash"),s=t("../util/preconditions"),o=t("../util/buffer"),a=t("../util/js"),u=function t(e,r){if(!(this instanceof t))return new t(e,r);if(e instanceof n)this.set({r:e,s:r});else if(e){var i=e;this.set(i)}};u.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i=void 0!==t.i?t.i:this.i,this.compressed=void 0!==t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},u.fromCompact=function(t){s.checkArgument(o.isBuffer(t),"Argument is expected to be a Buffer");var e=new u,r=!0,i=t.slice(0,1)[0]-27-4;i<0&&(r=!1,i+=4);var a=t.slice(1,33),f=t.slice(33,65);return s.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),s.checkArgument(32===a.length,new Error("r must be 32 bytes")),s.checkArgument(32===f.length,new Error("s must be 32 bytes")),e.compressed=r,e.i=i,e.r=n.fromBuffer(a),e.s=n.fromBuffer(f),e},u.fromDER=u.fromBuffer=function(t,e){var r=u.parseDER(t,e),n=new u;return n.r=r.r,n.s=r.s,n},u.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),n=new u.fromDER(r,!1);return n.nhashtype=e,n},u.fromString=function(t){var e=new r(t,"hex");return u.fromDER(e)},u.parseDER=function(t,e){s.checkArgument(o.isBuffer(t),new Error("DER formatted signature should be a buffer")),i.isUndefined(e)&&(e=!0);var r=t[0];s.checkArgument(48===r,new Error("Header byte should be 0x30"));var a=t[1],u=t.slice(2).length;s.checkArgument(!e||a===u,new Error("Length byte should length of what follows")),a=a73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;var i=t.slice(6+e);return 2===t[6+e-2]&&(0!==r&&(!(128&i[0])&&!(r>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(tu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var t=this.toDER(),e=new r(1);return e.writeUInt8(this.nhashtype,0),r.concat([t,e])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_FORKID=64,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/js":45,"../util/preconditions":46,"./bn":6,buffer:98,lodash:156}],12:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("bs58"),s=t("buffer"),o="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}else e&&this.set(e)};a.validCharacters=function(t){return s.Buffer.isBuffer(t)&&(t=t.toString()),n.every(n.map(t,function(t){return n.includes(o,t)}))},a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.encode=function(t){if(!s.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return i.encode(t)},a.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return new r(i.decode(t))},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{bs58:95,buffer:98,lodash:156}],13:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./base58"),s=t("buffer"),o=t("../crypto/hash").sha256sha256,a=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}else e&&this.set(e)};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.validChecksum=function(t,e){return n.isString(t)&&(t=new s.Buffer(i.decode(t))),n.isString(e)&&(e=new s.Buffer(i.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===e.toString("hex")},a.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=new r(i.decode(t));if(e.length<4)throw new Error("Input string too short");var n=e.slice(0,-4),s=e.slice(-4),a=o(n),u=a.slice(0,4);if(s.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(t){return o(t).slice(0,4)},a.encode=function(t){if(!r.isBuffer(t))throw new Error("Input must be a buffer");var e=new r(t.length+4),n=a.checksum(t);return t.copy(e),n.copy(e,t.length),i.encode(e)},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"./base58":12,buffer:98,lodash:156}],14:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../util/preconditions"),s=t("../util/buffer"),o=t("../crypto/bn"),a=function t(e){if(!(this instanceof t))return new t(e);if(!n.isUndefined(e))if(r.isBuffer(e))this.set({buf:e});else if(n.isString(e)){var i=new r(e,"hex");if(2*i.length!=e.length)throw new TypeError("Invalid hex string");this.set({buf:i})}else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for BufferReader");var s=e;this.set(s)}};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(t){i.checkArgument(!n.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},a.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},a.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},a.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readInt32LE=function(){var t=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=o.fromBuffer(t);return this.pos=this.pos+8,e},a.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=this.buf.readUInt32LE(this.pos+4),n=4294967296*r+e;if(n<=9007199254740991)t=new o(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new o(i,10,"le")}return this.pos=this.pos+8,t},a.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN(),r=e.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},a.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return i.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},a.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)}},a.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(t)}},a.prototype.reverse=function(){for(var t=new r(this.buf.length),e=0;e=0&&t=n.Hardened||e,t64)throw new y.InvalidEntropyArgument.TooMuchEntropy(t);var i=h.sha512hmac(t,new s.Buffer("Bitcoin seed"));return new n({network:d.get(e)||d.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},n.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=t("./hdpublickey");this._hdPublicKey=new e(this)}},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),v.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,m.emptyBuffer(1),t.privateKey],i=s.Buffer.concat(e);if(t.checksum&&t.checksum.length){if(t.checksum.toString()!==c.checksum(i).toString())throw new g.InvalidB58Checksum(i)}else t.checksum=c.checksum(i);var o,a=d.get(m.integerFromBuffer(t.version));o=c.encode(s.Buffer.concat(e)),t.xprivkey=new r(o);var f=new p(u.fromBuffer(t.privateKey),a),l=f.toPublicKey(),b=n.ParentFingerPrintSize,y=h.sha256ripemd160(l.toBuffer()).slice(0,b);return v.defineImmutable(this,{xprivkey:o,network:a,depth:m.integerFromSingleByteBuffer(t.depth),privateKey:f,publicKey:l,fingerPrint:y}),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},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];i(m.isBuffer(n),e+" argument is not a buffer"),i(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("privateKey",n.PrivateKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.prototype.toString=function(){return this.xprivkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(m.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:m.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:m.integerFromBuffer(this.fingerPrint),parentFingerPrint:m.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:m.integerFromBuffer(this._buffers.childIndex),chainCode:m.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:m.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},n.fromBuffer=function(t){return new n(t.toString())},n.prototype.toBuffer=function(){return m.copy(this._buffers.xprivkey)},n.DefaultDepth=0,n.DefaultFingerprint=0,n.DefaultChildIndex=0,n.Hardened=2147483648,n.MaxIndex=2*n.Hardened,n.RootElementAlias=["m","M","m'","M'"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PrivateKeySize=32,n.CheckSumSize=4,n.DataLength=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PrivateKeyStart=n.ChainCodeEnd+1,n.PrivateKeyEnd=n.PrivateKeyStart+n.PrivateKeySize,n.ChecksumStart=n.PrivateKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,i(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./crypto/random":10,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdpublickey":20,"./networks":21,"./privatekey":23,"./util/buffer":43,"./util/js":45,"./util/preconditions":46,assert:61,buffer:98,lodash:156}],20:[function(t,e,r){(function(r){"use strict";function n(t){if(t instanceof n)return t;if(!(this instanceof n))return new n(t);if(t){if(i.isString(t)||v.isBuffer(t)){var e=n.getSerializedError(t);if(e){if(v.isBuffer(t)&&!n.getSerializedError(t.toString()))return this._buildFromSerialized(t.toString());if(e instanceof g.ArgumentIsPrivateExtended)return new c(t).hdPublicKey;throw e}return this._buildFromSerialized(t)}if(i.isObject(t))return t instanceof c?this._buildFromPrivate(t):this._buildFromObject(t);throw new g.UnrecognizedArgument(t)}throw new g.MustSupplyArgument}var i=t("lodash"),s=t("./util/preconditions"),o=t("./crypto/bn"),a=t("./encoding/base58"),u=t("./encoding/base58check"),f=t("./crypto/hash"),c=t("./hdprivatekey"),h=t("./networks"),d=t("./crypto/point"),l=t("./publickey"),p=t("./errors"),b=p,g=p.HDPublicKey,y=t("assert"),m=t("./util/js"),v=t("./util/buffer");n.isValidPath=function(t){if(i.isString(t)){var e=c._getDerivationIndexes(t);return null!==e&&i.every(e,n.isValidPath)}return!!i.isNumber(t)&&(t>=0&&t=n.Hardened||e)throw new g.InvalidIndexCantDeriveHardened;if(t<0)throw new g.InvalidPath(t);var r,i=v.integerAsBuffer(t),s=v.concat([this.publicKey.toBuffer(),i]),a=f.sha512hmac(s,this._buffers.chainCode),u=o.fromBuffer(a.slice(0,32),{size:32}),c=a.slice(32,64);try{r=l.fromPoint(d.getG().mul(u).add(this.publicKey.point))}catch(e){return this._deriveWithNumber(t+1)}return new n({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:c,publicKey:r})},n.prototype._deriveFromString=function(t){if(i.includes(t,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!n.isValidPath(t))throw new g.InvalidPath(t);return c._getDerivationIndexes(t).reduce(function(t,e){return t._deriveWithNumber(e)},this)},n.isValidSerialized=function(t,e){return i.isNull(n.getSerializedError(t,e))},n.getSerializedError=function(t,e){if(!i.isString(t)&&!v.isBuffer(t))return new g.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(t))return new b.InvalidB58Char("(unknown)",t);try{t=u.decode(t)}catch(e){return new b.InvalidB58Checksum(t)}if(t.length!==n.DataSize)return new g.InvalidLength(t);if(!i.isUndefined(e)){var r=n._validateNetwork(t,e);if(r)return r}var s=v.integerFromBuffer(t.slice(0,4));return s===h.livenet.xprivkey||s===h.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},n._validateNetwork=function(t,e){var r=h.get(e);if(!r)return new b.InvalidNetworkArgument(e);var i=t.slice(n.VersionStart,n.VersionEnd);return v.integerFromBuffer(i)!==r.xpubkey?new b.InvalidNetwork(i):null},n.prototype._buildFromPrivate=function(t){var e=i.clone(t._buffers),r=d.getG().mul(o.fromBuffer(e.privateKey));return e.publicKey=d.pointToCompressed(r),e.version=v.integerAsBuffer(h.get(v.integerFromBuffer(e.version)).xpubkey),e.privateKey=void 0,e.checksum=void 0,e.xprivkey=void 0,this._buildFromBuffers(e)},n.prototype._buildFromObject=function(t){var e={version:t.network?v.integerAsBuffer(h.get(t.network).xpubkey):t.version,depth:i.isNumber(t.depth)?v.integerAsSingleByteBuffer(t.depth):t.depth,parentFingerPrint:i.isNumber(t.parentFingerPrint)?v.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:i.isNumber(t.childIndex)?v.integerAsBuffer(t.childIndex):t.childIndex,chainCode:i.isString(t.chainCode)?v.hexToBuffer(t.chainCode):t.chainCode,publicKey:i.isString(t.publicKey)?v.hexToBuffer(t.publicKey):v.isBuffer(t.publicKey)?t.publicKey:t.publicKey.toBuffer(),checksum:i.isNumber(t.checksum)?v.integerAsBuffer(t.checksum):t.checksum};return this._buildFromBuffers(e)},n.prototype._buildFromSerialized=function(t){var e=u.decode(t),r={version:e.slice(n.VersionStart,n.VersionEnd),depth:e.slice(n.DepthStart,n.DepthEnd),parentFingerPrint:e.slice(n.ParentFingerPrintStart,n.ParentFingerPrintEnd),childIndex:e.slice(n.ChildIndexStart,n.ChildIndexEnd),chainCode:e.slice(n.ChainCodeStart,n.ChainCodeEnd),publicKey:e.slice(n.PublicKeyStart,n.PublicKeyEnd),checksum:e.slice(n.ChecksumStart,n.ChecksumEnd),xpubkey:t};return this._buildFromBuffers(r)},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),m.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,t.publicKey],i=v.concat(e),s=u.checksum(i);if(t.checksum&&t.checksum.length){if(t.checksum.toString("hex")!==s.toString("hex"))throw new b.InvalidB58Checksum(i,s)}else t.checksum=s;var o,a=h.get(v.integerFromBuffer(t.version));o=u.encode(v.concat(e)),t.xpubkey=new r(o);var c=new l(t.publicKey,{network:a}),d=n.ParentFingerPrintSize,p=f.sha256ripemd160(c.toBuffer()).slice(0,d);return m.defineImmutable(this,{xpubkey:o,network:a,depth:v.integerFromSingleByteBuffer(t.depth),publicKey:c,fingerPrint:p}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];y(v.isBuffer(n),e+" argument is not a buffer, it's "+typeof n),y(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("publicKey",n.PublicKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.fromString=function(t){return s.checkArgument(i.isString(t),"No valid string was provided"),new n(t)},n.fromObject=function(t){return s.checkArgument(i.isObject(t),"No valid argument was provided"),new n(t) -},n.prototype.toString=function(){return this.xpubkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:h.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},n.fromBuffer=function(t){return new n(t)},n.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},n.Hardened=2147483648,n.RootElementAlias=["m","M"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PublicKeySize=33,n.CheckSumSize=4,n.DataSize=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PublicKeyStart=n.ChainCodeEnd,n.PublicKeyEnd=n.PublicKeyStart+n.PublicKeySize,n.ChecksumStart=n.PublicKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,y(n.PublicKeyEnd===n.DataSize),y(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdprivatekey":19,"./networks":21,"./publickey":24,"./util/buffer":43,"./util/js":45,"./util/preconditions":46,assert:61,buffer:98,lodash:156}],21:[function(t,e,r){"use strict";function n(){}function i(t,e){if(~b.indexOf(t))return t;if(!e)return g[t];d.isArray(e)||(e=[e]);for(var r=0;r=0&&t<=16,"Invalid Argument: n must be between 0 and 16"),0===t?n("OP_0"):new n(n.map.OP_1+t-1)},n.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},n.reverseMap=[];for(var u in n.map)n.reverseMap[n.map[u]]=u;i.extend(n,n.map),n.isSmallIntOp=function(t){return t instanceof n&&(t=t.toNumber()),t===n.map.OP_0||t>=n.map.OP_1&&t<=n.map.OP_16},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./util/buffer":43,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],23:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(t instanceof n)return t;var r=this._classifyArguments(t,e);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return u.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var i=t("lodash"),s=t("./address"),o=t("./encoding/base58check"),a=t("./crypto/bn"),u=t("./util/js"),f=t("./networks"),c=t("./crypto/point"),h=t("./publickey"),d=t("./crypto/random"),l=t("./util/preconditions");n.prototype._classifyArguments=function(t,e){var s={compressed:!0,network:e?f.get(e):f.defaultNetwork};if(i.isUndefined(t)||i.isNull(t))s.bn=n._getRandomBN();else if(t instanceof a)s.bn=t;else if(t instanceof r||t instanceof Uint8Array)s=n._transformBuffer(t,e);else if(t.bn&&t.network)s=n._transformObject(t);else if(!e&&f.get(t))s.bn=n._getRandomBN(),s.network=f.get(t);else{if("string"!=typeof t)throw new TypeError("First argument is an unrecognized data type.");u.isHexa(t)?s.bn=new a(new r(t,"hex")):s=n._transformWIF(t,e)}return s},n._getRandomBN=function(){var t,e;do{var r=d.getRandomBuffer(32);e=a.fromBuffer(r),t=e.lt(c.getN())}while(!t);return e},n._transformBuffer=function(t,e){var r={};if(32===t.length)return n._transformBNBuffer(t,e);if(r.network=f.get(t[0],"privatekey"),!r.network)throw new Error("Invalid network");if(e&&r.network!==f.get(e))throw new TypeError("Private key network mismatch");if(34===t.length&&1===t[33])r.compressed=!0;else{if(33!==t.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(t.slice(1,33)),r},n._transformBNBuffer=function(t,e){var r={};return r.network=f.get(e)||f.defaultNetwork,r.bn=a.fromBuffer(t),r.compressed=!1,r},n._transformWIF=function(t,e){return n._transformBuffer(o.decode(t),e)},n.fromBuffer=function(t,e){return new n(t,e)},n._transformObject=function(t){return{bn:new a(t.bn,"hex"),network:f.get(t.network),compressed:t.compressed}},n.fromString=n.fromWIF=function(t){return l.checkArgument(i.isString(t),"First argument is expected to be a string."),new n(t)},n.fromObject=function(t){return l.checkArgument(i.isObject(t),"First argument is expected to be an object."),new n(t)},n.fromRandom=function(t){return new n(n._getRandomBN(),t)},n.getValidationError=function(t,e){var r;try{new n(t,e)}catch(t){r=t}return r},n.isValid=function(t,e){return!!t&&!n.getValidationError(t,e)},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toWIF=function(){var t,e=this.network,n=this.compressed;return t=n?r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32}),new r([1])]):r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(t)},n.prototype.toBigNumber=function(){return this.bn},n.prototype.toBuffer=function(){return this.bn.toBuffer()},n.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},n.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},n.prototype.toAddress=function(t){var e=this.toPublicKey();return s.fromPublicKey(e,t||this.network)},n.prototype.toObject=n.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},n.prototype.inspect=function(){var t=this.compressed?"":", uncompressed";return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/point":9,"./crypto/random":10,"./encoding/base58check":13,"./networks":21,"./publickey":24,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],24:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(c.checkArgument(t,"First argument is required, please include public key data."),t instanceof n)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||u.defaultNetwork}),this}var i=t("./crypto/bn"),s=t("./crypto/point"),o=t("./crypto/hash"),a=t("./util/js"),u=t("./networks"),f=t("lodash"),c=t("./util/preconditions");n.prototype._classifyArgs=function(t,e){var i={compressed:f.isUndefined(e.compressed)||e.compressed};if(t instanceof s)i.point=t;else if(t.x&&t.y)i=n._transformObject(t);else if("string"==typeof t)i=n._transformDER(new r(t,"hex"));else if(n._isBuffer(t))i=n._transformDER(t);else{if(!n._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");i=n._transformPrivateKey(t)}return i.network||(i.network=f.isUndefined(e.network)?void 0:u.get(e.network)),i},n._isPrivateKey=function(e){return e instanceof t("./privatekey")},n._isBuffer=function(t){return t instanceof r||t instanceof Uint8Array},n._transformPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=s.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},n._transformDER=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r={};e=!!f.isUndefined(e)||e;var o,a,u,h;if(4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])u=t.slice(1),o=new i(u),r=n._transformX(!0,o),r.compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");u=t.slice(1),o=new i(u),r=n._transformX(!1,o),r.compressed=!0}else{if(u=t.slice(1,33),h=t.slice(33,65),32!==u.length||32!==h.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");o=new i(u),a=new i(h),r.point=new s(o,a),r.compressed=!1}return r},n._transformX=function(t,e){c.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=s.fromX(t,e),r},n._transformObject=function(t){var e=new i(t.x,"hex"),r=new i(t.y,"hex");return new n(new s(e,r),{compressed:t.compressed})},n.fromPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e=n._transformPrivateKey(t);return new n(e.point,{compressed:e.compressed,network:e.network})},n.fromDER=n.fromBuffer=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r=n._transformDER(t,e);return new n(r.point,{compressed:r.compressed})},n.fromPoint=function(t,e){return c.checkArgument(t instanceof s,"First argument must be an instance of Point."),new n(t,{compressed:e})},n.fromString=function(t,e){var i=new r(t,e||"hex"),s=n._transformDER(i);return new n(s.point,{compressed:s.compressed})},n.fromX=function(t,e){var r=n._transformX(t,e);return new n(r.point,{compressed:r.compressed})},n.getValidationError=function(t){var e;try{new n(t)}catch(t){e=t}return e},n.isValid=function(t){return!n.getValidationError(t)},n.prototype.toObject=n.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},n.prototype.toBuffer=n.prototype.toDER=function(){var t,e=this.point.getX(),n=this.point.getY(),i=e.toBuffer({size:32}),s=n.toBuffer({size:32});if(this.compressed){var o=s[s.length-1]%2;return t=new r(o?[3]:[2]),r.concat([t,i])}return t=new r([4]),r.concat([t,i,s])},n.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},n.prototype.toAddress=function(e){return t("./address").fromPublicKey(this,e||this.network)},n.prototype.toString=function(){return this.toDER().toString("hex")},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./networks":21,"./privatekey":23,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],25:[function(t,e,r){e.exports=t("./script"),e.exports.Interpreter=t("./interpreter")},{"./interpreter":26,"./script":27}],26:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./script"),s=t("../opcode"),o=t("../crypto/bn"),a=t("../crypto/hash"),u=t("../crypto/signature"),f=t("../publickey"),c=function t(e){if(!(this instanceof t))return new t(e);e?(this.initialize(),this.set(e)):this.initialize()};c.prototype.verify=function(e,r,s,o,a){var u=t("../transaction");n.isUndefined(s)&&(s=new u),n.isUndefined(o)&&(o=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:s,nin:o,flags:a});var f;if(0!=(a&c.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&c.SCRIPT_VERIFY_P2SH&&(f=this.stack.slice());var h=this.stack;if(this.initialize(),this.set({script:r,stack:h,tx:s,nin:o,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var d=this.stack[this.stack.length-1];if(!c.castToBool(d))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&c.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===f.length)throw new Error("internal error - stack copy empty");var l=f[f.length-1],p=i.fromBuffer(l);return f.pop(),this.initialize(),this.set({script:p,stack:f,tx:s,nin:o,flags:a}),!!this.evaluate()&&(0===f.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!c.castToBool(f[f.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},e.exports=c,c.prototype.initialize=function(t){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},c.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin=void 0!==t.nin?t.nin:this.nin,this.stack=t.stack||this.stack,this.altstack=t.altack||this.altstack,this.pc=void 0!==t.pc?t.pc:this.pc,this.pbegincodehash=void 0!==t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags=void 0!==t.flags?t.flags:this.flags},c.true=new r([1]),c.false=new r([]),c.MAX_SCRIPT_ELEMENT_SIZE=520,c.LOCKTIME_THRESHOLD=5e8,c.LOCKTIME_THRESHOLD_BN=new o(c.LOCKTIME_THRESHOLD),c.SCRIPT_VERIFY_NONE=0,c.SCRIPT_VERIFY_P2SH=1,c.SCRIPT_VERIFY_STRICTENC=2,c.SCRIPT_VERIFY_DERSIG=4,c.SCRIPT_VERIFY_LOW_S=8,c.SCRIPT_VERIFY_NULLDUMMY=16,c.SCRIPT_VERIFY_SIGPUSHONLY=32,c.SCRIPT_VERIFY_MINIMALDATA=64,c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,c.castToBool=function(t){for(var e=0;e1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},c.prototype.checkLockTime=function(t){return!!(this.tx.nLockTime=c.LOCKTIME_THRESHOLD&&t.gte(c.LOCKTIME_THRESHOLD_BN))&&(!t.gt(new o(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},c.prototype.step=function(){var t,e,r,h,d,l,p,b,g,y,m,v,_,w,S,k,E,I=0!=(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),A=-1===this.vfExec.indexOf(!1),x=this.script.chunks[this.pc];this.pc++;var O=x.opcodenum;if(n.isUndefined(O))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(x.buf&&x.buf.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(O>s.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(O===s.OP_CAT||O===s.OP_SUBSTR||O===s.OP_LEFT||O===s.OP_RIGHT||O===s.OP_INVERT||O===s.OP_AND||O===s.OP_OR||O===s.OP_XOR||O===s.OP_2MUL||O===s.OP_2DIV||O===s.OP_MUL||O===s.OP_DIV||O===s.OP_MOD||O===s.OP_LSHIFT||O===s.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(A&&0<=O&&O<=s.OP_PUSHDATA4){if(I&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(x.buf){if(x.len!==x.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(x.buf)}else this.stack.push(c.false)}else if(A||s.OP_IF<=O&&O<=s.OP_ENDIF)switch(O){case s.OP_1NEGATE:case s.OP_1:case s.OP_2:case s.OP_3:case s.OP_4:case s.OP_5:case s.OP_6:case s.OP_7:case s.OP_8:case s.OP_9:case s.OP_10:case s.OP_11:case s.OP_12:case s.OP_13:case s.OP_14:case s.OP_15:case s.OP_16:d=O-(s.OP_1-1),t=new o(d).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_NOP:break;case s.OP_NOP2:case s.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&c.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 P=o.fromScriptNumBuffer(this.stack[this.stack.length-1],I,5);if(P.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(P))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP1:case s.OP_NOP3:case s.OP_NOP4:case s.OP_NOP5:case s.OP_NOP6:case s.OP_NOP7:case s.OP_NOP8:case s.OP_NOP9:case s.OP_NOP10:if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case s.OP_IF:case s.OP_NOTIF:if(k=!1,A){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;t=this.stack.pop(),k=c.castToBool(t),O===s.OP_NOTIF&&(k=!k)}this.vfExec.push(k);break;case s.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 s.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case s.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],!(k=c.castToBool(t)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case s.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case s.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case s.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case s.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case s.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],this.stack.push(e),this.stack.push(r);break;case s.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-3],r=this.stack[this.stack.length-2];var B=this.stack[this.stack.length-1];this.stack.push(e),this.stack.push(r),this.stack.push(B);break;case s.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-4],r=this.stack[this.stack.length-3],this.stack.push(e),this.stack.push(r);break;case s.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-6,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-4,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1],k=c.castToBool(t),k&&this.stack.push(t);break;case s.OP_DEPTH:t=new o(this.stack.length).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case s.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 s.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 s.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 s.OP_PICK:case s.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,I),d=b.toNumber(),this.stack.pop(),d<0||d>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-d-1],O===s.OP_ROLL&&this.stack.splice(this.stack.length-d-1,1),this.stack.push(t);break;case s.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-3],p=this.stack[this.stack.length-2];var R=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=p,this.stack[this.stack.length-2]=R,this.stack[this.stack.length-1]=l;break;case s.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],p=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=p,this.stack[this.stack.length-1]=l;break;case s.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 s.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=new o(this.stack[this.stack.length-1].length),this.stack.push(b.toScriptNumBuffer());break;case s.OP_EQUAL:case s.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];var M=e.toString("hex")===r.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(M?c.true:c.false),O===s.OP_EQUALVERIFY){if(!M)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case s.OP_1ADD:case s.OP_1SUB:case s.OP_NEGATE:case s.OP_ABS:case s.OP_NOT:case s.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,I),O){case s.OP_1ADD:b=b.add(o.One);break;case s.OP_1SUB:b=b.sub(o.One);break;case s.OP_NEGATE:b=b.neg();break;case s.OP_ABS:b.cmp(o.Zero)<0&&(b=b.neg());break;case s.OP_NOT:b=new o((0===b.cmp(o.Zero))+0);break;case s.OP_0NOTEQUAL:b=new o((0!==b.cmp(o.Zero))+0)}this.stack.pop(),this.stack.push(b.toScriptNumBuffer());break;case s.OP_ADD:case s.OP_SUB:case s.OP_BOOLAND:case s.OP_BOOLOR:case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:case s.OP_NUMNOTEQUAL:case s.OP_LESSTHAN:case s.OP_GREATERTHAN:case s.OP_LESSTHANOREQUAL:case s.OP_GREATERTHANOREQUAL:case s.OP_MIN:case s.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(g=o.fromScriptNumBuffer(this.stack[this.stack.length-2],I),y=o.fromScriptNumBuffer(this.stack[this.stack.length-1],I),b=new o(0),O){case s.OP_ADD:b=g.add(y);break;case s.OP_SUB:b=g.sub(y);break;case s.OP_BOOLAND:b=new o((0!==g.cmp(o.Zero)&&0!==y.cmp(o.Zero))+0);break;case s.OP_BOOLOR:b=new o((0!==g.cmp(o.Zero)||0!==y.cmp(o.Zero))+0);break;case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:b=new o((0===g.cmp(y))+0);break;case s.OP_NUMNOTEQUAL:b=new o((0!==g.cmp(y))+0);break;case s.OP_LESSTHAN:b=new o((g.cmp(y)<0)+0);break;case s.OP_GREATERTHAN:b=new o((g.cmp(y)>0)+0);break;case s.OP_LESSTHANOREQUAL:b=new o((g.cmp(y)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:b=new o((g.cmp(y)>=0)+0);break;case s.OP_MIN:b=g.cmp(y)<0?g:y;break;case s.OP_MAX:b=g.cmp(y)>0?g:y}if(this.stack.pop(),this.stack.pop(),this.stack.push(b.toScriptNumBuffer()),O===s.OP_NUMEQUALVERIFY){if(!c.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case s.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=o.fromScriptNumBuffer(this.stack[this.stack.length-3],I),y=o.fromScriptNumBuffer(this.stack[this.stack.length-2],I);var T=o.fromScriptNumBuffer(this.stack[this.stack.length-1],I);k=y.cmp(g)<=0&&g.cmp(T)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(k?c.true:c.false);break;case s.OP_RIPEMD160:case s.OP_SHA1:case s.OP_SHA256:case s.OP_HASH160:case s.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1];var C;O===s.OP_RIPEMD160?C=a.ripemd160(t):O===s.OP_SHA1?C=a.sha1(t):O===s.OP_SHA256?C=a.sha256(t):O===s.OP_HASH160?C=a.sha256ripemd160(t):O===s.OP_HASH256&&(C=a.sha256sha256(t)),this.stack.pop(),this.stack.push(C);break;case s.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case s.OP_CHECKSIG:case s.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=this.stack[this.stack.length-2],v=this.stack[this.stack.length-1],_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var N=(new i).add(m);if(_.findAndDelete(N),!this.checkSignatureEncoding(m)||!this.checkPubkeyEncoding(v))return!1;try{w=u.fromTxFormat(m),S=f.fromBuffer(v,!1),E=this.tx.verifySignature(w,S,this.nin,_)}catch(t){E=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(E?c.true:c.false),O===s.OP_CHECKSIGVERIFY){if(!E)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case s.OP_CHECKMULTISIG:case s.OP_CHECKMULTISIGVERIFY:var j=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=U,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var L=++j;if(j+=U,this.stack.lengthU)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var H=++j;if(j+=D,this.stack.length0;){if(m=this.stack[this.stack.length-H],v=this.stack[this.stack.length-L],!this.checkSignatureEncoding(m)||!this.checkPubkeyEncoding(v))return!1;var F;try{w=u.fromTxFormat(m),S=f.fromBuffer(v,!1),F=this.tx.verifySignature(w,S,this.nin,_)}catch(t){F=!1}F&&(H++,D--),L++,U--,D>U&&(E=!1)}for(;j-- >1;)this.stack.pop() -;if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&c.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(E?c.true:c.false),O===s.OP_CHECKMULTISIGVERIFY){if(!E)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../opcode":22,"../publickey":24,"../transaction":28,"./script":27,buffer:98,lodash:156}],27:[function(t,e,r){(function(r){"use strict";var n=t("../address"),i=t("../encoding/bufferreader"),s=t("../encoding/bufferwriter"),o=t("../crypto/hash"),a=t("../opcode"),u=t("../publickey"),f=t("../crypto/signature"),c=t("../networks"),h=t("../util/preconditions"),d=t("lodash"),l=t("../errors"),p=t("buffer"),b=t("../util/buffer"),g=t("../util/js"),y=function t(e){return this instanceof t?(this.chunks=[],b.isBuffer(e)?t.fromBuffer(e):e instanceof n?t.fromAddress(e):e instanceof t?t.fromBuffer(e.toBuffer()):d.isString(e)?t.fromString(e):void(d.isObject(e)&&d.isArray(e.chunks)&&this.set(e))):new t(e)};y.prototype.set=function(t){return h.checkArgument(d.isObject(t)),h.checkArgument(d.isArray(t.chunks)),this.chunks=t.chunks,this},y.fromBuffer=function(t){var e=new y;e.chunks=[];for(var r=new i(t);!r.finished();)try{var n,s,o=r.readUInt8();o>0&&o0&&u0&&(i=n?i+" "+t.buf.toString("hex"):i+" "+t.len+" 0x"+t.buf.toString("hex"));else if(void 0!==a.reverseMap[r])n?0===r?i+=" 0":79===r?i+=" -1":i=i+" "+a(r).toString():i=i+" "+a(r).toString();else{var s=r.toString(16);s.length%2!=0&&(s="0"+s),i=n?i+" "+s:i+" 0x"+s}return i},y.prototype.toASM=function(){for(var t="",e=0;e"},y.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},y.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},y.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if(4!==e&&6!==e&&7!==e||65!==t.length?3!==e&&2!==e||33!==t.length||(r=!0):r=!0,r)return u.isValid(t)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===a.OP_HASH160&&20===t[1]&&t[t.length-1]===a.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t=this.chunks[this.chunks.length-1],e=t.buf;if(!e)return!1;var r;try{r=y.fromBuffer(e)}catch(t){if(t instanceof l.Script.InvalidBuffer)return!1;throw t}return r.classify()!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(t){return t.buf&&b.isBuffer(t.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},y.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(t){return t.buf&&b.isBuffer(t.buf)&&f.isTxDER(t.buf)})},y.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=y.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},y.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new r(d.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new r(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},y.prototype.isPushOnly=function(){return d.every(this.chunks,function(t){return t.opcodenum<=a.OP_16})},y.types={},y.types.UNKNOWN="Unknown",y.types.PUBKEY_OUT="Pay to public key",y.types.PUBKEY_IN="Spend from public key",y.types.PUBKEYHASH_OUT="Pay to public key hash",y.types.PUBKEYHASH_IN="Spend from public key hash",y.types.SCRIPTHASH_OUT="Pay to script hash",y.types.SCRIPTHASH_IN="Spend from script hash",y.types.MULTISIG_OUT="Pay to multisig",y.types.MULTISIG_IN="Spend from multisig",y.types.DATA_OUT="Data push",y.OP_RETURN_STANDARD_SIZE=80,y.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var t=this.classifyOutput();return t!=y.types.UNKNOWN?t:this.classifyInput()},y.outputIdentifiers={},y.outputIdentifiers.PUBKEY_OUT=y.prototype.isPublicKeyOut,y.outputIdentifiers.PUBKEYHASH_OUT=y.prototype.isPublicKeyHashOut,y.outputIdentifiers.MULTISIG_OUT=y.prototype.isMultisigOut,y.outputIdentifiers.SCRIPTHASH_OUT=y.prototype.isScriptHashOut,y.outputIdentifiers.DATA_OUT=y.prototype.isDataOut,y.prototype.classifyOutput=function(){for(var t in y.outputIdentifiers)if(y.outputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.inputIdentifiers={},y.inputIdentifiers.PUBKEY_IN=y.prototype.isPublicKeyIn,y.inputIdentifiers.PUBKEYHASH_IN=y.prototype.isPublicKeyHashIn,y.inputIdentifiers.MULTISIG_IN=y.prototype.isMultisigIn,y.inputIdentifiers.SCRIPTHASH_IN=y.prototype.isScriptHashIn,y.prototype.classifyInput=function(){for(var t in y.inputIdentifiers)if(y.inputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.prototype.isStandard=function(){return this.classify()!==y.types.UNKNOWN},y.prototype.prepend=function(t){return this._addByType(t,!0),this},y.prototype.equals=function(t){if(h.checkState(t instanceof y,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e=0&&n=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:!(r.length<=65535)||n===a.OP_PUSHDATA2)},y.prototype._decodeOP_N=function(t){if(t===a.OP_0)return 0;if(t>=a.OP_1&&t<=a.OP_16)return t-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},y.prototype.getSignatureOperationsCount=function(t){t=!!d.isUndefined(t)||t;var e=this,r=0,n=a.OP_INVALIDOPCODE;return d.each(e.chunks,function(i){var s=i.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(t&&n>=a.OP_1&&n<=a.OP_16?r+=e._decodeOP_N(n):r+=20),n=s}),r},e.exports=y}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../networks":21,"../opcode":22,"../publickey":24,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],28:[function(t,e,r){e.exports=t("./transaction"),e.exports.Input=t("./input"),e.exports.Output=t("./output"),e.exports.UnspentOutput=t("./unspentoutput"),e.exports.Signature=t("./signature"),e.exports.Sighash=t("./sighash")},{"./input":29,"./output":35,"./sighash":36,"./signature":37,"./transaction":38,"./unspentoutput":39}],29:[function(t,e,r){e.exports=t("./input"),e.exports.PublicKey=t("./publickey"),e.exports.PublicKeyHash=t("./publickeyhash"),e.exports.MultiSig=t("./multisig.js"),e.exports.MultiSigScriptHash=t("./multisigscripthash.js")},{"./input":30,"./multisig.js":31,"./multisigscripthash.js":32,"./publickey":33,"./publickeyhash":34}],30:[function(t,e,r){"use strict";function n(t){return this instanceof n?t?this._fromObject(t):void 0:new n(t)}var i=t("lodash"),s=t("../../util/preconditions"),o=t("../../errors"),a=t("../../encoding/bufferwriter"),u=t("buffer"),f=t("../../util/buffer"),c=t("../../util/js"),h=t("../../script"),d=t("../sighash"),l=t("../output");n.MAXINT=4294967295,n.DEFAULT_SEQNUMBER=4294967295,n.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,n.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),n.fromObject=function(t){return s.checkArgument(i.isObject(t)),(new n)._fromObject(t)},n.prototype._fromObject=function(t){var e;if(e=i.isString(t.prevTxId)&&c.isHexa(t.prevTxId)?new u.Buffer(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof l?t.output:new l(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=i.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=i.isUndefined(t.sequenceNumber)?i.isUndefined(t.seqnum)?4294967295:t.seqnum:t.sequenceNumber,i.isUndefined(t.script)&&i.isUndefined(t.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},n.prototype.toObject=n.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},n.fromBufferReader=function(t){var e=new n;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},n.prototype.toBufferWriter=function(t){t||(t=new a),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},n.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(c.isHexa(t))this._scriptBuffer=new u.Buffer(t,"hex");else if(i.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!f.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new u.Buffer(t)}return this},n.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},n.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},n.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},n.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},n.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,d.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},n.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},n.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=n},{"../../encoding/bufferwriter":15,"../../errors":17,"../../script":25,"../../util/buffer":43,"../../util/js":45,"../../util/preconditions":46,"../output":35,"../sighash":36,buffer:98,lodash:156}],31:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),u.checkState(f.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=(t("../transaction"),t("./input")),a=t("../output"),u=t("../../util/preconditions"),f=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),l=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){if(t)return new l(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},n.prototype.getSignatures=function(t,e,r,n){u.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new l({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.output.script,s.output.satoshisBN),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(f.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},n.normalizeSignatures=function(t,e,r,n,i){return i.map(function(i){var s=null;return n=n.filter(function(n){if(s)return!0;var o=new l({signature:c.fromTxFormat(n),publicKey:i,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:c.SIGHASH_ALL});return o.signature.nhashtype=o.sigtype,!h.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script)||(s=o,!1)}),s||null})},n.OPCODES_SIZE=1,n.SIGNATURE_SIZE=73,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":24,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"../transaction":38,"./input":30,inherits:153,lodash:156}],32:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),this.redeemScript=f.buildMultisigOut(this.publicKeys,r),u.checkState(f.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=t("./input"),a=t("../output"),u=t("../../util/preconditions"),f=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),l=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){if(t)return new l(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},n.prototype.getSignatures=function(t,e,r,n){u.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new l({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.redeemScript,s.output.satoshisBN),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(f.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript,this.output.satoshisBN)},n.OPCODES_SIZE=7,n.SIGNATURE_SIZE=74,n.PUBKEY_SIZE=34,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE+this.publicKeys.length*n.PUBKEY_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":24,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153,lodash:156}],33:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=(t("../../util/buffer"),t("./input")),a=t("../output"),u=t("../sighash"),f=t("../../script"),c=t("../../crypto/signature"),h=t("../signature");i(n,o),n.prototype.getSignatures=function(t,e,r,n){s.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var i=e.toPublicKey();return i.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:i,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(t,e,n,r,this.output.script,this.output.satoshisBN),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(f.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},n.SCRIPT_MAX_SIZE=73,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/signature":11,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153}],34:[function(t,e,r){"use strict";function n(){u.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=t("../../util/buffer"),a=t("../../crypto/hash"),u=t("./input"),f=t("../output"),c=t("../sighash"),h=t("../../script"),d=t("../../crypto/signature"),l=t("../signature");i(n,u),n.prototype.getSignatures=function(t,e,r,n,i){return s.checkState(this.output instanceof f),i=i||a.sha256ripemd160(e.publicKey.toBuffer()),n=n||d.SIGHASH_ALL|d.SIGHASH_FORKID,o.equals(i,this.output.script.getPublicKeyHash())?[new l({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(t,e,n,r,this.output.script,this.output.satoshisBN),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(h.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(h.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},n.SCRIPT_MAX_SIZE=107,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/hash":8,"../../crypto/signature":11,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153}],35:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(!i.isObject(t))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=t.satoshis,a.isBuffer(t.script))this._scriptBuffer=t.script;else{var e;e=i.isString(t.script)&&u.isHexa(t.script)?new o.Buffer(t.script,"hex"):t.script,this.setScript(e)}}var i=t("lodash"),s=t("../crypto/bn"),o=t("buffer"),a=t("../util/buffer"),u=t("../util/js"),f=t("../encoding/bufferwriter"),c=t("../script"),h=t("../util/preconditions"),d=t("../errors");Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(n.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(t){t instanceof s?(this._satoshisBN=t,this._satoshis=t.toNumber()):i.isString(t)?(this._satoshis=parseInt(t),this._satoshisBN=s.fromNumber(this._satoshis)):(h.checkArgument(u.isNaturalNumber(t),"Output satoshis is not a natural number"),this._satoshisBN=s.fromNumber(t),this._satoshis=t),h.checkState(u.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.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"},Object.defineProperty(n.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(t){this._satoshisBN=t,this._satoshis=t.toNumber(),h.checkState(u.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.prototype.toObject=n.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},n.fromObject=function(t){return new n(t)},n.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){ -if(!(t instanceof d.Script.InvalidBuffer))throw t;this._script=null}},n.prototype.setScript=function(t){if(t instanceof c)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(i.isString(t))this._script=c.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!a.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},n.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},n.fromBufferReader=function(t){var e={};e.satoshis=t.readUInt64LEBN();var r=t.readVarintNum();return e.script=0!==r?t.read(r):new o.Buffer([]),new n(e)},n.prototype.toBufferWriter=function(t){t||(t=new f),t.writeUInt64LEBN(this._satoshisBN);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t},e.exports=n},{"../crypto/bn":6,"../encoding/bufferwriter":15,"../errors":17,"../script":25,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],36:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n,i,s){var o=m(t,r,n,i,s);return l.sign(o,e,"little").set({nhashtype:r})}function i(t,e,r,n,i,s){p.checkArgument(!g.isUndefined(t)),p.checkArgument(!g.isUndefined(e)&&!g.isUndefined(e.nhashtype));var o=m(t,e.nhashtype,n,i,s);return l.verify(o,e,r,"little")}var s=t("buffer"),o=t("../crypto/signature"),a=t("../script"),u=t("./output"),f=t("../encoding/bufferreader"),c=t("../encoding/bufferwriter"),h=t("../crypto/bn"),d=t("../crypto/hash"),l=t("../crypto/ecdsa"),p=t("../util/preconditions"),b=t("../util/buffer"),g=t("lodash"),y=function(t,e,r,n,i){function s(t,e){var r=new c;g.isUndefined(e)?g.each(t.outputs,function(t){t.toBufferWriter(r)}):t.outputs[e].toBufferWriter(r);var n=r.toBuffer();return d.sha256sha256(n)}var a=t.inputs[r];p.checkArgument(i instanceof h,"For ForkId=0 signatures, satoshis or complete input must be provided");var u=b.emptyBuffer(32),l=b.emptyBuffer(32),y=b.emptyBuffer(32);e&o.SIGHASH_ANYONECANPAY||(u=function(t){var e=new c;g.each(t.inputs,function(t){e.writeReverse(t.prevTxId),e.writeUInt32LE(t.outputIndex)});var r=e.toBuffer();return d.sha256sha256(r)}(t)),e&o.SIGHASH_ANYONECANPAY||(31&e)==o.SIGHASH_SINGLE||(31&e)==o.SIGHASH_NONE||(l=function(t){var e=new c;g.each(t.inputs,function(t){e.writeUInt32LE(t.sequenceNumber)});var r=e.toBuffer();return d.sha256sha256(r)}(t)),(31&e)!=o.SIGHASH_SINGLE&&(31&e)!=o.SIGHASH_NONE?y=s(t):(31&e)==o.SIGHASH_SINGLE&&r>>0);var _=m.toBuffer(),w=d.sha256sha256(_);return w=new f(w).readReverse()},m=function(e,n,i,l,p){var b=t("./transaction"),g=t("./input"),m=b.shallowCopy(e);if(l=new a(l),n&o.SIGHASH_FORKID)return y(m,n,i,l,p);l.removeCodeseparators();var v;for(v=0;v=m.outputs.length)return new r("0000000000000000000000000000000000000000000000000000000000000001","hex");for(m.outputs.length=i+1,v=0;vr)return this._missingChange()?new u.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new u.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+e)}},n.prototype._missingChange=function(){return!this._changeScript},n.prototype._hasDustOutputs=function(t){if(!t.disableDustOutputs){var e,r;for(e in this.outputs)if(r=this.outputs[e],r.satoshis"},n.prototype.toBuffer=function(){var t=new d;return this.toBufferWriter(t).toBuffer()},n.prototype.toBufferWriter=function(t){return t.writeInt32LE(this.version),t.writeVarintNum(this.inputs.length),i.each(this.inputs,function(e){e.toBufferWriter(t)}),t.writeVarintNum(this.outputs.length),i.each(this.outputs,function(e){e.toBufferWriter(t)}),t.writeUInt32LE(this.nLockTime),t},n.prototype.fromBuffer=function(t){var e=new h(t);return this.fromBufferReader(e)},n.prototype.fromBufferReader=function(t){s.checkArgument(!t.finished(),"No transaction data received");var e,r,n;for(this.version=t.readInt32LE(),r=t.readVarintNum(),e=0;e=n.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new u.Transaction.BlockHeightTooHigh;if(t<0)throw new u.Transaction.NLockTimeOutOfRange;for(var e=0;e0?(this._changeIndex=this.outputs.length,this._addOutput(new k({script:this._changeScript,satoshis:r}))):this._changeIndex=void 0}},n.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},n.prototype._estimateFee=function(){var t=this._estimateSize(),e=this._getUnspentValue();return n._estimateFee(t,e,this._feePerKb)},n.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},n.prototype._clearSignatures=function(){i.each(this.inputs,function(t){t.clearSignatures()})},n._estimateFee=function(t,e,r){return e>Math.ceil(t/1e3)*(r||n.FEE_PER_KB)&&(t+=n.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(t/1e3)*(r||n.FEE_PER_KB)},n.prototype._estimateSize=function(){var t=n.MAXIMUM_EXTRA_SIZE;return i.each(this.inputs,function(e){t+=e._estimateSize()}),i.each(this.outputs,function(e){t+=e.script.toBuffer().length+9}),t},n.prototype._removeOutput=function(t){var e=this.outputs[t];this.outputs=i.without(this.outputs,e),this._outputAmount=void 0},n.prototype.removeOutput=function(t){this._removeOutput(t),this._updateChangeOutput()},n.prototype.sort=function(){return this.sortInputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return a(t.prevTxId,e.prevTxId)||t.outputIndex-e.outputIndex}),e}),this.sortOutputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return t.satoshis-e.satoshis||a(t.script.toBuffer(),e.script.toBuffer())}),e}),this},n.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},n.prototype.sortOutputs=function(t){var e=t(this.outputs);return this._newOutputOrder(e)},n.prototype.sortInputs=function(t){return this.inputs=t(this.inputs),this._clearSignatures(),this},n.prototype._newOutputOrder=function(t){if(this.outputs.length!==t.length||0!==i.difference(this.outputs,t).length)throw new u.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var e=this.outputs[this._changeIndex];this._changeIndex=i.findIndex(t,e)}return this.outputs=t,this},n.prototype.removeInput=function(t,e){var r;if((r=!e&&i.isNumber(t)?t:i.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===t&&r.outputIndex===e}))<0||r>=this.inputs.length)throw new u.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},n.prototype.sign=function(t,e){s.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return i.isArray(t)?(i.each(t,function(t){r.sign(t,e)}),this):(i.each(this.getSignatures(t,e),function(t){r.applySignature(t)}),this)},n.prototype.getSignatures=function(t,e){t=new I(t),e=e||p.SIGHASH_ALL|p.SIGHASH_FORKID;var r=this,n=[],s=l.sha256ripemd160(t.publicKey.toBuffer());return i.each(this.inputs,function(o,a){i.each(o.getSignatures(r,t,a,e,s),function(t){n.push(t)})}),n},n.prototype.applySignature=function(t){return this.inputs[t.inputIndex].addSignature(this,t),this},n.prototype.isFullySigned=function(){return i.each(this.inputs,function(t){if(t.isFullySigned===m.prototype.isFullySigned)throw new u.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),i.every(i.map(this.inputs,function(t){return t.isFullySigned()}))},n.prototype.isValidSignature=function(t){var e=this;if(this.inputs[t.inputIndex].isValidSignature===m.prototype.isValidSignature)throw new u.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[t.inputIndex].isValidSignature(e,t)},n.prototype.verifySignature=function(t,e,r,n){return b.verify(this,t,e,r,n)},n.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var t=new A(0),e=0;e1e6)return"transaction over the maximum block size";var s={};for(e=0;e100)return"coinbase transaction script size invalid"}else for(e=0;e=m.MAXINT-1&&(e.sequenceNumber=m.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=n}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../privatekey":23,"../script":25,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,"./input":29,"./output":35,"./sighash":36,"./unspentoutput":39,buffer:98,"buffer-compare":96,lodash:156}],39:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);s.checkArgument(i.isObject(t),"Must provide an object from where to extract data");var e=t.address?new u(t.address):void 0,r=t.txid?t.txid:t.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",t);var c=i.isUndefined(t.vout)?t.outputIndex:t.vout;if(!i.isNumber(c))throw new Error("Invalid outputIndex, received "+c);s.checkArgument(!i.isUndefined(t.scriptPubKey)||!i.isUndefined(t.script),"Must provide the scriptPubKey for that output!");var h=new a(t.scriptPubKey||t.script);s.checkArgument(!i.isUndefined(t.amount)||!i.isUndefined(t.satoshis),"Must provide an amount for the output");var d=i.isUndefined(t.amount)?t.satoshis:new f.fromBTC(t.amount).toSatoshis();s.checkArgument(i.isNumber(d),"Amount must be a number"),o.defineImmutable(this,{address:e,txId:r,outputIndex:c,script:h,satoshis:d})}var i=t("lodash"),s=t("../util/preconditions"),o=t("../util/js"),a=t("../script"),u=t("../address"),f=t("../unit");n.prototype.inspect=function(){return""},n.prototype.toString=function(){return this.txId+":"+this.outputIndex},n.fromObject=function(t){return new n(t)},n.prototype.toObject=n.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:f.fromSatoshis(this.satoshis).toBTC()}},e.exports=n},{"../address":1,"../script":25,"../unit":40,"../util/js":45,"../util/preconditions":46,lodash:156}],40:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(i.isNumber(e)){if(e<=0)throw new s.Unit.InvalidRate(e);t/=e,e=n.BTC}this._value=this._from(t,e);var r=this,o=function(t){Object.defineProperty(r,t,{get:function(){return r.to(t)},enumerable:!0})};Object.keys(a).forEach(o)}var i=t("lodash"),s=t("./errors"),o=t("./util/preconditions"),a={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(a).forEach(function(t){n[t]=t}),n.fromObject=function(t){return o.checkArgument(i.isObject(t),"Argument is expected to be an object"),new n(t.amount,t.code)},n.fromBTC=function(t){return new n(t,n.BTC)},n.fromMillis=n.fromMilis=function(t){return new n(t,n.mBTC)},n.fromMicros=n.fromBits=function(t){return new n(t,n.bits)},n.fromSatoshis=function(t){return new n(t,n.satoshis)},n.fromFiat=function(t,e){return new n(t,e)},n.prototype._from=function(t,e){if(!a[e])throw new s.Unit.UnknownCode(e);return parseInt((t*a[e][0]).toFixed())},n.prototype.to=function(t){if(i.isNumber(t)){if(t<=0)throw new s.Unit.InvalidRate(t);return parseFloat((this.BTC*t).toFixed(2))}if(!a[t])throw new s.Unit.UnknownCode(t);var e=this._value/a[t][0];return parseFloat(e.toFixed(a[t][1]))},n.prototype.toBTC=function(){return this.to(n.BTC)},n.prototype.toMillis=n.prototype.toMilis=function(){return this.to(n.mBTC)},n.prototype.toMicros=n.prototype.toBits=function(){return this.to(n.bits)},n.prototype.toSatoshis=function(){return this.to(n.satoshis)},n.prototype.atRate=function(t){return this.to(t)},n.prototype.toString=function(){return this.satoshis+" satoshis"},n.prototype.toObject=n.prototype.toJSON=function(){return{amount:this.BTC,code:n.BTC}},n.prototype.inspect=function(){return""},e.exports=n},{"./errors":17,"./util/preconditions":46,lodash:156}],41:[function(t,e,r){"use strict";var n=t("lodash"),i=t("url"),s=t("./address"),o=t("./unit"),a=function(t,e){if(!(this instanceof a))return new a(t,e);if(this.extras={},this.knownParams=e||[],this.address=this.network=this.amount=this.message=null,"string"==typeof t){var r=a.parse(t);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof t)throw new TypeError("Unrecognized data format.");this._fromObject(t)}};a.fromString=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function(t){return new a(t)},a.isValid=function(t,e){try{new a(t,e)}catch(t){return!1}return!0},a.parse=function(t){var e=i.parse(t,!0);if("bitcoincash:"!==e.protocol)throw new TypeError("Invalid bitcoin URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(t);return e.query.address=r&&r[1]||void 0,e.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(t){if(!s.isValid(t.address))throw new TypeError("Invalid bitcoin address");this.address=new s(t.address),this.network=this.address.network,this.amount=t.amount;for(var e in t)if("address"!==e&&"amount"!==e){if(/^req-/.exec(e)&&-1===this.knownParams.indexOf(e))throw Error("Unknown required argument "+e);var r=a.Members.indexOf(e)>-1?this:this.extras;r[e]=t[e]}},a.prototype._parseAmount=function(t){if(t=Number(t),isNaN(t))throw new TypeError("Invalid amount");return o.fromBTC(t).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function(){for(var t={},e=0;e"},e.exports=a},{"./address":1,"./unit":40,lodash:156,url:211}],42:[function(t,e,r){"use strict";function n(t){s.checkArgument(t instanceof Array,"Must be Array");for(var e="",r=0;r>24&255),e.push(t>>16&255),e.push(t>>8&255),e.push(255&t),new r(e)},integerFromBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function(t){for(var e=new i.Buffer(t.length),r=0;r>e!=0),"value "+c),s=s<=r;)o-=r,a.push(s>>o&u)}return i?n.checkState(!(o>=e||s<0&&a.push(s<=0}}},{lodash:156}],46:[function(t,e,r){"use strict";var n=t("../errors"),i=t("lodash");e.exports={checkState:function(t,e){if(!t)throw new n.InvalidState(e)},checkArgument:function(t,e,r,i){if(!t)throw new n.InvalidArgument(e,r,i)},checkArgumentType:function(e,r,s){if(s=s||"(unknown name)",i.isString(r)){if("Buffer"===r){var o=t("buffer") -;if(!o.Buffer.isBuffer(e))throw new n.InvalidArgumentType(e,r,s)}else if(typeof e!==r)throw new n.InvalidArgumentType(e,r,s)}else if(!(e instanceof r))throw new n.InvalidArgumentType(e,r.name,s)}}},{"../errors":17,buffer:98,lodash:156}],47:[function(t,e,r){var n=r;n.bignum=t("bn.js"),n.define=t("./asn1/api").define,n.base=t("./asn1/base"),n.constants=t("./asn1/constants"),n.decoders=t("./asn1/decoders"),n.encoders=t("./asn1/encoders")},{"./asn1/api":48,"./asn1/base":50,"./asn1/constants":54,"./asn1/decoders":56,"./asn1/encoders":59,"bn.js":64}],48:[function(t,e,r){function n(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}var i=t("../asn1"),s=t("inherits");r.define=function(t,e){return new n(t,e)},n.prototype._createNamed=function(e){var r;try{r=t("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){r=function(t){this._initNamed(t)}}return s(r,e),r.prototype._initNamed=function(t){e.call(this,t)},new r(this)},n.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},n.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},n.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},n.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},{"../asn1":47,inherits:153,vm:216}],49:[function(t,e,r){function n(t,e){if(o.call(this,e),!a.isBuffer(t))return void this.error("Input not Buffer");this.base=t,this.offset=0,this.length=t.length}function i(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof i||(t=new i(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=a.byteLength(t);else{if(!a.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}var s=t("inherits"),o=t("../base").Reporter,a=t("buffer").Buffer;s(n,o),r.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:o.prototype.save.call(this)}},n.prototype.restore=function(t){var e=new n(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,o.prototype.restore.call(this,t.reporter),e},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},n.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},n.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},r.EncoderBuffer=i,i.prototype.join=function(t,e){return t||(t=new a(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(t,e),e+=r.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):a.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},{"../base":50,buffer:98,inherits:153}],50:[function(t,e,r){var n=r;n.Reporter=t("./reporter").Reporter,n.DecoderBuffer=t("./buffer").DecoderBuffer,n.EncoderBuffer=t("./buffer").EncoderBuffer,n.Node=t("./node")},{"./buffer":49,"./node":51,"./reporter":52}],51:[function(t,e,r){function n(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var i=t("../base").Reporter,s=t("../base").EncoderBuffer,o=t("../base").DecoderBuffer,a=t("minimalistic-assert"),u=["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"],f=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(u),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];e.exports=n;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];n.prototype.clone=function(){var t=this._baseState,e={};h.forEach(function(r){e[r]=t[r]});var r=new this.constructor(e.parent);return r._baseState=e,r},n.prototype._wrap=function(){var t=this._baseState;f.forEach(function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},n.prototype._init=function(t){var e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),a.equal(e.children.length,1,"Root node can have only one child")},n.prototype._useArgs=function(t){var e=this._baseState,r=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach(function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r}),e}))},c.forEach(function(t){n.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),u.forEach(function(t){n.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}}),n.prototype.use=function(t){a(t);var e=this._baseState;return a(null===e.use),e.use=t,this},n.prototype.optional=function(){return this._baseState.optional=!0,this},n.prototype.def=function(t){var e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},n.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},n.prototype.implicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},n.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},n.prototype.key=function(t){var e=this._baseState;return a(null===e.key),e.key=t,this},n.prototype.any=function(){return this._baseState.any=!0,this},n.prototype.choice=function(t){var e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},n.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},n.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var n=r.default,i=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){var a=null;if(null!==r.explicit?a=r.explicit:null!==r.implicit?a=r.implicit:null!==r.tag&&(a=r.tag),null!==a||r.any){if(i=this._peekTag(t,a,r.any),t.isError(i))return i}else{var u=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),i=!0}catch(t){i=!1}t.restore(u)}}var f;if(r.obj&&i&&(f=t.enterObject()),i){if(null!==r.explicit){var c=this._decodeTag(t,r.explicit);if(t.isError(c))return c;t=c}var h=t.offset;if(null===r.use&&null===r.choice){if(r.any)var u=t.save();var d=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(d))return d;r.any?n=t.raw(u):t=d}if(e&&e.track&&null!==r.tag&&e.track(t.path(),h,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),n=r.any?n:null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(t,e)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(l,e)}}return r.obj&&i&&(n=t.leaveObject(f)),null===r.key||null===n&&!0!==i?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},n.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},n.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},n.prototype._decodeChoice=function(t,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(s){var o=t.save(),a=r.choice[s];try{var u=a._decode(t,e);if(t.isError(u))return!1;n={type:s,value:u},i=!0}catch(e){return t.restore(o),!1}return!0},this),i?n:t.error("Choice not matched")},n.prototype._createEncoderBuffer=function(t){return new s(t,this.reporter)},n.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n.default||n.default!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},n.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var s=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var o=null,a=!1;if(n.any)s=this._createEncoderBuffer(t);else if(n.choice)s=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)o=n.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i},this).filter(function(t){return t}),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(r){var n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)},u))}else null!==n.use?s=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),a=!0);var s;if(!n.any&&null===n.choice){var f=null!==n.implicit?n.implicit:n.tag,c=null===n.implicit?"universal":"context";null===f?null===n.use&&e.error("Tag could be ommited only for .use()"):null===n.use&&(s=this._encodeComposite(f,a,c,o))}return null!==n.explicit&&(s=this._encodeComposite(n.explicit,!1,"context",s)),s},n.prototype._encodeChoice=function(t,e){var r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},n.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},n.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},n.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},{"../base":50,"minimalistic-assert":160}],52:[function(t,e,r){function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function i(t,e){this.path=t,this.rethrow(e)}var s=t("inherits");r.Reporter=n,n.prototype.isError=function(t){return t instanceof i},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof i;if(e=n?t:new i(r.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},s(i,Error),i.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{inherits:153}],53:[function(t,e,r){var n=t("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n._reverse(r.tagClass),r.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"},r.tagByName=n._reverse(r.tag)},{"../constants":54}],54:[function(t,e,r){var n=r;n._reverse=function(t){var e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r|=0);var n=t[r];e[n]=r}),e},n.der=t("./der")},{"./der":53}],55:[function(t,e,r){function n(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new i,this.tree._init(t.body)}function i(t){f.Node.call(this,"der",t)}function s(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=h.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){var s=r;for(r=0;128==(128&s);){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=127&s}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:h.tag[r]}}function o(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var s=0;s=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=h.tagClassByName[r||"universal"]<<6)}var a=t("inherits"),u=t("buffer").Buffer,f=t("../../asn1"),c=f.base,h=f.constants.der;e.exports=n,n.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},a(i,c.Node),i.prototype._encodeComposite=function(t,e,r,n){var i=o(t,e,r,this.reporter);if(n.length<128){var s=new u(2);return s[0]=i,s[1]=n.length,this._createEncoderBuffer([s,n])}for(var a=1,f=n.length;f>=256;f>>=8)a++;var s=new u(2+a);s[0]=i,s[1]=128|a;for(var f=1+a,c=n.length;c>0;f--,c>>=8)s[f]=255&c;return this._createEncoderBuffer([s,n])},i.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new u(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}for(var i=0,n=0;n=128;s>>=7)i++}for(var o=new u(i),a=o.length-1,n=t.length-1;n>=0;n--){var s=t[n];for(o[a--]=127&s;(s>>=7)>0;)o[a--]=128|127&s}return this._createEncoderBuffer(o)},i.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[s(n.getFullYear()),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[s(n.getFullYear()%100),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!u.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new u(r)}if(u.isBuffer(t)){var n=t.length;0===t.length&&n++;var i=new u(n);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var n=1,s=t;s>=256;s>>=8)n++;for(var i=new Array(n),s=i.length-1;s>=0;s--)i[s]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new u(i))},i.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},i.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},i.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),s.length!==i.defaultBuffer.length)return!1;for(n=0;n=0;a--)if(u[a]!==f[a])return!1;for(a=u.length-1;a>=0;a--)if(o=u[a],!l(t[o],e[o],r,n))return!1;return!0}function g(t,e,r){l(t,e,!0)&&h(t,e,r,"notDeepStrictEqual",g)}function y(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function m(t){var e;try{t()}catch(t){e=t}return e}function v(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=m(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&h(i,r,"Missing expected exception"+n);var s="string"==typeof n,o=!t&&_.isError(i),a=!t&&i&&!r;if((o&&s&&y(i,r)||a)&&h(i,r,"Got unwanted exception"+n),t&&i&&r&&!y(i,r)||!t&&i)throw i}var _=t("util/"),w=Object.prototype.hasOwnProperty,S=Array.prototype.slice,k=function(){return"foo"===function(){}.name}(),E=e.exports=d,I=/\s*function\s+([^\(\s]*)\s*/;E.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||h;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=a(e),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},_.inherits(E.AssertionError,Error),E.fail=h,E.ok=d,E.equal=function(t,e,r){t!=e&&h(t,e,r,"==",E.equal)},E.notEqual=function(t,e,r){t==e&&h(t,e,r,"!=",E.notEqual)},E.deepEqual=function(t,e,r){l(t,e,!1)||h(t,e,r,"deepEqual",E.deepEqual)},E.deepStrictEqual=function(t,e,r){l(t,e,!0)||h(t,e,r,"deepStrictEqual",E.deepStrictEqual)},E.notDeepEqual=function(t,e,r){l(t,e,!1)&&h(t,e,r,"notDeepEqual",E.notDeepEqual)},E.notDeepStrictEqual=g,E.strictEqual=function(t,e,r){t!==e&&h(t,e,r,"===",E.strictEqual)},E.notStrictEqual=function(t,e,r){t===e&&h(t,e,r,"!==",E.notStrictEqual)},E.throws=function(t,e,r){v(!0,t,e,r)},E.doesNotThrow=function(t,e,r){v(!1,t,e,r)},E.ifError=function(t){if(t)throw t};var A=Object.keys||function(t){var e=[];for(var r in t)w.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":215}],62:[function(t,e,r){var n=t("safe-buffer").Buffer;e.exports=function(t){function e(e){if(0===e.length)return"";for(var r=[0],n=0;n0;)r.push(s%o),s=s/o|0}for(var a="",u=0;0===e[u]&&u=0;--f)a+=t[r[f]];return a}function r(t){if(0===t.length)return n.allocUnsafe(0);for(var e=[0],r=0;r>=8;for(;f>0;)e.push(255&f),f>>=8}for(var c=0;t[c]===a&&c0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function s(t){var e,r,i,s,o,a=t.length;s=n(t),o=new h(3*a/4-s),r=s>0?a-4:a;var u=0;for(e=0;e>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===s?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,o[u++]=255&i):1===s&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}function o(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function a(t,e,r){for(var n,i=[],s=e;su?u:o+16383));return 1===n?(e=t[r-1],i+=f[e>>2],i+=f[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=f[e>>10],i+=f[e>>4&63],i+=f[e<<2&63],i+="="),s.push(i),s.join("")}r.byteLength=i,r.toByteArray=s,r.fromByteArray=u;for(var f=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=d.length;l=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function a(t,e,r,n){ -for(var i=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return i}function u(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function f(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f>>26,h=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;i=0|t.words[p],s=0|e.words[l],o=i*s+h,c+=o/67108864|0,h=67108863&o}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0,i+=o>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}function h(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}function l(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function g(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function m(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function v(t){m.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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"==typeof e?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var _;try{_=t("buffer").Buffer}catch(t){}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-s&4194303,(s+=24)>=26&&(s-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,u=Math.min(s,s-o)+r,f=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var w=["","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"],S=[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],k=[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];s.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,s=0,o=0;o>>24-i&16777215,r=0!==s||o!==this.length-1?w[6-u.length]+u+r:u+r,i+=2,i>=26&&(i-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=S[t],c=k[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?d+r:w[f-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return n(void 0!==_),this.toArrayLike(_,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===e,f=new t(s),c=this.clone();if(u){for(a=0;!c.isZero();a++)o=c.andln(255),c.iushrn(8),f[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,g=0|o[2],y=8191&g,m=g>>>13,v=0|o[3],_=8191&v,w=v>>>13,S=0|o[4],k=8191&S,E=S>>>13,I=0|o[5],A=8191&I,x=I>>>13,O=0|o[6],P=8191&O,B=O>>>13,R=0|o[7],M=8191&R,T=R>>>13,C=0|o[8],N=8191&C,j=C>>>13,U=0|o[9],L=8191&U,D=U>>>13,H=0|a[0],K=8191&H,F=H>>>13,z=0|a[1],q=8191&z,V=z>>>13,Y=0|a[2],G=8191&Y,W=Y>>>13,X=0|a[3],Z=8191&X,J=X>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ct=0|a[8],ht=8191&ct,dt=ct>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,K),i=Math.imul(h,F),i=i+Math.imul(d,K)|0,s=Math.imul(d,F);var gt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,K),i=Math.imul(p,F),i=i+Math.imul(b,K)|0,s=Math.imul(b,F),n=n+Math.imul(h,q)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(d,q)|0,s=s+Math.imul(d,V)|0;var yt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,K),i=Math.imul(y,F),i=i+Math.imul(m,K)|0,s=Math.imul(m,F),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,V)|0,i=i+Math.imul(b,q)|0,s=s+Math.imul(b,V)|0,n=n+Math.imul(h,G)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(d,G)|0,s=s+Math.imul(d,W)|0;var mt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(_,K),i=Math.imul(_,F),i=i+Math.imul(w,K)|0,s=Math.imul(w,F),n=n+Math.imul(y,q)|0,i=i+Math.imul(y,V)|0,i=i+Math.imul(m,q)|0,s=s+Math.imul(m,V)|0,n=n+Math.imul(p,G)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(b,G)|0,s=s+Math.imul(b,W)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(d,Z)|0,s=s+Math.imul(d,J)|0;var vt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(k,K),i=Math.imul(k,F),i=i+Math.imul(E,K)|0,s=Math.imul(E,F),n=n+Math.imul(_,q)|0,i=i+Math.imul(_,V)|0,i=i+Math.imul(w,q)|0,s=s+Math.imul(w,V)|0,n=n+Math.imul(y,G)|0,i=i+Math.imul(y,W)|0,i=i+Math.imul(m,G)|0,s=s+Math.imul(m,W)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(b,Z)|0,s=s+Math.imul(b,J)|0,n=n+Math.imul(h,Q)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(d,Q)|0,s=s+Math.imul(d,tt)|0;var _t=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,K),i=Math.imul(A,F),i=i+Math.imul(x,K)|0,s=Math.imul(x,F),n=n+Math.imul(k,q)|0,i=i+Math.imul(k,V)|0,i=i+Math.imul(E,q)|0,s=s+Math.imul(E,V)|0,n=n+Math.imul(_,G)|0,i=i+Math.imul(_,W)|0,i=i+Math.imul(w,G)|0,s=s+Math.imul(w,W)|0,n=n+Math.imul(y,Z)|0,i=i+Math.imul(y,J)|0,i=i+Math.imul(m,Z)|0,s=s+Math.imul(m,J)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(b,Q)|0,s=s+Math.imul(b,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(d,rt)|0,s=s+Math.imul(d,nt)|0;var wt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,K),i=Math.imul(P,F),i=i+Math.imul(B,K)|0,s=Math.imul(B,F),n=n+Math.imul(A,q)|0,i=i+Math.imul(A,V)|0,i=i+Math.imul(x,q)|0,s=s+Math.imul(x,V)|0,n=n+Math.imul(k,G)|0,i=i+Math.imul(k,W)|0,i=i+Math.imul(E,G)|0,s=s+Math.imul(E,W)|0,n=n+Math.imul(_,Z)|0,i=i+Math.imul(_,J)|0,i=i+Math.imul(w,Z)|0,s=s+Math.imul(w,J)|0,n=n+Math.imul(y,Q)|0,i=i+Math.imul(y,tt)|0,i=i+Math.imul(m,Q)|0,s=s+Math.imul(m,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0,n=n+Math.imul(h,st)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(d,st)|0,s=s+Math.imul(d,ot)|0;var St=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(M,K),i=Math.imul(M,F),i=i+Math.imul(T,K)|0,s=Math.imul(T,F),n=n+Math.imul(P,q)|0,i=i+Math.imul(P,V)|0,i=i+Math.imul(B,q)|0,s=s+Math.imul(B,V)|0,n=n+Math.imul(A,G)|0,i=i+Math.imul(A,W)|0,i=i+Math.imul(x,G)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(k,Z)|0,i=i+Math.imul(k,J)|0,i=i+Math.imul(E,Z)|0,s=s+Math.imul(E,J)|0,n=n+Math.imul(_,Q)|0,i=i+Math.imul(_,tt)|0,i=i+Math.imul(w,Q)|0,s=s+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,i=i+Math.imul(m,rt)|0,s=s+Math.imul(m,nt)|0,n=n+Math.imul(p,st)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,n=n+Math.imul(h,ut)|0,i=i+Math.imul(h,ft)|0,i=i+Math.imul(d,ut)|0,s=s+Math.imul(d,ft)|0;var kt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(N,K),i=Math.imul(N,F),i=i+Math.imul(j,K)|0,s=Math.imul(j,F),n=n+Math.imul(M,q)|0,i=i+Math.imul(M,V)|0,i=i+Math.imul(T,q)|0,s=s+Math.imul(T,V)|0,n=n+Math.imul(P,G)|0,i=i+Math.imul(P,W)|0,i=i+Math.imul(B,G)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(A,Z)|0,i=i+Math.imul(A,J)|0,i=i+Math.imul(x,Z)|0,s=s+Math.imul(x,J)|0,n=n+Math.imul(k,Q)|0,i=i+Math.imul(k,tt)|0,i=i+Math.imul(E,Q)|0,s=s+Math.imul(E,tt)|0,n=n+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,i=i+Math.imul(w,rt)|0,s=s+Math.imul(w,nt)|0,n=n+Math.imul(y,st)|0,i=i+Math.imul(y,ot)|0,i=i+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0,n=n+Math.imul(p,ut)|0,i=i+Math.imul(p,ft)|0,i=i+Math.imul(b,ut)|0,s=s+Math.imul(b,ft)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,dt)|0,i=i+Math.imul(d,ht)|0,s=s+Math.imul(d,dt)|0;var Et=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(L,K),i=Math.imul(L,F),i=i+Math.imul(D,K)|0,s=Math.imul(D,F),n=n+Math.imul(N,q)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(j,q)|0,s=s+Math.imul(j,V)|0,n=n+Math.imul(M,G)|0,i=i+Math.imul(M,W)|0,i=i+Math.imul(T,G)|0,s=s+Math.imul(T,W)|0,n=n+Math.imul(P,Z)|0,i=i+Math.imul(P,J)|0,i=i+Math.imul(B,Z)|0,s=s+Math.imul(B,J)|0,n=n+Math.imul(A,Q)|0,i=i+Math.imul(A,tt)|0,i=i+Math.imul(x,Q)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,i=i+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(_,st)|0,i=i+Math.imul(_,ot)|0,i=i+Math.imul(w,st)|0,s=s+Math.imul(w,ot)|0,n=n+Math.imul(y,ut)|0,i=i+Math.imul(y,ft)|0,i=i+Math.imul(m,ut)|0,s=s+Math.imul(m,ft)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,dt)|0,i=i+Math.imul(b,ht)|0,s=s+Math.imul(b,dt)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,bt)|0,i=i+Math.imul(d,pt)|0,s=s+Math.imul(d,bt)|0;var It=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,q),i=Math.imul(L,V),i=i+Math.imul(D,q)|0,s=Math.imul(D,V),n=n+Math.imul(N,G)|0,i=i+Math.imul(N,W)|0,i=i+Math.imul(j,G)|0,s=s+Math.imul(j,W)|0,n=n+Math.imul(M,Z)|0,i=i+Math.imul(M,J)|0,i=i+Math.imul(T,Z)|0,s=s+Math.imul(T,J)|0,n=n+Math.imul(P,Q)|0,i=i+Math.imul(P,tt)|0,i=i+Math.imul(B,Q)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(A,rt)|0,i=i+Math.imul(A,nt)|0,i=i+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(k,st)|0,i=i+Math.imul(k,ot)|0,i=i+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,n=n+Math.imul(_,ut)|0,i=i+Math.imul(_,ft)|0,i=i+Math.imul(w,ut)|0,s=s+Math.imul(w,ft)|0,n=n+Math.imul(y,ht)|0,i=i+Math.imul(y,dt)|0,i=i+Math.imul(m,ht)|0,s=s+Math.imul(m,dt)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,bt)|0,i=i+Math.imul(b,pt)|0,s=s+Math.imul(b,bt)|0;var At=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,G),i=Math.imul(L,W),i=i+Math.imul(D,G)|0,s=Math.imul(D,W),n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(j,Z)|0,s=s+Math.imul(j,J)|0,n=n+Math.imul(M,Q)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(T,Q)|0,s=s+Math.imul(T,tt)|0,n=n+Math.imul(P,rt)|0,i=i+Math.imul(P,nt)|0,i=i+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(A,st)|0,i=i+Math.imul(A,ot)|0,i=i+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(k,ut)|0,i=i+Math.imul(k,ft)|0,i=i+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(_,ht)|0,i=i+Math.imul(_,dt)|0,i=i+Math.imul(w,ht)|0,s=s+Math.imul(w,dt)|0,n=n+Math.imul(y,pt)|0,i=i+Math.imul(y,bt)|0,i=i+Math.imul(m,pt)|0,s=s+Math.imul(m,bt)|0;var xt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,Z),i=Math.imul(L,J),i=i+Math.imul(D,Z)|0,s=Math.imul(D,J),n=n+Math.imul(N,Q)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(j,Q)|0,s=s+Math.imul(j,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(T,rt)|0,s=s+Math.imul(T,nt)|0,n=n+Math.imul(P,st)|0,i=i+Math.imul(P,ot)|0,i=i+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(A,ut)|0,i=i+Math.imul(A,ft)|0,i=i+Math.imul(x,ut)|0,s=s+Math.imul(x,ft)|0,n=n+Math.imul(k,ht)|0,i=i+Math.imul(k,dt)|0,i=i+Math.imul(E,ht)|0,s=s+Math.imul(E,dt)|0,n=n+Math.imul(_,pt)|0,i=i+Math.imul(_,bt)|0,i=i+Math.imul(w,pt)|0,s=s+Math.imul(w,bt)|0;var Ot=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,Q),i=Math.imul(L,tt),i=i+Math.imul(D,Q)|0,s=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(j,rt)|0,s=s+Math.imul(j,nt)|0,n=n+Math.imul(M,st)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,n=n+Math.imul(P,ut)|0,i=i+Math.imul(P,ft)|0,i=i+Math.imul(B,ut)|0,s=s+Math.imul(B,ft)|0,n=n+Math.imul(A,ht)|0,i=i+Math.imul(A,dt)|0,i=i+Math.imul(x,ht)|0,s=s+Math.imul(x,dt)|0,n=n+Math.imul(k,pt)|0,i=i+Math.imul(k,bt)|0,i=i+Math.imul(E,pt)|0,s=s+Math.imul(E,bt)|0;var Pt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,s=Math.imul(D,nt),n=n+Math.imul(N,st)|0,i=i+Math.imul(N,ot)|0,i=i+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,n=n+Math.imul(M,ut)|0,i=i+Math.imul(M,ft)|0,i=i+Math.imul(T,ut)|0,s=s+Math.imul(T,ft)|0,n=n+Math.imul(P,ht)|0,i=i+Math.imul(P,dt)|0,i=i+Math.imul(B,ht)|0,s=s+Math.imul(B,dt)|0,n=n+Math.imul(A,pt)|0,i=i+Math.imul(A,bt)|0,i=i+Math.imul(x,pt)|0,s=s+Math.imul(x,bt)|0;var Bt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(L,st),i=Math.imul(L,ot),i=i+Math.imul(D,st)|0,s=Math.imul(D,ot),n=n+Math.imul(N,ut)|0,i=i+Math.imul(N,ft)|0,i=i+Math.imul(j,ut)|0,s=s+Math.imul(j,ft)|0,n=n+Math.imul(M,ht)|0,i=i+Math.imul(M,dt)|0,i=i+Math.imul(T,ht)|0,s=s+Math.imul(T,dt)|0,n=n+Math.imul(P,pt)|0,i=i+Math.imul(P,bt)|0,i=i+Math.imul(B,pt)|0,s=s+Math.imul(B,bt)|0;var Rt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(L,ut),i=Math.imul(L,ft),i=i+Math.imul(D,ut)|0,s=Math.imul(D,ft),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,dt)|0,i=i+Math.imul(j,ht)|0,s=s+Math.imul(j,dt)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,bt)|0,i=i+Math.imul(T,pt)|0,s=s+Math.imul(T,bt)|0;var Mt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,ht),i=Math.imul(L,dt),i=i+Math.imul(D,ht)|0,s=Math.imul(D,dt),n=n+Math.imul(N,pt)|0,i=i+Math.imul(N,bt)|0,i=i+Math.imul(j,pt)|0,s=s+Math.imul(j,bt)|0;var Tt=(f+n|0)+((8191&i)<<13)|0;f=(s+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,pt),i=Math.imul(L,bt),i=i+Math.imul(D,pt)|0,s=Math.imul(D,bt);var Ct=(f+n|0)+((8191&i)<<13)|0;return f=(s+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=gt,u[1]=yt,u[2]=mt,u[3]=vt,u[4]=_t,u[5]=wt,u[6]=St,u[7]=kt,u[8]=Et,u[9]=It,u[10]=At,u[11]=xt,u[12]=Ot,u[13]=Pt,u[14]=Bt,u[15]=Rt,u[16]=Mt,u[17]=Tt,u[18]=Ct,0!==f&&(u[19]=f,r.length++),r};Math.imul||(E=f),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?E(this,t,e):r<63?f(this,t,e):r<1024?c(this,t,e):h(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;n>=1;return n},d.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=u(t);if(0===e.length)return new s(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);var i;i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,f=0;f=0&&(0!==c||f>=i);f--){var h=0|this.words[f];this.words[f]=c<<26-s|h>>>s,c=h&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){a=new s(null),a.length=u+1,a.words=new Array(a.length);for(var f=0;f=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var i,o,a;return 0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},s.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone() -;for(var i=new s(1),o=new s(0),a=new s(0),u=new s(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(u)):(r.isub(e),a.isub(i),u.isub(o))}return{a:a,b:u,gcd:r.iushln(f)}},s.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(a),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var d;return d=0===e.cmpn(1)?i:o,d.cmpn(0)<0&&d.iadd(t),d},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new m(t)},s.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var I={k256:null,p224:null,p192:null,p25519:null};l.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},l.prototype.split=function(t,e){t.iushrn(this.n,0,e)},l.prototype.imulK=function(t){return t.imul(this.k)},i(p,l),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=s}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(I[t])return I[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new b;else if("p192"===t)e=new g;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return I[t]=e,e},m.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},m.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},m.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},m.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},m.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},m.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},m.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},m.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},m.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},m.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},m.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},m.prototype.isqr=function(t){return this.imul(t,t.clone())},m.prototype.sqr=function(t){return this.mul(t,t)},m.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,f).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=o;0!==l.cmp(a);){for(var b=l,g=0;0!==b.cmp(a);g++)b=b.redSqr();n(g=0;n--){for(var f=e.words[n],c=u-1;c>=0;c--){var h=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}u=26}return i},m.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},m.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new v(t)},i(v,m),v.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},v.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},v.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},v.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},v.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:66}],65:[function(t,e,r){function n(t){this.rand=t}var i;if(e.exports=function(t){return i||(i=new n(null)),i.generate(t)},e.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&g]^e[y++],o=f[p>>>24]^c[b>>>16&255]^h[g>>>8&255]^d[255&l]^e[y++],a=f[b>>>24]^c[g>>>16&255]^h[l>>>8&255]^d[255&p]^e[y++],u=f[g>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[y++],l=s,p=o,b=a,g=u;return s=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&g])^e[y++],o=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[g>>>8&255]<<8|n[255&l])^e[y++],a=(n[b>>>24]<<24|n[g>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[y++],u=(n[g>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[y++],s>>>=0,o>>>=0,a>>>=0,u>>>=0,[s,o,a,u]}function o(t){this._key=n(t),this._reset()}var a=t("safe-buffer").Buffer,u=[0,1,2,4,8,16,32,64,128,27,54],f=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],s=[[],[],[],[]],o=0,a=0,u=0;u<256;++u){var f=a^a<<1^a<<2^a<<3^a<<4;f=f>>>8^255&f^99,r[o]=f,n[f]=o;var c=t[o],h=t[c],d=t[h],l=257*t[f]^16843008*f;i[0][o]=l<<24|l>>>8,i[1][o]=l<<16|l>>>16,i[2][o]=l<<8|l>>>24,i[3][o]=l,l=16843009*d^65537*h^257*c^16843008*o,s[0][f]=l<<24|l>>>8,s[1][f]=l<<16|l>>>16,s[2][f]=l<<8|l>>>24,s[3][f]=l,0===o?o=a=1:(o=c^t[t[t[d^c]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:s}}();o.blockSize=16,o.keySize=32,o.prototype.blockSize=o.blockSize,o.prototype.keySize=o.keySize,o.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],s=0;s>>24,o=f.SBOX[o>>>24]<<24|f.SBOX[o>>>16&255]<<16|f.SBOX[o>>>8&255]<<8|f.SBOX[255&o],o^=u[s/e|0]<<24):e>6&&s%e==4&&(o=f.SBOX[o>>>24]<<24|f.SBOX[o>>>16&255]<<16|f.SBOX[o>>>8&255]<<8|f.SBOX[255&o]),i[s]=i[s-e]^o}for(var a=[],c=0;c>>24]]^f.INV_SUB_MIX[1][f.SBOX[d>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[d>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a},o.prototype.encryptBlockRaw=function(t){return t=n(t),s(t,this._keySchedule,f.SUB_MIX,f.SBOX,this._nRounds)},o.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=a.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},o.prototype.decryptBlock=function(t){t=n(t);var e=t[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX,this._nRounds),i=a.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},o.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},e.exports.AES=o},{"safe-buffer":200}],68:[function(t,e,r){function n(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},i.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=a,r.createDecipheriv=o},{"./aes":67,"./authCipher":68,"./modes":80,"./streamCipher":83,"cipher-base":99,evp_bytestokey:135,inherits:153,"safe-buffer":200}],71:[function(t,e,r){function n(t,e,r){h.call(this),this._cache=new i,this._cipher=new d.AES(e),this._prev=f.from(r),this._mode=t,this._autopadding=!0}function i(){this.cache=f.allocUnsafe(0)}function s(t,e,r){var i=a[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=f.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=f.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new c(i.module,e,r):"auth"===i.type?new u(i.module,e,r):new n(i.module,e,r)}function o(t,e){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=l(e,!1,r.key,r.iv);return s(t,n.key,n.iv)}var a=t("./modes"),u=t("./authCipher"),f=t("safe-buffer").Buffer,c=t("./streamCipher"),h=t("cipher-base"),d=t("./aes"),l=t("evp_bytestokey");t("inherits")(n,h),n.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return f.concat(n)};var p=f.alloc(16,16);n.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(p))throw this._cipher.scrub(),new Error("data not multiple of block length")},n.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},i.prototype.add=function(t){this.cache=f.concat([this.cache,t])},i.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},i.prototype.flush=function(){for(var t=16-this.cache.length,e=f.allocUnsafe(t),r=-1;++r>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=o.alloc(16,0),this.cache=o.allocUnsafe(0)}var o=t("safe-buffer").Buffer,a=o.alloc(16,0);s.prototype.ghash=function(t){for(var e=-1;++e0;t--)s[t]=s[t]>>>1|(1&s[t-1])<<31;s[0]=s[0]>>>1,r&&(s[0]=s[0]^225<<24)}this.state=i(o)},s.prototype.update=function(t){this.cache=o.concat([this.cache,t]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(o.concat([this.cache,a],16)),this.ghash(i([0,t,0,e])),this.state},e.exports=s},{"safe-buffer":200}],73:[function(t,e,r){function n(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}e.exports=n},{}],74:[function(t,e,r){var n=t("buffer-xor");r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{"buffer-xor":97}],75:[function(t,e,r){function n(t,e,r){var n=e.length,o=s(e,t._cache);return t._cache=t._cache.slice(n),t._prev=i.concat([t._prev,r?e:o]),o}var i=t("safe-buffer").Buffer,s=t("buffer-xor");r.encrypt=function(t,e,r){for(var s,o=i.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),!(t._cache.length<=e.length)){o=i.concat([o,n(t,e,r)]);break}s=t._cache.length,o=i.concat([o,n(t,e.slice(0,s),r)]),e=e.slice(s)}return o}},{"buffer-xor":97,"safe-buffer":200}],76:[function(t,e,r){function n(t,e,r){for(var n,s,o,a=-1,u=0;++a<8;)n=t._cipher.encryptBlock(t._prev),s=e&1<<7-a?128:0,o=n[0]^s,u+=(128&o)>>a%8,t._prev=i(t._prev,r?s:o);return u}function i(t,e){var r=t.length,n=-1,i=s.allocUnsafe(t.length);for(t=s.concat([t,s.from([e])]);++n>7;return i}var s=t("safe-buffer").Buffer;r.encrypt=function(t,e,r){for(var i=e.length,o=s.allocUnsafe(i),a=-1;++a=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new o(a(e));return r}var o=t("bn.js"),a=t("randombytes");e.exports=i,i.getr=s}).call(this,t("buffer").Buffer)},{"bn.js":64,buffer:98,randombytes:184}],88:[function(t,e,r){e.exports=t("./browser/algorithms.json")},{"./browser/algorithms.json":89}],89:[function(t,e,r){e.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"}}},{}],90:[function(t,e,r){e.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"}},{}],91:[function(t,e,r){(function(r){function n(t){u.Writable.call(this);var e=d[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=a(e.hash),this._tag=e.id,this._signType=e.sign}function i(t){u.Writable.call(this);var e=d[t];if(!e)throw new Error("Unknown message digest");this._hash=a(e.hash),this._tag=e.id,this._signType=e.sign}function s(t){return new n(t)}function o(t){return new i(t)}var a=t("create-hash"),u=t("stream"),f=t("inherits"),c=t("./sign"),h=t("./verify"),d=t("./algorithms.json");Object.keys(d).forEach(function(t){d[t].id=new r(d[t].id,"hex"),d[t.toLowerCase()]=d[t]}),f(n,u.Writable),n.prototype._write=function(t,e,r){this._hash.update(t),r()},n.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},n.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=c(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},f(i,u.Writable),i.prototype._write=function(t,e,r){this._hash.update(t),r()},i.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},i.prototype.verify=function(t,e,n){"string"==typeof e&&(e=new r(e,n)),this.end();var i=this._hash.digest();return h(e,i,t,this._signType,this._tag)},e.exports={Sign:s,Verify:o,createSign:s,createVerify:o}}).call(this,t("buffer").Buffer)},{"./algorithms.json":89,"./sign":92,"./verify":93,buffer:98,"create-hash":102,inherits:153,stream:209}],92:[function(t,e,r){(function(r){function n(t,e,n,o,a){var u=g(e);if(u.curve){if("ecdsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");return i(t,u)}if("dsa"===u.type){if("dsa"!==o)throw new Error("wrong private key type");return s(t,u,n)}if("rsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");t=r.concat([a,t]);for(var f=u.modulus.byteLength(),c=[0,1];t.length+c.length+10&&r.ishrn(n),r}function f(t,e){t=u(t,e),t=t.mod(e);var n=new r(t.toArray());if(n.length=e)throw new Error("invalid sig")}var a=t("bn.js"),u=t("elliptic").ec,f=t("parse-asn1"),c=t("./curves.json");e.exports=n}).call(this,t("buffer").Buffer)},{"./curves.json":90,"bn.js":64,buffer:98,elliptic:118,"parse-asn1":166}],94:[function(t,e,r){function n(t){if(t&&!u(t))throw new Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function s(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function o(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var a=t("buffer").Buffer,u=a.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=r.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),n(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(t){for(var e="";this.charLength;){var r=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,n=e.charCodeAt(i);if(n>=55296&&n<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),t.copy(this.charBuffer,0,0,s),e.substring(0,i)}return e},f.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=e},f.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e}},{buffer:98}],95:[function(t,e,r){var n=t("base-x");e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":62}],96:[function(t,e,r){e.exports=function(t,e){if("function"==typeof t.compare)return t.compare(e);if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function b(t){return+t!=t&&(t=0),s.alloc(+t)}function g(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function s(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}var f;if(i){var c=-1;for(f=r;fa&&(r=a-u),f=r;f>=0;f--){for(var h=!0,d=0;di&&(n=i):n=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,f,c,h;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],128==(192&u)&&(h=(31&s)<<6|63&u)>127&&(o=h);break;case 3:u=t[i+1],f=t[i+2],128==(192&u)&&128==(192&f)&&(h=(15&s)<<12|(63&u)<<6|63&f)>2047&&(h<55296||h>57343)&&(o=h);break;case 4:u=t[i+1],f=t[i+2],c=t[i+3],128==(192&u)&&128==(192&f)&&128==(192&c)&&(h=(15&s)<<18|(63&u)<<12|(63&f)<<6|63&c)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return P(n)}function P(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function L(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,n,23,4),r+4}function H(t,e,r,n,i){return i||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,n,52,8),r+8}function K(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function G(t){return Z.toByteArray(K(t))}function W(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t){return t!==t}var Z=t("base64-js"),J=t("ieee754"),$=t("isarray");r.Buffer=s,r.SlowBuffer=b,r.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=n(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return o(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return u(null,t,e,r)},s.allocUnsafe=function(t){return f(null,t)},s.allocUnsafeSlow=function(t){return f(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,u=Math.min(o,a),f=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return I(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},s.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),J.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),J.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),J.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),J.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return H(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return H(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o>>2),o=0,a=0;o>5]|=128<>>9<<4)]=e;for(var r=1732584193,n=-271733879,i=-1732584194,c=271733878,h=0;h>16)+(e>>16)+(r>>16)<<16|65535&r}function c(t,e){return t<>>32-e}var h=t("./make-hash");e.exports=function(t){return h(t,n)}},{"./make-hash":103}],105:[function(t,e,r){"use strict";function n(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;if(this._alg=t,this._key=e,e.length>r){e=("rmd160"===t?new f:c(t)).update(e).digest()}else e.lengthu?e=t(e):e.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},n.prototype.final=function(t){var e;t&&(e=this.update(t));var r;return r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=u.r28shl(r,o),n=u.r28shl(n,o),u.pc2(r,n,t.keys,i)}},i.prototype._update=function(t,e,r,n){var i=this._desState,s=u.readUInt32BE(t,e),o=u.readUInt32BE(t,e+4);u.ip(s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,o,i.tmp,0):this._decrypt(i,s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],u.writeUInt32BE(r,s,n),u.writeUInt32BE(r,o,n+4)},i.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,s=l}u.rip(o,s,n,i)},i.prototype._decrypt=function(t,e,r,n,i){for(var s=r,o=e,a=t.keys.length-2;a>=0;a-=2){var f=t.keys[a],c=t.keys[a+1];u.expand(s,t.tmp,0),f^=t.tmp[0],c^=t.tmp[1];var h=u.substitute(f,c),d=u.permute(h),l=s;s=(o^d)>>>0,o=l}u.rip(s,o,n,i)}},{"../des":108,inherits:153,"minimalistic-assert":160}],112:[function(t,e,r){"use strict";function n(t,e){s.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);this.ciphers="encrypt"===t?[f.create({type:"encrypt",key:r}),f.create({type:"decrypt",key:n}),f.create({type:"encrypt",key:i})]:[f.create({type:"decrypt",key:i}),f.create({type:"encrypt",key:n}),f.create({type:"decrypt",key:r})]}function i(t){u.call(this,t);var e=new n(this.type,this.options.key);this._edeState=e}var s=t("minimalistic-assert"),o=t("inherits"),a=t("../des"),u=a.Cipher,f=a.DES;o(i,u),e.exports=i,i.create=function(t){return new i(t)},i.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},i.prototype._pad=f.prototype._pad,i.prototype._unpad=f.prototype._unpad},{"../des":108,inherits:153,"minimalistic-assert":160}],113:[function(t,e,r){"use strict";r.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},r.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},r.ip=function(t,e,r,n){for(var i=0,s=0,o=6;o>=0;o-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+o&1}for(var o=6;o>=0;o-=2){for(var a=1;a<=25;a+=8)s<<=1,s|=e>>>a+o&1;for(var a=1;a<=25;a+=8)s<<=1,s|=t>>>a+o&1}r[n+0]=i>>>0,r[n+1]=s>>>0},r.rip=function(t,e,r,n){for(var i=0,s=0,o=0;o<4;o++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+o&1,i<<=1,i|=t>>>a+o&1;for(var o=4;o<8;o++)for(var a=24;a>=0;a-=8)s<<=1,s|=e>>>a+o&1,s<<=1,s|=t>>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.pc1=function(t,e,r,n){for(var i=0,s=0,o=7;o>=5;o--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+o&1}for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var o=1;o<=3;o++){for(var a=0;a<=24;a+=8)s<<=1,s|=e>>a+o&1;for(var a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1}for(var a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(t,e,r,i){for(var s=0,o=0,a=n.length>>>1,u=0;u>>n[u]&1;for(var u=a;u>>n[u]&1;r[i+0]=s>>>0,r[i+1]=o>>>0},r.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(var s=11;s>=3;s-=4)i|=t>>>s&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(t,e){for(var r=0,n=0;n<4;n++){var s=t>>>18-6*n&63,o=i[64*n+s];r<<=4,r|=o}for(var n=0;n<4;n++){var s=e>>>18-6*n&63,o=i[256+64*n+s];r<<=4,r|=o}return r>>>0};var s=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(t){for(var e=0,r=0;r>>s[r]&1;return e>>>0},r.padSplit=function(t,e,r){for(var n=t.toString(2);n.lengtht;)r.ishrn(1);if(r.isEven()&&r.iadd(d),r.testn(1)||r.iadd(l),e.cmp(l)){if(!e.cmp(p))for(;r.mod(b).cmp(g);)r.iadd(m)}else for(;r.mod(f).cmp(y);)r.iadd(m);if(n=r.shrn(1),i(n)&&i(r)&&s(n)&&s(r)&&h.test(n)&&h.test(r))return r}}var a=t("randombytes");e.exports=o,o.simpleSieve=i,o.fermatTest=s;var u=t("bn.js"),f=new u(24),c=t("miller-rabin"),h=new c,d=new u(1),l=new u(2),p=new u(5),b=(new u(16),new u(8),new u(10)),g=new u(3),y=(new u(7),new u(11)),m=new u(4),v=(new u(12),null)},{"bn.js":64,"miller-rabin":159,randombytes:184}],117:[function(t,e,r){e.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"}}},{}],118:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":133,"./elliptic/curve":121,"./elliptic/curves":124,"./elliptic/ec":125,"./elliptic/eddsa":128,"./elliptic/utils":132,brorand:65}],119:[function(t,e,r){"use strict";function n(t,e){this.type=t,this.p=new s(e.p,16),this.red=e.prime?s.red(e.prime):s.mont(this.p),this.zero=new s(0).toRed(this.red),this.one=new s(1).toRed(this.red),this.two=new s(2).toRed(this.red),this.n=e.n&&new s(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(t,e){this.curve=t,this.type=e,this.precomputed=null}var s=t("bn.js"),o=t("../../elliptic"),a=o.utils,u=a.getNAF,f=a.getJSF,c=a.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(t,e){c(t.precomputed);var r=t._getDoubles(),n=u(e,1),i=(1<=o;e--)a=(a<<1)+n[e];s.push(a)}for(var f=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(var o=0;o=0;a--){for(var e=0;a>=0&&0===s[a];a--)e++;if(a>=0&&e++,o=o.dblp(e),a<0)break;var f=s[a];c(0!==f),o="affine"===t.type?f>0?o.mixedAdd(i[f-1>>1]):o.mixedAdd(i[-f-1>>1].neg()):f>0?o.add(i[f-1>>1]):o.add(i[-f-1>>1].neg())}return"affine"===t.type?o.toP():o},n.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,o=this._wnafT2,a=this._wnafT3,c=0,h=0;h=1;h-=2){var p=h-1,b=h;if(1===s[p]&&1===s[b]){var g=[e[p],null,null,e[b]];0===e[p].y.cmp(e[b].y)?(g[1]=e[p].add(e[b]),g[2]=e[p].toJ().mixedAdd(e[b].neg())):0===e[p].y.cmp(e[b].y.redNeg())?(g[1]=e[p].toJ().mixedAdd(e[b]),g[2]=e[p].add(e[b].neg())):(g[1]=e[p].toJ().mixedAdd(e[b]),g[2]=e[p].toJ().mixedAdd(e[b].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=f(r[p],r[b]);c=Math.max(m[0].length,c),a[p]=new Array(c),a[b]=new Array(c);for(var v=0;v=0;h--){for(var E=0;h>=0;){for(var I=!0,v=0;v=0&&E++,S=S.dblp(E),h<0)break;for(var v=0;v0?d=o[v][A-1>>1]:A<0&&(d=o[v][-A-1>>1].neg()),S="affine"===d.type?S.mixedAdd(d):S.add(d))}}for(var h=0;h=Math.ceil((t.bitLength()+1)/e.step)},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),u=i.redMul(o),f=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(u,f,h,c)},i.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(i),a=o.redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(a.redSub(this.curve.two)),e=a.redMul(o.redSub(s)),r=a.redSqr().redSub(a).redSub(a);else{var u=this.z.redSqr(),f=a.redSub(u).redISub(u);t=n.redSub(i).redISub(s).redMul(f),e=a.redMul(o.redSub(s)),r=a.redMul(f)}}else{var o=i.redAdd(s),u=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=o.redSub(u).redSub(u);t=this.curve._mulC(n.redISub(o)).redMul(f),e=this.curve._mulC(o).redMul(i.redISub(s)),r=o.redMul(f)}return this.curve.point(t,e,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=s.redMul(o),c=a.redMul(u),h=s.redMul(u),d=o.redMul(a);return this.curve.point(f,c,d,h)},i.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),u=i.redSub(a),f=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(f).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(f)):(e=n.redMul(f).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,e,r)},i.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},i.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},i.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},i.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],121:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":119,"./edwards":120,"./mont":122,"./short":123}],122:[function(t,e,r){"use strict";function n(t){u.call(this,"mont",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(t,e,r){u.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(e,16),this.z=new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var s=t("../curve"),o=t("bn.js"),a=t("inherits"),u=s.base,f=t("../../elliptic"),c=f.utils;a(n,u),e.exports=n,n.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},a(i,u.BasePoint),n.prototype.decodePoint=function(t,e){return this.point(c.toArray(t,e),1)},n.prototype.point=function(t,e){return new i(this,t,e)},n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(t,e){return new i(t,e[0],e[1]||t.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),i=e.redSub(n),s=e.redMul(n),o=i.redMul(n.redAdd(this.curve.a24.redMul(i)));return this.curve.point(s,o)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z),o=s.redMul(r),a=i.redMul(n),u=e.z.redMul(o.redAdd(a).redSqr()),f=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(u,f)},i.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=this,s=[];0!==e.cmpn(0);e.iushrn(1))s.push(e.andln(1));for(var o=s.length-1;o>=0;o--)0===s[o]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],123:[function(t,e,r){"use strict";function n(t){c.call(this,"short",t),this.a=new u(t.a,16).toRed(this.red),this.b=new u(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(t,e,r,n){c.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new u(e,16),this.y=new u(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(t,e,r,n){c.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new u(0)):(this.x=new u(e,16),this.y=new u(r,16),this.z=new u(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var o=t("../curve"),a=t("../../elliptic"),u=t("bn.js"),f=t("inherits"),c=o.base,h=a.utils.assert;f(n,c),e.exports=n,n.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new u(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new u(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],h(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}var s;return s=t.basis?t.basis.map(function(t){return{a:new u(t.a,16),b:new u(t.b,16)}}):this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},n.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:u.mont(t),r=new u(2).toRed(e).redInvm(),n=r.redNeg(),i=new u(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},n.prototype._getEndoBasis=function(t){for(var e,r,n,i,s,o,a,f,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new u(1),b=new u(0),g=new u(0),y=new u(1),m=0;0!==d.cmpn(0);){var v=l.div(d);f=l.sub(v.mul(d)),c=g.sub(v.mul(p));var _=y.sub(v.mul(b));if(!n&&f.cmp(h)<0)e=a.neg(),r=p,n=f.neg(),i=c;else if(n&&2==++m)break;a=f,l=d,d=f,g=p,p=c,y=b,b=_}s=f.neg(),o=c;var w=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=e,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},n.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),f=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},n.prototype.pointFromX=function(t,e){t=new u(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},n.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},n.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},i.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(t){return t=new u(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},i.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},i.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},i.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},i.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},f(s,c.BasePoint),n.prototype.jpoint=function(t,e,r){return new s(this,t,e,r)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),c=f.redMul(a),h=n.redMul(f),d=u.redSqr().redIAdd(c).redISub(h).redISub(h),l=u.redMul(h.redISub(d)).redISub(s.redMul(c)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},s.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),f=u.redMul(o),c=r.redMul(u),h=a.redSqr().redIAdd(f).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(h,d,l)},s.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],124:[function(t,e,r){"use strict";function n(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,u(this.g.validate(),"Invalid curve"),u(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(t,e){Object.defineProperty(s,t,{configurable:!0,enumerable:!0,get:function(){var r=new n(e);return Object.defineProperty(s,t,{configurable:!0,enumerable:!0,value:r}),r}})}var s=r,o=t("hash.js"),a=t("../elliptic"),u=a.utils.assert;s.PresetCurve=n,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=t("./precomputed/secp256k1")}catch(t){f=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})},{"../elliptic":118,"./precomputed/secp256k1":131,"hash.js":137}],125:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);"string"==typeof t&&(u(o.curves.hasOwnProperty(t),"Unknown curve "+t),t=o.curves[t]),t instanceof o.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var i=t("bn.js"),s=t("hmac-drbg"),o=t("../../elliptic"),a=o.utils,u=a.assert,f=t("./key"),c=t("./signature");e.exports=n,n.prototype.keyPair=function(t){return new f(this,t)},n.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},n.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},n.prototype.genKeyPair=function(t){t||(t={});for(var e=new s({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new i(2));;){var a=new i(e.generate(r));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}},n.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},n.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new s({hash:this.hash,entropy:a,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;!0;d++){var l=n.k?n.k(d):new i(f.generate(this.n.byteLength()));if(l=this._truncateToN(l,!0),!(l.cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),g=b.umod(this.n);if(0!==g.cmpn(0)){var y=l.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(y=y.umod(this.n),0!==y.cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),m^=1),new c({r:g,s:y,recoveryParam:m})}}}}}},n.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n),e=new c(e,"hex");var s=e.r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(t).umod(this.n),f=a.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(u,r.getPublic(),f);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(u,r.getPublic(),f);return!h.isInfinity()&&h.eqXToP(s)},n.prototype.recoverPubKey=function(t,e,r,n){u((3&r)===r,"The recovery param is more than two bits"),e=new c(e,n);var s=this.n,o=new i(t),a=e.r,f=e.s,h=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var l=e.r.invm(s),p=s.sub(o).mul(l).umod(s),b=f.mul(l).umod(s);return this.g.mulAdd(p,a,b)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new c(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":118,"./key":126,"./signature":127, -"bn.js":64,"hmac-drbg":150}],126:[function(t,e,r){"use strict";function n(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils,a=o.assert;e.exports=n,n.fromPublic=function(t,e,r){return e instanceof n?e:new n(t,{pub:e,pubEnc:r})},n.fromPrivate=function(t,e,r){return e instanceof n?e:new n(t,{priv:e,privEnc:r})},n.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},n.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},n.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?a(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||a(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},n.prototype.derive=function(t){return t.mul(this.priv).getX()},n.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},n.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},n.prototype.inspect=function(){return""}},{"../../elliptic":118,"bn.js":64}],127:[function(t,e,r){"use strict";function n(t,e){if(t instanceof n)return t;this._importDER(t,e)||(h(t.r&&t.s,"Signature without r or s"),this.r=new u(t.r,16),this.s=new u(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function i(){this.place=0}function s(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,s=0,o=e.place;s>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}var u=t("bn.js"),f=t("../../elliptic"),c=f.utils,h=c.assert;e.exports=n,n.prototype._importDER=function(t,e){t=c.toArray(t,e);var r=new i;if(48!==t[r.place++])return!1;if(s(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=s(t,r),o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=s(t,r);if(t.length!==a+r.place)return!1;var f=t.slice(r.place,a+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new u(o),this.s=new u(f),this.recoveryParam=null,!0},n.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=o(e),r=o(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];a(n,e.length),n=n.concat(e),n.push(2),a(n,r.length);var i=n.concat(r),s=[48];return a(s,i.length),s=s.concat(i),c.encode(s,t)}},{"../../elliptic":118,"bn.js":64}],128:[function(t,e,r){"use strict";function n(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof n))return new n(t);var t=s.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}var i=t("hash.js"),s=t("../../elliptic"),o=s.utils,a=o.assert,u=o.parseBytes,f=t("./key"),c=t("./signature");e.exports=n,n.prototype.sign=function(t,e){t=u(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:s})},n.prototype.verify=function(t,e,r){t=u(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},n.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0;){var s;if(i.isOdd()){var o=i.andln(n-1);s=o>(n>>1)-1?(n>>1)-o:o,i.isubn(s)}else s=0;r.push(s);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,u=1;u0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,o=e.andln(3)+i&3;3===s&&(s=-1),3===o&&(o=-1);var a;if(0==(1&s))a=0;else{var u=t.andln(7)+n&7;a=3!==u&&5!==u||2!==o?s:-s}r[0].push(a);var f;if(0==(1&o))f=0;else{var u=e.andln(7)+i&7;f=3!==u&&5!==u||2!==s?o:-o}r[1].push(f),2*n===a+1&&(n=1-n),2*i===f+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}function s(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function o(t){return"string"==typeof t?u.toArray(t,"hex"):t}function a(t){return new f(t,"hex","le")}var u=r,f=t("bn.js"),c=t("minimalistic-assert"),h=t("minimalistic-crypto-utils");u.assert=c,u.toArray=h.toArray,u.zero2=h.zero2,u.toHex=h.toHex,u.encode=h.encode,u.getNAF=n,u.getJSF=i,u.cachedProperty=s,u.parseBytes=o,u.intFromLE=a},{"bn.js":64,"minimalistic-assert":160,"minimalistic-crypto-utils":161}],133:[function(t,e,r){e.exports={_from:"elliptic@=6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/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","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_spec:"elliptic@=6.4.0",_where:"/Users/ematiu/dev/cash-blib",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"}},{}],134:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,u,f;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(r=this._events[t],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),f=r.slice(),n=f.length,u=0;u0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,s,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){n=a;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],135:[function(t,e,r){function n(t,e,r,n){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,a=i.alloc(o),u=i.alloc(n||0),f=i.alloc(0);o>0||n>0;){var c=new s;c.update(f),c.update(t),e&&c.update(e),f=c.digest();var h=0;if(o>0){var d=a.length-o;h=Math.min(o,f.length),f.copy(a,d,0,h),o-=h}if(h0){var l=u.length-n,p=Math.min(n,f.length-h);f.copy(u,l,h,h+p),n-=p}}return f.fill(0),{key:a,iv:u}}var i=t("safe-buffer").Buffer,s=t("md5.js");e.exports=n},{"md5.js":157,"safe-buffer":200}],136:[function(t,e,r){(function(r){"use strict";function n(t){i.call(this),this._block=new r(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var i=t("stream").Transform;t("inherits")(n,i),n.prototype._transform=function(t,e,n){var i=null;try{"buffer"!==e&&(t=new r(t,e)),this.update(t)}catch(t){i=t}n(i)},n.prototype._flush=function(t){var e=null;try{this.push(this._digest())}catch(t){e=t}t(e)},n.prototype.update=function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=new r(t,e||"binary"));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var s=this._blockOffset;s0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},n.prototype._update=function(t){throw new Error("_update is not implemented")},n.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();return void 0!==t&&(e=e.toString(t)),e},n.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,inherits:153,stream:209}],137:[function(t,e,r){var n=r;n.utils=t("./hash/utils"),n.common=t("./hash/common"),n.sha=t("./hash/sha"),n.ripemd=t("./hash/ripemd"),n.hmac=t("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":138,"./hash/hmac":139,"./hash/ripemd":140,"./hash/sha":141,"./hash/utils":148}],138:[function(t,e,r){"use strict";function n(){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 i=t("./utils"),s=t("minimalistic-assert");r.BlockHash=n,n.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;sthis.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var e=t.length;e>>3}function c(t){return d(t,17)^d(t,19)^t>>>10}var h=t("../utils"),d=h.rotr32;r.ft_1=n,r.ch32=i,r.maj32=s,r.p32=o,r.s0_256=a,r.s1_256=u,r.g0_256=f,r.g1_256=c},{"../utils":148}],148:[function(t,e,r){"use strict";function n(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for(t=t.replace(/[^a-z0-9]+/gi,""),t.length%2!=0&&(t="0"+t),n=0;n>8,o=255&i;s?r.push(s,o):r.push(o)}else for(n=0;n>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t,e){for(var r="",n=0;n>>0}return s}function c(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r}function h(t,e){return t>>>e|t<<32-e}function d(t,e){return t<>>32-e}function l(t,e){return t+e>>>0}function p(t,e,r){return t+e+r>>>0}function b(t,e,r,n){return t+e+r+n>>>0}function g(t,e,r,n,i){return t+e+r+n+i>>>0}function y(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}function m(t,e,r,n){return(e+n>>>0>>0}function v(t,e,r,n){return e+n>>>0}function _(t,e,r,n,i,s,o,a){var u=0,f=e;return f=f+n>>>0,u+=f>>0,u+=f>>0,u+=f>>0}function w(t,e,r,n,i,s,o,a){return e+n+s+a>>>0}function S(t,e,r,n,i,s,o,a,u,f){var c=0,h=e;return h=h+n>>>0,c+=h>>0,c+=h>>0,c+=h>>0,c+=h>>0}function k(t,e,r,n,i,s,o,a,u,f){return e+n+s+a+f>>>0}function E(t,e,r){return(e<<32-r|t>>>r)>>>0}function I(t,e,r){return(t<<32-r|e>>>r)>>>0}function A(t,e,r){return t>>>r}function x(t,e,r){return(t<<32-r|e>>>r)>>>0}var O=t("minimalistic-assert"),P=t("inherits");r.inherits=P,r.toArray=n,r.toHex=i,r.htonl=s,r.toHex32=o,r.zero2=a,r.zero8=u,r.join32=f,r.split32=c,r.rotr32=h,r.rotl32=d,r.sum32=l,r.sum32_3=p,r.sum32_4=b,r.sum32_5=g,r.sum64=y,r.sum64_hi=m,r.sum64_lo=v,r.sum64_4_hi=_,r.sum64_4_lo=w,r.sum64_5_hi=S,r.sum64_5_lo=k,r.rotr64_hi=E,r.rotr64_lo=I,r.shr64_hi=A,r.shr64_lo=x},{inherits:149,"minimalistic-assert":160}],149:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],150:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=s.toArray(t.entropy,t.entropyEnc||"hex"),r=s.toArray(t.nonce,t.nonceEnc||"hex"),i=s.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var i=t("hash.js"),s=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");e.exports=n,n.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},n.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=s.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,c=-7,h=r?i-1:0,d=r?-1:1,l=t[e+h];for(h+=d,s=l&(1<<-c)-1,l>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=d,c-=8);if(0===s)s=1-f;else{if(s===u)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,n),s-=f}return(l?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,f=8*s-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:s-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),e+=o+h>=1?d/u:d*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*u-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+l]=255&a,l+=p,a/=256,i-=8);for(o=o<0;t[r+l]=255&o,l+=p,o/=256,f-=8);t[r+l-p]|=128*b}},{}],152:[function(t,e,r){var n=[].indexOf;e.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r-1}function d(t,e,r){for(var n=-1,i=null==t?0:t.length;++n-1;);return r}function U(t,e){for(var r=t.length;r--&&S(e,t[r],0)>-1;);return r}function L(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}function D(t){return"\\"+Ir[t]}function H(t,e){return null==t?rt:t[e]}function K(t){return gr.test(t)}function F(t){return yr.test(t)}function z(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}function q(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function V(t,e){return function(r){return t(e(r))}}function Y(t,e){for(var r=-1,n=t.length,i=0,s=[];++r>>1,Ut=[["ary",wt],["bind",pt],["bindKey",bt],["curry",yt],["curryRight",mt],["flip",kt],["partial",vt],["partialRight",_t],["rearg",St]],Lt="[object Arguments]",Dt="[object Array]",Ht="[object AsyncFunction]",Kt="[object Boolean]",Ft="[object Date]",zt="[object DOMException]",qt="[object Error]",Vt="[object Function]",Yt="[object GeneratorFunction]",Gt="[object Map]",Wt="[object Number]",Xt="[object Null]",Zt="[object Object]",Jt="[object Proxy]",$t="[object RegExp]",Qt="[object Set]",te="[object String]",ee="[object Symbol]",re="[object Undefined]",ne="[object WeakMap]",ie="[object WeakSet]",se="[object ArrayBuffer]",oe="[object DataView]",ae="[object Float32Array]",ue="[object Float64Array]",fe="[object Int8Array]",ce="[object Int16Array]",he="[object Int32Array]",de="[object Uint8Array]",le="[object Uint8ClampedArray]",pe="[object Uint16Array]",be="[object Uint32Array]",ge=/\b__p \+= '';/g,ye=/\b(__p \+=) '' \+/g,me=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ve=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,we=RegExp(ve.source),Se=RegExp(_e.source),ke=/<%-([\s\S]+?)%>/g,Ee=/<%([\s\S]+?)%>/g,Ie=/<%=([\s\S]+?)%>/g,Ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xe=/^\w*$/,Oe=/^\./,Pe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Be=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(Be.source),Me=/^\s+|\s+$/g,Te=/^\s+/,Ce=/\s+$/,Ne=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,je=/\{\n\/\* \[wrapped with (.+)\] \*/,Ue=/,? & /,Le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,De=/\\(\\)?/g,He=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ke=/\w*$/,Fe=/^[-+]0x[0-9a-f]+$/i,ze=/^0b[01]+$/i,qe=/^\[object .+?Constructor\]$/,Ve=/^0o[0-7]+$/i,Ye=/^(?:0|[1-9]\d*)$/,Ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,We=/($^)/,Xe=/['\n\r\u2028\u2029\\]/g,Ze="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\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",$e="["+Je+"]",Qe="["+Ze+"]",tr="[a-z\\xdf-\\xf6\\xf8-\\xff]",er="[^\\ud800-\\udfff"+Je+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rr="\\ud83c[\\udffb-\\udfff]",nr="(?:\\ud83c[\\udde6-\\uddff]){2}",ir="[\\ud800-\\udbff][\\udc00-\\udfff]",sr="[A-Z\\xc0-\\xd6\\xd8-\\xde]",or="(?:"+tr+"|"+er+")",ar="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ur="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",nr,ir].join("|")+")[\\ufe0e\\ufe0f]?"+ar+")*",fr="[\\ufe0e\\ufe0f]?"+ar+ur,cr="(?:"+["[\\u2700-\\u27bf]",nr,ir].join("|")+")"+fr,hr="(?:"+["[^\\ud800-\\udfff]"+Qe+"?",Qe,nr,ir,"[\\ud800-\\udfff]"].join("|")+")",dr=RegExp("['’]","g"),lr=RegExp(Qe,"g"),pr=RegExp(rr+"(?="+rr+")|"+hr+fr,"g"),br=RegExp([sr+"?"+tr+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[$e,sr,"$"].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))?(?="+[$e,sr+or,"$"].join("|")+")",sr+"?"+or+"+(?:['’](?:d|ll|m|re|s|t|ve))?",sr+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",cr].join("|"),"g"),gr=RegExp("[\\u200d\\ud800-\\udfff"+Ze+"\\ufe0e\\ufe0f]"),yr=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,mr=["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"],vr=-1,_r={};_r[ae]=_r[ue]=_r[fe]=_r[ce]=_r[he]=_r[de]=_r[le]=_r[pe]=_r[be]=!0,_r[Lt]=_r[Dt]=_r[se]=_r[Kt]=_r[oe]=_r[Ft]=_r[qt]=_r[Vt]=_r[Gt]=_r[Wt]=_r[Zt]=_r[$t]=_r[Qt]=_r[te]=_r[ne]=!1;var wr={};wr[Lt]=wr[Dt]=wr[se]=wr[oe]=wr[Kt]=wr[Ft]=wr[ae]=wr[ue]=wr[fe]=wr[ce]=wr[he]=wr[Gt]=wr[Wt]=wr[Zt]=wr[$t]=wr[Qt]=wr[te]=wr[ee]=wr[de]=wr[le]=wr[pe]=wr[be]=!0,wr[qt]=wr[Vt]=wr[ne]=!1;var Sr={"À":"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"},kr={"&":"&","<":"<",">":">",'"':""","'":"'"},Er={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ir={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ar=parseFloat,xr=parseInt,Or="object"==typeof t&&t&&t.Object===Object&&t,Pr="object"==typeof self&&self&&self.Object===Object&&self,Br=Or||Pr||Function("return this")(),Rr="object"==typeof r&&r&&!r.nodeType&&r,Mr=Rr&&"object"==typeof e&&e&&!e.nodeType&&e,Tr=Mr&&Mr.exports===Rr,Cr=Tr&&Or.process,Nr=function(){try{return Cr&&Cr.binding&&Cr.binding("util")}catch(t){}}(),jr=Nr&&Nr.isArrayBuffer,Ur=Nr&&Nr.isDate,Lr=Nr&&Nr.isMap,Dr=Nr&&Nr.isRegExp,Hr=Nr&&Nr.isSet,Kr=Nr&&Nr.isTypedArray,Fr=A("length"),zr=x(Sr),qr=x(kr),Vr=x(Er),Yr=function t(e){function r(t){if(su(t)&&!yd(t)&&!(t instanceof X)){if(t instanceof x)return t;if(yc.call(t,"__wrapped__"))return eo(t)}return new x(t)}function m(){}function x(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=rt}function X(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ct,this.__views__=[]}function Q(){var t=new X(this.__wrapped__);return t.__actions__=Ui(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ui(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ui(this.__views__),t}function tt(){if(this.__filtered__){var t=new X(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function Le(){var t=this.__wrapped__.value(),e=this.__dir__,r=yd(t),n=e<0,i=r?t.length:0,s=As(0,i,this.__views__),o=s.start,a=s.end,u=a-o,f=n?a:o-1,c=this.__iteratees__,h=c.length,d=0,l=Gc(u,this.__takeCount__);if(!r||!n&&i==u&&l==u)return mi(t,this.__actions__);var p=[];t:for(;u--&&d-1}function ar(t,e){var r=this.__data__,n=Xr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function ur(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function rn(t,e,r,n,i,s){var o,u=e&ft,f=e&ct,c=e&ht;if(r&&(o=i?r(t,n,i,s):r(t)),o!==rt)return o;if(!iu(t))return t;var h=yd(t);if(h){if(o=Ps(t),!u)return Ui(t,o)}else{var d=xh(t),l=d==Vt||d==Yt;if(vd(t))return Ii(t,u);if(d==Zt||d==Lt||l&&!i){if(o=f||l?{}:Bs(t),!u)return f?Hi(t,$r(o,t)):Di(t,Jr(o,t))}else{if(!wr[d])return i?t:{};o=Rs(t,d,rn,u)}}s||(s=new kr);var p=s.get(t);if(p)return p;s.set(t,o);var b=c?f?ms:ys:f?Ku:Hu,g=h?rt:b(t);return a(g||t,function(n,i){g&&(i=n,n=t[i]),Wr(o,i,rn(n,e,r,i,t,s))}),o}function nn(t){var e=Hu(t);return function(r){return sn(r,t,e)}}function sn(t,e,r){var n=r.length;if(null==t)return!n;for(t=uc(t);n--;){var i=r[n],s=e[i],o=t[i];if(o===rt&&!(i in t)||!s(o))return!1}return!0}function on(t,e,r){if("function"!=typeof t)throw new hc(st);return Bh(function(){t.apply(rt,r)},e)}function an(t,e,r,n){var i=-1,s=h,o=!0,a=t.length,u=[],f=e.length;if(!a)return u;r&&(e=l(e,T(r))),n?(s=d,o=!1):e.length>=nt&&(s=N,o=!1,e=new gr(e));t:for(;++ii?0:i+r),n=n===rt||n>i?i:Su(n),n<0&&(n+=i),n=r>n?0:ku(n);r0&&r(a)?e>1?dn(a,e-1,r,n,i):p(i,a):n||(i[i.length]=a)}return i}function ln(t,e){return t&&yh(t,e,Hu)}function pn(t,e){return t&&mh(t,e,Hu)}function bn(t,e){return c(e,function(e){return eu(t[e])})}function gn(t,e){e=ki(e,t);for(var r=0,n=e.length;null!=t&&re}function _n(t,e){return null!=t&&yc.call(t,e)}function wn(t,e){return null!=t&&e in uc(t)}function Sn(t,e,r){return t>=Gc(e,r)&&t=120&&c.length>=120)?new gr(o&&c):rt}c=t[0];var p=-1,b=a[0];t:for(;++p-1;)a!==t&&Rc.call(a,u,1),Rc.call(t,u,1);return t}function $n(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;Cs(i)?Rc.call(t,i,1):bi(t,i)}}return t}function Qn(t,e){return t+Hc(Zc()*(e-t+1))}function ti(t,e,r,n){for(var i=-1,s=Yc(Dc((e-t)/(r||1)),0),o=nc(s);s--;)o[n?s:++i]=t,t+=r;return o}function ei(t,e){var r="";if(!t||e<1||e>Rt)return r;do{e%2&&(r+=t),(e=Hc(e/2))&&(t+=t)}while(e);return r}function ri(t,e){return Rh(Ys(t,e,Rf),t+"")}function ni(t){return Cr(Qu(t))}function ii(t,e){var r=Qu(t);return Js(r,en(e,0,r.length))}function si(t,e,r,n){if(!iu(t))return t;e=ki(e,t);for(var i=-1,s=e.length,o=s-1,a=t;null!=a&&++ii?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=nc(i);++n>>1,o=t[s];null!==o&&!gu(o)&&(r?o<=e:o=nt){var f=e?null:kh(t);if(f)return G(f);o=!1,i=N,u=new gr}else u=e?[]:a;t:for(;++n=n?t:ai(t,e,r)}function Ii(t,e){if(e)return t.slice();var r=t.length,n=xc?xc(r):new t.constructor(r);return t.copy(n),n}function Ai(t){var e=new t.constructor(t.byteLength);return new Ac(e).set(new Ac(t)),e}function xi(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function Oi(t,e,r){return b(e?r(q(t),ft):q(t),n,new t.constructor)}function Pi(t){var e=new t.constructor(t.source,Ke.exec(t));return e.lastIndex=t.lastIndex,e}function Bi(t,e,r){return b(e?r(G(t),ft):G(t),i,new t.constructor)}function Ri(t){return dh?uc(dh.call(t)):{}}function Mi(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Ti(t,e){if(t!==e){var r=t!==rt,n=null===t,i=t===t,s=gu(t),o=e!==rt,a=null===e,u=e===e,f=gu(e);if(!a&&!f&&!s&&t>e||s&&o&&u&&!a&&!f||n&&o&&u||!r&&u||!i)return 1;if(!n&&!s&&!f&&t=a)return u;return u*("desc"==r[n]?-1:1)}}return t.index-e.index}function Ni(t,e,r,n){for(var i=-1,s=t.length,o=r.length,a=-1,u=e.length,f=Yc(s-o,0),c=nc(u+f),h=!n;++a1?r[i-1]:rt,o=i>2?r[2]:rt;for(s=t.length>3&&"function"==typeof s?(i--,s):rt,o&&Ns(r[0],r[1],o)&&(s=i<3?rt:s,i=1),e=uc(e);++n-1?i[s?e[o]:o]:rt}}function Ji(t){return gs(function(e){var r=e.length,n=r,i=x.prototype.thru;for(t&&e.reverse();n--;){var s=e[n];if("function"!=typeof s)throw new hc(st);if(i&&!o&&"wrapper"==vs(s))var o=new x([],!0)}for(n=o?n:r;++n1&&m.reverse(),h&&ua))return!1;var f=s.get(t);if(f&&s.get(e))return f==e;var c=-1,h=!0,d=r<?new gr:rt;for(s.set(t,e),s.set(e,t);++c1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(Ne,"{\n/* [wrapped with "+e+"] */\n")}function Ts(t){return yd(t)||gd(t)||!!(Mc&&t&&t[Mc])}function Cs(t,e){return!!(e=null==e?Rt:e)&&("number"==typeof t||Ye.test(t))&&t>-1&&t%1==0&&t0){if(++e>=At)return arguments[0]}else e=0;return t.apply(rt,arguments)}}function Js(t,e){var r=-1,n=t.length,i=n-1;for(e=e===rt?n:e;++r=this.__values__.length;return{done:t,value:t?rt:this.__values__[this.__index__++]}}function ra(){return this}function na(t){for(var e,r=this;r instanceof m;){var n=eo(r);n.__index__=0,n.__values__=rt,e?i.__wrapped__=n:e=n;var i=n;r=r.__wrapped__}return i.__wrapped__=t,e}function ia(){var t=this.__wrapped__;if(t instanceof X){var e=t;return this.__actions__.length&&(e=new X(this)),e=e.reverse(),e.__actions__.push({func:$o,args:[Oo],thisArg:rt}),new x(e,this.__chain__)}return this.thru(Oo)}function sa(){return mi(this.__wrapped__,this.__actions__)}function oa(t,e,r){var n=yd(t)?f:un;return r&&Ns(t,e,r)&&(e=rt),n(t,ws(e,3))}function aa(t,e){return(yd(t)?c:hn)(t,ws(e,3))}function ua(t,e){return dn(pa(t,e),1)}function fa(t,e){return dn(pa(t,e),Bt)}function ca(t,e,r){return r=r===rt?1:Su(r),dn(pa(t,e),r)}function ha(t,e){return(yd(t)?a:bh)(t,ws(e,3))}function da(t,e){return(yd(t)?u:gh)(t,ws(e,3))}function la(t,e,r,n){t=Ya(t)?t:Qu(t),r=r&&!n?Su(r):0;var i=t.length;return r<0&&(r=Yc(i+r,0)),bu(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&S(t,e,r)>-1}function pa(t,e){return(yd(t)?l:Kn)(t,ws(e,3))}function ba(t,e,r,n){return null==t?[]:(yd(e)||(e=null==e?[]:[e]),r=n?rt:r,yd(r)||(r=null==r?[]:[r]),Gn(t,e,r))}function ga(t,e,r){var n=yd(t)?b:O,i=arguments.length<3;return n(t,ws(e,4),r,i,bh)}function ya(t,e,r){var n=yd(t)?g:O,i=arguments.length<3;return n(t,ws(e,4),r,i,gh)}function ma(t,e){return(yd(t)?c:hn)(t,Ma(ws(e,3)))}function va(t){return(yd(t)?Cr:ni)(t)}function _a(t,e,r){return e=(r?Ns(t,e,r):e===rt)?1:Su(e),(yd(t)?Nr:ii)(t,e)}function wa(t){return(yd(t)?Fr:oi)(t)}function Sa(t){if(null==t)return 0;if(Ya(t))return bu(t)?J(t):t.length;var e=xh(t);return e==Gt||e==Qt?t.size:Ln(t).length}function ka(t,e,r){var n=yd(t)?y:ui;return r&&Ns(t,e,r)&&(e=rt),n(t,ws(e,3))}function Ea(t,e){if("function"!=typeof e)throw new hc(st);return t=Su(t),function(){if(--t<1)return e.apply(this,arguments)}}function Ia(t,e,r){return e=r?rt:e,e=t&&null==e?t.length:e,fs(t,wt,rt,rt,rt,rt,e)}function Aa(t,e){var r;if("function"!=typeof e)throw new hc(st);return t=Su(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=rt),r}}function xa(t,e,r){e=r?rt:e;var n=fs(t,yt,rt,rt,rt,rt,rt,e);return n.placeholder=xa.placeholder,n}function Oa(t,e,r){e=r?rt:e;var n=fs(t,mt,rt,rt,rt,rt,rt,e);return n.placeholder=Oa.placeholder,n}function Pa(t,e,r){function n(e){var r=d,n=l;return d=l=rt,m=e,b=t.apply(n,r)}function i(t){return m=t,g=Bh(a,e),v?n(t):b}function s(t){var r=t-y,n=t-m,i=e-r;return _?Gc(i,p-n):i}function o(t){var r=t-y,n=t-m;return y===rt||r>=e||r<0||_&&n>=p}function a(){var t=sd();if(o(t))return u(t);g=Bh(a,s(t))}function u(t){return g=rt,w&&d?n(t):(d=l=rt,b)}function f(){g!==rt&&Sh(g),m=0,d=y=l=g=rt}function c(){return g===rt?b:u(sd())}function h(){var t=sd(),r=o(t);if(d=arguments,l=this,y=t,r){if(g===rt)return i(y);if(_)return g=Bh(a,e),n(y)}return g===rt&&(g=Bh(a,e)),b}var d,l,p,b,g,y,m=0,v=!1,_=!1,w=!0;if("function"!=typeof t)throw new hc(st);return e=Eu(e)||0,iu(r)&&(v=!!r.leading,_="maxWait"in r,p=_?Yc(Eu(r.maxWait)||0,e):p,w="trailing"in r?!!r.trailing:w),h.cancel=f,h.flush=c,h}function Ba(t){return fs(t,kt)}function Ra(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new hc(st);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Ra.Cache||ur),r}function Ma(t){if("function"!=typeof t)throw new hc(st);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Ta(t){return Aa(2,t)}function Ca(t,e){if("function"!=typeof t)throw new hc(st);return e=e===rt?e:Su(e),ri(t,e)}function Na(t,e){if("function"!=typeof t)throw new hc(st);return e=null==e?0:Yc(Su(e),0),ri(function(r){var n=r[e],i=Ei(r,0,e);return n&&p(i,n),s(t,this,i)})}function ja(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new hc(st);return iu(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Pa(t,e,{leading:n,maxWait:e,trailing:i})}function Ua(t){return Ia(t,1)}function La(t,e){return hd(Si(e),t)}function Da(){if(!arguments.length)return[];var t=arguments[0];return yd(t)?t:[t]}function Ha(t){return rn(t,ht)}function Ka(t,e){return e="function"==typeof e?e:rt,rn(t,ht,e)}function Fa(t){return rn(t,ft|ht)}function za(t,e){return e="function"==typeof e?e:rt,rn(t,ft|ht,e)}function qa(t,e){return null==e||sn(t,e,Hu(e))}function Va(t,e){return t===e||t!==t&&e!==e}function Ya(t){return null!=t&&nu(t.length)&&!eu(t)}function Ga(t){return su(t)&&Ya(t)}function Wa(t){return!0===t||!1===t||su(t)&&mn(t)==Kt}function Xa(t){return su(t)&&1===t.nodeType&&!lu(t)}function Za(t){if(null==t)return!0;if(Ya(t)&&(yd(t)||"string"==typeof t||"function"==typeof t.splice||vd(t)||Ed(t)||gd(t)))return!t.length;var e=xh(t);if(e==Gt||e==Qt)return!t.size;if(Hs(t))return!Ln(t).length;for(var r in t)if(yc.call(t,r))return!1;return!0}function Ja(t,e){return Pn(t,e)}function $a(t,e,r){r="function"==typeof r?r:rt;var n=r?r(t,e):rt;return n===rt?Pn(t,e,rt,r):!!n}function Qa(t){if(!su(t))return!1;var e=mn(t);return e==qt||e==zt||"string"==typeof t.message&&"string"==typeof t.name&&!lu(t)}function tu(t){return"number"==typeof t&&zc(t)}function eu(t){if(!iu(t))return!1;var e=mn(t);return e==Vt||e==Yt||e==Ht||e==Jt}function ru(t){return"number"==typeof t&&t==Su(t)}function nu(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Rt}function iu(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function su(t){return null!=t&&"object"==typeof t}function ou(t,e){return t===e||Mn(t,e,ks(e))}function au(t,e,r){return r="function"==typeof r?r:rt,Mn(t,e,ks(e),r)}function uu(t){return du(t)&&t!=+t}function fu(t){if(Oh(t))throw new sc(it);return Tn(t)}function cu(t){return null===t}function hu(t){return null==t}function du(t){return"number"==typeof t||su(t)&&mn(t)==Wt}function lu(t){if(!su(t)||mn(t)!=Zt)return!1;var e=Oc(t);if(null===e)return!0;var r=yc.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&gc.call(r)==wc}function pu(t){return ru(t)&&t>=-Rt&&t<=Rt}function bu(t){return"string"==typeof t||!yd(t)&&su(t)&&mn(t)==te}function gu(t){return"symbol"==typeof t||su(t)&&mn(t)==ee}function yu(t){return t===rt}function mu(t){return su(t)&&xh(t)==ne}function vu(t){return su(t)&&mn(t)==ie}function _u(t){if(!t)return[];if(Ya(t))return bu(t)?$(t):Ui(t);if(Tc&&t[Tc])return z(t[Tc]());var e=xh(t);return(e==Gt?q:e==Qt?G:Qu)(t)}function wu(t){if(!t)return 0===t?t:0;if((t=Eu(t))===Bt||t===-Bt){return(t<0?-1:1)*Mt}return t===t?t:0}function Su(t){var e=wu(t),r=e%1;return e===e?r?e-r:e:0}function ku(t){return t?en(Su(t),0,Ct):0}function Eu(t){if("number"==typeof t)return t;if(gu(t))return Tt;if(iu(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=iu(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Me,"");var r=ze.test(t);return r||Ve.test(t)?xr(t.slice(2),r?2:8):Fe.test(t)?Tt:+t}function Iu(t){return Li(t,Ku(t))}function Au(t){return t?en(Su(t),-Rt,Rt):0===t?t:0}function xu(t){return null==t?"":li(t)}function Ou(t,e){var r=ph(t);return null==e?r:Jr(r,e)}function Pu(t,e){return _(t,ws(e,3),ln)}function Bu(t,e){return _(t,ws(e,3),pn)}function Ru(t,e){return null==t?t:yh(t,ws(e,3),Ku)}function Mu(t,e){return null==t?t:mh(t,ws(e,3),Ku)}function Tu(t,e){return t&&ln(t,ws(e,3))}function Cu(t,e){return t&&pn(t,ws(e,3))}function Nu(t){return null==t?[]:bn(t,Hu(t))}function ju(t){return null==t?[]:bn(t,Ku(t))}function Uu(t,e,r){var n=null==t?rt:gn(t,e);return n===rt?r:n}function Lu(t,e){return null!=t&&Os(t,e,_n)}function Du(t,e){return null!=t&&Os(t,e,wn)}function Hu(t){return Ya(t)?Mr(t):Ln(t)}function Ku(t){return Ya(t)?Mr(t,!0):Dn(t)}function Fu(t,e){var r={};return e=ws(e,3),ln(t,function(t,n,i){Qr(r,e(t,n,i),t)}),r}function zu(t,e){var r={};return e=ws(e,3),ln(t,function(t,n,i){Qr(r,n,e(t,n,i))}),r}function qu(t,e){return Vu(t,Ma(ws(e)))}function Vu(t,e){if(null==t)return{};var r=l(ms(t),function(t){return[t]});return e=ws(e),Xn(t,r,function(t,r){return e(t,r[0])})}function Yu(t,e,r){e=ki(e,t);var n=-1,i=e.length;for(i||(i=1,t=rt);++ne){var n=t;t=e,e=n}if(r||t%1||e%1){var i=Zc();return Gc(t+i*(e-t+Ar("1e-"+((i+"").length-1))),e)}return Qn(t,e)}function sf(t){return Zd(xu(t).toLowerCase())}function of(t){return(t=xu(t))&&t.replace(Ge,zr).replace(lr,"")}function af(t,e,r){t=xu(t),e=li(e);var n=t.length;r=r===rt?n:en(Su(r),0,n);var i=r;return(r-=e.length)>=0&&t.slice(r,i)==e}function uf(t){return t=xu(t),t&&Se.test(t)?t.replace(_e,qr):t}function ff(t){return t=xu(t),t&&Re.test(t)?t.replace(Be,"\\$&"):t}function cf(t,e,r){t=xu(t),e=Su(e);var n=e?J(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return rs(Hc(i),r)+t+rs(Dc(i),r)}function hf(t,e,r){t=xu(t),e=Su(e);var n=e?J(t):0;return e&&n>>0)?(t=xu(t),t&&("string"==typeof e||null!=e&&!Sd(e))&&!(e=li(e))&&K(t)?Ei($(t),0,r):t.split(e,r)):[]}function yf(t,e,r){return t=xu(t),r=null==r?0:en(Su(r),0,t.length),e=li(e),t.slice(r,r+e.length)==e}function mf(t,e,n){var i=r.templateSettings;n&&Ns(t,e,n)&&(e=rt),t=xu(t),e=Pd({},e,i,cs);var s,o,a=Pd({},e.imports,i.imports,cs),u=Hu(a),f=C(a,u),c=0,h=e.interpolate||We,d="__p += '",l=fc((e.escape||We).source+"|"+h.source+"|"+(h===Ie?He:We).source+"|"+(e.evaluate||We).source+"|$","g"),p="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++vr+"]")+"\n";t.replace(l,function(e,r,n,i,a,u){return n||(n=i),d+=t.slice(c,u).replace(Xe,D),r&&(s=!0,d+="' +\n__e("+r+") +\n'"),a&&(o=!0,d+="';\n"+a+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=u+e.length,e}),d+="';\n";var b=e.variable;b||(d="with (obj) {\n"+d+"\n}\n"),d=(o?d.replace(ge,""):d).replace(ye,"$1").replace(me,"$1;"),d="function("+(b||"obj")+") {\n"+(b?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Jd(function(){return oc(u,p+"return "+d).apply(rt,f)});if(g.source=d,Qa(g))throw g;return g}function vf(t){return xu(t).toLowerCase()}function _f(t){return xu(t).toUpperCase()}function wf(t,e,r){if((t=xu(t))&&(r||e===rt))return t.replace(Me,"");if(!t||!(e=li(e)))return t;var n=$(t),i=$(e);return Ei(n,j(n,i),U(n,i)+1).join("")}function Sf(t,e,r){if((t=xu(t))&&(r||e===rt))return t.replace(Ce,"");if(!t||!(e=li(e)))return t;var n=$(t);return Ei(n,0,U(n,$(e))+1).join("")}function kf(t,e,r){if((t=xu(t))&&(r||e===rt))return t.replace(Te,"");if(!t||!(e=li(e)))return t;var n=$(t);return Ei(n,j(n,$(e))).join("")}function Ef(t,e){var r=Et,n=It;if(iu(e)){var i="separator"in e?e.separator:i;r="length"in e?Su(e.length):r,n="omission"in e?li(e.omission):n}t=xu(t);var s=t.length;if(K(t)){var o=$(t);s=o.length}if(r>=s)return t;var a=r-J(n);if(a<1)return n;var u=o?Ei(o,0,a).join(""):t.slice(0,a);if(i===rt)return u+n;if(o&&(a+=u.length-a),Sd(i)){if(t.slice(a).search(i)){var f,c=u;for(i.global||(i=fc(i.source,xu(Ke.exec(i))+"g")),i.lastIndex=0;f=i.exec(c);)var h=f.index;u=u.slice(0,h===rt?a:h)}}else if(t.indexOf(li(i),a)!=a){var d=u.lastIndexOf(i);d>-1&&(u=u.slice(0,d))}return u+n}function If(t){return t=xu(t),t&&we.test(t)?t.replace(ve,Vr):t}function Af(t,e,r){return t=xu(t),e=r?rt:e,e===rt?F(t)?et(t):v(t):t.match(e)||[]}function xf(t){var e=null==t?0:t.length,r=ws();return t=e?l(t,function(t){if("function"!=typeof t[1])throw new hc(st);return[r(t[0]),t[1]]}):[],ri(function(r){for(var n=-1;++nRt)return[];var r=Ct,n=Gc(t,Ct);e=ws(e),t-=Ct;for(var i=R(n,e);++r1?t[e-1]:rt;return r="function"==typeof r?(t.pop(),r):rt,Go(t,r)}),Zh=gs(function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,i=function(e){return tn(e,t)};return!(e>1||this.__actions__.length)&&n instanceof X&&Cs(r)?(n=n.slice(r,+r+(e?1:0)),n.__actions__.push({func:$o,args:[i],thisArg:rt}),new x(n,this.__chain__).thru(function(t){return e&&!t.length&&t.push(rt),t})):this.thru(i)}),Jh=Ki(function(t,e,r){yc.call(t,r)?++t[r]:Qr(t,r,1)}),$h=Zi(co),Qh=Zi(ho),td=Ki(function(t,e,r){yc.call(t,r)?t[r].push(e):Qr(t,r,[e])}),ed=ri(function(t,e,r){var n=-1,i="function"==typeof e,o=Ya(t)?nc(t.length):[];return bh(t,function(t){o[++n]=i?s(e,t,r):In(t,e,r)}),o}),rd=Ki(function(t,e,r){Qr(t,r,e)}),nd=Ki(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]}),id=ri(function(t,e){if(null==t)return[];var r=e.length;return r>1&&Ns(t,e[0],e[1])?e=[]:r>2&&Ns(e[0],e[1],e[2])&&(e=[e[0]]),Gn(t,dn(e,1),[])}),sd=Uc||function(){return Br.Date.now()},od=ri(function(t,e,r){var n=pt;if(r.length){var i=Y(r,_s(od));n|=vt}return fs(t,n,e,r,i)}),ad=ri(function(t,e,r){var n=pt|bt;if(r.length){var i=Y(r,_s(ad));n|=vt}return fs(e,n,t,r,i)}),ud=ri(function(t,e){return on(t,1,e)}),fd=ri(function(t,e,r){return on(t,Eu(e)||0,r)});Ra.Cache=ur;var cd=wh(function(t,e){e=1==e.length&&yd(e[0])?l(e[0],T(ws())):l(dn(e,1),T(ws()));var r=e.length;return ri(function(n){for(var i=-1,o=Gc(n.length,r);++i=e}),gd=An(function(){return arguments}())?An:function(t){return su(t)&&yc.call(t,"callee")&&!Bc.call(t,"callee")},yd=nc.isArray,md=jr?T(jr):xn,vd=Fc||Ff,_d=Ur?T(Ur):On,wd=Lr?T(Lr):Rn,Sd=Dr?T(Dr):Cn,kd=Hr?T(Hr):Nn,Ed=Kr?T(Kr):jn,Id=ss(Hn),Ad=ss(function(t,e){return t<=e}),xd=Fi(function(t,e){if(Hs(e)||Ya(e))return void Li(e,Hu(e),t);for(var r in e)yc.call(e,r)&&Wr(t,r,e[r])}),Od=Fi(function(t,e){Li(e,Ku(e),t)}),Pd=Fi(function(t,e,r,n){Li(e,Ku(e),t,n)}),Bd=Fi(function(t,e,r,n){Li(e,Hu(e),t,n)}),Rd=gs(tn),Md=ri(function(t){return t.push(rt,cs),s(Pd,rt,t)}),Td=ri(function(t){return t.push(rt,hs),s(Ld,rt,t)}),Cd=Qi(function(t,e,r){t[e]=r},Pf(Rf)),Nd=Qi(function(t,e,r){yc.call(t,e)?t[e].push(r):t[e]=[r]},ws),jd=ri(In),Ud=Fi(function(t,e,r){qn(t,e,r)}),Ld=Fi(function(t,e,r,n){qn(t,e,r,n)}),Dd=gs(function(t,e){var r={};if(null==t)return r;var n=!1;e=l(e,function(e){return e=ki(e,t),n||(n=e.length>1),e}),Li(t,ms(t),r),n&&(r=rn(r,ft|ct|ht,ds));for(var i=e.length;i--;)bi(r,e[i]);return r}),Hd=gs(function(t,e){return null==t?{}:Wn(t,e)}),Kd=us(Hu),Fd=us(Ku),zd=Gi(function(t,e,r){return e=e.toLowerCase(),t+(r?sf(e):e)}),qd=Gi(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),Vd=Gi(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),Yd=Yi("toLowerCase"),Gd=Gi(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}),Wd=Gi(function(t,e,r){return t+(r?" ":"")+Zd(e)}),Xd=Gi(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),Zd=Yi("toUpperCase"),Jd=ri(function(t,e){try{return s(t,rt,e)}catch(t){return Qa(t)?t:new sc(t)}}),$d=gs(function(t,e){return a(e,function(e){e=$s(e),Qr(t,e,od(t[e],t))}),t}),Qd=Ji(),tl=Ji(!0),el=ri(function(t,e){return function(r){return In(r,t,e)}}),rl=ri(function(t,e){return function(r){return In(t,r,e)}}),nl=es(l),il=es(f),sl=es(y),ol=is(),al=is(!0),ul=ts(function(t,e){return t+e},0),fl=as("ceil"),cl=ts(function(t,e){return t/e},1),hl=as("floor"),dl=ts(function(t,e){return t*e},1),ll=as("round"),pl=ts(function(t,e){return t-e},0);return r.after=Ea,r.ary=Ia,r.assign=xd,r.assignIn=Od,r.assignInWith=Pd,r.assignWith=Bd,r.at=Rd,r.before=Aa,r.bind=od,r.bindAll=$d,r.bindKey=ad,r.castArray=Da,r.chain=Zo,r.chunk=ro,r.compact=no,r.concat=io,r.cond=xf,r.conforms=Of,r.constant=Pf,r.countBy=Jh,r.create=Ou,r.curry=xa,r.curryRight=Oa,r.debounce=Pa,r.defaults=Md,r.defaultsDeep=Td,r.defer=ud,r.delay=fd,r.difference=Th,r.differenceBy=Ch,r.differenceWith=Nh,r.drop=so,r.dropRight=oo,r.dropRightWhile=ao,r.dropWhile=uo,r.fill=fo,r.filter=aa,r.flatMap=ua,r.flatMapDeep=fa,r.flatMapDepth=ca,r.flatten=lo,r.flattenDeep=po,r.flattenDepth=bo,r.flip=Ba,r.flow=Qd,r.flowRight=tl,r.fromPairs=go,r.functions=Nu,r.functionsIn=ju,r.groupBy=td,r.initial=vo,r.intersection=jh,r.intersectionBy=Uh,r.intersectionWith=Lh,r.invert=Cd,r.invertBy=Nd,r.invokeMap=ed,r.iteratee=Mf,r.keyBy=rd,r.keys=Hu,r.keysIn=Ku,r.map=pa,r.mapKeys=Fu,r.mapValues=zu,r.matches=Tf,r.matchesProperty=Cf,r.memoize=Ra,r.merge=Ud,r.mergeWith=Ld,r.method=el,r.methodOf=rl,r.mixin=Nf,r.negate=Ma,r.nthArg=Lf,r.omit=Dd,r.omitBy=qu,r.once=Ta,r.orderBy=ba,r.over=nl,r.overArgs=cd,r.overEvery=il,r.overSome=sl,r.partial=hd,r.partialRight=dd,r.partition=nd,r.pick=Hd,r.pickBy=Vu,r.property=Df,r.propertyOf=Hf,r.pull=Dh,r.pullAll=Eo,r.pullAllBy=Io,r.pullAllWith=Ao,r.pullAt=Hh,r.range=ol,r.rangeRight=al,r.rearg=ld,r.reject=ma,r.remove=xo,r.rest=Ca,r.reverse=Oo,r.sampleSize=_a,r.set=Gu,r.setWith=Wu,r.shuffle=wa,r.slice=Po,r.sortBy=id,r.sortedUniq=jo,r.sortedUniqBy=Uo,r.split=gf,r.spread=Na,r.tail=Lo,r.take=Do,r.takeRight=Ho,r.takeRightWhile=Ko,r.takeWhile=Fo,r.tap=Jo,r.throttle=ja,r.thru=$o,r.toArray=_u,r.toPairs=Kd,r.toPairsIn=Fd,r.toPath=Gf,r.toPlainObject=Iu,r.transform=Xu,r.unary=Ua,r.union=Kh,r.unionBy=Fh,r.unionWith=zh,r.uniq=zo,r.uniqBy=qo,r.uniqWith=Vo,r.unset=Zu,r.unzip=Yo,r.unzipWith=Go,r.update=Ju,r.updateWith=$u,r.values=Qu,r.valuesIn=tf,r.without=qh,r.words=Af,r.wrap=La,r.xor=Vh,r.xorBy=Yh,r.xorWith=Gh,r.zip=Wh,r.zipObject=Wo,r.zipObjectDeep=Xo,r.zipWith=Xh,r.entries=Kd,r.entriesIn=Fd,r.extend=Od,r.extendWith=Pd,Nf(r,r),r.add=ul,r.attempt=Jd,r.camelCase=zd,r.capitalize=sf,r.ceil=fl,r.clamp=ef,r.clone=Ha,r.cloneDeep=Fa,r.cloneDeepWith=za,r.cloneWith=Ka,r.conformsTo=qa,r.deburr=of,r.defaultTo=Bf,r.divide=cl,r.endsWith=af,r.eq=Va,r.escape=uf,r.escapeRegExp=ff,r.every=oa,r.find=$h,r.findIndex=co,r.findKey=Pu,r.findLast=Qh,r.findLastIndex=ho,r.findLastKey=Bu,r.floor=hl,r.forEach=ha,r.forEachRight=da,r.forIn=Ru,r.forInRight=Mu,r.forOwn=Tu,r.forOwnRight=Cu,r.get=Uu,r.gt=pd,r.gte=bd,r.has=Lu,r.hasIn=Du,r.head=yo,r.identity=Rf,r.includes=la,r.indexOf=mo,r.inRange=rf,r.invoke=jd,r.isArguments=gd,r.isArray=yd,r.isArrayBuffer=md,r.isArrayLike=Ya,r.isArrayLikeObject=Ga,r.isBoolean=Wa,r.isBuffer=vd,r.isDate=_d,r.isElement=Xa,r.isEmpty=Za,r.isEqual=Ja,r.isEqualWith=$a,r.isError=Qa,r.isFinite=tu,r.isFunction=eu,r.isInteger=ru,r.isLength=nu,r.isMap=wd,r.isMatch=ou,r.isMatchWith=au,r.isNaN=uu,r.isNative=fu,r.isNil=hu,r.isNull=cu,r.isNumber=du,r.isObject=iu,r.isObjectLike=su,r.isPlainObject=lu,r.isRegExp=Sd,r.isSafeInteger=pu,r.isSet=kd,r.isString=bu,r.isSymbol=gu,r.isTypedArray=Ed,r.isUndefined=yu,r.isWeakMap=mu,r.isWeakSet=vu,r.join=_o,r.kebabCase=qd,r.last=wo,r.lastIndexOf=So,r.lowerCase=Vd,r.lowerFirst=Yd,r.lt=Id,r.lte=Ad,r.max=Xf,r.maxBy=Zf,r.mean=Jf,r.meanBy=$f,r.min=Qf,r.minBy=tc,r.stubArray=Kf,r.stubFalse=Ff,r.stubObject=zf,r.stubString=qf,r.stubTrue=Vf,r.multiply=dl,r.nth=ko,r.noConflict=jf,r.noop=Uf,r.now=sd,r.pad=cf,r.padEnd=hf,r.padStart=df,r.parseInt=lf,r.random=nf,r.reduce=ga,r.reduceRight=ya,r.repeat=pf,r.replace=bf,r.result=Yu,r.round=ll,r.runInContext=t,r.sample=va,r.size=Sa,r.snakeCase=Gd,r.some=ka,r.sortedIndex=Bo,r.sortedIndexBy=Ro,r.sortedIndexOf=Mo,r.sortedLastIndex=To,r.sortedLastIndexBy=Co,r.sortedLastIndexOf=No,r.startCase=Wd,r.startsWith=yf,r.subtract=pl,r.sum=ec,r.sumBy=rc,r.template=mf,r.times=Yf,r.toFinite=wu,r.toInteger=Su,r.toLength=ku,r.toLower=vf,r.toNumber=Eu,r.toSafeInteger=Au,r.toString=xu,r.toUpper=_f,r.trim=wf,r.trimEnd=Sf,r.trimStart=kf,r.truncate=Ef,r.unescape=If,r.uniqueId=Wf,r.upperCase=Xd,r.upperFirst=Zd,r.each=ha,r.eachRight=da,r.first=yo,Nf(r,function(){var t={};return ln(r,function(e,n){yc.call(r.prototype,n)||(t[n]=e)}),t}(),{chain:!1}),r.VERSION="4.17.4",a(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){r[t].placeholder=r}),a(["drop","take"],function(t,e){X.prototype[t]=function(r){r=r===rt?1:Yc(Su(r),0);var n=this.__filtered__&&!e?new X(this):this.clone();return n.__filtered__?n.__takeCount__=Gc(r,n.__takeCount__):n.__views__.push({size:Gc(r,Ct),type:t+(n.__dir__<0?"Right":"")}),n},X.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),a(["filter","map","takeWhile"],function(t,e){var r=e+1,n=r==Ot||3==r;X.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ws(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}}),a(["head","last"],function(t,e){var r="take"+(e?"Right":"");X.prototype[t]=function(){return this[r](1).value()[0]}}),a(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");X.prototype[t]=function(){return this.__filtered__?new X(this):this[r](1)}}),X.prototype.compact=function(){return this.filter(Rf)},X.prototype.find=function(t){return this.filter(t).head()},X.prototype.findLast=function(t){return this.reverse().find(t)},X.prototype.invokeMap=ri(function(t,e){return"function"==typeof t?new X(this):this.map(function(r){return In(r,t,e)})}),X.prototype.reject=function(t){return this.filter(Ma(ws(t)))},X.prototype.slice=function(t,e){t=Su(t);var r=this;return r.__filtered__&&(t>0||e<0)?new X(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==rt&&(e=Su(e),r=e<0?r.dropRight(-e):r.take(e-t)),r)},X.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},X.prototype.toArray=function(){return this.take(Ct)},ln(X.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),s=r[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);s&&(r.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,u=e instanceof X,f=a[0],c=u||yd(e),h=function(t){var e=s.apply(r,p([t],a));return i&&d?e[0]:e};c&&n&&"function"==typeof f&&1!=f.length&&(u=c=!1);var d=this.__chain__,l=!!this.__actions__.length,b=o&&!d,g=u&&!l;if(!o&&c){e=g?e:new X(this);var y=t.apply(e,a);return y.__actions__.push({func:$o,args:[h],thisArg:rt}),new x(y,d)}return b&&g?t.apply(this,a):(y=this.thru(h),b?i?y.value()[0]:y.value():y)})}),a(["pop","push","shift","sort","splice","unshift"],function(t){var e=dc[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);r.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(yd(r)?r:[],t)}return this[n](function(r){return e.apply(yd(r)?r:[],t)})}}),ln(X.prototype,function(t,e){var n=r[e];if(n){var i=n.name+"";(sh[i]||(sh[i]=[])).push({name:e,func:n})}}),sh[$i(rt,bt).name]=[{name:"wrapper",func:rt}],X.prototype.clone=Q,X.prototype.reverse=tt,X.prototype.value=Le,r.prototype.at=Zh,r.prototype.chain=Qo,r.prototype.commit=ta,r.prototype.next=ea,r.prototype.plant=na,r.prototype.reverse=ia,r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=sa,r.prototype.first=r.prototype.head,Tc&&(r.prototype[Tc]=ra),r}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Br._=Yr,define(function(){return Yr})):Mr?((Mr.exports=Yr)._=Yr,Rr._=Yr):Br._=Yr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],157:[function(t,e,r){(function(r){"use strict";function n(){c.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(t,e){return t<>>32-e}function s(t,e,r,n,s,o,a){return i(t+(e&r|~e&n)+s+o|0,a)+e|0}function o(t,e,r,n,s,o,a){return i(t+(e&n|r&~n)+s+o|0,a)+e|0}function a(t,e,r,n,s,o,a){return i(t+(e^r^n)+s+o|0,a)+e|0}function u(t,e,r,n,s,o,a){return i(t+(r^(e|~n))+s+o|0,a)+e|0}var f=t("inherits"),c=t("hash-base"),h=new Array(16);f(n,c),n.prototype._update=function(){for(var t=h,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,f=this._d;r=s(r,n,i,f,t[0],3614090360,7),f=s(f,r,n,i,t[1],3905402710,12),i=s(i,f,r,n,t[2],606105819,17),n=s(n,i,f,r,t[3],3250441966,22),r=s(r,n,i,f,t[4],4118548399,7),f=s(f,r,n,i,t[5],1200080426,12),i=s(i,f,r,n,t[6],2821735955,17),n=s(n,i,f,r,t[7],4249261313,22),r=s(r,n,i,f,t[8],1770035416,7),f=s(f,r,n,i,t[9],2336552879,12),i=s(i,f,r,n,t[10],4294925233,17),n=s(n,i,f,r,t[11],2304563134,22),r=s(r,n,i,f,t[12],1804603682,7),f=s(f,r,n,i,t[13],4254626195,12),i=s(i,f,r,n,t[14],2792965006,17),n=s(n,i,f,r,t[15],1236535329,22),r=o(r,n,i,f,t[1],4129170786,5),f=o(f,r,n,i,t[6],3225465664,9),i=o(i,f,r,n,t[11],643717713,14),n=o(n,i,f,r,t[0],3921069994,20),r=o(r,n,i,f,t[5],3593408605,5),f=o(f,r,n,i,t[10],38016083,9),i=o(i,f,r,n,t[15],3634488961,14),n=o(n,i,f,r,t[4],3889429448,20),r=o(r,n,i,f,t[9],568446438,5),f=o(f,r,n,i,t[14],3275163606,9),i=o(i,f,r,n,t[3],4107603335,14),n=o(n,i,f,r,t[8],1163531501,20),r=o(r,n,i,f,t[13],2850285829,5),f=o(f,r,n,i,t[2],4243563512,9),i=o(i,f,r,n,t[7],1735328473,14),n=o(n,i,f,r,t[12],2368359562,20),r=a(r,n,i,f,t[5],4294588738,4),f=a(f,r,n,i,t[8],2272392833,11),i=a(i,f,r,n,t[11],1839030562,16),n=a(n,i,f,r,t[14],4259657740,23),r=a(r,n,i,f,t[1],2763975236,4),f=a(f,r,n,i,t[4],1272893353,11),i=a(i,f,r,n,t[7],4139469664,16),n=a(n,i,f,r,t[10],3200236656,23),r=a(r,n,i,f,t[13],681279174,4),f=a(f,r,n,i,t[0],3936430074,11),i=a(i,f,r,n,t[3],3572445317,16),n=a(n,i,f,r,t[6],76029189,23),r=a(r,n,i,f,t[9],3654602809,4),f=a(f,r,n,i,t[12],3873151461,11),i=a(i,f,r,n,t[15],530742520,16),n=a(n,i,f,r,t[2],3299628645,23),r=u(r,n,i,f,t[0],4096336452,6),f=u(f,r,n,i,t[7],1126891415,10),i=u(i,f,r,n,t[14],2878612391,15),n=u(n,i,f,r,t[5],4237533241,21),r=u(r,n,i,f,t[12],1700485571,6),f=u(f,r,n,i,t[3],2399980690,10),i=u(i,f,r,n,t[10],4293915773,15),n=u(n,i,f,r,t[1],2240044497,21),r=u(r,n,i,f,t[8],1873313359,6),f=u(f,r,n,i,t[15],4264355552,10),i=u(i,f,r,n,t[6],2734768916,15),n=u(n,i,f,r,t[13],1309151649,21),r=u(r,n,i,f,t[4],4149444226,6),f=u(f,r,n,i,t[11],3174756917,10),i=u(i,f,r,n,t[2],718787259,15),n=u(n,i,f,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+f|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,"hash-base":158,inherits:153}],158:[function(t,e,r){"use strict";function n(t,e){if(!s.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}function i(t){o.call(this),this._block=s.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var s=t("safe-buffer").Buffer,o=t("stream").Transform;t("inherits")(i,o),i.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(n(t,"Data"),this._finalized)throw new Error("Digest already called");s.isBuffer(t)||(t=s.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=u,(u=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*u);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=i},{inherits:153,"safe-buffer":200,stream:209}],159:[function(t,e,r){function n(t){this.rand=t||new s.Rand}var i=t("bn.js"),s=t("brorand");e.exports=n,n.create=function(t){return new n(t)},n.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},n.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},n.prototype.test=function(t,e,r){var n=t.bitLength(),s=i.mont(t),o=new i(1).toRed(s);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var f=t.shrn(u),c=a.toRed(s);e>0;e--){var h=this._randrange(new i(2),a);r&&r(h);var d=h.toRed(s).redPow(f);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var l=1;l0;e--){var c=this._randrange(new i(2),o),h=t.gcd(c);if(0!==h.cmpn(1))return h;var d=c.toRed(n).redPow(u);if(0!==d.cmp(s)&&0!==d.cmp(f)){for(var l=1;l>8,o=255&i;s?r.push(s,o):r.push(o)}return r}function i(t){return 1===t.length?"0"+t:t}function s(t){for(var e="",r=0;r=6?"utf-8":"binary"}e.exports=r}).call(this,t("_process"))},{_process:173}],170:[function(t,e,r){var n=Math.pow(2,30)-1;e.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>n||e!==e)throw new TypeError("Bad key length")}},{}],171:[function(t,e,r){function n(t,e,r){var n=i(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=n(e):e.length1)for(var r=1;r=e.length){s++;break}var o=e.slice(2,i-1);e.slice(i-1,i);if(("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&s++,o.length<8&&s++,s)throw new Error("decryption error");return e.slice(i)}function s(t,e){t=new r(t),e=new r(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));for(var s=-1;++sh||new f(e).cmp(u.modulus)>=0)throw new Error("decryption error");var l;l=s?d(new f(e),u):c(e,u);var p=new r(h-l.length);if(p.fill(0),l=r.concat([p,l],h),4===a)return n(u,l);if(1===a)return i(u,l,s);if(3===a)return l;throw new Error("unknown padding")}}).call(this,t("buffer").Buffer)},{"./mgf":175,"./withPublic":178,"./xor":179,"bn.js":64,"browserify-rsa":87,buffer:98,"create-hash":102,"parse-asn1":166}],177:[function(t,e,r){(function(r){function n(t,e){var n=t.modulus.byteLength(),i=e.length,s=u("sha1").update(new r("")).digest(),o=s.length,d=2*o;if(i>n-d-2)throw new Error("message too long");var l=new r(n-i-d-2);l.fill(0);var p=n-o-1,b=a(o),g=c(r.concat([s,l,new r([1]),e],p),f(b,p)),y=c(b,f(g,o));return new h(r.concat([new r([0]),y,g],n))}function i(t,e,n){var i=e.length,o=t.modulus.byteLength();if(i>o-11)throw new Error("message too long");var a;return n?(a=new r(o-i-3),a.fill(255)):a=s(o-i-3),new h(r.concat([new r([0,n?1:2]),a,new r([0]),e],o))}function s(t,e){for(var n,i=new r(t),s=0,o=a(2*t),u=0;s=0)throw new Error("data too long for modulus")}return r?l(a,u):d(a,u)}}).call(this,t("buffer").Buffer)},{"./mgf":175,"./withPublic":178,"./xor":179,"bn.js":64,"browserify-rsa":87,buffer:98,"create-hash":102,"parse-asn1":166,randombytes:184}],178:[function(t,e,r){(function(r){function n(t,e){return new r(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}var i=t("bn.js");e.exports=n}).call(this,t("buffer").Buffer)},{"bn.js":64,buffer:98}],179:[function(t,e,r){e.exports=function(t,e){for(var r=t.length,n=-1;++n1&&(n=r[0]+"@",t=r[1]),t=t.replace(M,"."),n+s(t.split("."),e).join(".")}function a(t){for(var e,r,n=[],i=0,s=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=j(t>>>10&1023|55296),t=56320|1023&t),e+=j(t)}).join("")}function f(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:S}function c(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function h(t,e,r){var n=0;for(t=r?N(t/A):t>>1,t+=N(t/e);t>C*E>>1;n+=S)t=N(t/C);return N(n+(C+1)*t/(t+I))}function d(t){var e,r,n,s,o,a,c,d,l,p,b=[],g=t.length,y=0,m=O,v=x;for(r=t.lastIndexOf(P),r<0&&(r=0),n=0;n=128&&i("not-basic"),b.push(t.charCodeAt(n));for(s=r>0?r+1:0;s=g&&i("invalid-input"),d=f(t.charCodeAt(s++)),(d>=S||d>N((w-y)/a))&&i("overflow"),y+=d*a,l=c<=v?k:c>=v+E?E:c-v,!(dN(w/p)&&i("overflow"),a*=p;e=b.length+1,v=h(y-o,e,0==o),N(y/e)>w-m&&i("overflow"),m+=N(y/e),y%=e,b.splice(y++,0,m)}return u(b)}function l(t){var e,r,n,s,o,u,f,d,l,p,b,g,y,m,v,_=[];for(t=a(t),g=t.length,e=O,r=0,o=x,u=0;u=e&&bN((w-r)/y)&&i("overflow"),r+=(f-e)*y,e=f,u=0;uw&&i("overflow"),b==e){for(d=r,l=S;p=l<=o?k:l>=o+E?E:l-o,!(d= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=S-k,N=Math.floor,j=String.fromCharCode;if(v={version:"1.4.1",ucs2:{decode:a,encode:u},decode:d,encode:l,toASCII:b,toUnicode:p},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return v});else if(g&&y)if(e.exports==g)y.exports=v;else for(_ in v)v.hasOwnProperty(_)&&(g[_]=v[_]);else n.punycode=v}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],181:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,s){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var u=1e3;s&&"number"==typeof s.maxKeys&&(u=s.maxKeys);var f=t.length;u>0&&f>u&&(f=u);for(var c=0;c=0?(h=b.substr(0,g),d=b.substr(g+1)):(h=b,d=""),l=decodeURIComponent(h),p=decodeURIComponent(d),n(o,l)?i(o[l])?o[l].push(p):o[l]=[o[l],p]:o[l]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],182:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n65536)throw new Error("requested too many random bytes");var i=new n.Uint8Array(t);t>0&&a.getRandomValues(i);var s=o.from(i.buffer);return"function"==typeof e?r.nextTick(function(){e(null,s)}):s}var o=t("safe-buffer").Buffer,a=n.crypto||n.msCrypto;a&&a.getRandomValues?e.exports=s:e.exports=i}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:173,"safe-buffer":200}],185:[function(t,e,r){e.exports=t("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":186}],186:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);f.call(this,t),c.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||o(s,this)}function s(t){t.end()}var o=t("process-nextick-args"),a=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=n;var u=t("core-util-is");u.inherits=t("inherits");var f=t("./_stream_readable"),c=t("./_stream_writable");u.inherits(n,f);for(var h=a(c.prototype),d=0;d0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===U.prototype||(e=i(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):c(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?c(t,o,e,!1):m(t,o)):c(t,o,e,!1))):n||(o.reading=!1)}return d(o)}function c(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&g(t)),m(t,e)}function h(t,e){var r;return s(e)||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function d(t){return!t.ended&&(t.needReadable||t.length=Y?t=Y:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function p(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=l(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function b(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,g(t)}}function g(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(K("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?M(y,t):y(t))}function y(t){K("emit readable"),t.emit("readable"),E(t)}function m(t,e){e.readingMore||(e.readingMore=!0,M(v,t,e))}function v(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=A(t,e.buffer,e.decoder),r}function A(t,e,r){var n;return ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}function O(t,e){var r=U.allocUnsafe(t),n=e.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}function P(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,M(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return K("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?P(this):g(this),null;if(0===(t=p(t,e))&&e.ended)return 0===e.length&&P(this),null;var n=e.needReadable;K("need readable",n),(0===e.length||e.length-t0?I(t,e):null,null===i?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&P(this)),null!==i&&this.emit("data",i),i},u.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},u.prototype.pipe=function(t,e){function n(t,e){K("onunpipe"),t===d&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,s())}function i(){K("onend"),t.end()}function s(){K("cleanup"),t.removeListener("close",f),t.removeListener("finish",c),t.removeListener("drain",g),t.removeListener("error",u),t.removeListener("unpipe",n),d.removeListener("end",i),d.removeListener("end",h),d.removeListener("data",a),y=!0,!l.awaitDrain||t._writableState&&!t._writableState.needDrain||g()}function a(e){K("ondata"),m=!1,!1!==t.write(e)||m||((1===l.pipesCount&&l.pipes===t||l.pipesCount>1&&-1!==R(l.pipes,t))&&!y&&(K("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,m=!0),d.pause())}function u(e){K("onerror",e),h(),t.removeListener("error",u),0===N(t,"error")&&t.emit("error",e)}function f(){t.removeListener("finish",c),h()}function c(){K("onfinish"),t.removeListener("close",f),h()}function h(){K("unpipe"),d.unpipe(t)}var d=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=t;break;case 1:l.pipes=[l.pipes,t];break;default:l.pipes.push(t)}l.pipesCount+=1,K("pipe count=%d opts=%j",l.pipesCount,e);var p=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr,b=p?i:h;l.endEmitted?M(b):d.once("end",b),t.on("unpipe",n);var g=_(d);t.on("drain",g);var y=!1,m=!1;return d.on("data",a),o(t,"error",u),t.once("close",f),t.once("finish",c),t.emit("pipe",d),l.flowing||(K("pipe resume"),d.resume()),t},u.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?setImmediate:x;f.WritableState=u;var B=t("core-util-is");B.inherits=t("inherits");var R={deprecate:t("util-deprecate")},M=t("./internal/streams/stream"),T=t("safe-buffer").Buffer,C=n.Uint8Array||function(){},N=t("./internal/streams/destroy");B.inherits(f,M),u.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(u.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}();var j;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(f,Symbol.hasInstance,{value:function(t){return!!j.call(this,t)||t&&t._writableState instanceof u}})):j=function(t){return t instanceof this},f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},f.prototype.write=function(t,e,r){var n=this._writableState,i=!1,u=o(t)&&!n.objectMode;return u&&!T.isBuffer(t)&&(t=s(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=a),n.ended?c(this,r):(u||h(this,n,t,r))&&(n.pendingcb++,i=l(this,n,u,t,e,r)),i},f.prototype.cork=function(){this._writableState.corked++},f.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},f.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},f.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},f.prototype._writev=null,f.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||I(this,n,r)},Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),f.prototype.destroy=N.destroy,f.prototype._undestroy=N.undestroy,f.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":186,"./internal/streams/destroy":192,"./internal/streams/stream":193,_process:173,"core-util-is":100,inherits:194,"process-nextick-args":172,"safe-buffer":200,"util-deprecate":213}],191:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,r){t.copy(e,r)}var s=t("safe-buffer").Buffer;e.exports=function(){function t(){n(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return s.alloc(0);if(1===this.length)return this.head.data;for(var e=s.allocUnsafe(t>>>0),r=this.head,n=0;r;)i(r.data,e,n),n+=r.data.length,r=r.next;return e},t}()},{"safe-buffer":200}],192:[function(t,e,r){"use strict";function n(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;if(n||i)return void(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||o(s,this,t));this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(o(s,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})}function i(){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 s(t,e){t.emit("error",e)}var o=t("process-nextick-args");e.exports={destroy:n,undestroy:i}},{"process-nextick-args":172}],193:[function(t,e,r){e.exports=t("events").EventEmitter},{events:134}],194:[function(t,e,r){arguments[4][149][0].apply(r,arguments)},{dup:149}],195:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":196}],196:[function(t,e,r){r=e.exports=t("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":186,"./lib/_stream_passthrough.js":187,"./lib/_stream_readable.js":188,"./lib/_stream_transform.js":189,"./lib/_stream_writable.js":190}],197:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":196}],198:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":190}],199:[function(t,e,r){(function(r){"use strict";function n(){h.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function i(t,e){return t<>>32-e}function s(t,e,r,n,s,o,a,u){return i(t+(e^r^n)+o+a|0,u)+s|0}function o(t,e,r,n,s,o,a,u){return i(t+(e&r|~e&n)+o+a|0,u)+s|0}function a(t,e,r,n,s,o,a,u){return i(t+((e|~r)^n)+o+a|0,u)+s|0}function u(t,e,r,n,s,o,a,u){return i(t+(e&n|r&~n)+o+a|0,u)+s|0}function f(t,e,r,n,s,o,a,u){return i(t+(e^(r|~n))+o+a|0,u)+s|0}var c=t("inherits"),h=t("hash-base");c(n,h),n.prototype._update=function(){for(var t=new Array(16),e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,c=this._c,h=this._d,d=this._e;r=s(r,n,c,h,d,t[0],0,11),c=i(c,10),d=s(d,r,n,c,h,t[1],0,14),n=i(n,10),h=s(h,d,r,n,c,t[2],0,15),r=i(r,10),c=s(c,h,d,r,n,t[3],0,12),d=i(d,10),n=s(n,c,h,d,r,t[4],0,5),h=i(h,10),r=s(r,n,c,h,d,t[5],0,8),c=i(c,10),d=s(d,r,n,c,h,t[6],0,7),n=i(n,10),h=s(h,d,r,n,c,t[7],0,9),r=i(r,10),c=s(c,h,d,r,n,t[8],0,11),d=i(d,10),n=s(n,c,h,d,r,t[9],0,13),h=i(h,10),r=s(r,n,c,h,d,t[10],0,14),c=i(c,10),d=s(d,r,n,c,h,t[11],0,15),n=i(n,10),h=s(h,d,r,n,c,t[12],0,6),r=i(r,10),c=s(c,h,d,r,n,t[13],0,7),d=i(d,10),n=s(n,c,h,d,r,t[14],0,9),h=i(h,10),r=s(r,n,c,h,d,t[15],0,8),c=i(c,10),d=o(d,r,n,c,h,t[7],1518500249,7),n=i(n,10),h=o(h,d,r,n,c,t[4],1518500249,6),r=i(r,10),c=o(c,h,d,r,n,t[13],1518500249,8),d=i(d,10),n=o(n,c,h,d,r,t[1],1518500249,13),h=i(h,10),r=o(r,n,c,h,d,t[10],1518500249,11),c=i(c,10),d=o(d,r,n,c,h,t[6],1518500249,9),n=i(n,10),h=o(h,d,r,n,c,t[15],1518500249,7),r=i(r,10),c=o(c,h,d,r,n,t[3],1518500249,15),d=i(d,10),n=o(n,c,h,d,r,t[12],1518500249,7),h=i(h,10),r=o(r,n,c,h,d,t[0],1518500249,12),c=i(c,10),d=o(d,r,n,c,h,t[9],1518500249,15),n=i(n,10),h=o(h,d,r,n,c,t[5],1518500249,9),r=i(r,10),c=o(c,h,d,r,n,t[2],1518500249,11),d=i(d,10),n=o(n,c,h,d,r,t[14],1518500249,7),h=i(h,10),r=o(r,n,c,h,d,t[11],1518500249,13),c=i(c,10),d=o(d,r,n,c,h,t[8],1518500249,12),n=i(n,10),h=a(h,d,r,n,c,t[3],1859775393,11),r=i(r,10),c=a(c,h,d,r,n,t[10],1859775393,13),d=i(d,10),n=a(n,c,h,d,r,t[14],1859775393,6),h=i(h,10),r=a(r,n,c,h,d,t[4],1859775393,7),c=i(c,10),d=a(d,r,n,c,h,t[9],1859775393,14),n=i(n,10),h=a(h,d,r,n,c,t[15],1859775393,9),r=i(r,10),c=a(c,h,d,r,n,t[8],1859775393,13),d=i(d,10),n=a(n,c,h,d,r,t[1],1859775393,15),h=i(h,10),r=a(r,n,c,h,d,t[2],1859775393,14),c=i(c,10),d=a(d,r,n,c,h,t[7],1859775393,8),n=i(n,10),h=a(h,d,r,n,c,t[0],1859775393,13),r=i(r,10),c=a(c,h,d,r,n,t[6],1859775393,6),d=i(d,10),n=a(n,c,h,d,r,t[13],1859775393,5),h=i(h,10),r=a(r,n,c,h,d,t[11],1859775393,12),c=i(c,10),d=a(d,r,n,c,h,t[5],1859775393,7),n=i(n,10),h=a(h,d,r,n,c,t[12],1859775393,5),r=i(r,10),c=u(c,h,d,r,n,t[1],2400959708,11),d=i(d,10),n=u(n,c,h,d,r,t[9],2400959708,12),h=i(h,10),r=u(r,n,c,h,d,t[11],2400959708,14),c=i(c,10),d=u(d,r,n,c,h,t[10],2400959708,15),n=i(n,10),h=u(h,d,r,n,c,t[0],2400959708,14),r=i(r,10),c=u(c,h,d,r,n,t[8],2400959708,15),d=i(d,10),n=u(n,c,h,d,r,t[12],2400959708,9),h=i(h,10),r=u(r,n,c,h,d,t[4],2400959708,8),c=i(c,10),d=u(d,r,n,c,h,t[13],2400959708,9),n=i(n,10),h=u(h,d,r,n,c,t[3],2400959708,14),r=i(r,10),c=u(c,h,d,r,n,t[7],2400959708,5),d=i(d,10),n=u(n,c,h,d,r,t[15],2400959708,6),h=i(h,10),r=u(r,n,c,h,d,t[14],2400959708,8),c=i(c,10),d=u(d,r,n,c,h,t[5],2400959708,6),n=i(n,10),h=u(h,d,r,n,c,t[6],2400959708,5),r=i(r,10),c=u(c,h,d,r,n,t[2],2400959708,12),d=i(d,10),n=f(n,c,h,d,r,t[4],2840853838,9),h=i(h,10),r=f(r,n,c,h,d,t[0],2840853838,15),c=i(c,10),d=f(d,r,n,c,h,t[5],2840853838,5),n=i(n,10),h=f(h,d,r,n,c,t[9],2840853838,11),r=i(r,10),c=f(c,h,d,r,n,t[7],2840853838,6),d=i(d,10),n=f(n,c,h,d,r,t[12],2840853838,8),h=i(h,10),r=f(r,n,c,h,d,t[2],2840853838,13),c=i(c,10),d=f(d,r,n,c,h,t[10],2840853838,12),n=i(n,10),h=f(h,d,r,n,c,t[14],2840853838,5),r=i(r,10),c=f(c,h,d,r,n,t[1],2840853838,12),d=i(d,10),n=f(n,c,h,d,r,t[3],2840853838,13),h=i(h,10),r=f(r,n,c,h,d,t[8],2840853838,14),c=i(c,10),d=f(d,r,n,c,h,t[11],2840853838,11),n=i(n,10),h=f(h,d,r,n,c,t[6],2840853838,8),r=i(r,10),c=f(c,h,d,r,n,t[15],2840853838,5),d=i(d,10),n=f(n,c,h,d,r,t[13],2840853838,6),h=i(h,10);var l=this._a,p=this._b,b=this._c,g=this._d,y=this._e;l=f(l,p,b,g,y,t[5],1352829926,8),b=i(b,10),y=f(y,l,p,b,g,t[14],1352829926,9),p=i(p,10),g=f(g,y,l,p,b,t[7],1352829926,9),l=i(l,10),b=f(b,g,y,l,p,t[0],1352829926,11),y=i(y,10),p=f(p,b,g,y,l,t[9],1352829926,13),g=i(g,10),l=f(l,p,b,g,y,t[2],1352829926,15),b=i(b,10),y=f(y,l,p,b,g,t[11],1352829926,15),p=i(p,10),g=f(g,y,l,p,b,t[4],1352829926,5),l=i(l,10),b=f(b,g,y,l,p,t[13],1352829926,7),y=i(y,10),p=f(p,b,g,y,l,t[6],1352829926,7),g=i(g,10),l=f(l,p,b,g,y,t[15],1352829926,8),b=i(b,10),y=f(y,l,p,b,g,t[8],1352829926,11),p=i(p,10),g=f(g,y,l,p,b,t[1],1352829926,14),l=i(l,10),b=f(b,g,y,l,p,t[10],1352829926,14),y=i(y,10),p=f(p,b,g,y,l,t[3],1352829926,12),g=i(g,10),l=f(l,p,b,g,y,t[12],1352829926,6),b=i(b,10),y=u(y,l,p,b,g,t[6],1548603684,9),p=i(p,10),g=u(g,y,l,p,b,t[11],1548603684,13),l=i(l,10),b=u(b,g,y,l,p,t[3],1548603684,15),y=i(y,10),p=u(p,b,g,y,l,t[7],1548603684,7),g=i(g,10),l=u(l,p,b,g,y,t[0],1548603684,12),b=i(b,10),y=u(y,l,p,b,g,t[13],1548603684,8),p=i(p,10),g=u(g,y,l,p,b,t[5],1548603684,9),l=i(l,10),b=u(b,g,y,l,p,t[10],1548603684,11),y=i(y,10),p=u(p,b,g,y,l,t[14],1548603684,7),g=i(g,10),l=u(l,p,b,g,y,t[15],1548603684,7),b=i(b,10),y=u(y,l,p,b,g,t[8],1548603684,12),p=i(p,10),g=u(g,y,l,p,b,t[12],1548603684,7),l=i(l,10),b=u(b,g,y,l,p,t[4],1548603684,6),y=i(y,10),p=u(p,b,g,y,l,t[9],1548603684,15),g=i(g,10),l=u(l,p,b,g,y,t[1],1548603684,13),b=i(b,10),y=u(y,l,p,b,g,t[2],1548603684,11),p=i(p,10),g=a(g,y,l,p,b,t[15],1836072691,9),l=i(l,10),b=a(b,g,y,l,p,t[5],1836072691,7),y=i(y,10),p=a(p,b,g,y,l,t[1],1836072691,15),g=i(g,10),l=a(l,p,b,g,y,t[3],1836072691,11),b=i(b,10),y=a(y,l,p,b,g,t[7],1836072691,8),p=i(p,10),g=a(g,y,l,p,b,t[14],1836072691,6),l=i(l,10),b=a(b,g,y,l,p,t[6],1836072691,6),y=i(y,10),p=a(p,b,g,y,l,t[9],1836072691,14),g=i(g,10),l=a(l,p,b,g,y,t[11],1836072691,12),b=i(b,10),y=a(y,l,p,b,g,t[8],1836072691,13),p=i(p,10),g=a(g,y,l,p,b,t[12],1836072691,5),l=i(l,10),b=a(b,g,y,l,p,t[2],1836072691,14),y=i(y,10),p=a(p,b,g,y,l,t[10],1836072691,13),g=i(g,10),l=a(l,p,b,g,y,t[0],1836072691,13),b=i(b,10),y=a(y,l,p,b,g,t[4],1836072691,7),p=i(p,10),g=a(g,y,l,p,b,t[13],1836072691,5),l=i(l,10),b=o(b,g,y,l,p,t[8],2053994217,15),y=i(y,10),p=o(p,b,g,y,l,t[6],2053994217,5),g=i(g,10),l=o(l,p,b,g,y,t[4],2053994217,8),b=i(b,10),y=o(y,l,p,b,g,t[1],2053994217,11),p=i(p,10),g=o(g,y,l,p,b,t[3],2053994217,14),l=i(l,10),b=o(b,g,y,l,p,t[11],2053994217,14),y=i(y,10),p=o(p,b,g,y,l,t[15],2053994217,6),g=i(g,10),l=o(l,p,b,g,y,t[0],2053994217,14),b=i(b,10),y=o(y,l,p,b,g,t[5],2053994217,6),p=i(p,10),g=o(g,y,l,p,b,t[12],2053994217,9),l=i(l,10),b=o(b,g,y,l,p,t[2],2053994217,12),y=i(y,10),p=o(p,b,g,y,l,t[13],2053994217,9),g=i(g,10),l=o(l,p,b,g,y,t[9],2053994217,12),b=i(b,10),y=o(y,l,p,b,g,t[7],2053994217,5),p=i(p,10),g=o(g,y,l,p,b,t[10],2053994217,15),l=i(l,10),b=o(b,g,y,l,p,t[14],2053994217,8),y=i(y,10),p=s(p,b,g,y,l,t[12],0,8),g=i(g,10),l=s(l,p,b,g,y,t[15],0,5),b=i(b,10),y=s(y,l,p,b,g,t[10],0,12),p=i(p,10),g=s(g,y,l,p,b,t[4],0,9),l=i(l,10),b=s(b,g,y,l,p,t[1],0,12),y=i(y,10),p=s(p,b,g,y,l,t[5],0,5),g=i(g,10),l=s(l,p,b,g,y,t[8],0,14),b=i(b,10),y=s(y,l,p,b,g,t[7],0,6),p=i(p,10),g=s(g,y,l,p,b,t[6],0,8),l=i(l,10),b=s(b,g,y,l,p,t[2],0,13),y=i(y,10),p=s(p,b,g,y,l,t[13],0,6),g=i(g,10),l=s(l,p,b,g,y,t[14],0,5),b=i(b,10),y=s(y,l,p,b,g,t[0],0,15),p=i(p,10),g=s(g,y,l,p,b,t[3],0,13),l=i(l,10),b=s(b,g,y,l,p,t[9],0,11),y=i(y,10),p=s(p,b,g,y,l,t[11],0,11),g=i(g,10);var m=this._b+c+g|0;this._b=this._c+h+y|0,this._c=this._d+d+l|0,this._d=this._e+r+p|0,this._e=this._a+n+b|0,this._a=m},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,"hash-base":136,inherits:153}],200:[function(t,e,r){function n(t,e){for(var r in t)e[r]=t[r]}function i(t,e,r){return o(t,e,r)}var s=t("buffer"),o=s.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=s:(n(s,r),r.Buffer=i),n(o,i),i.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return o(t,e,r)},i.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=o(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return s.SlowBuffer(t)}},{buffer:98}],201:[function(t,e,r){function n(t,e){this._block=i.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}var i=t("safe-buffer").Buffer;n.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=i.from(t,e));for(var r=this._block,n=this._blockSize,s=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=4294967295&r,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=n},{"safe-buffer":200}],202:[function(t,e,r){var r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":203,"./sha1":204,"./sha224":205,"./sha256":206,"./sha384":207,"./sha512":208}],203:[function(t,e,r){function n(){this.init(),this._w=h,u.call(this,64,56)}function i(t){return t<<5|t>>>27}function s(t){return t<<30|t>>>2}function o(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var a=t("inherits"),u=t("./hash"),f=t("safe-buffer").Buffer,c=[1518500249,1859775393,-1894007588,-899497514],h=new Array(80);a(n,u),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,a=0|this._c,u=0|this._d,f=0|this._e,h=0;h<16;++h)e[h]=t.readInt32BE(4*h);for(;h<80;++h)e[h]=e[h-3]^e[h-8]^e[h-14]^e[h-16];for(var d=0;d<80;++d){var l=~~(d/20),p=i(r)+o(l,n,a,u)+f+e[d]+c[l]|0;f=u,u=a,a=s(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=u+this._d|0,this._e=f+this._e|0},n.prototype._hash=function(){var t=f.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],204:[function(t,e,r){function n(){this.init(),this._w=d,f.call(this,64,56)}function i(t){return t<<1|t>>>31}function s(t){return t<<5|t>>>27}function o(t){return t<<30|t>>>2}function a(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var u=t("inherits"),f=t("./hash"),c=t("safe-buffer").Buffer,h=[1518500249,1859775393,-1894007588,-899497514],d=new Array(80);u(n,f),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,u=0|this._c,f=0|this._d,c=0|this._e,d=0;d<16;++d)e[d]=t.readInt32BE(4*d);for(;d<80;++d)e[d]=i(e[d-3]^e[d-8]^e[d-14]^e[d-16]);for(var l=0;l<80;++l){var p=~~(l/20),b=s(r)+a(p,n,u,f)+c+e[l]+h[p]|0;c=f,f=u,u=o(n),n=r,r=b}this._a=r+this._a|0,this._b=n+this._b|0,this._c=u+this._c|0,this._d=f+this._d|0,this._e=c+this._e|0},n.prototype._hash=function(){var t=c.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],205:[function(t,e,r){function n(){this.init(),this._w=u,o.call(this,64,56)}var i=t("inherits"),s=t("./sha256"),o=t("./hash"),a=t("safe-buffer").Buffer,u=new Array(64);i(n,s),n.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},n.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=n},{"./hash":201,"./sha256":206,inherits:153,"safe-buffer":200}],206:[function(t,e,r){function n(){this.init(),this._w=p,h.call(this,64,56)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function a(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function u(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function f(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}var c=t("inherits"),h=t("./hash"),d=t("safe-buffer").Buffer,l=[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],p=new Array(64);c(n,h),n.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},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,c=0|this._c,h=0|this._d,d=0|this._e,p=0|this._f,b=0|this._g,g=0|this._h,y=0;y<16;++y)e[y]=t.readInt32BE(4*y);for(;y<64;++y)e[y]=f(e[y-2])+e[y-7]+u(e[y-15])+e[y-16]|0;for(var m=0;m<64;++m){var v=g+a(d)+i(d,p,b)+l[m]+e[m]|0,_=o(r)+s(r,n,c)|0;g=b,b=p,p=d,d=h+v|0,h=c,c=n,n=r,r=v+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=c+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=g+this._h|0},n.prototype._hash=function(){var t=d.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],207:[function(t,e,r){function n(){this.init(),this._w=u,o.call(this,128,112)}var i=t("inherits"),s=t("./sha512"),o=t("./hash"),a=t("safe-buffer").Buffer,u=new Array(160);i(n,s),n.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},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=a.allocUnsafe(48);return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=n},{"./hash":201,"./sha512":208,inherits:153,"safe-buffer":200}],208:[function(t,e,r){function n(){this.init(),this._w=y,p.call(this,128,112)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function a(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function u(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function c(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function h(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function d(t,e){return t>>>0>>0?1:0}var l=t("inherits"),p=t("./hash"),b=t("safe-buffer").Buffer,g=[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],y=new Array(160);l(n,p),n.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},n.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,l=0|this._ch,p=0|this._dh,b=0|this._eh,y=0|this._fh,m=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,k=0|this._dl,E=0|this._el,I=0|this._fl,A=0|this._gl,x=0|this._hl,O=0;O<32;O+=2)e[O]=t.readInt32BE(4*O),e[O+1]=t.readInt32BE(4*O+4);for(;O<160;O+=2){var P=e[O-30],B=e[O-30+1],R=u(P,B),M=f(B,P);P=e[O-4],B=e[O-4+1];var T=c(P,B),C=h(B,P),N=e[O-14],j=e[O-14+1],U=e[O-32],L=e[O-32+1],D=M+j|0,H=R+N+d(D,M)|0;D=D+C|0,H=H+T+d(D,C)|0,D=D+L|0,H=H+U+d(D,L)|0,e[O]=H,e[O+1]=D}for(var K=0;K<160;K+=2){H=e[K],D=e[K+1];var F=s(r,n,l),z=s(_,w,S),q=o(r,_),V=o(_,r),Y=a(b,E),G=a(E,b),W=g[K],X=g[K+1],Z=i(b,y,m),J=i(E,I,A),$=x+G|0,Q=v+Y+d($,x)|0;$=$+J|0,Q=Q+Z+d($,J)|0,$=$+X|0,Q=Q+W+d($,X)|0,$=$+D|0,Q=Q+H+d($,D)|0;var tt=V+z|0,et=q+F+d(tt,V)|0;v=m,x=A,m=y,A=I,y=b,I=E, -E=k+$|0,b=p+Q+d(E,k)|0,p=l,k=S,l=n,S=w,n=r,w=_,_=$+tt|0,r=Q+et+d(_,$)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+k|0,this._el=this._el+E|0,this._fl=this._fl+I|0,this._gl=this._gl+A|0,this._hl=this._hl+x|0,this._ah=this._ah+r+d(this._al,_)|0,this._bh=this._bh+n+d(this._bl,w)|0,this._ch=this._ch+l+d(this._cl,S)|0,this._dh=this._dh+p+d(this._dl,k)|0,this._eh=this._eh+b+d(this._el,E)|0,this._fh=this._fh+y+d(this._fl,I)|0,this._gh=this._gh+m+d(this._gl,A)|0,this._hh=this._hh+v+d(this._hl,x)|0},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=b.allocUnsafe(64);return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],209:[function(t,e,r){function n(){i.call(this)}e.exports=n;var i=t("events").EventEmitter;t("inherits")(n,i),n.Readable=t("readable-stream/readable.js"),n.Writable=t("readable-stream/writable.js"),n.Duplex=t("readable-stream/duplex.js"),n.Transform=t("readable-stream/transform.js"),n.PassThrough=t("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(t,e){function r(e){t.writable&&!1===t.write(e)&&f.pause&&f.pause()}function n(){f.readable&&f.resume&&f.resume()}function s(){c||(c=!0,t.end())}function o(){c||(c=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(u(),0===i.listenerCount(this,"error"))throw t}function u(){f.removeListener("data",r),t.removeListener("drain",n),f.removeListener("end",s),f.removeListener("close",o),f.removeListener("error",a),t.removeListener("error",a),f.removeListener("end",u),f.removeListener("close",u),t.removeListener("close",u)}var f=this;f.on("data",r),t.on("drain",n),t._isStdio||e&&!1===e.end||(f.on("end",s),f.on("close",o));var c=!1;return f.on("error",a),t.on("error",a),f.on("end",u),f.on("close",u),t.on("close",u),t.emit("pipe",f),t}},{events:134,inherits:153,"readable-stream/duplex.js":185,"readable-stream/passthrough.js":195,"readable-stream/readable.js":196,"readable-stream/transform.js":197,"readable-stream/writable.js":198}],210:[function(t,e,r){"use strict";function n(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function i(t){var e=n(t);if("string"!=typeof e&&(m.isEncoding===v||!v(t)))throw new Error("Unknown encoding: "+t);return e||t}function s(t){this.encoding=i(t);var e;switch(this.encoding){case"utf16le":this.text=d,this.end=l,e=4;break;case"utf8":this.fillLast=f,e=4;break;case"base64":this.text=p,this.end=b,e=3;break;default:return this.write=g,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=m.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function a(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0)}function u(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�".repeat(r);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�".repeat(r+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�".repeat(r+2)}}function f(t){var e=this.lastTotal-this.lastNeed,r=u(this,t,e);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){var r=a(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�".repeat(this.lastTotal-this.lastNeed):e}function d(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function p(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function b(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function g(t){return t.toString(this.encoding)}function y(t){return t&&t.length?this.write(t):""}var m=t("safe-buffer").Buffer,v=m.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(l),b=["'"].concat(p),g=["%","/","?",";","#"].concat(b),y=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,v=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");n.prototype.parse=function(t,e,r){if(!f.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&n127?C+="x":C+=T[N];if(!C.match(m)){var U=R.slice(0,A),L=R.slice(A+1),D=T.match(v);D&&(U.push(D[1]),L.unshift(D[2])),L.length&&(a="/"+L.join(".")+a),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=u.toASCII(this.hostname));var H=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+H,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!_[p])for(var A=0,M=b.length;A0)&&r.host.split("@");I&&(r.auth=I.shift(),r.host=r.hostname=I.shift())}return r.search=t.search,r.query=t.query,f.isNull(r.pathname)&&f.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=k.slice(-1)[0],x=(r.host||t.host||k.length>1)&&("."===A||".."===A)||""===A,O=0,P=k.length;P>=0;P--)A=k[P],"."===A?k.splice(P,1):".."===A?(k.splice(P,1),O++):O&&(k.splice(P,1),O--);if(!v&&!_)for(;O--;O)k.unshift("..");!v||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),x&&"/"!==k.join("/").substr(-1)&&k.push("");var B=""===k[0]||k[0]&&"/"===k[0].charAt(0);if(E){r.hostname=r.host=B?"":k.length?k.shift():"";var I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");I&&(r.auth=I.shift(),r.host=r.hostname=I.shift())}return v=v||r.host&&k.length,v&&!B&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),f.isNull(r.pathname)&&f.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":212,punycode:180,querystring:183}],212:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],213:[function(t,e,r){(function(t){function r(t,e){function r(){if(!i){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}if(n("noDeprecation"))return t;var i=!1;return r}function n(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],214:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],215:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(e)?n.showHidden=e:e&&r._extend(n,e),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),u(n,t,n.depth)}function s(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function o(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function u(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=u(t,i,n)),i}var s=f(t,e);if(s)return s;var o=Object.keys(e),b=a(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),I(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(A(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(E(e))return t.stylize(Date.prototype.toString.call(e),"date");if(I(e))return c(e)}var y="",m=!1,_=["{","}"];if(p(e)&&(m=!0,_=["[","]"]),A(e)){y=" [Function"+(e.name?": "+e.name:"")+"]"}if(S(e)&&(y=" "+RegExp.prototype.toString.call(e)),E(e)&&(y=" "+Date.prototype.toUTCString.call(e)),I(e)&&(y=" "+c(e)),0===o.length&&(!m||0==e.length))return _[0]+y+_[1];if(n<0)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var w;return w=m?h(t,e,n,b,o):o.map(function(r){return d(t,e,n,b,r,m)}),t.seen.pop(),l(w,y,_)}function f(t,e){if(w(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return m(e)?t.stylize(""+e,"number"):b(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var s=[],o=0,a=e.length;o-1&&(a=s?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function l(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return null==t}function m(t){return"number"==typeof t}function v(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return k(t)&&"[object RegExp]"===O(t)}function k(t){return"object"==typeof t&&null!==t}function E(t){return k(t)&&"[object Date]"===O(t)}function I(t){return k(t)&&("[object Error]"===O(t)||t instanceof Error)}function A(t){return"function"==typeof t}function x(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function O(t){return Object.prototype.toString.call(t)}function P(t){return t<10?"0"+t.toString(10):t.toString(10)}function B(){var t=new Date,e=[P(t.getHours()),P(t.getMinutes()),P(t.getSeconds())].join(":");return[t.getDate(),N[t.getMonth()],e].join(" ")}function R(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var M=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),a=n[r];r",main:"index.js",scripts:{lint:"gulp lint",test:"gulp test",coverage:"gulp coverage",build:"gulp"},keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],repository:{type:"git",url:"https://github.com/bitpay/bitcore-lib/tree/cash"},browser:{request:"browser-request"},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","phantomjs-prebuilt":"^2.1.16"},devDependencies:{"bitcore-build":"https://github.com/bitpay/bitcore-build.git#d4e8b2b2f1e2c065c3a807dcb6a6250f61d67ab3",brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0"},license:"MIT"}},{}],"bitcore-lib":[function(t,e,r){(function(r,n){"use strict";var i=e.exports;i.version="v"+t("./package.json").version,i.versionGuard=function(t){if(void 0!==t){throw new Error("More than one instance of bitcore-lib-cash found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.")}},i.versionGuard(r._bitcoreCash),r._bitcoreCash=i.version,i.crypto={},i.crypto.BN=t("./lib/crypto/bn"),i.crypto.ECDSA=t("./lib/crypto/ecdsa"),i.crypto.Hash=t("./lib/crypto/hash"),i.crypto.Random=t("./lib/crypto/random"),i.crypto.Point=t("./lib/crypto/point"),i.crypto.Signature=t("./lib/crypto/signature"),i.encoding={},i.encoding.Base58=t("./lib/encoding/base58"),i.encoding.Base58Check=t("./lib/encoding/base58check"),i.encoding.BufferReader=t("./lib/encoding/bufferreader"),i.encoding.BufferWriter=t("./lib/encoding/bufferwriter"),i.encoding.Varint=t("./lib/encoding/varint"),i.util={},i.util.buffer=t("./lib/util/buffer"),i.util.js=t("./lib/util/js"),i.util.preconditions=t("./lib/util/preconditions"),i.util.base32=t("./lib/util/base32"),i.util.convertBits=t("./lib/util/convertBits"),i.errors=t("./lib/errors"),i.Address=t("./lib/address"),i.Block=t("./lib/block"),i.MerkleBlock=t("./lib/block/merkleblock"),i.BlockHeader=t("./lib/block/blockheader"),i.HDPrivateKey=t("./lib/hdprivatekey.js"),i.HDPublicKey=t("./lib/hdpublickey.js"),i.Networks=t("./lib/networks"),i.Opcode=t("./lib/opcode"),i.PrivateKey=t("./lib/privatekey"),i.PublicKey=t("./lib/publickey"),i.Script=t("./lib/script"),i.Transaction=t("./lib/transaction"),i.URI=t("./lib/uri"),i.Unit=t("./lib/unit"),i.deps={},i.deps.bnjs=t("bn.js"),i.deps.bs58=t("bs58"),i.deps.Buffer=n,i.deps.elliptic=t("elliptic"),i.deps._=t("lodash"),i.Transaction.sighash=t("./lib/transaction/sighash")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"./lib/address":1,"./lib/block":4,"./lib/block/blockheader":3,"./lib/block/merkleblock":5,"./lib/crypto/bn":6,"./lib/crypto/ecdsa":7,"./lib/crypto/hash":8,"./lib/crypto/point":9,"./lib/crypto/random":10,"./lib/crypto/signature":11,"./lib/encoding/base58":12,"./lib/encoding/base58check":13,"./lib/encoding/bufferreader":14,"./lib/encoding/bufferwriter":15,"./lib/encoding/varint":16,"./lib/errors":17,"./lib/hdprivatekey.js":19,"./lib/hdpublickey.js":20,"./lib/networks":21,"./lib/opcode":22,"./lib/privatekey":23,"./lib/publickey":24,"./lib/script":25,"./lib/transaction":28,"./lib/transaction/sighash":36,"./lib/unit":40,"./lib/uri":41,"./lib/util/base32":42,"./lib/util/buffer":43,"./lib/util/convertBits":44,"./lib/util/js":45,"./lib/util/preconditions":46,"./package.json":217,"bn.js":64,bs58:95,buffer:98,elliptic:118,lodash:156}]},{},[]); \ No newline at end of file +require=function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var f="function"==typeof require&&require;if(!a&&f)return f(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o35){var o=i(t);if(!o.network||s&&s.name!==o.network.name)throw new TypeError("Address has mismatched network type.");if(!o.type||r&&r!==o.type)throw new TypeError("Address has mismatched type.");return o}var a=h.decode(t);return n._transformBuffer(a,e,r)},n.fromPublicKey=function(t,e){var r=n._transformPublicKey(t);return e=e||d.defaultNetwork,new n(r.hashBuffer,e,r.type)},n.fromPublicKeyHash=function(t,e){return new n(n._transformHash(t).hashBuffer,e,n.PayToPublicKeyHash)},n.fromScriptHash=function(t,e){return u.checkArgument(t,"hash parameter is required"),new n(n._transformHash(t).hashBuffer,e,n.PayToScriptHash)},n.payingTo=function(t,e){return u.checkArgument(t,"script is required"),u.checkArgument(t instanceof _,"script must be instance of Script"),n.fromScriptHash(l.sha256ripemd160(t.toBuffer()),e)},n.fromScript=function(t,e){u.checkArgument(t instanceof _,"script must be a Script instance");var r=n._transformScript(t,e);return new n(r.hashBuffer,e,r.type)},n.fromBuffer=function(t,e,r){var i=n._transformBuffer(t,e,r);return new n(i.hashBuffer,i.network,i.type)},n.fromString=function(t,e,r){var i=n._transformString(t,e,r);return new n(i.hashBuffer,i.network,i.type)},n.fromObject=function(t){return u.checkState(p.isHexa(t.hash),'Unexpected hash property, "'+t.hash+'", expected to be hex.'),new n(r.from(t.hash,"hex"),t.network,t.type)},n.getValidationError=function(t,e,r){var i;try{new n(t,e,r)}catch(t){i=t}return i},n.isValid=function(t,e,r){return!n.getValidationError(t,e,r)},n.prototype.isPayToPublicKeyHash=function(){return this.type===n.PayToPublicKeyHash},n.prototype.isPayToScriptHash=function(){return this.type===n.PayToScriptHash},n.prototype.toBuffer=function(){var t=new r([this.network[this.type]]);return r.concat([t,this.hashBuffer])},n.prototype.toObject=n.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},n.prototype.inspect=function(){return""},n.prototype.toCashBuffer=function(){var t=new r([this.network[this.type]]);return r.concat([t,this.hashBuffer])},n.prototype.toLegacyAddress=function(){return h.encode(this.toBuffer())},n.prototype.toCashAddress=function(t){var e=[0,0,0,0,0,0,0,0],r=this.network.prefixArray.concat([0]),n=function(t){switch(t){case"pubkeyhash":return 0;case"scripthash":return 8;default:throw new Error("Invalid type:"+t)}}(this.type)+function(t){switch(8*t.length){case 160:return 0;case 192:return 1;case 224:return 2;case 256:return 3;case 320:return 4;case 384:return 5;case 448:return 6;case 512:return 7;default:throw new Error("Invalid hash size:"+t.length)}}(this.hashBuffer),i=Array.prototype.slice.call(this.hashBuffer,0),s=m([n].concat(i),8,5),f=r.concat(s).concat(e),u=s.concat(o(a(f)));return!0===t?y.encode(u):this.network.prefix+":"+y.encode(u)},n.prototype.toString=n.prototype.toCashAddress;var v=f.map([656907472481,522768456162,0xf33e5fb3c4,748107326120,130178868336],function(t){return new g(t)});e.exports=n;var _=t("./script")}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./encoding/base58check":13,"./errors":17,"./networks":21,"./publickey":24,"./script":25,"./util/base32":42,"./util/convertBits":44,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],2:[function(t,e,r){(function(r){"use strict";function n(t){return this instanceof n?(i.extend(this,n._from(t)),this):new n(t)}var i=t("lodash"),s=t("./blockheader"),o=t("../crypto/bn"),a=t("../util/buffer"),f=t("../encoding/bufferreader"),u=t("../encoding/bufferwriter"),c=t("../crypto/hash"),h=t("../transaction"),d=t("../util/preconditions");n.MAX_BLOCK_SIZE=1e6,n._from=function(t){var e={};if(a.isBuffer(t))e=n._fromBufferReader(f(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for Block");e=n._fromObject(t)}return e},n._fromObject=function(t){var e=[];return t.transactions.forEach(function(t){t instanceof h?e.push(t):e.push(h().fromObject(t))}),{header:s.fromObject(t.header),transactions:e}},n.fromObject=function(t){return new n(n._fromObject(t))},n._fromBufferReader=function(t){var e={};d.checkState(!t.finished(),"No block data received"),e.header=s.fromBufferReader(t);var r=t.readVarintNum();e.transactions=[];for(var n=0;n1;n=Math.floor((n+1)/2)){for(var i=0;i"},n.Values={START_OF_BLOCK:8,NULL_HASH:r.from("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":28,"../util/buffer":43,"../util/preconditions":46,"./blockheader":3,buffer:98,lodash:156}],3:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../crypto/bn"),s=t("../util/buffer"),o=t("../encoding/bufferreader"),a=t("../encoding/bufferwriter"),f=t("../crypto/hash"),u=(t("../util/js"),t("../util/preconditions")),c=function t(e){if(!(this instanceof t))return new t(e);var r=t._from(e);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&u.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};c._from=function(t){var e={};if(s.isBuffer(t))e=c._fromBufferReader(o(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");e=c._fromObject(t)}return e},c._fromObject=function(t){u.checkArgument(t,"data is required");var e=t.prevHash,i=t.merkleRoot;return n.isString(t.prevHash)&&(e=s.reverse(r.from(t.prevHash,"hex"))),n.isString(t.merkleRoot)&&(i=s.reverse(r.from(t.merkleRoot,"hex"))),{hash:t.hash,version:t.version,prevHash:e,merkleRoot:i,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce}},c.fromObject=function(t){var e=c._fromObject(t);return new c(e)},c.fromRawBlock=function(t){s.isBuffer(t)||(t=r.from(t,"binary"));var e=o(t);e.pos=c.Constants.START_OF_HEADER;var n=c._fromBufferReader(e);return new c(n)},c.fromBuffer=function(t){var e=c._fromBufferReader(o(t));return new c(e)},c.fromString=function(t){var e=r.from(t,"hex");return c.fromBuffer(e)},c._fromBufferReader=function(t){var e={};return e.version=t.readInt32LE(),e.prevHash=t.read(32),e.merkleRoot=t.read(32),e.time=t.readUInt32LE(),e.bits=t.readUInt32LE(),e.nonce=t.readUInt32LE(),e},c.fromBufferReader=function(t){var e=c._fromBufferReader(t);return new c(e)},c.prototype.toObject=c.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:s.reverse(this.prevHash).toString("hex"),merkleRoot:s.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toString=function(){return this.toBuffer().toString("hex")},c.prototype.toBufferWriter=function(t){return t||(t=new a),t.writeInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},c.prototype.getTargetDifficulty=function(t){t=t||this.bits;for(var e=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)e=e.mul(new i(2));return e},c.prototype.getDifficulty=function(){var t=this.getTargetDifficulty(486604799).mul(new i(Math.pow(10,8))),e=this.getTargetDifficulty(),r=t.div(e).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},c.prototype._getHash=function(){var t=this.toBuffer();return f.sha256sha256(t)};var h={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(c.prototype,"id",h),Object.defineProperty(c.prototype,"hash",h),c.prototype.validTimestamp=function(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+c.Constants.MAX_TIME_OFFSET)},c.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return!(t.cmp(e)>0)},c.prototype.inspect=function(){return""},c.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=c}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],4:[function(t,e,r){e.exports=t("./block"),e.exports.BlockHeader=t("./blockheader"),e.exports.MerkleBlock=t("./merkleblock")},{"./block":2,"./blockheader":3,"./merkleblock":5}],5:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);var e={};if(o.isBuffer(t))e=n._fromBufferReader(a(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=t.header instanceof s?t.header:s.fromObject(t.header),e={header:r,numTransactions:t.numTransactions,hashes:t.hashes,flags:t.flags}}return i.extend(this,e),this._flagBitsUsed=0,this._hashesUsed=0,this}var i=t("lodash"),s=t("./blockheader"),o=t("../util/buffer"),a=t("../encoding/bufferreader"),f=t("../encoding/bufferwriter"),u=t("../crypto/hash"),c=(t("../util/js"),t("../transaction")),h=t("../errors"),d=t("../util/preconditions");n.fromBuffer=function(t){return n.fromBufferReader(a(t))},n.fromBufferReader=function(t){return new n(n._fromBufferReader(t))},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toBufferWriter=function(t){t||(t=new f),t.write(this.header.toBuffer()),t.writeUInt32LE(this.numTransactions),t.writeVarintNum(this.hashes.length);for(var e=0;ethis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new h.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length8*this.flags.length)return null;var s=this.flags[n.flagBitsUsed>>3]>>>(7&n.flagBitsUsed++)&1;if(0!==t&&s){var o=this._traverseMerkleTree(t-1,2*e,n),a=o;return 2*e+1=this.hashes.length)return null;var f=this.hashes[n.hashesUsed++];return 0===t&&s&&n.txs.push(f),r.from(f,"hex")},n.prototype._calcTreeWidth=function(t){return this.numTransactions+(1<>t},n.prototype._calcTreeHeight=function(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},n.prototype.hasTransaction=function(t){d.checkArgument(!i.isUndefined(t),"tx cannot be undefined"),d.checkArgument(t instanceof c||"string"==typeof t,'Invalid tx given, tx must be a "string" or "Transaction"');var e=t;t instanceof c&&(e=o.reverse(r.from(t.id,"hex")).toString("hex"));var n=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:n}),-1!==n.indexOf(e)},n._fromBufferReader=function(t){d.checkState(!t.finished(),"No merkleblock data received");var e={};e.header=s.fromBufferReader(t),e.numTransactions=t.readUInt32LE();var r=t.readVarintNum();e.hashes=[];for(var n=0;nt.size?e=n.trim(e,s):s0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(t,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.trim=function(t,e){return t.slice(e-t.length,t.length)},n.pad=function(t,e,n){for(var i=r.alloc(n),s=0;s>1,u=i.getN(),c=i.getG(),d=f?r.add(u):r,l=i.fromX(a,d);if(!l.mul(u).isInfinity())throw new Error("nR is not a valid curve point");var p=e.neg().umod(u),b=r.invm(u),g=l.mul(s).add(c.mul(p)).mul(b);return o.fromPoint(g,this.sig.compressed)},d.prototype.sigError=function(){if(!u.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,e=this.sig.s;if(!(t.gt(n.Zero)&&t.lt(i.getN())&&e.gt(n.Zero)&&e.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=i.getN(),o=e.invm(s),a=o.mul(r).umod(s),f=o.mul(t).umod(s),c=i.getG().mulAdd(a,this.pubkey.point,f);return c.isInfinity()?"p is infinity":0!==c.getX().umod(s).cmp(t)&&"Invalid signature"},d.toLowS=function(t){return t.gt(n.fromBuffer(r.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=i.getN().sub(t)),t},d.prototype._findSignature=function(t,e){var r,s,o,a,f=i.getN(),u=i.getG(),c=0;do{(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,s=u.mul(r),o=s.x.umod(f),a=r.invm(f).mul(e.add(t.mul(o))).umod(f)}while(o.cmp(n.Zero)<=0||a.cmp(n.Zero)<=0);return a=d.toLowS(a),{s:a,r:o}},d.prototype.sign=function(){var t=this.hashbuf,e=this.privkey,r=e.bn;h.checkState(t&&e&&r,new Error("invalid parameters")),h.checkState(u.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(t,this.endian?{endian:this.endian}:void 0),o=this._findSignature(r,i);return o.compressed=this.pubkey.compressed,this.sig=new s(o),this},d.prototype.signRandomK=function(){return this.randomK(),this.sign()},d.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},d.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},d.sign=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().sig},d.verify=function(t,e,r,n){return d().set({hashbuf:t,endian:n,sig:e,pubkey:r}).verify().verified},e.exports=d}).call(this,t("buffer").Buffer)},{"../publickey":24,"../util/buffer":43,"../util/preconditions":46,"./bn":6,"./hash":8,"./point":9,"./random":10,"./signature":11,buffer:98,lodash:156}],8:[function(t,e,r){(function(r){"use strict";var n=t("crypto"),i=t("../util/buffer"),s=t("../util/preconditions"),o=e.exports;o.sha1=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha1").update(t).digest()},o.sha1.blocksize=512,o.sha256=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha256").update(t).digest()},o.sha256.blocksize=512,o.sha256sha256=function(t){return s.checkArgument(i.isBuffer(t)),o.sha256(o.sha256(t))},o.ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("ripemd160").update(t).digest()},o.sha256ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha512").update(t).digest()},o.sha512.blocksize=1024,o.hmac=function(t,e,n){s.checkArgument(i.isBuffer(e)),s.checkArgument(i.isBuffer(n)),s.checkArgument(t.blocksize);var o=t.blocksize/8;if(n.length>o)n=t(n);else if(n>>=8)}return r},e.exports=i}).call(this,t("_process"),t("buffer").Buffer)},{_process:173,buffer:98,crypto:107}],11:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("lodash"),s=t("../util/preconditions"),o=t("../util/buffer"),a=t("../util/js"),f=function t(e,r){if(!(this instanceof t))return new t(e,r);if(e instanceof n)this.set({r:e,s:r});else if(e){var i=e;this.set(i)}};f.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i=void 0!==t.i?t.i:this.i,this.compressed=void 0!==t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},f.fromCompact=function(t){s.checkArgument(o.isBuffer(t),"Argument is expected to be a Buffer");var e=new f,r=!0,i=t.slice(0,1)[0]-27-4;i<0&&(r=!1,i+=4);var a=t.slice(1,33),u=t.slice(33,65);return s.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),s.checkArgument(32===a.length,new Error("r must be 32 bytes")),s.checkArgument(32===u.length,new Error("s must be 32 bytes")),e.compressed=r,e.i=i,e.r=n.fromBuffer(a),e.s=n.fromBuffer(u),e},f.fromDER=f.fromBuffer=function(t,e){var r=f.parseDER(t,e),n=new f;return n.r=r.r,n.s=r.s,n},f.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),n=new f.fromDER(r,!1);return n.nhashtype=e,n},f.fromString=function(t){var e=r.from(t,"hex");return f.fromDER(e)},f.parseDER=function(t,e){s.checkArgument(o.isBuffer(t),new Error("DER formatted signature should be a buffer")),i.isUndefined(e)&&(e=!0);var r=t[0];s.checkArgument(48===r,new Error("Header byte should be 0x30"));var a=t[1],f=t.slice(2).length +;s.checkArgument(!e||a===f,new Error("Length byte should length of what follows")),a=a73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;var i=t.slice(6+e);return 2===t[6+e-2]&&(0!==r&&(!(128&i[0])&&!(r>1&&0===i[0]&&!(128&i[1]))))},f.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},f.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=31&this.nhashtype;return!(tf.SIGHASH_SINGLE)},f.prototype.toTxFormat=function(){var t=this.toDER(),e=r.alloc(1);return e.writeUInt8(this.nhashtype,0),r.concat([t,e])},f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_FORKID=64,f.SIGHASH_ANYONECANPAY=128,e.exports=f}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/js":45,"../util/preconditions":46,"./bn":6,buffer:98,lodash:156}],12:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("bs58"),s=t("buffer"),o="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}else e&&this.set(e)};a.validCharacters=function(t){return s.Buffer.isBuffer(t)&&(t=t.toString()),n.every(n.map(t,function(t){return n.includes(o,t)}))},a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.encode=function(t){if(!s.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return i.encode(t)},a.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return r.from(i.decode(t))},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{bs58:95,buffer:98,lodash:156}],13:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./base58"),s=t("buffer"),o=t("../crypto/hash").sha256sha256,a=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}else e&&this.set(e)};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.validChecksum=function(t,e){return n.isString(t)&&(t=new s.Buffer(i.decode(t))),n.isString(e)&&(e=new s.Buffer(i.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===e.toString("hex")},a.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=r.from(i.decode(t));if(e.length<4)throw new Error("Input string too short");var n=e.slice(0,-4),s=e.slice(-4),a=o(n),f=a.slice(0,4);if(s.toString("hex")!==f.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(t){return o(t).slice(0,4)},a.encode=function(t){if(!r.isBuffer(t))throw new Error("Input must be a buffer");var e=r.alloc(t.length+4),n=a.checksum(t);return t.copy(e),n.copy(e,t.length),i.encode(e)},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"./base58":12,buffer:98,lodash:156}],14:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../util/preconditions"),s=t("../util/buffer"),o=t("../crypto/bn"),a=function t(e){if(!(this instanceof t))return new t(e);if(!n.isUndefined(e))if(r.isBuffer(e))this.set({buf:e});else if(n.isString(e)){var i=r.from(e,"hex");if(2*i.length!=e.length)throw new TypeError("Invalid hex string");this.set({buf:i})}else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for BufferReader");var s=e;this.set(s)}};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(t){i.checkArgument(!n.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},a.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},a.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},a.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readInt32LE=function(){var t=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=o.fromBuffer(t);return this.pos=this.pos+8,e},a.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=this.buf.readUInt32LE(this.pos+4),n=4294967296*r+e;if(n<=9007199254740991)t=new o(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new o(i,10,"le")}return this.pos=this.pos+8,t},a.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN(),r=e.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},a.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return i.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},a.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)}},a.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(t)}},a.prototype.reverse=function(){for(var t=r.alloc(this.buf.length),e=0;e=0&&t=n.Hardened||e,t64)throw new y.InvalidEntropyArgument.TooMuchEntropy(t);var i=h.sha512hmac(t,new s.Buffer("Bitcoin seed"));return new n({network:d.get(e)||d.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},n.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=t("./hdpublickey");this._hdPublicKey=new e(this)}},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),v.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,m.emptyBuffer(1),t.privateKey],i=s.Buffer.concat(e);if(t.checksum&&t.checksum.length){if(t.checksum.toString()!==c.checksum(i).toString())throw new g.InvalidB58Checksum(i)}else t.checksum=c.checksum(i);var o,a=d.get(m.integerFromBuffer(t.version));o=c.encode(s.Buffer.concat(e)),t.xprivkey=r.from(o);var u=new p(f.fromBuffer(t.privateKey),a),l=u.toPublicKey(),b=n.ParentFingerPrintSize,y=h.sha256ripemd160(l.toBuffer()).slice(0,b);return v.defineImmutable(this,{xprivkey:o,network:a,depth:m.integerFromSingleByteBuffer(t.depth),privateKey:u,publicKey:l,fingerPrint:y}),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},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];i(m.isBuffer(n),e+" argument is not a buffer"),i(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("privateKey",n.PrivateKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.prototype.toString=function(){return this.xprivkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(m.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:m.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:m.integerFromBuffer(this.fingerPrint),parentFingerPrint:m.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:m.integerFromBuffer(this._buffers.childIndex),chainCode:m.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:m.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},n.fromBuffer=function(t){return new n(t.toString())},n.prototype.toBuffer=function(){return m.copy(this._buffers.xprivkey)},n.DefaultDepth=0,n.DefaultFingerprint=0,n.DefaultChildIndex=0,n.Hardened=2147483648,n.MaxIndex=2*n.Hardened,n.RootElementAlias=["m","M","m'","M'"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PrivateKeySize=32,n.CheckSumSize=4,n.DataLength=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PrivateKeyStart=n.ChainCodeEnd+1,n.PrivateKeyEnd=n.PrivateKeyStart+n.PrivateKeySize,n.ChecksumStart=n.PrivateKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,i(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./crypto/random":10,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdpublickey":20,"./networks":21,"./privatekey":23,"./util/buffer":43,"./util/js":45,"./util/preconditions":46,assert:61,buffer:98,lodash:156}],20:[function(t,e,r){(function(r){"use strict";function n(t){if(t instanceof n)return t;if(!(this instanceof n))return new n(t);if(t){if(i.isString(t)||v.isBuffer(t)){var e=n.getSerializedError(t);if(e){if(v.isBuffer(t)&&!n.getSerializedError(t.toString()))return this._buildFromSerialized(t.toString());if(e instanceof g.ArgumentIsPrivateExtended)return new c(t).hdPublicKey;throw e}return this._buildFromSerialized(t)}if(i.isObject(t))return t instanceof c?this._buildFromPrivate(t):this._buildFromObject(t);throw new g.UnrecognizedArgument(t)}throw new g.MustSupplyArgument}var i=t("lodash"),s=t("./util/preconditions"),o=t("./crypto/bn"),a=t("./encoding/base58"),f=t("./encoding/base58check"),u=t("./crypto/hash"),c=t("./hdprivatekey"),h=t("./networks"),d=t("./crypto/point"),l=t("./publickey"),p=t("./errors"),b=p,g=p.HDPublicKey,y=t("assert"),m=t("./util/js"),v=t("./util/buffer");n.isValidPath=function(t){if(i.isString(t)){var e=c._getDerivationIndexes(t);return null!==e&&i.every(e,n.isValidPath)}return!!i.isNumber(t)&&(t>=0&&t=n.Hardened||e)throw new g.InvalidIndexCantDeriveHardened;if(t<0)throw new g.InvalidPath(t);var r,i=v.integerAsBuffer(t),s=v.concat([this.publicKey.toBuffer(),i]),a=u.sha512hmac(s,this._buffers.chainCode),f=o.fromBuffer(a.slice(0,32),{size:32}),c=a.slice(32,64);try{r=l.fromPoint(d.getG().mul(f).add(this.publicKey.point))}catch(e){return this._deriveWithNumber(t+1)}return new n({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:c,publicKey:r})},n.prototype._deriveFromString=function(t){if(i.includes(t,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!n.isValidPath(t))throw new g.InvalidPath(t);return c._getDerivationIndexes(t).reduce(function(t,e){return t._deriveWithNumber(e)},this)},n.isValidSerialized=function(t,e){return i.isNull(n.getSerializedError(t,e))},n.getSerializedError=function(t,e){if(!i.isString(t)&&!v.isBuffer(t))return new g.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(t))return new b.InvalidB58Char("(unknown)",t);try{t=f.decode(t)}catch(e){return new b.InvalidB58Checksum(t)}if(t.length!==n.DataSize)return new g.InvalidLength(t);if(!i.isUndefined(e)){var r=n._validateNetwork(t,e);if(r)return r}var s=v.integerFromBuffer(t.slice(0,4));return s===h.livenet.xprivkey||s===h.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},n._validateNetwork=function(t,e){var r=h.get(e);if(!r)return new b.InvalidNetworkArgument(e);var i=t.slice(n.VersionStart,n.VersionEnd);return v.integerFromBuffer(i)!==r.xpubkey?new b.InvalidNetwork(i):null},n.prototype._buildFromPrivate=function(t){var e=i.clone(t._buffers),r=d.getG().mul(o.fromBuffer(e.privateKey));return e.publicKey=d.pointToCompressed(r),e.version=v.integerAsBuffer(h.get(v.integerFromBuffer(e.version)).xpubkey),e.privateKey=void 0,e.checksum=void 0,e.xprivkey=void 0,this._buildFromBuffers(e)},n.prototype._buildFromObject=function(t){var e={version:t.network?v.integerAsBuffer(h.get(t.network).xpubkey):t.version,depth:i.isNumber(t.depth)?v.integerAsSingleByteBuffer(t.depth):t.depth,parentFingerPrint:i.isNumber(t.parentFingerPrint)?v.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:i.isNumber(t.childIndex)?v.integerAsBuffer(t.childIndex):t.childIndex,chainCode:i.isString(t.chainCode)?v.hexToBuffer(t.chainCode):t.chainCode,publicKey:i.isString(t.publicKey)?v.hexToBuffer(t.publicKey):v.isBuffer(t.publicKey)?t.publicKey:t.publicKey.toBuffer(),checksum:i.isNumber(t.checksum)?v.integerAsBuffer(t.checksum):t.checksum};return this._buildFromBuffers(e)},n.prototype._buildFromSerialized=function(t){var e=f.decode(t),r={version:e.slice(n.VersionStart,n.VersionEnd),depth:e.slice(n.DepthStart,n.DepthEnd),parentFingerPrint:e.slice(n.ParentFingerPrintStart,n.ParentFingerPrintEnd),childIndex:e.slice(n.ChildIndexStart,n.ChildIndexEnd),chainCode:e.slice(n.ChainCodeStart,n.ChainCodeEnd),publicKey:e.slice(n.PublicKeyStart,n.PublicKeyEnd),checksum:e.slice(n.ChecksumStart,n.ChecksumEnd),xpubkey:t};return this._buildFromBuffers(r)},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),m.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,t.publicKey],i=v.concat(e),s=f.checksum(i);if(t.checksum&&t.checksum.length){if(t.checksum.toString("hex")!==s.toString("hex"))throw new b.InvalidB58Checksum(i,s)}else t.checksum=s;var o,a=h.get(v.integerFromBuffer(t.version));o=f.encode(v.concat(e)),t.xpubkey=r.from(o);var c=new l(t.publicKey,{network:a}),d=n.ParentFingerPrintSize,p=u.sha256ripemd160(c.toBuffer()).slice(0,d);return m.defineImmutable(this,{xpubkey:o,network:a,depth:v.integerFromSingleByteBuffer(t.depth),publicKey:c,fingerPrint:p}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];y(v.isBuffer(n),e+" argument is not a buffer, it's "+typeof n),y(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize), +e("chainCode",n.ChainCodeSize),e("publicKey",n.PublicKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.fromString=function(t){return s.checkArgument(i.isString(t),"No valid string was provided"),new n(t)},n.fromObject=function(t){return s.checkArgument(i.isObject(t),"No valid argument was provided"),new n(t)},n.prototype.toString=function(){return this.xpubkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:h.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},n.fromBuffer=function(t){return new n(t)},n.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},n.Hardened=2147483648,n.RootElementAlias=["m","M"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PublicKeySize=33,n.CheckSumSize=4,n.DataSize=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PublicKeyStart=n.ChainCodeEnd,n.PublicKeyEnd=n.PublicKeyStart+n.PublicKeySize,n.ChecksumStart=n.PublicKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,y(n.PublicKeyEnd===n.DataSize),y(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdprivatekey":19,"./networks":21,"./publickey":24,"./util/buffer":43,"./util/js":45,"./util/preconditions":46,assert:61,buffer:98,lodash:156}],21:[function(t,e,r){"use strict";function n(){}function i(t,e){if(~b.indexOf(t))return t;if(!e)return g[t];d.isArray(e)||(e=[e]);for(var r=0;r=0&&t<=16,"Invalid Argument: n must be between 0 and 16"),0===t?n("OP_0"):new n(n.map.OP_1+t-1)},n.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_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM: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_CHECKSEQUENCEVERIFY:178,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},n.reverseMap=[];for(var f in n.map)n.reverseMap[n.map[f]]=f;i.extend(n,n.map),n.isSmallIntOp=function(t){return t instanceof n&&(t=t.toNumber()),t===n.map.OP_0||t>=n.map.OP_1&&t<=n.map.OP_16},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./util/buffer":43,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],23:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(t instanceof n)return t;var r=this._classifyArguments(t,e);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return f.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var i=t("lodash"),s=t("./address"),o=t("./encoding/base58check"),a=t("./crypto/bn"),f=t("./util/js"),u=t("./networks"),c=t("./crypto/point"),h=t("./publickey"),d=t("./crypto/random"),l=t("./util/preconditions");n.prototype._classifyArguments=function(t,e){var s={compressed:!0,network:e?u.get(e):u.defaultNetwork};if(i.isUndefined(t)||i.isNull(t))s.bn=n._getRandomBN();else if(t instanceof a)s.bn=t;else if(t instanceof r||t instanceof Uint8Array)s=n._transformBuffer(t,e);else if(t.bn&&t.network)s=n._transformObject(t);else if(!e&&u.get(t))s.bn=n._getRandomBN(),s.network=u.get(t);else{if("string"!=typeof t)throw new TypeError("First argument is an unrecognized data type.");f.isHexa(t)?s.bn=new a(r.from(t,"hex")):s=n._transformWIF(t,e)}return s},n._getRandomBN=function(){var t,e;do{var r=d.getRandomBuffer(32);e=a.fromBuffer(r),t=e.lt(c.getN())}while(!t);return e},n._transformBuffer=function(t,e){var r={};if(32===t.length)return n._transformBNBuffer(t,e);if(r.network=u.get(t[0],"privatekey"),!r.network)throw new Error("Invalid network");if(e&&r.network!==u.get(e))throw new TypeError("Private key network mismatch");if(34===t.length&&1===t[33])r.compressed=!0;else{if(33!==t.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(t.slice(1,33)),r},n._transformBNBuffer=function(t,e){var r={};return r.network=u.get(e)||u.defaultNetwork,r.bn=a.fromBuffer(t),r.compressed=!1,r},n._transformWIF=function(t,e){return n._transformBuffer(o.decode(t),e)},n.fromBuffer=function(t,e){return new n(t,e)},n._transformObject=function(t){return{bn:new a(t.bn,"hex"),network:u.get(t.network),compressed:t.compressed}},n.fromString=n.fromWIF=function(t){return l.checkArgument(i.isString(t),"First argument is expected to be a string."),new n(t)},n.fromObject=function(t){return l.checkArgument(i.isObject(t),"First argument is expected to be an object."),new n(t)},n.fromRandom=function(t){return new n(n._getRandomBN(),t)},n.getValidationError=function(t,e){var r;try{new n(t,e)}catch(t){r=t}return r},n.isValid=function(t,e){return!!t&&!n.getValidationError(t,e)},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toWIF=function(){var t,e=this.network,n=this.compressed;return t=n?r.concat([r.from([e.privatekey]),this.bn.toBuffer({size:32}),r.from([1])]):r.concat([r.from([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(t)},n.prototype.toBigNumber=function(){return this.bn},n.prototype.toBuffer=function(){return this.bn.toBuffer()},n.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},n.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},n.prototype.toAddress=function(t){var e=this.toPublicKey();return s.fromPublicKey(e,t||this.network)},n.prototype.toObject=n.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},n.prototype.inspect=function(){var t=this.compressed?"":", uncompressed";return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/point":9,"./crypto/random":10,"./encoding/base58check":13,"./networks":21,"./publickey":24,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],24:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(c.checkArgument(t,"First argument is required, please include public key data."),t instanceof n)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||f.defaultNetwork}),this}var i=t("./crypto/bn"),s=t("./crypto/point"),o=t("./crypto/hash"),a=t("./util/js"),f=t("./networks"),u=t("lodash"),c=t("./util/preconditions");n.prototype._classifyArgs=function(t,e){var i={compressed:u.isUndefined(e.compressed)||e.compressed};if(t instanceof s)i.point=t;else if(t.x&&t.y)i=n._transformObject(t);else if("string"==typeof t)i=n._transformDER(r.from(t,"hex"));else if(n._isBuffer(t))i=n._transformDER(t);else{if(!n._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");i=n._transformPrivateKey(t)}return i.network||(i.network=u.isUndefined(e.network)?void 0:f.get(e.network)),i},n._isPrivateKey=function(e){return e instanceof t("./privatekey")},n._isBuffer=function(t){return t instanceof r||t instanceof Uint8Array},n._transformPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=s.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},n._transformDER=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r={};e=!!u.isUndefined(e)||e;var o,a,f,h;if(4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])f=t.slice(1),o=new i(f),r=n._transformX(!0,o),r.compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");f=t.slice(1),o=new i(f),r=n._transformX(!1,o),r.compressed=!0}else{if(f=t.slice(1,33),h=t.slice(33,65),32!==f.length||32!==h.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");o=new i(f),a=new i(h),r.point=new s(o,a),r.compressed=!1}return r},n._transformX=function(t,e){c.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=s.fromX(t,e),r},n._transformObject=function(t){var e=new i(t.x,"hex"),r=new i(t.y,"hex");return new n(new s(e,r),{compressed:t.compressed})},n.fromPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e=n._transformPrivateKey(t);return new n(e.point,{compressed:e.compressed,network:e.network})},n.fromDER=n.fromBuffer=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r=n._transformDER(t,e);return new n(r.point,{compressed:r.compressed})},n.fromPoint=function(t,e){return c.checkArgument(t instanceof s,"First argument must be an instance of Point."),new n(t,{compressed:e})},n.fromString=function(t,e){var i=r.from(t,e||"hex"),s=n._transformDER(i);return new n(s.point,{compressed:s.compressed})},n.fromX=function(t,e){var r=n._transformX(t,e);return new n(r.point,{compressed:r.compressed})},n.getValidationError=function(t){var e;try{new n(t)}catch(t){e=t}return e},n.isValid=function(t){return!n.getValidationError(t)},n.prototype.toObject=n.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},n.prototype.toBuffer=n.prototype.toDER=function(){var t,e=this.point.getX(),n=this.point.getY(),i=e.toBuffer({size:32}),s=n.toBuffer({size:32});if(this.compressed){return t=s[s.length-1]%2?r.from([3]):r.from([2]),r.concat([t,i])}return t=r.from([4]),r.concat([t,i,s])},n.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},n.prototype.toAddress=function(e){return t("./address").fromPublicKey(this,e||this.network)},n.prototype.toString=function(){return this.toDER().toString("hex")},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./networks":21,"./privatekey":23,"./util/js":45,"./util/preconditions":46,buffer:98,lodash:156}],25:[function(t,e,r){e.exports=t("./script"),e.exports.Interpreter=t("./interpreter")},{"./interpreter":26,"./script":27}],26:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./script"),s=t("../opcode"),o=t("../crypto/bn"),a=t("../crypto/hash"),f=t("../crypto/signature"),u=t("../publickey"),c=function t(e){if(!(this instanceof t))return new t(e);e?(this.initialize(),this.set(e)):this.initialize()};c.prototype.verify=function(e,r,s,o,a,f){var u=t("../transaction");if(n.isUndefined(s)&&(s=new u),n.isUndefined(o)&&(o=0),n.isUndefined(a)&&(a=0),a&c.SCRIPT_ENABLE_SIGHASH_FORKID&&(a|=c.SCRIPT_VERIFY_STRICTENC,!f))throw new Error("internal error - need satoshisBN to verify FORKID transactions");this.set({script:e,tx:s,nin:o,flags:a,satoshisBN:f});var h;if(0!=(a&c.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&c.SCRIPT_VERIFY_P2SH&&(h=this.stack.slice());var d=this.stack;if(this.initialize(),this.set({script:r,stack:d,tx:s,nin:o,flags:a,satoshisBN:f}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var l=this.stack[this.stack.length-1];if(!c.castToBool(l))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&c.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===h.length)throw new Error("internal error - stack copy empty");var p=h[h.length-1],b=i.fromBuffer(p);if(h.pop(),this.initialize(),this.set({script:b,stack:h,tx:s,nin:o,flags:a,satoshisBN:f}),!this.evaluate())return!1;if(0===h.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!c.castToBool(h[h.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if(0!=(a&c.SCRIPT_VERIFY_CLEANSTACK)){if(0==(a&c.SCRIPT_VERIFY_P2SH))throw new Error("internal error - CLEANSTACK without P2SH");if(1!=h.length)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0},e.exports=c,c.prototype.initialize=function(t){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},c.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin=void 0!==t.nin?t.nin:this.nin,this.satoshisBN=t.satoshisBN||this.satoshisBN,this.stack=t.stack||this.stack,this.altstack=t.altack||this.altstack,this.pc=void 0!==t.pc?t.pc:this.pc,this.pbegincodehash=void 0!==t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags=void 0!==t.flags?t.flags:this.flags},c.true=r.from([1]),c.false=r.from([]),c.MAX_SCRIPT_ELEMENT_SIZE=520,c.MAXIMUM_ELEMENT_SIZE=4,c.LOCKTIME_THRESHOLD=5e8,c.LOCKTIME_THRESHOLD_BN=new o(c.LOCKTIME_THRESHOLD),c.SCRIPT_VERIFY_NONE=0,c.SCRIPT_VERIFY_P2SH=1,c.SCRIPT_VERIFY_STRICTENC=2,c.SCRIPT_VERIFY_DERSIG=4,c.SCRIPT_VERIFY_LOW_S=8,c.SCRIPT_VERIFY_NULLDUMMY=16,c.SCRIPT_VERIFY_SIGPUSHONLY=32,c.SCRIPT_VERIFY_MINIMALDATA=64,c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,c.SCRIPT_VERIFY_CLEANSTACK=256,c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,c.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,c.SCRIPT_VERIFY_MINIMALIF=8192,c.SCRIPT_VERIFY_NULLFAIL=16384,c.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768,c.SCRIPT_ENABLE_SIGHASH_FORKID=65536,c.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17,c.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18,c.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,c.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,c.SEQUENCE_LOCKTIME_MASK=65535,c.castToBool=function(t){for(var e=0;ee)&&!(t.length>0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))},c._minimallyEncode=function(t){if(0==t.length)return t;var e=t[t.length-1];if(127&e)return t;if(1==t.length)return r.from("");if(128&t[t.length-2])return t;for(var n=t.length-1;n>0;n--)if(0!=t[n-1])return 128&t[n-1]?t[n++]=e:t[n-1]|=e,t.slice(0,n);return r.from("")},c.prototype.evaluate=function(){if(this.script.toBuffer().length>1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},c.prototype.checkLockTime=function(t){return!!(this.tx.nLockTime=c.LOCKTIME_THRESHOLD&&t.gte(c.LOCKTIME_THRESHOLD_BN))&&(!t.gt(new o(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},c.prototype.checkSequence=function(t){var e=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2)return!1;if(e&SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=c.SEQUENCE_LOCKTIME_TYPE_FLAG|c.SEQUENCE_LOCKTIME_MASK,n=new o(e&r),i=t.and(r),s=new o(c.SEQUENCE_LOCKTIME_TYPE_FLAG);return!!(n.lt(s)&&i.lt(s)||n.gte(s)&&i.gte(s))&&!i.gt(n)},c.prototype.step=function(){function t(t){return P.stack[P.stack.length+t]}var e,h,d,l,p,b,g,y,m,v,_,w,S,E,I,k,A,P=this,O=0!=(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),x=-1===this.vfExec.indexOf(!1),B=this.script.chunks[this.pc];this.pc++;var R=B.opcodenum;if(n.isUndefined(R))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(B.buf&&B.buf.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(R>s.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(function(t){switch(t){case s.OP_INVERT:case s.OP_2MUL:case s.OP_2DIV:case s.OP_MUL:case s.OP_LSHIFT:case s.OP_RSHIFT:return!0;case s.OP_DIV:case s.OP_MOD:case s.OP_SPLIT:case s.OP_CAT:case s.OP_AND:case s.OP_OR:case s.OP_XOR:case s.OP_BIN2NUM:case s.OP_NUM2BIN:if(0==(P.flags&c.SCRIPT_ENABLE_MONOLITH_OPCODES))return!0}return!1}(R))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(x&&0<=R&&R<=s.OP_PUSHDATA4){if(O&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(B.buf){if(B.len!==B.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(B.buf)}else this.stack.push(c.false)}else if(x||s.OP_IF<=R&&R<=s.OP_ENDIF)switch(R){case s.OP_1NEGATE:case s.OP_1:case s.OP_2:case s.OP_3:case s.OP_4:case s.OP_5:case s.OP_6:case s.OP_7:case s.OP_8:case s.OP_9:case s.OP_10:case s.OP_11:case s.OP_12:case s.OP_13:case s.OP_14:case s.OP_15:case s.OP_16:p=R-(s.OP_1-1),e=new o(p).toScriptNumBuffer(),this.stack.push(e);break;case s.OP_NOP:break;case s.OP_NOP2:case s.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&c.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 T=o.fromScriptNumBuffer(this.stack[this.stack.length-1],O,5);if(T.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(T))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP3:case s.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&c.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 M=o.fromScriptNumBuffer(t(-1),O,5);if(M.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(M&c.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(M))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP1:case s.OP_NOP4:case s.OP_NOP5:case s.OP_NOP6:case s.OP_NOP7:case s.OP_NOP8:case s.OP_NOP9:case s.OP_NOP10:if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case s.OP_IF:case s.OP_NOTIF:if(k=!1,x){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(e=t(-1),this.flags&c.SCRIPT_VERIFY_MINIMALIF){if(e.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(1==e.length&&1!=e[0])return this.errstr="SCRIPT_ERR_MINIMALIF",!1}k=c.castToBool(e),R===s.OP_NOTIF&&(k=!k),this.stack.pop()}this.vfExec.push(k);break;case s.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 s.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case s.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(e=t(-1),!(k=c.castToBool(e)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case s.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case s.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case s.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case s.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case s.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=t(-2),d=t(-1),this.stack.push(h),this.stack.push(d);break;case s.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=t(-3),d=t(-2);var C=t(-1);this.stack.push(h),this.stack.push(d),this.stack.push(C);break;case s.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=t(-4),d=t(-3),this.stack.push(h),this.stack.push(d);break;case s.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-6,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case s.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-4,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case s.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=t(-1),k=c.castToBool(e),k&&this.stack.push(e);break;case s.OP_DEPTH:e=new o(this.stack.length).toScriptNumBuffer(),this.stack.push(e);break;case s.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case s.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t(-1));break;case s.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 s.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t(-2));break;case s.OP_PICK:case s.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(e=t(-1),y=o.fromScriptNumBuffer(e,O),p=y.toNumber(),this.stack.pop(),p<0||p>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=t(-p-1),R===s.OP_ROLL&&this.stack.splice(this.stack.length-p-1,1),this.stack.push(e);break;case s.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=t(-3),g=t(-2);var N=t(-1);this.stack[this.stack.length-3]=g,this.stack[this.stack.length-2]=N,this.stack[this.stack.length-1]=b;break;case s.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=t(-2),g=t(-1),this.stack[this.stack.length-2]=g,this.stack[this.stack.length-1]=b;break;case s.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,t(-1));break;case s.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new o(t(-1).length),this.stack.push(y.toScriptNumBuffer());break;case s.OP_AND:case s.OP_OR:case s.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=t(-2),d=t(-1),h.length!==d.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(R){case s.OP_AND:for(var U=0;U0)+0);break;case s.OP_LESSTHANOREQUAL: +y=new o((m.cmp(v)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:y=new o((m.cmp(v)>=0)+0);break;case s.OP_MIN:y=m.cmp(v)<0?m:v;break;case s.OP_MAX:y=m.cmp(v)>0?m:v}if(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),R===s.OP_NUMEQUALVERIFY){if(!c.castToBool(t(-1)))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case s.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=o.fromScriptNumBuffer(t(-3),O),v=o.fromScriptNumBuffer(t(-2),O);var L=o.fromScriptNumBuffer(t(-1),O);k=v.cmp(m)<=0&&m.cmp(L)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(k?c.true:c.false);break;case s.OP_RIPEMD160:case s.OP_SHA1:case s.OP_SHA256:case s.OP_HASH160:case s.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=t(-1);var D;R===s.OP_RIPEMD160?D=a.ripemd160(e):R===s.OP_SHA1?D=a.sha1(e):R===s.OP_SHA256?D=a.sha256(e):R===s.OP_HASH160?D=a.sha256ripemd160(e):R===s.OP_HASH256&&(D=a.sha256sha256(e)),this.stack.pop(),this.stack.push(D);break;case s.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case s.OP_CHECKSIG:case s.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(_=t(-2),w=t(-1),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;S=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var K=(new i).add(_);S.findAndDelete(K);try{E=f.fromTxFormat(_),I=u.fromBuffer(w,!1),A=this.tx.verifySignature(E,I,this.nin,S,this.satoshisBN,this.flags)}catch(t){A=!1}if(!A&&this.flags&c.SCRIPT_VERIFY_NULLFAIL&&_.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(A?c.true:c.false),R===s.OP_CHECKSIGVERIFY){if(!A)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case s.OP_CHECKMULTISIG:case s.OP_CHECKMULTISIGVERIFY:var U=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=H,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var F=++U;U+=H;var z=H+2;if(this.stack.lengthH)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var V=++U;if(U+=q,this.stack.length0;){if(_=t(-V),w=t(-F),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;var G;try{E=f.fromTxFormat(_),I=u.fromBuffer(w,!1),G=this.tx.verifySignature(E,I,this.nin,S,this.satoshisBN,this.flags)}catch(t){G=!1}G&&(V++,q--),F++,H--,q>H&&(A=!1)}for(;U-- >1;){if(!A&&this.flags&c.SCRIPT_VERIFY_NULLFAIL&&!z&&t(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;z>0&&z--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&c.SCRIPT_VERIFY_NULLDUMMY&&t(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(A?c.true:c.false),R===s.OP_CHECKMULTISIGVERIFY){if(!A)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;case s.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=t(-2),d=t(-1),h.length+d.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=r.concat([h,d]),this.stack.pop();break;case s.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=t(-2);var W=o.fromScriptNumBuffer(t(-1),O).toNumber();if(W<0||W>h.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var X=r.from(h);this.stack[this.stack.length-2]=X.slice(0,W),this.stack[this.stack.length-1]=X.slice(W);break;case s.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var Z=o.fromScriptNumBuffer(t(-1),O).toNumber();if(Z>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var J=t(-1);if(J=c._minimallyEncode(J),J.length>Z)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(J.length==Z){this.stack[this.stack.length-1]=J;break}var Q=0;J.length>0&&(Q=128&J[J.length-1],J[J.length-1]&=127);var $=r.alloc(Z);J.copy($,0);for(var tt=J.length-1;tt++0&&o0&&f0&&(i=n?i+" "+t.buf.toString("hex"):i+" "+t.len+" 0x"+t.buf.toString("hex"));else if(void 0!==a.reverseMap[r])n?0===r?i+=" 0":79===r?i+=" -1":i=i+" "+a(r).toString():i=i+" "+a(r).toString();else{var s=r.toString(16);s.length%2!=0&&(s="0"+s),i=n?i+" "+s:i+" 0x"+s}return i},y.prototype.toASM=function(){for(var t="",e=0;e"},y.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},y.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},y.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if(4!==e&&6!==e&&7!==e||65!==t.length?3!==e&&2!==e||33!==t.length||(r=!0):r=!0,r)return f.isValid(t)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===a.OP_HASH160&&20===t[1]&&t[t.length-1]===a.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t=this.chunks[this.chunks.length-1],e=t.buf;if(!e)return!1;var r;try{r=y.fromBuffer(e)}catch(t){if(t instanceof l.Script.InvalidBuffer)return!1;throw t}return r.classify()!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(t){return t.buf&&b.isBuffer(t.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},y.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(t){return t.buf&&b.isBuffer(t.buf)&&u.isTxDER(t.buf)})},y.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=y.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},y.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return d.isUndefined(this.chunks[1])?r.alloc(0):r.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return r.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},y.prototype.isPushOnly=function(){return d.every(this.chunks,function(t){return t.opcodenum<=a.OP_16})},y.types={},y.types.UNKNOWN="Unknown",y.types.PUBKEY_OUT="Pay to public key",y.types.PUBKEY_IN="Spend from public key",y.types.PUBKEYHASH_OUT="Pay to public key hash",y.types.PUBKEYHASH_IN="Spend from public key hash",y.types.SCRIPTHASH_OUT="Pay to script hash",y.types.SCRIPTHASH_IN="Spend from script hash",y.types.MULTISIG_OUT="Pay to multisig",y.types.MULTISIG_IN="Spend from multisig",y.types.DATA_OUT="Data push",y.OP_RETURN_STANDARD_SIZE=220,y.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var t=this.classifyOutput();return t!=y.types.UNKNOWN?t:this.classifyInput()},y.outputIdentifiers={},y.outputIdentifiers.PUBKEY_OUT=y.prototype.isPublicKeyOut,y.outputIdentifiers.PUBKEYHASH_OUT=y.prototype.isPublicKeyHashOut,y.outputIdentifiers.MULTISIG_OUT=y.prototype.isMultisigOut,y.outputIdentifiers.SCRIPTHASH_OUT=y.prototype.isScriptHashOut,y.outputIdentifiers.DATA_OUT=y.prototype.isDataOut,y.prototype.classifyOutput=function(){for(var t in y.outputIdentifiers)if(y.outputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.inputIdentifiers={},y.inputIdentifiers.PUBKEY_IN=y.prototype.isPublicKeyIn,y.inputIdentifiers.PUBKEYHASH_IN=y.prototype.isPublicKeyHashIn,y.inputIdentifiers.MULTISIG_IN=y.prototype.isMultisigIn,y.inputIdentifiers.SCRIPTHASH_IN=y.prototype.isScriptHashIn,y.prototype.classifyInput=function(){for(var t in y.inputIdentifiers)if(y.inputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.prototype.isStandard=function(){return this.classify()!==y.types.UNKNOWN},y.prototype.prepend=function(t){return this._addByType(t,!0),this},y.prototype.equals=function(t){if(h.checkState(t instanceof y,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e=0&&n=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:!(r.length<=65535)||n===a.OP_PUSHDATA2)},y.prototype._decodeOP_N=function(t){if(t===a.OP_0)return 0;if(t>=a.OP_1&&t<=a.OP_16)return t-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},y.prototype.getSignatureOperationsCount=function(t){t=!!d.isUndefined(t)||t;var e=this,r=0,n=a.OP_INVALIDOPCODE;return d.each(e.chunks,function(i){var s=i.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(t&&n>=a.OP_1&&n<=a.OP_16?r+=e._decodeOP_N(n):r+=20),n=s}),r},e.exports=y}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../networks":21,"../opcode":22,"../publickey":24,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],28:[function(t,e,r){e.exports=t("./transaction"),e.exports.Input=t("./input"),e.exports.Output=t("./output"),e.exports.UnspentOutput=t("./unspentoutput"),e.exports.Signature=t("./signature"),e.exports.Sighash=t("./sighash")},{"./input":29,"./output":35,"./sighash":36,"./signature":37,"./transaction":38,"./unspentoutput":39}],29:[function(t,e,r){e.exports=t("./input"),e.exports.PublicKey=t("./publickey"),e.exports.PublicKeyHash=t("./publickeyhash"),e.exports.MultiSig=t("./multisig.js"),e.exports.MultiSigScriptHash=t("./multisigscripthash.js")},{"./input":30,"./multisig.js":31,"./multisigscripthash.js":32,"./publickey":33,"./publickeyhash":34}],30:[function(t,e,r){"use strict";function n(t){return this instanceof n?t?this._fromObject(t):void 0:new n(t)}var i=t("lodash"),s=t("../../util/preconditions"),o=t("../../errors"),a=t("../../encoding/bufferwriter"),f=t("buffer"),u=t("../../util/buffer"),c=t("../../util/js"),h=t("../../script"),d=t("../sighash"),l=t("../output");n.MAXINT=4294967295,n.DEFAULT_SEQNUMBER=4294967295,n.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,n.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),n.fromObject=function(t){return s.checkArgument(i.isObject(t)),(new n)._fromObject(t)},n.prototype._fromObject=function(t){var e;if(e=i.isString(t.prevTxId)&&c.isHexa(t.prevTxId)?new f.Buffer(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof l?t.output:new l(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=i.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=i.isUndefined(t.sequenceNumber)?i.isUndefined(t.seqnum)?4294967295:t.seqnum:t.sequenceNumber,i.isUndefined(t.script)&&i.isUndefined(t.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},n.prototype.toObject=n.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},n.fromBufferReader=function(t){var e=new n;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},n.prototype.toBufferWriter=function(t){t||(t=new a),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},n.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(c.isHexa(t))this._scriptBuffer=new f.Buffer(t,"hex");else if(i.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new f.Buffer(t)}return this},n.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},n.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},n.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},n.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},n.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,d.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},n.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},n.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=n},{"../../encoding/bufferwriter":15,"../../errors":17,"../../script":25,"../../util/buffer":43,"../../util/js":45,"../../util/preconditions":46,"../output":35,"../sighash":36,buffer:98,lodash:156}],31:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),f.checkState(u.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=(t("../transaction"),t("./input")),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),l=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){if(t)return new l(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new l({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.output.script,s.output.satoshisBN),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},n.normalizeSignatures=function(t,e,r,n,i){return i.map(function(i){var s=null;return n=n.filter(function(n){if(s)return!0;var o=new l({signature:c.fromTxFormat(n),publicKey:i,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:c.SIGHASH_ALL});return o.signature.nhashtype=o.sigtype,!h.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script)||(s=o,!1)}),s||null})},n.OPCODES_SIZE=1,n.SIGNATURE_SIZE=73,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":24,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"../transaction":38,"./input":30,inherits:153,lodash:156}],32:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),f.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=t("./input"),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),l=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){if(t)return new l(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new l({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.redeemScript,s.output.satoshisBN),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript,this.output.satoshisBN)},n.OPCODES_SIZE=7,n.SIGNATURE_SIZE=74,n.PUBKEY_SIZE=34,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE+this.publicKeys.length*n.PUBKEY_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":24,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153,lodash:156}],33:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=(t("../../util/buffer"), +t("./input")),a=t("../output"),f=t("../sighash"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../signature");i(n,o),n.prototype.getSignatures=function(t,e,r,n){s.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL|c.SIGHASH_FORKID;var i=e.toPublicKey();return i.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:i,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:f.sign(t,e,n,r,this.output.script,this.output.satoshisBN),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},n.SCRIPT_MAX_SIZE=73,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/signature":11,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153}],34:[function(t,e,r){"use strict";function n(){f.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=t("../../util/buffer"),a=t("../../crypto/hash"),f=t("./input"),u=t("../output"),c=t("../sighash"),h=t("../../script"),d=t("../../crypto/signature"),l=t("../signature");i(n,f),n.prototype.getSignatures=function(t,e,r,n,i){return s.checkState(this.output instanceof u),i=i||a.sha256ripemd160(e.publicKey.toBuffer()),n=n||d.SIGHASH_ALL|d.SIGHASH_FORKID,o.equals(i,this.output.script.getPublicKeyHash())?[new l({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(t,e,n,r,this.output.script,this.output.satoshisBN),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(h.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(h.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},n.SCRIPT_MAX_SIZE=107,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/hash":8,"../../crypto/signature":11,"../../script":25,"../../util/buffer":43,"../../util/preconditions":46,"../output":35,"../sighash":36,"../signature":37,"./input":30,inherits:153}],35:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(!i.isObject(t))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=t.satoshis,a.isBuffer(t.script))this._scriptBuffer=t.script;else{var e;e=i.isString(t.script)&&f.isHexa(t.script)?new o.Buffer(t.script,"hex"):t.script,this.setScript(e)}}var i=t("lodash"),s=t("../crypto/bn"),o=t("buffer"),a=t("../util/buffer"),f=t("../util/js"),u=t("../encoding/bufferwriter"),c=t("../script"),h=t("../util/preconditions"),d=t("../errors");Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(n.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(t){t instanceof s?(this._satoshisBN=t,this._satoshis=t.toNumber()):i.isString(t)?(this._satoshis=parseInt(t),this._satoshisBN=s.fromNumber(this._satoshis)):(h.checkArgument(f.isNaturalNumber(t),"Output satoshis is not a natural number"),this._satoshisBN=s.fromNumber(t),this._satoshis=t),h.checkState(f.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.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"},Object.defineProperty(n.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(t){this._satoshisBN=t,this._satoshis=t.toNumber(),h.checkState(f.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.prototype.toObject=n.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},n.fromObject=function(t){return new n(t)},n.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(!(t instanceof d.Script.InvalidBuffer))throw t;this._script=null}},n.prototype.setScript=function(t){if(t instanceof c)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(i.isString(t))this._script=c.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!a.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},n.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},n.fromBufferReader=function(t){var e={};e.satoshis=t.readUInt64LEBN();var r=t.readVarintNum();return e.script=0!==r?t.read(r):new o.Buffer([]),new n(e)},n.prototype.toBufferWriter=function(t){t||(t=new u),t.writeUInt64LEBN(this._satoshisBN);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t},e.exports=n},{"../crypto/bn":6,"../encoding/bufferwriter":15,"../errors":17,"../script":25,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,buffer:98,lodash:156}],36:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n,i,s,o){var a=_(t,r,n,i,s,o);return l.sign(a,e,"little").set({nhashtype:r})}function i(t,e,r,n,i,s,o){p.checkArgument(!y.isUndefined(t)),p.checkArgument(!y.isUndefined(e)&&!y.isUndefined(e.nhashtype));var a=_(t,e.nhashtype,n,i,s,o);return l.verify(a,e,r,"little")}var s=t("buffer"),o=t("../crypto/signature"),a=t("../script"),f=t("./output"),u=t("../encoding/bufferreader"),c=t("../encoding/bufferwriter"),h=t("../crypto/bn"),d=t("../crypto/hash"),l=t("../crypto/ecdsa"),p=t("../util/preconditions"),b=t("../util/buffer"),g=t("../script/interpreter"),y=t("lodash"),m=g.SCRIPT_ENABLE_SIGHASH_FORKID,v=function(t,e,r,n,i){function s(t,e){var r=new c;y.isUndefined(e)?y.each(t.outputs,function(t){t.toBufferWriter(r)}):t.outputs[e].toBufferWriter(r);var n=r.toBuffer();return d.sha256sha256(n)}var a=t.inputs[r];p.checkArgument(i instanceof h,"For ForkId=0 signatures, satoshis or complete input must be provided");var f=b.emptyBuffer(32),l=b.emptyBuffer(32),g=b.emptyBuffer(32);e&o.SIGHASH_ANYONECANPAY||(f=function(t){var e=new c;y.each(t.inputs,function(t){e.writeReverse(t.prevTxId),e.writeUInt32LE(t.outputIndex)});var r=e.toBuffer();return d.sha256sha256(r)}(t)),e&o.SIGHASH_ANYONECANPAY||(31&e)==o.SIGHASH_SINGLE||(31&e)==o.SIGHASH_NONE||(l=function(t){var e=new c;y.each(t.inputs,function(t){e.writeUInt32LE(t.sequenceNumber)});var r=e.toBuffer();return d.sha256sha256(r)}(t)),(31&e)!=o.SIGHASH_SINGLE&&(31&e)!=o.SIGHASH_NONE?g=s(t):(31&e)==o.SIGHASH_SINGLE&&r>>0);var _=m.toBuffer(),w=d.sha256sha256(_);return w=new u(w).readReverse()},_=function(e,n,i,l,p,b){var _=t("./transaction"),w=t("./input");y.isUndefined(b)&&(b=m);var S=_.shallowCopy(e);if(l=new a(l),b&g.SCRIPT_ENABLE_REPLAY_PROTECTION){n=(16711680|57005^n>>8)<<8|255&n}if(n&o.SIGHASH_FORKID&&b&g.SCRIPT_ENABLE_SIGHASH_FORKID)return v(S,n,i,l,p);l.removeCodeseparators();var E;for(E=0;E=S.outputs.length)return r.from("0000000000000000000000000000000000000000000000000000000000000001","hex");for(S.outputs.length=i+1,E=0;Er)return this._missingChange()?new f.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new f.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+e)}},n.prototype._missingChange=function(){return!this._changeScript},n.prototype._hasDustOutputs=function(t){if(!t.disableDustOutputs){var e,r;for(e in this.outputs)if(r=this.outputs[e],r.satoshis"},n.prototype.toBuffer=function(){var t=new d;return this.toBufferWriter(t).toBuffer()},n.prototype.toBufferWriter=function(t){return t.writeInt32LE(this.version),t.writeVarintNum(this.inputs.length),i.each(this.inputs,function(e){e.toBufferWriter(t)}),t.writeVarintNum(this.outputs.length),i.each(this.outputs,function(e){e.toBufferWriter(t)}),t.writeUInt32LE(this.nLockTime),t},n.prototype.fromBuffer=function(t){var e=new h(t);return this.fromBufferReader(e)},n.prototype.fromBufferReader=function(t){s.checkArgument(!t.finished(),"No transaction data received");var e,r,n;for(this.version=t.readInt32LE(),r=t.readVarintNum(),e=0;e=n.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new f.Transaction.BlockHeightTooHigh;if(t<0)throw new f.Transaction.NLockTimeOutOfRange;for(var e=0;e0?(this._changeIndex=this.outputs.length,this._addOutput(new E({script:this._changeScript,satoshis:r}))):this._changeIndex=void 0}},n.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},n.prototype._estimateFee=function(){var t=this._estimateSize(),e=this._getUnspentValue();return n._estimateFee(t,e,this._feePerKb)},n.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},n.prototype._clearSignatures=function(){i.each(this.inputs,function(t){t.clearSignatures()})},n._estimateFee=function(t,e,r){return e>Math.ceil(t/1e3)*(r||n.FEE_PER_KB)&&(t+=n.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(t/1e3)*(r||n.FEE_PER_KB)},n.prototype._estimateSize=function(){var t=n.MAXIMUM_EXTRA_SIZE;return i.each(this.inputs,function(e){t+=e._estimateSize()}),i.each(this.outputs,function(e){t+=e.script.toBuffer().length+9}),t},n.prototype._removeOutput=function(t){var e=this.outputs[t];this.outputs=i.without(this.outputs,e),this._outputAmount=void 0},n.prototype.removeOutput=function(t){this._removeOutput(t),this._updateChangeOutput()},n.prototype.sort=function(){return this.sortInputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return a(t.prevTxId,e.prevTxId)||t.outputIndex-e.outputIndex}),e}),this.sortOutputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return t.satoshis-e.satoshis||a(t.script.toBuffer(),e.script.toBuffer())}),e}),this},n.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},n.prototype.sortOutputs=function(t){var e=t(this.outputs);return this._newOutputOrder(e)},n.prototype.sortInputs=function(t){return this.inputs=t(this.inputs),this._clearSignatures(),this},n.prototype._newOutputOrder=function(t){if(this.outputs.length!==t.length||0!==i.difference(this.outputs,t).length)throw new f.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var e=this.outputs[this._changeIndex];this._changeIndex=i.findIndex(t,e)}return this.outputs=t,this},n.prototype.removeInput=function(t,e){var r;if((r=!e&&i.isNumber(t)?t:i.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===t&&r.outputIndex===e}))<0||r>=this.inputs.length)throw new f.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},n.prototype.sign=function(t,e){s.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return i.isArray(t)?(i.each(t,function(t){r.sign(t,e)}),this):(i.each(this.getSignatures(t,e),function(t){r.applySignature(t)}),this)},n.prototype.getSignatures=function(t,e){t=new k(t),e=e||p.SIGHASH_ALL|p.SIGHASH_FORKID;var r=this,n=[],s=l.sha256ripemd160(t.publicKey.toBuffer());return i.each(this.inputs,function(o,a){i.each(o.getSignatures(r,t,a,e,s),function(t){n.push(t)})}),n},n.prototype.applySignature=function(t){return this.inputs[t.inputIndex].addSignature(this,t),this},n.prototype.isFullySigned=function(){return i.each(this.inputs,function(t){if(t.isFullySigned===m.prototype.isFullySigned)throw new f.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),i.every(i.map(this.inputs,function(t){return t.isFullySigned()}))},n.prototype.isValidSignature=function(t){var e=this;if(this.inputs[t.inputIndex].isValidSignature===m.prototype.isValidSignature)throw new f.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[t.inputIndex].isValidSignature(e,t)},n.prototype.verifySignature=function(t,e,r,n,i,s){return b.verify(this,t,e,r,n,i,s)},n.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var t=new A(0),e=0;e1e6)return"transaction over the maximum block size";var s={};for(e=0;e100)return"coinbase transaction script size invalid"}else for(e=0;e=m.MAXINT-1&&(e.sequenceNumber=m.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=n}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../privatekey":23,"../script":25,"../util/buffer":43,"../util/js":45,"../util/preconditions":46,"./input":29,"./output":35,"./sighash":36,"./unspentoutput":39,buffer:98,"buffer-compare":96,lodash:156}],39:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);s.checkArgument(i.isObject(t),"Must provide an object from where to extract data");var e=t.address?new f(t.address):void 0,r=t.txid?t.txid:t.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",t);var c=i.isUndefined(t.vout)?t.outputIndex:t.vout;if(!i.isNumber(c))throw new Error("Invalid outputIndex, received "+c);s.checkArgument(!i.isUndefined(t.scriptPubKey)||!i.isUndefined(t.script),"Must provide the scriptPubKey for that output!");var h=new a(t.scriptPubKey||t.script);s.checkArgument(!i.isUndefined(t.amount)||!i.isUndefined(t.satoshis),"Must provide an amount for the output");var d=i.isUndefined(t.amount)?t.satoshis:new u.fromBTC(t.amount).toSatoshis();s.checkArgument(i.isNumber(d),"Amount must be a number"),o.defineImmutable(this,{address:e,txId:r,outputIndex:c,script:h,satoshis:d})}var i=t("lodash"),s=t("../util/preconditions"),o=t("../util/js"),a=t("../script"),f=t("../address"),u=t("../unit");n.prototype.inspect=function(){return""},n.prototype.toString=function(){return this.txId+":"+this.outputIndex},n.fromObject=function(t){return new n(t)},n.prototype.toObject=n.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:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=n},{"../address":1,"../script":25,"../unit":40,"../util/js":45,"../util/preconditions":46,lodash:156}],40:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(i.isNumber(e)){if(e<=0)throw new s.Unit.InvalidRate(e);t/=e,e=n.BTC}this._value=this._from(t,e);var r=this,o=function(t){Object.defineProperty(r,t,{get:function(){return r.to(t)},enumerable:!0})};Object.keys(a).forEach(o)}var i=t("lodash"),s=t("./errors"),o=t("./util/preconditions"),a={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(a).forEach(function(t){n[t]=t}),n.fromObject=function(t){return o.checkArgument(i.isObject(t),"Argument is expected to be an object"),new n(t.amount,t.code)},n.fromBTC=function(t){return new n(t,n.BTC)},n.fromMillis=n.fromMilis=function(t){return new n(t,n.mBTC)},n.fromMicros=n.fromBits=function(t){return new n(t,n.bits)},n.fromSatoshis=function(t){return new n(t,n.satoshis)},n.fromFiat=function(t,e){return new n(t,e)},n.prototype._from=function(t,e){if(!a[e])throw new s.Unit.UnknownCode(e);return parseInt((t*a[e][0]).toFixed())},n.prototype.to=function(t){if(i.isNumber(t)){if(t<=0)throw new s.Unit.InvalidRate(t);return parseFloat((this.BTC*t).toFixed(2))}if(!a[t])throw new s.Unit.UnknownCode(t);var e=this._value/a[t][0];return parseFloat(e.toFixed(a[t][1]))},n.prototype.toBTC=function(){return this.to(n.BTC)},n.prototype.toMillis=n.prototype.toMilis=function(){return this.to(n.mBTC)},n.prototype.toMicros=n.prototype.toBits=function(){return this.to(n.bits)},n.prototype.toSatoshis=function(){return this.to(n.satoshis)},n.prototype.atRate=function(t){return this.to(t)},n.prototype.toString=function(){return this.satoshis+" satoshis"},n.prototype.toObject=n.prototype.toJSON=function(){return{amount:this.BTC,code:n.BTC}},n.prototype.inspect=function(){return""},e.exports=n},{"./errors":17,"./util/preconditions":46,lodash:156}],41:[function(t,e,r){"use strict";var n=t("lodash"),i=t("url"),s=t("./address"),o=t("./unit"),a=function(t,e){if(!(this instanceof a))return new a(t,e);if(this.extras={},this.knownParams=e||[],this.address=this.network=this.amount=this.message=null,"string"==typeof t){var r=a.parse(t);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof t)throw new TypeError("Unrecognized data format.");this._fromObject(t)}};a.fromString=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function(t){return new a(t)},a.isValid=function(t,e){try{new a(t,e)}catch(t){return!1}return!0},a.parse=function(t){var e=i.parse(t,!0);if("bitcoincash:"!==e.protocol)throw new TypeError("Invalid bitcoin URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(t) +;return e.query.address=r&&r[1]||void 0,e.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(t){if(!s.isValid(t.address))throw new TypeError("Invalid bitcoin address");this.address=new s(t.address),this.network=this.address.network,this.amount=t.amount;for(var e in t)if("address"!==e&&"amount"!==e){if(/^req-/.exec(e)&&-1===this.knownParams.indexOf(e))throw Error("Unknown required argument "+e);var r=a.Members.indexOf(e)>-1?this:this.extras;r[e]=t[e]}},a.prototype._parseAmount=function(t){if(t=Number(t),isNaN(t))throw new TypeError("Invalid amount");return o.fromBTC(t).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function(){for(var t={},e=0;e"},e.exports=a},{"./address":1,"./unit":40,lodash:156,url:211}],42:[function(t,e,r){"use strict";function n(t){s.checkArgument(t instanceof Array,"Must be Array");for(var e="",r=0;r>24&255),e.push(t>>16&255),e.push(t>>8&255),e.push(255&t),r.from(e)},integerFromBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function(t){for(var e=new i.Buffer(t.length),r=0;r>e!=0),"value "+c),s=s<=r;)o-=r,a.push(s>>o&f)}return i?n.checkState(!(o>=e||s<0&&a.push(s<=0}}},{lodash:156}],46:[function(t,e,r){"use strict";var n=t("../errors"),i=t("lodash");e.exports={checkState:function(t,e){if(!t)throw new n.InvalidState(e)},checkArgument:function(t,e,r,i){if(!t)throw new n.InvalidArgument(e,r,i)},checkArgumentType:function(e,r,s){if(s=s||"(unknown name)",i.isString(r)){if("Buffer"===r){var o=t("buffer");if(!o.Buffer.isBuffer(e))throw new n.InvalidArgumentType(e,r,s)}else if(typeof e!==r)throw new n.InvalidArgumentType(e,r,s)}else if(!(e instanceof r))throw new n.InvalidArgumentType(e,r.name,s)}}},{"../errors":17,buffer:98,lodash:156}],47:[function(t,e,r){var n=r;n.bignum=t("bn.js"),n.define=t("./asn1/api").define,n.base=t("./asn1/base"),n.constants=t("./asn1/constants"),n.decoders=t("./asn1/decoders"),n.encoders=t("./asn1/encoders")},{"./asn1/api":48,"./asn1/base":50,"./asn1/constants":54,"./asn1/decoders":56,"./asn1/encoders":59,"bn.js":64}],48:[function(t,e,r){function n(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}var i=t("../asn1"),s=t("inherits");r.define=function(t,e){return new n(t,e)},n.prototype._createNamed=function(e){var r;try{r=t("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){r=function(t){this._initNamed(t)}}return s(r,e),r.prototype._initNamed=function(t){e.call(this,t)},new r(this)},n.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},n.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},n.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},n.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},{"../asn1":47,inherits:153,vm:216}],49:[function(t,e,r){function n(t,e){if(o.call(this,e),!a.isBuffer(t))return void this.error("Input not Buffer");this.base=t,this.offset=0,this.length=t.length}function i(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof i||(t=new i(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=a.byteLength(t);else{if(!a.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}var s=t("inherits"),o=t("../base").Reporter,a=t("buffer").Buffer;s(n,o),r.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:o.prototype.save.call(this)}},n.prototype.restore=function(t){var e=new n(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,o.prototype.restore.call(this,t.reporter),e},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},n.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},n.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},r.EncoderBuffer=i,i.prototype.join=function(t,e){return t||(t=new a(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(t,e),e+=r.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):a.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},{"../base":50,buffer:98,inherits:153}],50:[function(t,e,r){var n=r;n.Reporter=t("./reporter").Reporter,n.DecoderBuffer=t("./buffer").DecoderBuffer,n.EncoderBuffer=t("./buffer").EncoderBuffer,n.Node=t("./node")},{"./buffer":49,"./node":51,"./reporter":52}],51:[function(t,e,r){function n(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var i=t("../base").Reporter,s=t("../base").EncoderBuffer,o=t("../base").DecoderBuffer,a=t("minimalistic-assert"),f=["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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(f),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];e.exports=n;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];n.prototype.clone=function(){var t=this._baseState,e={};h.forEach(function(r){e[r]=t[r]});var r=new this.constructor(e.parent);return r._baseState=e,r},n.prototype._wrap=function(){var t=this._baseState;u.forEach(function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},n.prototype._init=function(t){var e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),a.equal(e.children.length,1,"Root node can have only one child")},n.prototype._useArgs=function(t){var e=this._baseState,r=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach(function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r}),e}))},c.forEach(function(t){n.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),f.forEach(function(t){n.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}}),n.prototype.use=function(t){a(t);var e=this._baseState;return a(null===e.use),e.use=t,this},n.prototype.optional=function(){return this._baseState.optional=!0,this},n.prototype.def=function(t){var e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},n.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},n.prototype.implicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},n.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},n.prototype.key=function(t){var e=this._baseState;return a(null===e.key),e.key=t,this},n.prototype.any=function(){return this._baseState.any=!0,this},n.prototype.choice=function(t){var e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},n.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},n.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var n=r.default,i=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){var a=null;if(null!==r.explicit?a=r.explicit:null!==r.implicit?a=r.implicit:null!==r.tag&&(a=r.tag),null!==a||r.any){if(i=this._peekTag(t,a,r.any),t.isError(i))return i}else{var f=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),i=!0}catch(t){i=!1}t.restore(f)}}var u;if(r.obj&&i&&(u=t.enterObject()),i){if(null!==r.explicit){var c=this._decodeTag(t,r.explicit);if(t.isError(c))return c;t=c}var h=t.offset;if(null===r.use&&null===r.choice){if(r.any)var f=t.save();var d=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(d))return d;r.any?n=t.raw(f):t=d}if(e&&e.track&&null!==r.tag&&e.track(t.path(),h,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),n=r.any?n:null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(t,e)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(l,e)}}return r.obj&&i&&(n=t.leaveObject(u)),null===r.key||null===n&&!0!==i?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},n.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},n.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},n.prototype._decodeChoice=function(t,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(s){var o=t.save(),a=r.choice[s];try{var f=a._decode(t,e);if(t.isError(f))return!1;n={type:s,value:f},i=!0}catch(e){return t.restore(o),!1}return!0},this),i?n:t.error("Choice not matched")},n.prototype._createEncoderBuffer=function(t){return new s(t,this.reporter)},n.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n.default||n.default!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},n.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var s=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var o=null,a=!1;if(n.any)s=this._createEncoderBuffer(t);else if(n.choice)s=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)o=n.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i},this).filter(function(t){return t}),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(r){var n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)},f))}else null!==n.use?s=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),a=!0);var s;if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,c=null===n.implicit?"universal":"context";null===u?null===n.use&&e.error("Tag could be ommited only for .use()"):null===n.use&&(s=this._encodeComposite(u,a,c,o))}return null!==n.explicit&&(s=this._encodeComposite(n.explicit,!1,"context",s)),s},n.prototype._encodeChoice=function(t,e){var r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},n.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},n.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},n.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},{"../base":50,"minimalistic-assert":160}],52:[function(t,e,r){function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function i(t,e){this.path=t,this.rethrow(e)}var s=t("inherits");r.Reporter=n,n.prototype.isError=function(t){return t instanceof i},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof i;if(e=n?t:new i(r.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},s(i,Error),i.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{inherits:153}],53:[function(t,e,r){var n=t("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n._reverse(r.tagClass),r.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"},r.tagByName=n._reverse(r.tag)},{"../constants":54}],54:[function(t,e,r){var n=r;n._reverse=function(t){var e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r|=0);var n=t[r];e[n]=r}),e},n.der=t("./der")},{"./der":53}],55:[function(t,e,r){function n(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new i,this.tree._init(t.body)}function i(t){u.Node.call(this,"der",t)}function s(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=h.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){var s=r;for(r=0;128==(128&s);){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=127&s}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:h.tag[r]}}function o(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var s=0;s=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=h.tagClassByName[r||"universal"]<<6)}var a=t("inherits"),f=t("buffer").Buffer,u=t("../../asn1"),c=u.base,h=u.constants.der;e.exports=n,n.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},a(i,c.Node),i.prototype._encodeComposite=function(t,e,r,n){var i=o(t,e,r,this.reporter);if(n.length<128){var s=new f(2);return s[0]=i,s[1]=n.length,this._createEncoderBuffer([s,n])}for(var a=1,u=n.length;u>=256;u>>=8)a++;var s=new f(2+a);s[0]=i,s[1]=128|a;for(var u=1+a,c=n.length;c>0;u--,c>>=8)s[u]=255&c;return this._createEncoderBuffer([s,n])},i.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new f(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}for(var i=0,n=0;n=128;s>>=7)i++}for(var o=new f(i),a=o.length-1,n=t.length-1;n>=0;n--){var s=t[n];for(o[a--]=127&s;(s>>=7)>0;)o[a--]=128|127&s}return this._createEncoderBuffer(o)},i.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[s(n.getFullYear()),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[s(n.getFullYear()%100),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!f.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new f(r)}if(f.isBuffer(t)){var n=t.length;0===t.length&&n++;var i=new f(n);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var n=1,s=t;s>=256;s>>=8)n++;for(var i=new Array(n),s=i.length-1;s>=0;s--)i[s]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new f(i))},i.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},i.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},i.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),s.length!==i.defaultBuffer.length)return!1;for(n=0;n=0;a--)if(f[a]!==u[a])return!1;for(a=f.length-1;a>=0;a--)if(o=f[a],!l(t[o],e[o],r,n))return!1;return!0}function g(t,e,r){l(t,e,!0)&&h(t,e,r,"notDeepStrictEqual",g)}function y(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function m(t){var e;try{t()}catch(t){e=t}return e}function v(t,e,r,n){var i +;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=m(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&h(i,r,"Missing expected exception"+n);var s="string"==typeof n,o=!t&&_.isError(i),a=!t&&i&&!r;if((o&&s&&y(i,r)||a)&&h(i,r,"Got unwanted exception"+n),t&&i&&r&&!y(i,r)||!t&&i)throw i}var _=t("util/"),w=Object.prototype.hasOwnProperty,S=Array.prototype.slice,E=function(){return"foo"===function(){}.name}(),I=e.exports=d,k=/\s*function\s+([^\(\s]*)\s*/;I.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||h;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=a(e),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},_.inherits(I.AssertionError,Error),I.fail=h,I.ok=d,I.equal=function(t,e,r){t!=e&&h(t,e,r,"==",I.equal)},I.notEqual=function(t,e,r){t==e&&h(t,e,r,"!=",I.notEqual)},I.deepEqual=function(t,e,r){l(t,e,!1)||h(t,e,r,"deepEqual",I.deepEqual)},I.deepStrictEqual=function(t,e,r){l(t,e,!0)||h(t,e,r,"deepStrictEqual",I.deepStrictEqual)},I.notDeepEqual=function(t,e,r){l(t,e,!1)&&h(t,e,r,"notDeepEqual",I.notDeepEqual)},I.notDeepStrictEqual=g,I.strictEqual=function(t,e,r){t!==e&&h(t,e,r,"===",I.strictEqual)},I.notStrictEqual=function(t,e,r){t===e&&h(t,e,r,"!==",I.notStrictEqual)},I.throws=function(t,e,r){v(!0,t,e,r)},I.doesNotThrow=function(t,e,r){v(!1,t,e,r)},I.ifError=function(t){if(t)throw t};var A=Object.keys||function(t){var e=[];for(var r in t)w.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":215}],62:[function(t,e,r){var n=t("safe-buffer").Buffer;e.exports=function(t){function e(e){if(0===e.length)return"";for(var r=[0],n=0;n0;)r.push(s%o),s=s/o|0}for(var a="",f=0;0===e[f]&&f=0;--u)a+=t[r[u]];return a}function r(t){if(0===t.length)return n.allocUnsafe(0);for(var e=[0],r=0;r>=8;for(;u>0;)e.push(255&u),u>>=8}for(var c=0;t[c]===a&&c0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function s(t){var e,r,i,s,o,a=t.length;s=n(t),o=new h(3*a/4-s),r=s>0?a-4:a;var f=0;for(e=0;e>16&255,o[f++]=i>>8&255,o[f++]=255&i;return 2===s?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,o[f++]=255&i):1===s&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=255&i),o}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,r){for(var n,i=[],s=e;sf?f:o+16383));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),s.push(i),s.join("")}r.byteLength=i,r.toByteArray=s,r.fromByteArray=f;for(var u=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=d.length;l=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function a(t,e,r,n){for(var i=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return i}function f(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,f=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,h=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;i=0|t.words[p],s=0|e.words[l],o=i*s+h,c+=o/67108864|0,h=67108863&o}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0,i+=o>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}function h(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}function l(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function g(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function m(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function v(t){m.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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"==typeof e?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var _;try{_=t("buffer").Buffer}catch(t){}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-s&4194303,(s+=24)>=26&&(s-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,f=Math.min(s,s-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var w=["","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"],S=[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],E=[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];s.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,s=0,o=0;o>>24-i&16777215,r=0!==s||o!==this.length-1?w[6-f.length]+f+r:f+r,i+=2,i>=26&&(i-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=S[t],c=E[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?d+r:w[u-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return n(void 0!==_),this.toArrayLike(_,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var o,a,f="le"===e,u=new t(s),c=this.clone();if(f){for(a=0;!c.isZero();a++)o=c.andln(255),c.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,g=0|o[2],y=8191&g,m=g>>>13,v=0|o[3],_=8191&v,w=v>>>13,S=0|o[4],E=8191&S,I=S>>>13,k=0|o[5],A=8191&k,P=k>>>13,O=0|o[6],x=8191&O,B=O>>>13,R=0|o[7],T=8191&R,M=R>>>13,C=0|o[8],N=8191&C,U=C>>>13,j=0|o[9],L=8191&j,D=j>>>13,K=0|a[0],H=8191&K,F=K>>>13,z=0|a[1],q=8191&z,V=z>>>13,Y=0|a[2],G=8191&Y,W=Y>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ft=8191&at,ut=at>>>13,ct=0|a[8],ht=8191&ct,dt=ct>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,H),i=Math.imul(h,F),i=i+Math.imul(d,H)|0,s=Math.imul(d,F);var gt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,H),i=Math.imul(p,F),i=i+Math.imul(b,H)|0,s=Math.imul(b,F),n=n+Math.imul(h,q)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(d,q)|0,s=s+Math.imul(d,V)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=Math.imul(y,F),i=i+Math.imul(m,H)|0,s=Math.imul(m,F),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,V)|0,i=i+Math.imul(b,q)|0,s=s+Math.imul(b,V)|0,n=n+Math.imul(h,G)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(d,G)|0,s=s+Math.imul(d,W)|0;var mt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(_,H),i=Math.imul(_,F),i=i+Math.imul(w,H)|0,s=Math.imul(w,F),n=n+Math.imul(y,q)|0,i=i+Math.imul(y,V)|0,i=i+Math.imul(m,q)|0,s=s+Math.imul(m,V)|0,n=n+Math.imul(p,G)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(b,G)|0,s=s+Math.imul(b,W)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(d,Z)|0,s=s+Math.imul(d,J)|0;var vt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,H),i=Math.imul(E,F),i=i+Math.imul(I,H)|0,s=Math.imul(I,F),n=n+Math.imul(_,q)|0,i=i+Math.imul(_,V)|0,i=i+Math.imul(w,q)|0,s=s+Math.imul(w,V)|0,n=n+Math.imul(y,G)|0,i=i+Math.imul(y,W)|0,i=i+Math.imul(m,G)|0,s=s+Math.imul(m,W)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(b,Z)|0,s=s+Math.imul(b,J)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(d,$)|0,s=s+Math.imul(d,tt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,H),i=Math.imul(A,F),i=i+Math.imul(P,H)|0,s=Math.imul(P,F),n=n+Math.imul(E,q)|0,i=i+Math.imul(E,V)|0,i=i+Math.imul(I,q)|0,s=s+Math.imul(I,V)|0,n=n+Math.imul(_,G)|0,i=i+Math.imul(_,W)|0,i=i+Math.imul(w,G)|0,s=s+Math.imul(w,W)|0,n=n+Math.imul(y,Z)|0,i=i+Math.imul(y,J)|0,i=i+Math.imul(m,Z)|0,s=s+Math.imul(m,J)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(d,rt)|0,s=s+Math.imul(d,nt)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,H),i=Math.imul(x,F),i=i+Math.imul(B,H)|0,s=Math.imul(B,F),n=n+Math.imul(A,q)|0,i=i+Math.imul(A,V)|0,i=i+Math.imul(P,q)|0,s=s+Math.imul(P,V)|0,n=n+Math.imul(E,G)|0,i=i+Math.imul(E,W)|0,i=i+Math.imul(I,G)|0,s=s+Math.imul(I,W)|0,n=n+Math.imul(_,Z)|0,i=i+Math.imul(_,J)|0,i=i+Math.imul(w,Z)|0,s=s+Math.imul(w,J)|0,n=n+Math.imul(y,$)|0,i=i+Math.imul(y,tt)|0,i=i+Math.imul(m,$)|0,s=s+Math.imul(m,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0,n=n+Math.imul(h,st)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(d,st)|0,s=s+Math.imul(d,ot)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,H),i=Math.imul(T,F),i=i+Math.imul(M,H)|0,s=Math.imul(M,F),n=n+Math.imul(x,q)|0,i=i+Math.imul(x,V)|0,i=i+Math.imul(B,q)|0,s=s+Math.imul(B,V)|0,n=n+Math.imul(A,G)|0,i=i+Math.imul(A,W)|0,i=i+Math.imul(P,G)|0,s=s+Math.imul(P,W)|0,n=n+Math.imul(E,Z)|0,i=i+Math.imul(E,J)|0,i=i+Math.imul(I,Z)|0,s=s+Math.imul(I,J)|0,n=n+Math.imul(_,$)|0,i=i+Math.imul(_,tt)|0,i=i+Math.imul(w,$)|0,s=s+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,i=i+Math.imul(m,rt)|0,s=s+Math.imul(m,nt)|0,n=n+Math.imul(p,st)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,n=n+Math.imul(h,ft)|0,i=i+Math.imul(h,ut)|0,i=i+Math.imul(d,ft)|0,s=s+Math.imul(d,ut)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=Math.imul(N,F),i=i+Math.imul(U,H)|0,s=Math.imul(U,F),n=n+Math.imul(T,q)|0,i=i+Math.imul(T,V)|0,i=i+Math.imul(M,q)|0,s=s+Math.imul(M,V)|0,n=n+Math.imul(x,G)|0,i=i+Math.imul(x,W)|0,i=i+Math.imul(B,G)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(A,Z)|0,i=i+Math.imul(A,J)|0,i=i+Math.imul(P,Z)|0,s=s+Math.imul(P,J)|0,n=n+Math.imul(E,$)|0,i=i+Math.imul(E,tt)|0,i=i+Math.imul(I,$)|0,s=s+Math.imul(I,tt)|0,n=n+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,i=i+Math.imul(w,rt)|0,s=s+Math.imul(w,nt)|0,n=n+Math.imul(y,st)|0,i=i+Math.imul(y,ot)|0,i=i+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0,n=n+Math.imul(p,ft)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(b,ft)|0,s=s+Math.imul(b,ut)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,dt)|0,i=i+Math.imul(d,ht)|0,s=s+Math.imul(d,dt)|0;var It=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,H),i=Math.imul(L,F),i=i+Math.imul(D,H)|0,s=Math.imul(D,F),n=n+Math.imul(N,q)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(U,q)|0,s=s+Math.imul(U,V)|0,n=n+Math.imul(T,G)|0,i=i+Math.imul(T,W)|0,i=i+Math.imul(M,G)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(x,Z)|0,i=i+Math.imul(x,J)|0,i=i+Math.imul(B,Z)|0,s=s+Math.imul(B,J)|0,n=n+Math.imul(A,$)|0,i=i+Math.imul(A,tt)|0,i=i+Math.imul(P,$)|0,s=s+Math.imul(P,tt)|0,n=n+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,i=i+Math.imul(I,rt)|0,s=s+Math.imul(I,nt)|0,n=n+Math.imul(_,st)|0,i=i+Math.imul(_,ot)|0,i=i+Math.imul(w,st)|0,s=s+Math.imul(w,ot)|0,n=n+Math.imul(y,ft)|0,i=i+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,s=s+Math.imul(m,ut)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,dt)|0,i=i+Math.imul(b,ht)|0,s=s+Math.imul(b,dt)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,bt)|0,i=i+Math.imul(d,pt)|0,s=s+Math.imul(d,bt)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,q),i=Math.imul(L,V),i=i+Math.imul(D,q)|0,s=Math.imul(D,V),n=n+Math.imul(N,G)|0,i=i+Math.imul(N,W)|0,i=i+Math.imul(U,G)|0,s=s+Math.imul(U,W)|0,n=n+Math.imul(T,Z)|0,i=i+Math.imul(T,J)|0,i=i+Math.imul(M,Z)|0,s=s+Math.imul(M,J)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(B,$)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(A,rt)|0,i=i+Math.imul(A,nt)|0,i=i+Math.imul(P,rt)|0,s=s+Math.imul(P,nt)|0,n=n+Math.imul(E,st)|0,i=i+Math.imul(E,ot)|0,i=i+Math.imul(I,st)|0,s=s+Math.imul(I,ot)|0,n=n+Math.imul(_,ft)|0,i=i+Math.imul(_,ut)|0,i=i+Math.imul(w,ft)|0,s=s+Math.imul(w,ut)|0,n=n+Math.imul(y,ht)|0,i=i+Math.imul(y,dt)|0,i=i+Math.imul(m,ht)|0,s=s+Math.imul(m,dt)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,bt)|0,i=i+Math.imul(b,pt)|0,s=s+Math.imul(b,bt)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,G),i=Math.imul(L,W),i=i+Math.imul(D,G)|0,s=Math.imul(D,W),n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(U,Z)|0,s=s+Math.imul(U,J)|0,n=n+Math.imul(T,$)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(A,st)|0,i=i+Math.imul(A,ot)|0,i=i+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,n=n+Math.imul(E,ft)|0,i=i+Math.imul(E,ut)|0,i=i+Math.imul(I,ft)|0,s=s+Math.imul(I,ut)|0,n=n+Math.imul(_,ht)|0,i=i+Math.imul(_,dt)|0,i=i+Math.imul(w,ht)|0,s=s+Math.imul(w,dt)|0,n=n+Math.imul(y,pt)|0,i=i+Math.imul(y,bt)|0,i=i+Math.imul(m,pt)|0,s=s+Math.imul(m,bt)|0;var Pt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,Z),i=Math.imul(L,J),i=i+Math.imul(D,Z)|0,s=Math.imul(D,J),n=n+Math.imul(N,$)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(U,$)|0,s=s+Math.imul(U,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(x,st)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(A,ft)|0,i=i+Math.imul(A,ut)|0,i=i+Math.imul(P,ft)|0,s=s+Math.imul(P,ut)|0,n=n+Math.imul(E,ht)|0,i=i+Math.imul(E,dt)|0,i=i+Math.imul(I,ht)|0,s=s+Math.imul(I,dt)|0,n=n+Math.imul(_,pt)|0,i=i+Math.imul(_,bt)|0,i=i+Math.imul(w,pt)|0,s=s+Math.imul(w,bt)|0;var Ot=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,$),i=Math.imul(L,tt),i=i+Math.imul(D,$)|0,s=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(U,rt)|0,s=s+Math.imul(U,nt)|0,n=n+Math.imul(T,st)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(x,ft)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(B,ft)|0,s=s+Math.imul(B,ut)|0,n=n+Math.imul(A,ht)|0,i=i+Math.imul(A,dt)|0,i=i+Math.imul(P,ht)|0,s=s+Math.imul(P,dt)|0,n=n+Math.imul(E,pt)|0,i=i+Math.imul(E,bt)|0,i=i+Math.imul(I,pt)|0,s=s+Math.imul(I,bt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,s=Math.imul(D,nt),n=n+Math.imul(N,st)|0,i=i+Math.imul(N,ot)|0,i=i+Math.imul(U,st)|0,s=s+Math.imul(U,ot)|0,n=n+Math.imul(T,ft)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(M,ft)|0,s=s+Math.imul(M,ut)|0,n=n+Math.imul(x,ht)|0,i=i+Math.imul(x,dt)|0,i=i+Math.imul(B,ht)|0,s=s+Math.imul(B,dt)|0,n=n+Math.imul(A,pt)|0,i=i+Math.imul(A,bt)|0,i=i+Math.imul(P,pt)|0,s=s+Math.imul(P,bt)|0;var Bt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(L,st),i=Math.imul(L,ot),i=i+Math.imul(D,st)|0,s=Math.imul(D,ot),n=n+Math.imul(N,ft)|0,i=i+Math.imul(N,ut)|0,i=i+Math.imul(U,ft)|0,s=s+Math.imul(U,ut)|0,n=n+Math.imul(T,ht)|0,i=i+Math.imul(T,dt)|0,i=i+Math.imul(M,ht)|0,s=s+Math.imul(M,dt)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,bt)|0,i=i+Math.imul(B,pt)|0,s=s+Math.imul(B,bt)|0;var Rt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(L,ft),i=Math.imul(L,ut),i=i+Math.imul(D,ft)|0,s=Math.imul(D,ut),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,dt)|0,i=i+Math.imul(U,ht)|0,s=s+Math.imul(U,dt)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,bt)|0,i=i+Math.imul(M,pt)|0,s=s+Math.imul(M,bt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,ht),i=Math.imul(L,dt),i=i+Math.imul(D,ht)|0,s=Math.imul(D,dt),n=n+Math.imul(N,pt)|0,i=i+Math.imul(N,bt)|0,i=i+Math.imul(U,pt)|0,s=s+Math.imul(U,bt)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,pt),i=Math.imul(L,bt),i=i+Math.imul(D,pt)|0,s=Math.imul(D,bt);var Ct=(u+n|0)+((8191&i)<<13)|0;return u=(s+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=gt,f[1]=yt,f[2]=mt,f[3]=vt,f[4]=_t,f[5]=wt,f[6]=St,f[7]=Et,f[8]=It,f[9]=kt,f[10]=At,f[11]=Pt,f[12]=Ot,f[13]=xt,f[14]=Bt,f[15]=Rt,f[16]=Tt,f[17]=Mt,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};Math.imul||(I=u),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?I(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):h(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;n>=1;return n},d.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=f(t);if(0===e.length)return new s(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);var i;i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-s|h>>>s,c=h&a}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){ +return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,f=n.length-i.length;if("mod"!==e){a=new s(null),a.length=f+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var i,o,a;return 0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},s.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=new s(0),f=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(c),f.isub(h)),a.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(f)):(r.isub(e),a.isub(i),f.isub(o))}return{a:a,b:f,gcd:r.iushln(u)}},s.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,u=1;0==(e.words[0]&u)&&f<26;++f,u<<=1);if(f>0)for(e.iushrn(f);f-- >0;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(a),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var d;return d=0===e.cmpn(1)?i:o,d.cmpn(0)<0&&d.iadd(t),d},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new m(t)},s.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var k={k256:null,p224:null,p192:null,p25519:null};l.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},l.prototype.split=function(t,e){t.iushrn(this.n,0,e)},l.prototype.imulK=function(t){return t.imul(this.k)},i(p,l),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=s}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(k[t])return k[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new b;else if("p192"===t)e=new g;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return k[t]=e,e},m.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},m.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},m.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},m.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},m.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},m.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},m.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},m.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},m.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},m.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},m.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},m.prototype.isqr=function(t){return this.imul(t,t.clone())},m.prototype.sqr=function(t){return this.mul(t,t)},m.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),f=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=o;0!==l.cmp(a);){for(var b=l,g=0;0!==b.cmp(a);g++)b=b.redSqr();n(g=0;n--){for(var u=e.words[n],c=f-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}f=26}return i},m.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},m.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new v(t)},i(v,m),v.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},v.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},v.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},v.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},v.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:66}],65:[function(t,e,r){function n(t){this.rand=t}var i;if(e.exports=function(t){return i||(i=new n(null)),i.generate(t)},e.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&g]^e[y++],o=u[p>>>24]^c[b>>>16&255]^h[g>>>8&255]^d[255&l]^e[y++],a=u[b>>>24]^c[g>>>16&255]^h[l>>>8&255]^d[255&p]^e[y++],f=u[g>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[y++],l=s,p=o,b=a,g=f;return s=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&g])^e[y++],o=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[g>>>8&255]<<8|n[255&l])^e[y++],a=(n[b>>>24]<<24|n[g>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[y++],f=(n[g>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[y++],s>>>=0,o>>>=0,a>>>=0,f>>>=0,[s,o,a,f]}function o(t){this._key=n(t),this._reset()}var a=t("safe-buffer").Buffer,f=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],s=[[],[],[],[]],o=0,a=0,f=0;f<256;++f){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,r[o]=u,n[u]=o;var c=t[o],h=t[c],d=t[h],l=257*t[u]^16843008*u;i[0][o]=l<<24|l>>>8,i[1][o]=l<<16|l>>>16,i[2][o]=l<<8|l>>>24,i[3][o]=l,l=16843009*d^65537*h^257*c^16843008*o,s[0][u]=l<<24|l>>>8,s[1][u]=l<<16|l>>>16,s[2][u]=l<<8|l>>>24,s[3][u]=l,0===o?o=a=1:(o=c^t[t[t[d^c]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:s}}();o.blockSize=16,o.keySize=32,o.prototype.blockSize=o.blockSize,o.prototype.keySize=o.keySize,o.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],s=0;s>>24,o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o],o^=f[s/e|0]<<24):e>6&&s%e==4&&(o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o]),i[s]=i[s-e]^o}for(var a=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a},o.prototype.encryptBlockRaw=function(t){return t=n(t),s(t,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},o.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=a.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},o.prototype.decryptBlock=function(t){t=n(t);var e=t[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),i=a.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},o.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},e.exports.AES=o},{"safe-buffer":200}],68:[function(t,e,r){function n(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},i.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=a,r.createDecipheriv=o},{"./aes":67,"./authCipher":68,"./modes":80,"./streamCipher":83,"cipher-base":99,evp_bytestokey:135,inherits:153,"safe-buffer":200}],71:[function(t,e,r){function n(t,e,r){h.call(this),this._cache=new i,this._cipher=new d.AES(e),this._prev=u.from(r),this._mode=t,this._autopadding=!0}function i(){this.cache=u.allocUnsafe(0)}function s(t,e,r){var i=a[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=u.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=u.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new c(i.module,e,r):"auth"===i.type?new f(i.module,e,r):new n(i.module,e,r)}function o(t,e){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=l(e,!1,r.key,r.iv);return s(t,n.key,n.iv)}var a=t("./modes"),f=t("./authCipher"),u=t("safe-buffer").Buffer,c=t("./streamCipher"),h=t("cipher-base"),d=t("./aes"),l=t("evp_bytestokey");t("inherits")(n,h),n.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return u.concat(n)};var p=u.alloc(16,16);n.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(p))throw this._cipher.scrub(),new Error("data not multiple of block length")},n.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},i.prototype.add=function(t){this.cache=u.concat([this.cache,t])},i.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},i.prototype.flush=function(){for(var t=16-this.cache.length,e=u.allocUnsafe(t),r=-1;++r>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=o.alloc(16,0),this.cache=o.allocUnsafe(0)}var o=t("safe-buffer").Buffer,a=o.alloc(16,0);s.prototype.ghash=function(t){for(var e=-1;++e0;t--)s[t]=s[t]>>>1|(1&s[t-1])<<31;s[0]=s[0]>>>1,r&&(s[0]=s[0]^225<<24)}this.state=i(o)},s.prototype.update=function(t){this.cache=o.concat([this.cache,t]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(o.concat([this.cache,a],16)),this.ghash(i([0,t,0,e])),this.state},e.exports=s},{"safe-buffer":200}],73:[function(t,e,r){function n(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}e.exports=n},{}],74:[function(t,e,r){var n=t("buffer-xor");r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{"buffer-xor":97}],75:[function(t,e,r){function n(t,e,r){var n=e.length,o=s(e,t._cache);return t._cache=t._cache.slice(n),t._prev=i.concat([t._prev,r?e:o]),o}var i=t("safe-buffer").Buffer,s=t("buffer-xor");r.encrypt=function(t,e,r){for(var s,o=i.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),!(t._cache.length<=e.length)){o=i.concat([o,n(t,e,r)]);break}s=t._cache.length,o=i.concat([o,n(t,e.slice(0,s),r)]),e=e.slice(s)}return o}},{"buffer-xor":97,"safe-buffer":200}],76:[function(t,e,r){function n(t,e,r){for(var n,s,o,a=-1,f=0;++a<8;)n=t._cipher.encryptBlock(t._prev),s=e&1<<7-a?128:0,o=n[0]^s,f+=(128&o)>>a%8,t._prev=i(t._prev,r?s:o);return f}function i(t,e){var r=t.length,n=-1,i=s.allocUnsafe(t.length);for(t=s.concat([t,s.from([e])]);++n>7;return i}var s=t("safe-buffer").Buffer;r.encrypt=function(t,e,r){for(var i=e.length,o=s.allocUnsafe(i),a=-1;++a=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new o(a(e));return r}var o=t("bn.js"),a=t("randombytes");e.exports=i,i.getr=s}).call(this,t("buffer").Buffer)},{"bn.js":64,buffer:98,randombytes:184}],88:[function(t,e,r){e.exports=t("./browser/algorithms.json")},{"./browser/algorithms.json":89}],89:[function(t,e,r){e.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"}}},{}],90:[function(t,e,r){e.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"}},{}],91:[function(t,e,r){(function(r){function n(t){f.Writable.call(this);var e=d[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=a(e.hash),this._tag=e.id,this._signType=e.sign}function i(t){f.Writable.call(this);var e=d[t];if(!e)throw new Error("Unknown message digest");this._hash=a(e.hash),this._tag=e.id,this._signType=e.sign}function s(t){return new n(t)}function o(t){return new i(t)}var a=t("create-hash"),f=t("stream"),u=t("inherits"),c=t("./sign"),h=t("./verify"),d=t("./algorithms.json");Object.keys(d).forEach(function(t){d[t].id=new r(d[t].id,"hex"),d[t.toLowerCase()]=d[t]}),u(n,f.Writable),n.prototype._write=function(t,e,r){this._hash.update(t),r()},n.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},n.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=c(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},u(i,f.Writable),i.prototype._write=function(t,e,r){this._hash.update(t),r()},i.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},i.prototype.verify=function(t,e,n){"string"==typeof e&&(e=new r(e,n)),this.end();var i=this._hash.digest();return h(e,i,t,this._signType,this._tag)},e.exports={Sign:s,Verify:o,createSign:s,createVerify:o}}).call(this,t("buffer").Buffer)},{"./algorithms.json":89,"./sign":92,"./verify":93,buffer:98,"create-hash":102,inherits:153,stream:209}],92:[function(t,e,r){(function(r){function n(t,e,n,o,a){var f=g(e);if(f.curve){if("ecdsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");return i(t,f)}if("dsa"===f.type){if("dsa"!==o)throw new Error("wrong private key type");return s(t,f,n)}if("rsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");t=r.concat([a,t]);for(var u=f.modulus.byteLength(),c=[0,1];t.length+c.length+10&&r.ishrn(n),r}function u(t,e){t=f(t,e),t=t.mod(e);var n=new r(t.toArray());if(n.length=e)throw new Error("invalid sig")}var a=t("bn.js"),f=t("elliptic").ec,u=t("parse-asn1"),c=t("./curves.json");e.exports=n}).call(this,t("buffer").Buffer)},{"./curves.json":90,"bn.js":64,buffer:98,elliptic:118,"parse-asn1":166}],94:[function(t,e,r){function n(t){if(t&&!f(t))throw new Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function s(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function o(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var a=t("buffer").Buffer,f=a.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},u=r.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),n(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(t){for(var e="";this.charLength;){var r=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,n=e.charCodeAt(i);if(n>=55296&&n<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),t.copy(this.charBuffer,0,0,s),e.substring(0,i)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e}},{buffer:98}],95:[function(t,e,r){var n=t("base-x");e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":62}],96:[function(t,e,r){e.exports=function(t,e){if("function"==typeof t.compare)return t.compare(e);if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function b(t){return+t!=t&&(t=0),s.alloc(+t)}function g(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return P(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function s(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,a=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,f/=2,r/=2}var u;if(i){var c=-1;for(u=r;ua&&(r=a-f),u=r;u>=0;u--){for(var h=!0,d=0;di&&(n=i):n=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(i+a<=r){var f,u,c,h;switch(a){case 1:s<128&&(o=s);break;case 2:f=t[i+1],128==(192&f)&&(h=(31&s)<<6|63&f)>127&&(o=h);break;case 3:f=t[i+1],u=t[i+2],128==(192&f)&&128==(192&u)&&(h=(15&s)<<12|(63&f)<<6|63&u)>2047&&(h<55296||h>57343)&&(o=h);break;case 4:f=t[i+1],u=t[i+2],c=t[i+3],128==(192&f)&&128==(192&u)&&128==(192&c)&&(h=(15&s)<<18|(63&f)<<12|(63&u)<<6|63&c)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return x(n)}function x(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function L(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,n,23,4),r+4}function K(t,e,r,n,i){return i||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,n,52,8),r+8}function H(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function G(t){return Z.toByteArray(H(t))}function W(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t){return t!==t}var Z=t("base64-js"),J=t("ieee754"),Q=t("isarray");r.Buffer=s,r.SlowBuffer=b,r.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=n(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return o(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return f(null,t,e,r)},s.allocUnsafe=function(t){return u(null,t)},s.allocUnsafeSlow=function(t){return u(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,f=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},s.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),J.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),J.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),J.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),J.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)}, +s.prototype.writeDoubleLE=function(t,e,r){return K(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return K(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o>>2),o=0,a=0;o>5]|=128<>>9<<4)]=e;for(var r=1732584193,n=-271733879,i=-1732584194,c=271733878,h=0;h>16)+(e>>16)+(r>>16)<<16|65535&r}function c(t,e){return t<>>32-e}var h=t("./make-hash");e.exports=function(t){return h(t,n)}},{"./make-hash":103}],105:[function(t,e,r){"use strict";function n(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;if(this._alg=t,this._key=e,e.length>r){e=("rmd160"===t?new u:c(t)).update(e).digest()}else e.lengthf?e=t(e):e.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},n.prototype.final=function(t){var e;t&&(e=this.update(t));var r;return r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=f.r28shl(r,o),n=f.r28shl(n,o),f.pc2(r,n,t.keys,i)}},i.prototype._update=function(t,e,r,n){var i=this._desState,s=f.readUInt32BE(t,e),o=f.readUInt32BE(t,e+4);f.ip(s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,o,i.tmp,0):this._decrypt(i,s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],f.writeUInt32BE(r,s,n),f.writeUInt32BE(r,o,n+4)},i.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,s=l}f.rip(o,s,n,i)},i.prototype._decrypt=function(t,e,r,n,i){for(var s=r,o=e,a=t.keys.length-2;a>=0;a-=2){var u=t.keys[a],c=t.keys[a+1];f.expand(s,t.tmp,0),u^=t.tmp[0],c^=t.tmp[1];var h=f.substitute(u,c),d=f.permute(h),l=s;s=(o^d)>>>0,o=l}f.rip(s,o,n,i)}},{"../des":108,inherits:153,"minimalistic-assert":160}],112:[function(t,e,r){"use strict";function n(t,e){s.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);this.ciphers="encrypt"===t?[u.create({type:"encrypt",key:r}),u.create({type:"decrypt",key:n}),u.create({type:"encrypt",key:i})]:[u.create({type:"decrypt",key:i}),u.create({type:"encrypt",key:n}),u.create({type:"decrypt",key:r})]}function i(t){f.call(this,t);var e=new n(this.type,this.options.key);this._edeState=e}var s=t("minimalistic-assert"),o=t("inherits"),a=t("../des"),f=a.Cipher,u=a.DES;o(i,f),e.exports=i,i.create=function(t){return new i(t)},i.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},i.prototype._pad=u.prototype._pad,i.prototype._unpad=u.prototype._unpad},{"../des":108,inherits:153,"minimalistic-assert":160}],113:[function(t,e,r){"use strict";r.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},r.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},r.ip=function(t,e,r,n){for(var i=0,s=0,o=6;o>=0;o-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+o&1}for(var o=6;o>=0;o-=2){for(var a=1;a<=25;a+=8)s<<=1,s|=e>>>a+o&1;for(var a=1;a<=25;a+=8)s<<=1,s|=t>>>a+o&1}r[n+0]=i>>>0,r[n+1]=s>>>0},r.rip=function(t,e,r,n){for(var i=0,s=0,o=0;o<4;o++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+o&1,i<<=1,i|=t>>>a+o&1;for(var o=4;o<8;o++)for(var a=24;a>=0;a-=8)s<<=1,s|=e>>>a+o&1,s<<=1,s|=t>>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.pc1=function(t,e,r,n){for(var i=0,s=0,o=7;o>=5;o--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+o&1}for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var o=1;o<=3;o++){for(var a=0;a<=24;a+=8)s<<=1,s|=e>>a+o&1;for(var a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1}for(var a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(t,e,r,i){for(var s=0,o=0,a=n.length>>>1,f=0;f>>n[f]&1;for(var f=a;f>>n[f]&1;r[i+0]=s>>>0,r[i+1]=o>>>0},r.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(var s=11;s>=3;s-=4)i|=t>>>s&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(t,e){for(var r=0,n=0;n<4;n++){var s=t>>>18-6*n&63,o=i[64*n+s];r<<=4,r|=o}for(var n=0;n<4;n++){var s=e>>>18-6*n&63,o=i[256+64*n+s];r<<=4,r|=o}return r>>>0};var s=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(t){for(var e=0,r=0;r>>s[r]&1;return e>>>0},r.padSplit=function(t,e,r){for(var n=t.toString(2);n.lengtht;)r.ishrn(1);if(r.isEven()&&r.iadd(d),r.testn(1)||r.iadd(l),e.cmp(l)){if(!e.cmp(p))for(;r.mod(b).cmp(g);)r.iadd(m)}else for(;r.mod(u).cmp(y);)r.iadd(m);if(n=r.shrn(1),i(n)&&i(r)&&s(n)&&s(r)&&h.test(n)&&h.test(r))return r}}var a=t("randombytes");e.exports=o,o.simpleSieve=i,o.fermatTest=s;var f=t("bn.js"),u=new f(24),c=t("miller-rabin"),h=new c,d=new f(1),l=new f(2),p=new f(5),b=(new f(16),new f(8),new f(10)),g=new f(3),y=(new f(7),new f(11)),m=new f(4),v=(new f(12),null)},{"bn.js":64,"miller-rabin":159,randombytes:184}],117:[function(t,e,r){e.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"}}},{}],118:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":133,"./elliptic/curve":121,"./elliptic/curves":124,"./elliptic/ec":125,"./elliptic/eddsa":128,"./elliptic/utils":132,brorand:65}],119:[function(t,e,r){"use strict";function n(t,e){this.type=t,this.p=new s(e.p,16),this.red=e.prime?s.red(e.prime):s.mont(this.p),this.zero=new s(0).toRed(this.red),this.one=new s(1).toRed(this.red),this.two=new s(2).toRed(this.red),this.n=e.n&&new s(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(t,e){this.curve=t,this.type=e,this.precomputed=null}var s=t("bn.js"),o=t("../../elliptic"),a=o.utils,f=a.getNAF,u=a.getJSF,c=a.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(t,e){c(t.precomputed);var r=t._getDoubles(),n=f(e,1),i=(1<=o;e--)a=(a<<1)+n[e];s.push(a)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(var o=0;o=0;a--){for(var e=0;a>=0&&0===s[a];a--)e++;if(a>=0&&e++,o=o.dblp(e),a<0)break;var u=s[a];c(0!==u),o="affine"===t.type?u>0?o.mixedAdd(i[u-1>>1]):o.mixedAdd(i[-u-1>>1].neg()):u>0?o.add(i[u-1>>1]):o.add(i[-u-1>>1].neg())}return"affine"===t.type?o.toP():o},n.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,o=this._wnafT2,a=this._wnafT3,c=0,h=0;h=1;h-=2){var p=h-1,b=h;if(1===s[p]&&1===s[b]){var g=[e[p],null,null,e[b]];0===e[p].y.cmp(e[b].y)?(g[1]=e[p].add(e[b]),g[2]=e[p].toJ().mixedAdd(e[b].neg())):0===e[p].y.cmp(e[b].y.redNeg())?(g[1]=e[p].toJ().mixedAdd(e[b]),g[2]=e[p].add(e[b].neg())):(g[1]=e[p].toJ().mixedAdd(e[b]),g[2]=e[p].toJ().mixedAdd(e[b].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=u(r[p],r[b]);c=Math.max(m[0].length,c),a[p]=new Array(c),a[b]=new Array(c);for(var v=0;v=0;h--){for(var I=0;h>=0;){for(var k=!0,v=0;v=0&&I++,S=S.dblp(I),h<0)break;for(var v=0;v0?d=o[v][A-1>>1]:A<0&&(d=o[v][-A-1>>1].neg()),S="affine"===d.type?S.mixedAdd(d):S.add(d))}}for(var h=0;h=Math.ceil((t.bitLength()+1)/e.step)},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),f=i.redMul(o),u=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(f,u,h,c)},i.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(i),a=o.redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(a.redSub(this.curve.two)),e=a.redMul(o.redSub(s)),r=a.redSqr().redSub(a).redSub(a);else{var f=this.z.redSqr(),u=a.redSub(f).redISub(f);t=n.redSub(i).redISub(s).redMul(u),e=a.redMul(o.redSub(s)),r=a.redMul(u)}}else{var o=i.redAdd(s),f=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=o.redSub(f).redSub(f);t=this.curve._mulC(n.redISub(o)).redMul(u),e=this.curve._mulC(o).redMul(i.redISub(s)),r=o.redMul(u)}return this.curve.point(t,e,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),f=r.redAdd(e),u=s.redMul(o),c=a.redMul(f),h=s.redMul(f),d=o.redMul(a);return this.curve.point(u,c,d,h)},i.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),f=i.redSub(a),u=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(f).redMul(c);return this.curve.twisted?(e=n.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=f.redMul(u)):(e=n.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(f).redMul(u)),this.curve.point(h,e,r)},i.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},i.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},i.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},i.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],121:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":119,"./edwards":120,"./mont":122,"./short":123}],122:[function(t,e,r){"use strict";function n(t){f.call(this,"mont",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(t,e,r){f.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(e,16),this.z=new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var s=t("../curve"),o=t("bn.js"),a=t("inherits"),f=s.base,u=t("../../elliptic"),c=u.utils;a(n,f),e.exports=n,n.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},a(i,f.BasePoint),n.prototype.decodePoint=function(t,e){return this.point(c.toArray(t,e),1)},n.prototype.point=function(t,e){return new i(this,t,e)},n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(t,e){return new i(t,e[0],e[1]||t.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),i=e.redSub(n),s=e.redMul(n),o=i.redMul(n.redAdd(this.curve.a24.redMul(i)));return this.curve.point(s,o)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z),o=s.redMul(r),a=i.redMul(n),f=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(f,u)},i.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=this,s=[];0!==e.cmpn(0);e.iushrn(1))s.push(e.andln(1));for(var o=s.length-1;o>=0;o--)0===s[o]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],123:[function(t,e,r){"use strict";function n(t){c.call(this,"short",t),this.a=new f(t.a,16).toRed(this.red),this.b=new f(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(t,e,r,n){c.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(e,16),this.y=new f(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(t,e,r,n){c.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new f(0)):(this.x=new f(e,16),this.y=new f(r,16),this.z=new f(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var o=t("../curve"),a=t("../../elliptic"),f=t("bn.js"),u=t("inherits"),c=o.base,h=a.utils.assert;u(n,c),e.exports=n,n.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new f(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new f(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],h(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}var s;return s=t.basis?t.basis.map(function(t){return{a:new f(t.a,16),b:new f(t.b,16)}}):this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},n.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:f.mont(t),r=new f(2).toRed(e).redInvm(),n=r.redNeg(),i=new f(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},n.prototype._getEndoBasis=function(t){for(var e,r,n,i,s,o,a,u,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new f(1),b=new f(0),g=new f(0),y=new f(1),m=0;0!==d.cmpn(0);){var v=l.div(d);u=l.sub(v.mul(d)),c=g.sub(v.mul(p));var _=y.sub(v.mul(b));if(!n&&u.cmp(h)<0)e=a.neg(),r=p,n=u.neg(),i=c;else if(n&&2==++m)break;a=u,l=d,d=u,g=p,p=c,y=b,b=_}s=u.neg(),o=c;var w=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=e,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},n.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),f=i.mul(r.b),u=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:f.add(u).neg()}},n.prototype.pointFromX=function(t,e){t=new f(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},n.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},n.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},i.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(t){return t=new f(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},i.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},i.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},i.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},i.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},u(s,c.BasePoint),n.prototype.jpoint=function(t,e,r){return new s(this,t,e,r)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),f=s.redSub(o);if(0===a.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=n.redMul(u),d=f.redSqr().redIAdd(c).redISub(h).redISub(h),l=f.redMul(h.redISub(d)).redISub(s.redMul(c)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},s.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),u=f.redMul(o),c=r.redMul(f),h=a.redSqr().redIAdd(u).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(u)),l=this.z.redMul(o);return this.curve.jpoint(h,d,l)},s.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":118,"../curve":121,"bn.js":64,inherits:153}],124:[function(t,e,r){"use strict";function n(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(t,e){Object.defineProperty(s,t,{configurable:!0,enumerable:!0,get:function(){var r=new n(e);return Object.defineProperty(s,t,{configurable:!0,enumerable:!0,value:r}),r}})}var s=r,o=t("hash.js"),a=t("../elliptic"),f=a.utils.assert;s.PresetCurve=n,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", +b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=t("./precomputed/secp256k1")}catch(t){u=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})},{"../elliptic":118,"./precomputed/secp256k1":131,"hash.js":137}],125:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);"string"==typeof t&&(f(o.curves.hasOwnProperty(t),"Unknown curve "+t),t=o.curves[t]),t instanceof o.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var i=t("bn.js"),s=t("hmac-drbg"),o=t("../../elliptic"),a=o.utils,f=a.assert,u=t("./key"),c=t("./signature");e.exports=n,n.prototype.keyPair=function(t){return new u(this,t)},n.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},n.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},n.prototype.genKeyPair=function(t){t||(t={});for(var e=new s({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new i(2));;){var a=new i(e.generate(r));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}},n.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},n.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),f=t.toArray("be",o),u=new s({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;!0;d++){var l=n.k?n.k(d):new i(u.generate(this.n.byteLength()));if(l=this._truncateToN(l,!0),!(l.cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),g=b.umod(this.n);if(0!==g.cmpn(0)){var y=l.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(y=y.umod(this.n),0!==y.cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),m^=1),new c({r:g,s:y,recoveryParam:m})}}}}}},n.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n),e=new c(e,"hex");var s=e.r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),f=a.mul(t).umod(this.n),u=a.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(f,r.getPublic(),u);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(f,r.getPublic(),u);return!h.isInfinity()&&h.eqXToP(s)},n.prototype.recoverPubKey=function(t,e,r,n){f((3&r)===r,"The recovery param is more than two bits"),e=new c(e,n);var s=this.n,o=new i(t),a=e.r,u=e.s,h=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var l=e.r.invm(s),p=s.sub(o).mul(l).umod(s),b=u.mul(l).umod(s);return this.g.mulAdd(p,a,b)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new c(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":118,"./key":126,"./signature":127,"bn.js":64,"hmac-drbg":150}],126:[function(t,e,r){"use strict";function n(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils,a=o.assert;e.exports=n,n.fromPublic=function(t,e,r){return e instanceof n?e:new n(t,{pub:e,pubEnc:r})},n.fromPrivate=function(t,e,r){return e instanceof n?e:new n(t,{priv:e,privEnc:r})},n.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},n.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},n.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?a(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||a(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},n.prototype.derive=function(t){return t.mul(this.priv).getX()},n.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},n.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},n.prototype.inspect=function(){return""}},{"../../elliptic":118,"bn.js":64}],127:[function(t,e,r){"use strict";function n(t,e){if(t instanceof n)return t;this._importDER(t,e)||(h(t.r&&t.s,"Signature without r or s"),this.r=new f(t.r,16),this.s=new f(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function i(){this.place=0}function s(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,s=0,o=e.place;s>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}var f=t("bn.js"),u=t("../../elliptic"),c=u.utils,h=c.assert;e.exports=n,n.prototype._importDER=function(t,e){t=c.toArray(t,e);var r=new i;if(48!==t[r.place++])return!1;if(s(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=s(t,r),o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=s(t,r);if(t.length!==a+r.place)return!1;var u=t.slice(r.place,a+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===u[0]&&128&u[1]&&(u=u.slice(1)),this.r=new f(o),this.s=new f(u),this.recoveryParam=null,!0},n.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=o(e),r=o(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];a(n,e.length),n=n.concat(e),n.push(2),a(n,r.length);var i=n.concat(r),s=[48];return a(s,i.length),s=s.concat(i),c.encode(s,t)}},{"../../elliptic":118,"bn.js":64}],128:[function(t,e,r){"use strict";function n(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof n))return new n(t);var t=s.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}var i=t("hash.js"),s=t("../../elliptic"),o=s.utils,a=o.assert,f=o.parseBytes,u=t("./key"),c=t("./signature");e.exports=n,n.prototype.sign=function(t,e){t=f(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:s})},n.prototype.verify=function(t,e,r){t=f(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},n.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0;){var s;if(i.isOdd()){var o=i.andln(n-1);s=o>(n>>1)-1?(n>>1)-o:o,i.isubn(s)}else s=0;r.push(s);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,f=1;f0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,o=e.andln(3)+i&3;3===s&&(s=-1),3===o&&(o=-1);var a;if(0==(1&s))a=0;else{var f=t.andln(7)+n&7;a=3!==f&&5!==f||2!==o?s:-s}r[0].push(a);var u;if(0==(1&o))u=0;else{var f=e.andln(7)+i&7;u=3!==f&&5!==f||2!==s?o:-o}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}function s(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function o(t){return"string"==typeof t?f.toArray(t,"hex"):t}function a(t){return new u(t,"hex","le")}var f=r,u=t("bn.js"),c=t("minimalistic-assert"),h=t("minimalistic-crypto-utils");f.assert=c,f.toArray=h.toArray,f.zero2=h.zero2,f.toHex=h.toHex,f.encode=h.encode,f.getNAF=n,f.getJSF=i,f.cachedProperty=s,f.parseBytes=o,f.intFromLE=a},{"bn.js":64,"minimalistic-assert":160,"minimalistic-crypto-utils":161}],133:[function(t,e,r){e.exports={_args:[["elliptic@6.4.0","/Users/ematiu/dev/bitcore-lib-cash"]],_from:"elliptic@6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/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","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_spec:"6.4.0",_where:"/Users/ematiu/dev/bitcore-lib-cash",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"}},{}],134:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,f,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(r=this._events[t],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,f=0;f0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,s,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){n=a;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],135:[function(t,e,r){function n(t,e,r,n){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,a=i.alloc(o),f=i.alloc(n||0),u=i.alloc(0);o>0||n>0;){var c=new s;c.update(u),c.update(t),e&&c.update(e),u=c.digest();var h=0;if(o>0){var d=a.length-o;h=Math.min(o,u.length),u.copy(a,d,0,h),o-=h}if(h0){var l=f.length-n,p=Math.min(n,u.length-h);u.copy(f,l,h,h+p),n-=p}}return u.fill(0),{key:a,iv:f}}var i=t("safe-buffer").Buffer,s=t("md5.js");e.exports=n},{"md5.js":157,"safe-buffer":200}],136:[function(t,e,r){(function(r){"use strict";function n(t){i.call(this),this._block=new r(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var i=t("stream").Transform;t("inherits")(n,i),n.prototype._transform=function(t,e,n){var i=null;try{"buffer"!==e&&(t=new r(t,e)),this.update(t)}catch(t){i=t}n(i)},n.prototype._flush=function(t){var e=null;try{this.push(this._digest())}catch(t){e=t}t(e)},n.prototype.update=function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=new r(t,e||"binary"));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var s=this._blockOffset;s0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},n.prototype._update=function(t){throw new Error("_update is not implemented")},n.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();return void 0!==t&&(e=e.toString(t)),e},n.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,inherits:153,stream:209}],137:[function(t,e,r){var n=r;n.utils=t("./hash/utils"),n.common=t("./hash/common"),n.sha=t("./hash/sha"),n.ripemd=t("./hash/ripemd"),n.hmac=t("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":138,"./hash/hmac":139,"./hash/ripemd":140,"./hash/sha":141,"./hash/utils":148}],138:[function(t,e,r){"use strict";function n(){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 i=t("./utils"),s=t("minimalistic-assert");r.BlockHash=n,n.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;sthis.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var e=t.length;e>>3}function c(t){return d(t,17)^d(t,19)^t>>>10}var h=t("../utils"),d=h.rotr32;r.ft_1=n,r.ch32=i,r.maj32=s,r.p32=o,r.s0_256=a,r.s1_256=f,r.g0_256=u,r.g1_256=c},{"../utils":148}],148:[function(t,e,r){"use strict";function n(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for(t=t.replace(/[^a-z0-9]+/gi,""),t.length%2!=0&&(t="0"+t),n=0;n>8,o=255&i;s?r.push(s,o):r.push(o)}else for(n=0;n>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t,e){for(var r="",n=0;n>>0}return s}function c(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r}function h(t,e){return t>>>e|t<<32-e}function d(t,e){return t<>>32-e}function l(t,e){return t+e>>>0}function p(t,e,r){return t+e+r>>>0}function b(t,e,r,n){return t+e+r+n>>>0}function g(t,e,r,n,i){return t+e+r+n+i>>>0}function y(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}function m(t,e,r,n){return(e+n>>>0>>0}function v(t,e,r,n){return e+n>>>0}function _(t,e,r,n,i,s,o,a){var f=0,u=e;return u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0}function w(t,e,r,n,i,s,o,a){return e+n+s+a>>>0}function S(t,e,r,n,i,s,o,a,f,u){var c=0,h=e;return h=h+n>>>0,c+=h>>0,c+=h>>0,c+=h>>0,c+=h>>0}function E(t,e,r,n,i,s,o,a,f,u){return e+n+s+a+u>>>0}function I(t,e,r){return(e<<32-r|t>>>r)>>>0}function k(t,e,r){return(t<<32-r|e>>>r)>>>0}function A(t,e,r){return t>>>r}function P(t,e,r){return(t<<32-r|e>>>r)>>>0}var O=t("minimalistic-assert"),x=t("inherits");r.inherits=x,r.toArray=n,r.toHex=i,r.htonl=s,r.toHex32=o,r.zero2=a,r.zero8=f,r.join32=u,r.split32=c,r.rotr32=h,r.rotl32=d,r.sum32=l,r.sum32_3=p,r.sum32_4=b,r.sum32_5=g,r.sum64=y,r.sum64_hi=m,r.sum64_lo=v,r.sum64_4_hi=_,r.sum64_4_lo=w,r.sum64_5_hi=S,r.sum64_5_lo=E,r.rotr64_hi=I,r.rotr64_lo=k,r.shr64_hi=A,r.shr64_lo=P},{inherits:149,"minimalistic-assert":160}],149:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],150:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=s.toArray(t.entropy,t.entropyEnc||"hex"),r=s.toArray(t.nonce,t.nonceEnc||"hex"),i=s.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var i=t("hash.js"),s=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");e.exports=n,n.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},n.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=s.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,c=-7,h=r?i-1:0,d=r?-1:1,l=t[e+h];for(h+=d,s=l&(1<<-c)-1,l>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===f)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,n),s-=u}return(l?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,f,u=8*s-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:s-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),e+=o+h>=1?d/f:d*Math.pow(2,1-h),e*f>=2&&(o++,f/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*f-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+l]=255&a,l+=p,a/=256,i-=8);for(o=o<0;t[r+l]=255&o,l+=p,o/=256,u-=8);t[r+l-p]|=128*b}},{}],152:[function(t,e,r){var n=[].indexOf;e.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r-1}function d(t,e,r){for(var n=-1,i=null==t?0:t.length;++n-1;);return r}function j(t,e){for(var r=t.length;r--&&S(e,t[r],0)>-1;);return r}function L(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}function D(t){return"\\"+kr[t]}function K(t,e){return null==t?rt:t[e]}function H(t){return gr.test(t)}function F(t){return yr.test(t)}function z(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}function q(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function V(t,e){return function(r){return t(e(r))}}function Y(t,e){for(var r=-1,n=t.length,i=0,s=[];++r>>1,jt=[["ary",wt],["bind",pt],["bindKey",bt],["curry",yt],["curryRight",mt],["flip",Et],["partial",vt],["partialRight",_t],["rearg",St]],Lt="[object Arguments]",Dt="[object Array]",Kt="[object AsyncFunction]",Ht="[object Boolean]",Ft="[object Date]",zt="[object DOMException]",qt="[object Error]",Vt="[object Function]",Yt="[object GeneratorFunction]",Gt="[object Map]",Wt="[object Number]",Xt="[object Null]",Zt="[object Object]",Jt="[object Proxy]",Qt="[object RegExp]",$t="[object Set]",te="[object String]",ee="[object Symbol]",re="[object Undefined]",ne="[object WeakMap]",ie="[object WeakSet]",se="[object ArrayBuffer]",oe="[object DataView]",ae="[object Float32Array]",fe="[object Float64Array]",ue="[object Int8Array]",ce="[object Int16Array]",he="[object Int32Array]",de="[object Uint8Array]",le="[object Uint8ClampedArray]",pe="[object Uint16Array]",be="[object Uint32Array]",ge=/\b__p \+= '';/g,ye=/\b(__p \+=) '' \+/g,me=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ve=/&(?:amp|lt|gt|quot|#39);/g,_e=/[&<>"']/g,we=RegExp(ve.source),Se=RegExp(_e.source),Ee=/<%-([\s\S]+?)%>/g,Ie=/<%([\s\S]+?)%>/g,ke=/<%=([\s\S]+?)%>/g,Ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Oe=/^\./,xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Be=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(Be.source),Te=/^\s+|\s+$/g,Me=/^\s+/,Ce=/\s+$/,Ne=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ue=/\{\n\/\* \[wrapped with (.+)\] \*/,je=/,? & /,Le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,De=/\\(\\)?/g,Ke=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,He=/\w*$/,Fe=/^[-+]0x[0-9a-f]+$/i,ze=/^0b[01]+$/i,qe=/^\[object .+?Constructor\]$/,Ve=/^0o[0-7]+$/i,Ye=/^(?:0|[1-9]\d*)$/,Ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,We=/($^)/,Xe=/['\n\r\u2028\u2029\\]/g,Ze="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\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",Qe="["+Je+"]",$e="["+Ze+"]",tr="[a-z\\xdf-\\xf6\\xf8-\\xff]",er="[^\\ud800-\\udfff"+Je+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rr="\\ud83c[\\udffb-\\udfff]",nr="(?:\\ud83c[\\udde6-\\uddff]){2}",ir="[\\ud800-\\udbff][\\udc00-\\udfff]",sr="[A-Z\\xc0-\\xd6\\xd8-\\xde]",or="(?:"+tr+"|"+er+")",ar="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",fr="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",nr,ir].join("|")+")[\\ufe0e\\ufe0f]?"+ar+")*",ur="[\\ufe0e\\ufe0f]?"+ar+fr,cr="(?:"+["[\\u2700-\\u27bf]",nr,ir].join("|")+")"+ur,hr="(?:"+["[^\\ud800-\\udfff]"+$e+"?",$e,nr,ir,"[\\ud800-\\udfff]"].join("|")+")",dr=RegExp("['’]","g"),lr=RegExp($e,"g"),pr=RegExp(rr+"(?="+rr+")|"+hr+ur,"g"),br=RegExp([sr+"?"+tr+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qe,sr,"$"].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))?(?="+[Qe,sr+or,"$"].join("|")+")",sr+"?"+or+"+(?:['’](?:d|ll|m|re|s|t|ve))?",sr+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",cr].join("|"),"g"),gr=RegExp("[\\u200d\\ud800-\\udfff"+Ze+"\\ufe0e\\ufe0f]"),yr=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,mr=["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"],vr=-1,_r={};_r[ae]=_r[fe]=_r[ue]=_r[ce]=_r[he]=_r[de]=_r[le]=_r[pe]=_r[be]=!0,_r[Lt]=_r[Dt]=_r[se]=_r[Ht]=_r[oe]=_r[Ft]=_r[qt]=_r[Vt]=_r[Gt]=_r[Wt]=_r[Zt]=_r[Qt]=_r[$t]=_r[te]=_r[ne]=!1;var wr={};wr[Lt]=wr[Dt]=wr[se]=wr[oe]=wr[Ht]=wr[Ft]=wr[ae]=wr[fe]=wr[ue]=wr[ce]=wr[he]=wr[Gt]=wr[Wt]=wr[Zt]=wr[Qt]=wr[$t]=wr[te]=wr[ee]=wr[de]=wr[le]=wr[pe]=wr[be]=!0,wr[qt]=wr[Vt]=wr[ne]=!1;var Sr={"À":"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"},Er={"&":"&","<":"<",">":">",'"':""","'":"'"},Ir={"&":"&","<":"<",">":">",""":'"',"'":"'"},kr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ar=parseFloat,Pr=parseInt,Or="object"==typeof t&&t&&t.Object===Object&&t,xr="object"==typeof self&&self&&self.Object===Object&&self,Br=Or||xr||Function("return this")(),Rr="object"==typeof r&&r&&!r.nodeType&&r,Tr=Rr&&"object"==typeof e&&e&&!e.nodeType&&e,Mr=Tr&&Tr.exports===Rr,Cr=Mr&&Or.process,Nr=function(){try{return Cr&&Cr.binding&&Cr.binding("util")}catch(t){}}(),Ur=Nr&&Nr.isArrayBuffer,jr=Nr&&Nr.isDate,Lr=Nr&&Nr.isMap,Dr=Nr&&Nr.isRegExp,Kr=Nr&&Nr.isSet,Hr=Nr&&Nr.isTypedArray,Fr=A("length"),zr=P(Sr),qr=P(Er),Vr=P(Ir),Yr=function t(e){function r(t){if(of(t)&&!yd(t)&&!(t instanceof X)){if(t instanceof P)return t;if(yc.call(t,"__wrapped__"))return eo(t)}return new P(t)}function m(){}function P(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=rt}function X(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ct,this.__views__=[]}function $(){var t=new X(this.__wrapped__);return t.__actions__=ji(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ji(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ji(this.__views__),t}function tt(){if(this.__filtered__){var t=new X(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function Le(){var t=this.__wrapped__.value(),e=this.__dir__,r=yd(t),n=e<0,i=r?t.length:0,s=As(0,i,this.__views__),o=s.start,a=s.end,f=a-o,u=n?a:o-1,c=this.__iteratees__,h=c.length,d=0,l=Gc(f,this.__takeCount__);if(!r||!n&&i==f&&l==f)return mi(t,this.__actions__);var p=[];t:for(;f--&&d-1}function ar(t,e){var r=this.__data__,n=Xr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function fr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function rn(t,e,r,n,i,s){var o,f=e&ut,u=e&ct,c=e&ht;if(r&&(o=i?r(t,n,i,s):r(t)),o!==rt)return o;if(!sf(t))return t;var h=yd(t);if(h){if(o=xs(t),!f)return ji(t,o)}else{var d=Ph(t),l=d==Vt||d==Yt;if(vd(t))return ki(t,f);if(d==Zt||d==Lt||l&&!i){if(o=u||l?{}:Bs(t),!f)return u?Ki(t,Qr(o,t)):Di(t,Jr(o,t))}else{if(!wr[d])return i?t:{};o=Rs(t,d,rn,f)}}s||(s=new Er);var p=s.get(t);if(p)return p;s.set(t,o);var b=c?u?ms:ys:u?Ff:Hf,g=h?rt:b(t);return a(g||t,function(n,i){g&&(i=n,n=t[i]),Wr(o,i,rn(n,e,r,i,t,s))}),o}function nn(t){var e=Hf(t);return function(r){return sn(r,t,e)}}function sn(t,e,r){var n=r.length;if(null==t)return!n;for(t=fc(t);n--;){var i=r[n],s=e[i],o=t[i];if(o===rt&&!(i in t)||!s(o))return!1}return!0}function on(t,e,r){if("function"!=typeof t)throw new hc(st);return Bh(function(){t.apply(rt,r)},e)}function an(t,e,r,n){var i=-1,s=h,o=!0,a=t.length,f=[],u=e.length;if(!a)return f;r&&(e=l(e,M(r))),n?(s=d,o=!1):e.length>=nt&&(s=N,o=!1,e=new gr(e));t:for(;++ii?0:i+r),n=n===rt||n>i?i:Ef(n),n<0&&(n+=i),n=r>n?0:If(n);r0&&r(a)?e>1?dn(a,e-1,r,n,i):p(i,a):n||(i[i.length]=a)}return i}function ln(t,e){return t&&yh(t,e,Hf)}function pn(t,e){return t&&mh(t,e,Hf)}function bn(t,e){return c(e,function(e){return ef(t[e])})}function gn(t,e){e=Ei(e,t);for(var r=0,n=e.length;null!=t&&re}function _n(t,e){return null!=t&&yc.call(t,e)}function wn(t,e){return null!=t&&e in fc(t)}function Sn(t,e,r){return t>=Gc(e,r)&&t=120&&c.length>=120)?new gr(o&&c):rt}c=t[0];var p=-1,b=a[0];t:for(;++p-1;)a!==t&&Rc.call(a,f,1),Rc.call(t,f,1);return t}function Qn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;Cs(i)?Rc.call(t,i,1):bi(t,i)}}return t}function $n(t,e){return t+Kc(Zc()*(e-t+1))}function ti(t,e,r,n){for(var i=-1,s=Yc(Dc((e-t)/(r||1)),0),o=nc(s);s--;)o[n?s:++i]=t,t+=r;return o}function ei(t,e){var r="";if(!t||e<1||e>Rt)return r;do{e%2&&(r+=t),(e=Kc(e/2))&&(t+=t)}while(e);return r}function ri(t,e){return Rh(Ys(t,e,Ru),t+"")}function ni(t){return Cr(tu(t))}function ii(t,e){var r=tu(t);return Js(r,en(e,0,r.length))}function si(t,e,r,n){if(!sf(t))return t;e=Ei(e,t);for(var i=-1,s=e.length,o=s-1,a=t;null!=a&&++ii?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=nc(i);++n>>1,o=t[s];null!==o&&!yf(o)&&(r?o<=e:o=nt){var u=e?null:Eh(t);if(u)return G(u);o=!1,i=N,f=new gr}else f=e?[]:a;t:for(;++n=n?t:ai(t,e,r)}function ki(t,e){if(e)return t.slice();var r=t.length,n=Pc?Pc(r):new t.constructor(r);return t.copy(n),n}function Ai(t){var e=new t.constructor(t.byteLength);return new Ac(e).set(new Ac(t)),e}function Pi(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function Oi(t,e,r){return b(e?r(q(t),ut):q(t),n,new t.constructor)}function xi(t){var e=new t.constructor(t.source,He.exec(t));return e.lastIndex=t.lastIndex,e}function Bi(t,e,r){return b(e?r(G(t),ut):G(t),i,new t.constructor)}function Ri(t){return dh?fc(dh.call(t)):{}}function Ti(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Mi(t,e){if(t!==e){var r=t!==rt,n=null===t,i=t===t,s=yf(t),o=e!==rt,a=null===e,f=e===e,u=yf(e);if(!a&&!u&&!s&&t>e||s&&o&&f&&!a&&!u||n&&o&&f||!r&&f||!i)return 1;if(!n&&!s&&!u&&t=a)return f;return f*("desc"==r[n]?-1:1)}}return t.index-e.index}function Ni(t,e,r,n){for(var i=-1,s=t.length,o=r.length,a=-1,f=e.length,u=Yc(s-o,0),c=nc(f+u),h=!n;++a1?r[i-1]:rt,o=i>2?r[2]:rt;for(s=t.length>3&&"function"==typeof s?(i--,s):rt,o&&Ns(r[0],r[1],o)&&(s=i<3?rt:s,i=1),e=fc(e);++n-1?i[s?e[o]:o]:rt}}function Ji(t){return gs(function(e){var r=e.length,n=r,i=P.prototype.thru;for(t&&e.reverse();n--;){var s=e[n];if("function"!=typeof s)throw new hc(st);if(i&&!o&&"wrapper"==vs(s))var o=new P([],!0)}for(n=o?n:r;++n1&&m.reverse(),h&&fa))return!1;var u=s.get(t);if(u&&s.get(e))return u==e;var c=-1,h=!0,d=r<?new gr:rt;for(s.set(t,e),s.set(e,t);++c1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(Ne,"{\n/* [wrapped with "+e+"] */\n")}function Ms(t){return yd(t)||gd(t)||!!(Tc&&t&&t[Tc])}function Cs(t,e){return!!(e=null==e?Rt:e)&&("number"==typeof t||Ye.test(t))&&t>-1&&t%1==0&&t0){if(++e>=At)return arguments[0]}else e=0;return t.apply(rt,arguments)}}function Js(t,e){var r=-1,n=t.length,i=n-1;for(e=e===rt?n:e;++r=this.__values__.length;return{done:t,value:t?rt:this.__values__[this.__index__++]}}function ra(){return this}function na(t){for(var e,r=this;r instanceof m;){var n=eo(r);n.__index__=0,n.__values__=rt,e?i.__wrapped__=n:e=n;var i=n;r=r.__wrapped__}return i.__wrapped__=t,e}function ia(){var t=this.__wrapped__;if(t instanceof X){var e=t;return this.__actions__.length&&(e=new X(this)),e=e.reverse(),e.__actions__.push({func:Qo,args:[Oo],thisArg:rt}),new P(e,this.__chain__)}return this.thru(Oo)}function sa(){return mi(this.__wrapped__,this.__actions__)}function oa(t,e,r){var n=yd(t)?u:fn;return r&&Ns(t,e,r)&&(e=rt),n(t,ws(e,3))}function aa(t,e){return(yd(t)?c:hn)(t,ws(e,3))}function fa(t,e){return dn(pa(t,e),1)}function ua(t,e){return dn(pa(t,e),Bt)}function ca(t,e,r){return r=r===rt?1:Ef(r),dn(pa(t,e),r)}function ha(t,e){return(yd(t)?a:bh)(t,ws(e,3))}function da(t,e){return(yd(t)?f:gh)(t,ws(e,3))}function la(t,e,r,n){t=Ya(t)?t:tu(t),r=r&&!n?Ef(r):0;var i=t.length;return r<0&&(r=Yc(i+r,0)),gf(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&S(t,e,r)>-1}function pa(t,e){return(yd(t)?l:Hn)(t,ws(e,3))}function ba(t,e,r,n){return null==t?[]:(yd(e)||(e=null==e?[]:[e]),r=n?rt:r,yd(r)||(r=null==r?[]:[r]),Gn(t,e,r))}function ga(t,e,r){var n=yd(t)?b:O,i=arguments.length<3;return n(t,ws(e,4),r,i,bh)}function ya(t,e,r){var n=yd(t)?g:O,i=arguments.length<3;return n(t,ws(e,4),r,i,gh)}function ma(t,e){return(yd(t)?c:hn)(t,Ta(ws(e,3)))}function va(t){return(yd(t)?Cr:ni)(t)}function _a(t,e,r){return e=(r?Ns(t,e,r):e===rt)?1:Ef(e),(yd(t)?Nr:ii)(t,e)}function wa(t){return(yd(t)?Fr:oi)(t)}function Sa(t){if(null==t)return 0;if(Ya(t))return gf(t)?J(t):t.length;var e=Ph(t);return e==Gt||e==$t?t.size:Ln(t).length}function Ea(t,e,r){var n=yd(t)?y:fi;return r&&Ns(t,e,r)&&(e=rt),n(t,ws(e,3))}function Ia(t,e){if("function"!=typeof e)throw new hc(st);return t=Ef(t),function(){if(--t<1)return e.apply(this,arguments)}}function ka(t,e,r){return e=r?rt:e,e=t&&null==e?t.length:e,us(t,wt,rt,rt,rt,rt,e)}function Aa(t,e){var r;if("function"!=typeof e)throw new hc(st);return t=Ef(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=rt),r}}function Pa(t,e,r){e=r?rt:e;var n=us(t,yt,rt,rt,rt,rt,rt,e);return n.placeholder=Pa.placeholder,n}function Oa(t,e,r){e=r?rt:e;var n=us(t,mt,rt,rt,rt,rt,rt,e);return n.placeholder=Oa.placeholder,n}function xa(t,e,r){function n(e){var r=d,n=l;return d=l=rt,m=e,b=t.apply(n,r)}function i(t){return m=t,g=Bh(a,e),v?n(t):b}function s(t){var r=t-y,n=t-m,i=e-r;return _?Gc(i,p-n):i}function o(t){var r=t-y,n=t-m;return y===rt||r>=e||r<0||_&&n>=p}function a(){var t=sd();if(o(t))return f(t);g=Bh(a,s(t))}function f(t){return g=rt,w&&d?n(t):(d=l=rt,b)}function u(){g!==rt&&Sh(g),m=0,d=y=l=g=rt}function c(){return g===rt?b:f(sd())}function h(){var t=sd(),r=o(t);if(d=arguments,l=this,y=t,r){if(g===rt)return i(y);if(_)return g=Bh(a,e),n(y)}return g===rt&&(g=Bh(a,e)),b}var d,l,p,b,g,y,m=0,v=!1,_=!1,w=!0;if("function"!=typeof t)throw new hc(st);return e=kf(e)||0,sf(r)&&(v=!!r.leading,_="maxWait"in r,p=_?Yc(kf(r.maxWait)||0,e):p,w="trailing"in r?!!r.trailing:w),h.cancel=u,h.flush=c,h}function Ba(t){return us(t,Et)}function Ra(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new hc(st);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Ra.Cache||fr),r}function Ta(t){if("function"!=typeof t)throw new hc(st);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Ma(t){return Aa(2,t)}function Ca(t,e){if("function"!=typeof t)throw new hc(st);return e=e===rt?e:Ef(e),ri(t,e)}function Na(t,e){if("function"!=typeof t)throw new hc(st);return e=null==e?0:Yc(Ef(e),0),ri(function(r){var n=r[e],i=Ii(r,0,e);return n&&p(i,n),s(t,this,i)})}function Ua(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new hc(st);return sf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),xa(t,e,{leading:n,maxWait:e,trailing:i})}function ja(t){return ka(t,1)}function La(t,e){return hd(Si(e),t)}function Da(){if(!arguments.length)return[];var t=arguments[0];return yd(t)?t:[t]}function Ka(t){return rn(t,ht)}function Ha(t,e){return e="function"==typeof e?e:rt,rn(t,ht,e)}function Fa(t){return rn(t,ut|ht)}function za(t,e){return e="function"==typeof e?e:rt,rn(t,ut|ht,e)}function qa(t,e){return null==e||sn(t,e,Hf(e))}function Va(t,e){return t===e||t!==t&&e!==e}function Ya(t){return null!=t&&nf(t.length)&&!ef(t)}function Ga(t){return of(t)&&Ya(t)}function Wa(t){return!0===t||!1===t||of(t)&&mn(t)==Ht}function Xa(t){return of(t)&&1===t.nodeType&&!pf(t)}function Za(t){if(null==t)return!0;if(Ya(t)&&(yd(t)||"string"==typeof t||"function"==typeof t.splice||vd(t)||Id(t)||gd(t)))return!t.length;var e=Ph(t);if(e==Gt||e==$t)return!t.size;if(Ks(t))return!Ln(t).length;for(var r in t)if(yc.call(t,r))return!1;return!0}function Ja(t,e){return xn(t,e)}function Qa(t,e,r){r="function"==typeof r?r:rt;var n=r?r(t,e):rt;return n===rt?xn(t,e,rt,r):!!n}function $a(t){if(!of(t))return!1;var e=mn(t);return e==qt||e==zt||"string"==typeof t.message&&"string"==typeof t.name&&!pf(t)}function tf(t){return"number"==typeof t&&zc(t)}function ef(t){if(!sf(t))return!1;var e=mn(t);return e==Vt||e==Yt||e==Kt||e==Jt}function rf(t){return"number"==typeof t&&t==Ef(t)}function nf(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Rt}function sf(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function of(t){return null!=t&&"object"==typeof t}function af(t,e){return t===e||Tn(t,e,Es(e))}function ff(t,e,r){return r="function"==typeof r?r:rt,Tn(t,e,Es(e),r)}function uf(t){return lf(t)&&t!=+t}function cf(t){if(Oh(t))throw new sc(it);return Mn(t)}function hf(t){return null===t}function df(t){return null==t}function lf(t){return"number"==typeof t||of(t)&&mn(t)==Wt}function pf(t){if(!of(t)||mn(t)!=Zt)return!1;var e=Oc(t);if(null===e)return!0;var r=yc.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&gc.call(r)==wc}function bf(t){return rf(t)&&t>=-Rt&&t<=Rt}function gf(t){return"string"==typeof t||!yd(t)&&of(t)&&mn(t)==te}function yf(t){return"symbol"==typeof t||of(t)&&mn(t)==ee}function mf(t){return t===rt}function vf(t){return of(t)&&Ph(t)==ne}function _f(t){return of(t)&&mn(t)==ie}function wf(t){if(!t)return[];if(Ya(t))return gf(t)?Q(t):ji(t);if(Mc&&t[Mc])return z(t[Mc]());var e=Ph(t);return(e==Gt?q:e==$t?G:tu)(t)}function Sf(t){if(!t)return 0===t?t:0;if((t=kf(t))===Bt||t===-Bt){return(t<0?-1:1)*Tt}return t===t?t:0}function Ef(t){var e=Sf(t),r=e%1;return e===e?r?e-r:e:0}function If(t){return t?en(Ef(t),0,Ct):0}function kf(t){if("number"==typeof t)return t;if(yf(t))return Mt;if(sf(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=sf(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Te,"");var r=ze.test(t);return r||Ve.test(t)?Pr(t.slice(2),r?2:8):Fe.test(t)?Mt:+t}function Af(t){return Li(t,Ff(t))}function Pf(t){return t?en(Ef(t),-Rt,Rt):0===t?t:0}function Of(t){return null==t?"":li(t)}function xf(t,e){var r=ph(t);return null==e?r:Jr(r,e)}function Bf(t,e){return _(t,ws(e,3),ln)}function Rf(t,e){return _(t,ws(e,3),pn)}function Tf(t,e){return null==t?t:yh(t,ws(e,3),Ff)}function Mf(t,e){return null==t?t:mh(t,ws(e,3),Ff)}function Cf(t,e){return t&&ln(t,ws(e,3))}function Nf(t,e){return t&&pn(t,ws(e,3))}function Uf(t){return null==t?[]:bn(t,Hf(t))}function jf(t){return null==t?[]:bn(t,Ff(t))}function Lf(t,e,r){var n=null==t?rt:gn(t,e);return n===rt?r:n}function Df(t,e){return null!=t&&Os(t,e,_n)}function Kf(t,e){return null!=t&&Os(t,e,wn)}function Hf(t){return Ya(t)?Tr(t):Ln(t)}function Ff(t){return Ya(t)?Tr(t,!0):Dn(t)}function zf(t,e){var r={};return e=ws(e,3),ln(t,function(t,n,i){$r(r,e(t,n,i),t)}),r}function qf(t,e){var r={};return e=ws(e,3),ln(t,function(t,n,i){$r(r,n,e(t,n,i))}),r}function Vf(t,e){return Yf(t,Ta(ws(e)))}function Yf(t,e){if(null==t)return{};var r=l(ms(t),function(t){return[t]});return e=ws(e),Xn(t,r,function(t,r){return e(t,r[0])})}function Gf(t,e,r){e=Ei(e,t);var n=-1,i=e.length;for(i||(i=1,t=rt);++ne){var n=t;t=e,e=n}if(r||t%1||e%1){var i=Zc();return Gc(t+i*(e-t+Ar("1e-"+((i+"").length-1))),e)}return $n(t,e)}function su(t){return Zd(Of(t).toLowerCase())}function ou(t){return(t=Of(t))&&t.replace(Ge,zr).replace(lr,"")}function au(t,e,r){t=Of(t),e=li(e);var n=t.length;r=r===rt?n:en(Ef(r),0,n);var i=r;return(r-=e.length)>=0&&t.slice(r,i)==e}function fu(t){return t=Of(t),t&&Se.test(t)?t.replace(_e,qr):t}function uu(t){return t=Of(t),t&&Re.test(t)?t.replace(Be,"\\$&"):t}function cu(t,e,r){t=Of(t),e=Ef(e);var n=e?J(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return rs(Kc(i),r)+t+rs(Dc(i),r)}function hu(t,e,r){t=Of(t),e=Ef(e);var n=e?J(t):0;return e&&n>>0)?(t=Of(t),t&&("string"==typeof e||null!=e&&!Sd(e))&&!(e=li(e))&&H(t)?Ii(Q(t),0,r):t.split(e,r)):[]}function yu(t,e,r){return t=Of(t),r=null==r?0:en(Ef(r),0,t.length),e=li(e),t.slice(r,r+e.length)==e}function mu(t,e,n){var i=r.templateSettings;n&&Ns(t,e,n)&&(e=rt),t=Of(t),e=xd({},e,i,cs);var s,o,a=xd({},e.imports,i.imports,cs),f=Hf(a),u=C(a,f),c=0,h=e.interpolate||We,d="__p += '",l=uc((e.escape||We).source+"|"+h.source+"|"+(h===ke?Ke:We).source+"|"+(e.evaluate||We).source+"|$","g"),p="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++vr+"]")+"\n";t.replace(l,function(e,r,n,i,a,f){return n||(n=i),d+=t.slice(c,f).replace(Xe,D),r&&(s=!0,d+="' +\n__e("+r+") +\n'"),a&&(o=!0,d+="';\n"+a+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=f+e.length,e}),d+="';\n";var b=e.variable;b||(d="with (obj) {\n"+d+"\n}\n"),d=(o?d.replace(ge,""):d).replace(ye,"$1").replace(me,"$1;"),d="function("+(b||"obj")+") {\n"+(b?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Jd(function(){return oc(f,p+"return "+d).apply(rt,u)});if(g.source=d,$a(g))throw g;return g}function vu(t){return Of(t).toLowerCase()}function _u(t){return Of(t).toUpperCase()}function wu(t,e,r){if((t=Of(t))&&(r||e===rt))return t.replace(Te,"");if(!t||!(e=li(e)))return t;var n=Q(t),i=Q(e);return Ii(n,U(n,i),j(n,i)+1).join("")}function Su(t,e,r){if((t=Of(t))&&(r||e===rt))return t.replace(Ce,"");if(!t||!(e=li(e)))return t;var n=Q(t);return Ii(n,0,j(n,Q(e))+1).join("")}function Eu(t,e,r){if((t=Of(t))&&(r||e===rt))return t.replace(Me,"");if(!t||!(e=li(e)))return t;var n=Q(t);return Ii(n,U(n,Q(e))).join("")}function Iu(t,e){var r=It,n=kt;if(sf(e)){var i="separator"in e?e.separator:i;r="length"in e?Ef(e.length):r,n="omission"in e?li(e.omission):n}t=Of(t);var s=t.length;if(H(t)){var o=Q(t);s=o.length}if(r>=s)return t;var a=r-J(n);if(a<1)return n;var f=o?Ii(o,0,a).join(""):t.slice(0,a);if(i===rt)return f+n;if(o&&(a+=f.length-a),Sd(i)){if(t.slice(a).search(i)){var u,c=f;for(i.global||(i=uc(i.source,Of(He.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var h=u.index;f=f.slice(0,h===rt?a:h)}}else if(t.indexOf(li(i),a)!=a){var d=f.lastIndexOf(i);d>-1&&(f=f.slice(0,d))}return f+n}function ku(t){return t=Of(t),t&&we.test(t)?t.replace(ve,Vr):t}function Au(t,e,r){return t=Of(t),e=r?rt:e,e===rt?F(t)?et(t):v(t):t.match(e)||[]}function Pu(t){var e=null==t?0:t.length,r=ws();return t=e?l(t,function(t){if("function"!=typeof t[1])throw new hc(st);return[r(t[0]),t[1]]}):[],ri(function(r){for(var n=-1;++nRt)return[];var r=Ct,n=Gc(t,Ct);e=ws(e),t-=Ct;for(var i=R(n,e);++r1?t[e-1]:rt;return r="function"==typeof r?(t.pop(),r):rt,Go(t,r)}),Zh=gs(function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,i=function(e){return tn(e,t)};return!(e>1||this.__actions__.length)&&n instanceof X&&Cs(r)?(n=n.slice(r,+r+(e?1:0)),n.__actions__.push({func:Qo,args:[i],thisArg:rt}),new P(n,this.__chain__).thru(function(t){return e&&!t.length&&t.push(rt),t})):this.thru(i)}),Jh=Hi(function(t,e,r){yc.call(t,r)?++t[r]:$r(t,r,1)}),Qh=Zi(co),$h=Zi(ho),td=Hi(function(t,e,r){yc.call(t,r)?t[r].push(e):$r(t,r,[e])}),ed=ri(function(t,e,r){var n=-1,i="function"==typeof e,o=Ya(t)?nc(t.length):[];return bh(t,function(t){o[++n]=i?s(e,t,r):kn(t,e,r)}),o}),rd=Hi(function(t,e,r){$r(t,r,e)}),nd=Hi(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]}),id=ri(function(t,e){if(null==t)return[];var r=e.length;return r>1&&Ns(t,e[0],e[1])?e=[]:r>2&&Ns(e[0],e[1],e[2])&&(e=[e[0]]),Gn(t,dn(e,1),[])}),sd=jc||function(){return Br.Date.now()},od=ri(function(t,e,r){var n=pt;if(r.length){var i=Y(r,_s(od));n|=vt}return us(t,n,e,r,i)}),ad=ri(function(t,e,r){var n=pt|bt;if(r.length){var i=Y(r,_s(ad));n|=vt}return us(e,n,t,r,i)}),fd=ri(function(t,e){return on(t,1,e)}),ud=ri(function(t,e,r){return on(t,kf(e)||0,r)});Ra.Cache=fr;var cd=wh(function(t,e){e=1==e.length&&yd(e[0])?l(e[0],M(ws())):l(dn(e,1),M(ws()));var r=e.length;return ri(function(n){for(var i=-1,o=Gc(n.length,r);++i=e}),gd=An(function(){return arguments}())?An:function(t){return of(t)&&yc.call(t,"callee")&&!Bc.call(t,"callee")},yd=nc.isArray,md=Ur?M(Ur):Pn,vd=Fc||Fu,_d=jr?M(jr):On,wd=Lr?M(Lr):Rn,Sd=Dr?M(Dr):Cn,Ed=Kr?M(Kr):Nn,Id=Hr?M(Hr):Un,kd=ss(Kn),Ad=ss(function(t,e){return t<=e}),Pd=Fi(function(t,e){if(Ks(e)||Ya(e))return void Li(e,Hf(e),t);for(var r in e)yc.call(e,r)&&Wr(t,r,e[r])}),Od=Fi(function(t,e){Li(e,Ff(e),t)}),xd=Fi(function(t,e,r,n){Li(e,Ff(e),t,n)}),Bd=Fi(function(t,e,r,n){Li(e,Hf(e),t,n)}),Rd=gs(tn),Td=ri(function(t){return t.push(rt,cs),s(xd,rt,t)}),Md=ri(function(t){return t.push(rt,hs),s(Ld,rt,t)}),Cd=$i(function(t,e,r){t[e]=r},xu(Ru)),Nd=$i(function(t,e,r){yc.call(t,e)?t[e].push(r):t[e]=[r]},ws),Ud=ri(kn),jd=Fi(function(t,e,r){qn(t,e,r)}),Ld=Fi(function(t,e,r,n){qn(t,e,r,n)}),Dd=gs(function(t,e){var r={};if(null==t)return r;var n=!1;e=l(e,function(e){return e=Ei(e,t),n||(n=e.length>1),e}),Li(t,ms(t),r),n&&(r=rn(r,ut|ct|ht,ds));for(var i=e.length;i--;)bi(r,e[i]);return r}),Kd=gs(function(t,e){return null==t?{}:Wn(t,e)}),Hd=fs(Hf),Fd=fs(Ff),zd=Gi(function(t,e,r){return e=e.toLowerCase(),t+(r?su(e):e)}),qd=Gi(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),Vd=Gi(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),Yd=Yi("toLowerCase"),Gd=Gi(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}),Wd=Gi(function(t,e,r){return t+(r?" ":"")+Zd(e)}),Xd=Gi(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),Zd=Yi("toUpperCase"),Jd=ri(function(t,e){try{return s(t,rt,e)}catch(t){return $a(t)?t:new sc(t)}}),Qd=gs(function(t,e){return a(e,function(e){e=Qs(e),$r(t,e,od(t[e],t))}),t}),$d=Ji(),tl=Ji(!0),el=ri(function(t,e){return function(r){return kn(r,t,e)}}),rl=ri(function(t,e){return function(r){return kn(t,r,e)}}),nl=es(l),il=es(u),sl=es(y),ol=is(),al=is(!0),fl=ts(function(t,e){return t+e},0),ul=as("ceil"),cl=ts(function(t,e){return t/e},1),hl=as("floor"),dl=ts(function(t,e){return t*e},1),ll=as("round"),pl=ts(function(t,e){return t-e},0);return r.after=Ia,r.ary=ka,r.assign=Pd,r.assignIn=Od,r.assignInWith=xd,r.assignWith=Bd,r.at=Rd,r.before=Aa,r.bind=od,r.bindAll=Qd,r.bindKey=ad,r.castArray=Da,r.chain=Zo,r.chunk=ro,r.compact=no,r.concat=io,r.cond=Pu,r.conforms=Ou,r.constant=xu,r.countBy=Jh,r.create=xf,r.curry=Pa,r.curryRight=Oa,r.debounce=xa,r.defaults=Td,r.defaultsDeep=Md,r.defer=fd,r.delay=ud,r.difference=Mh,r.differenceBy=Ch,r.differenceWith=Nh,r.drop=so,r.dropRight=oo,r.dropRightWhile=ao,r.dropWhile=fo,r.fill=uo,r.filter=aa,r.flatMap=fa,r.flatMapDeep=ua,r.flatMapDepth=ca,r.flatten=lo,r.flattenDeep=po,r.flattenDepth=bo,r.flip=Ba,r.flow=$d,r.flowRight=tl,r.fromPairs=go,r.functions=Uf,r.functionsIn=jf,r.groupBy=td,r.initial=vo,r.intersection=Uh,r.intersectionBy=jh,r.intersectionWith=Lh,r.invert=Cd,r.invertBy=Nd,r.invokeMap=ed,r.iteratee=Tu,r.keyBy=rd,r.keys=Hf,r.keysIn=Ff,r.map=pa,r.mapKeys=zf,r.mapValues=qf,r.matches=Mu,r.matchesProperty=Cu,r.memoize=Ra,r.merge=jd,r.mergeWith=Ld,r.method=el,r.methodOf=rl,r.mixin=Nu,r.negate=Ta,r.nthArg=Lu,r.omit=Dd,r.omitBy=Vf,r.once=Ma,r.orderBy=ba,r.over=nl,r.overArgs=cd,r.overEvery=il,r.overSome=sl,r.partial=hd,r.partialRight=dd,r.partition=nd,r.pick=Kd,r.pickBy=Yf,r.property=Du,r.propertyOf=Ku,r.pull=Dh,r.pullAll=Io,r.pullAllBy=ko,r.pullAllWith=Ao,r.pullAt=Kh,r.range=ol,r.rangeRight=al,r.rearg=ld,r.reject=ma,r.remove=Po,r.rest=Ca,r.reverse=Oo,r.sampleSize=_a,r.set=Wf,r.setWith=Xf,r.shuffle=wa,r.slice=xo,r.sortBy=id,r.sortedUniq=Uo,r.sortedUniqBy=jo,r.split=gu,r.spread=Na,r.tail=Lo,r.take=Do,r.takeRight=Ko,r.takeRightWhile=Ho,r.takeWhile=Fo,r.tap=Jo,r.throttle=Ua,r.thru=Qo,r.toArray=wf,r.toPairs=Hd,r.toPairsIn=Fd,r.toPath=Gu,r.toPlainObject=Af,r.transform=Zf,r.unary=ja,r.union=Hh,r.unionBy=Fh,r.unionWith=zh,r.uniq=zo,r.uniqBy=qo,r.uniqWith=Vo,r.unset=Jf,r.unzip=Yo,r.unzipWith=Go,r.update=Qf,r.updateWith=$f,r.values=tu,r.valuesIn=eu,r.without=qh,r.words=Au,r.wrap=La,r.xor=Vh,r.xorBy=Yh,r.xorWith=Gh,r.zip=Wh,r.zipObject=Wo,r.zipObjectDeep=Xo,r.zipWith=Xh,r.entries=Hd,r.entriesIn=Fd,r.extend=Od,r.extendWith=xd,Nu(r,r),r.add=fl,r.attempt=Jd,r.camelCase=zd,r.capitalize=su,r.ceil=ul,r.clamp=ru,r.clone=Ka,r.cloneDeep=Fa,r.cloneDeepWith=za,r.cloneWith=Ha,r.conformsTo=qa,r.deburr=ou,r.defaultTo=Bu,r.divide=cl,r.endsWith=au,r.eq=Va,r.escape=fu,r.escapeRegExp=uu,r.every=oa,r.find=Qh,r.findIndex=co,r.findKey=Bf,r.findLast=$h,r.findLastIndex=ho,r.findLastKey=Rf,r.floor=hl,r.forEach=ha,r.forEachRight=da,r.forIn=Tf,r.forInRight=Mf,r.forOwn=Cf,r.forOwnRight=Nf,r.get=Lf,r.gt=pd,r.gte=bd,r.has=Df,r.hasIn=Kf,r.head=yo,r.identity=Ru,r.includes=la,r.indexOf=mo,r.inRange=nu,r.invoke=Ud,r.isArguments=gd,r.isArray=yd,r.isArrayBuffer=md,r.isArrayLike=Ya,r.isArrayLikeObject=Ga,r.isBoolean=Wa,r.isBuffer=vd,r.isDate=_d,r.isElement=Xa,r.isEmpty=Za,r.isEqual=Ja,r.isEqualWith=Qa,r.isError=$a,r.isFinite=tf,r.isFunction=ef,r.isInteger=rf,r.isLength=nf,r.isMap=wd,r.isMatch=af,r.isMatchWith=ff,r.isNaN=uf,r.isNative=cf,r.isNil=df,r.isNull=hf,r.isNumber=lf,r.isObject=sf,r.isObjectLike=of,r.isPlainObject=pf,r.isRegExp=Sd,r.isSafeInteger=bf,r.isSet=Ed,r.isString=gf,r.isSymbol=yf,r.isTypedArray=Id,r.isUndefined=mf,r.isWeakMap=vf,r.isWeakSet=_f,r.join=_o,r.kebabCase=qd,r.last=wo,r.lastIndexOf=So,r.lowerCase=Vd,r.lowerFirst=Yd,r.lt=kd,r.lte=Ad,r.max=Xu,r.maxBy=Zu,r.mean=Ju,r.meanBy=Qu,r.min=$u,r.minBy=tc,r.stubArray=Hu,r.stubFalse=Fu,r.stubObject=zu,r.stubString=qu,r.stubTrue=Vu,r.multiply=dl,r.nth=Eo,r.noConflict=Uu,r.noop=ju,r.now=sd,r.pad=cu,r.padEnd=hu,r.padStart=du,r.parseInt=lu,r.random=iu,r.reduce=ga,r.reduceRight=ya,r.repeat=pu,r.replace=bu,r.result=Gf,r.round=ll,r.runInContext=t,r.sample=va,r.size=Sa,r.snakeCase=Gd,r.some=Ea,r.sortedIndex=Bo,r.sortedIndexBy=Ro,r.sortedIndexOf=To,r.sortedLastIndex=Mo,r.sortedLastIndexBy=Co,r.sortedLastIndexOf=No,r.startCase=Wd,r.startsWith=yu,r.subtract=pl,r.sum=ec,r.sumBy=rc,r.template=mu,r.times=Yu,r.toFinite=Sf,r.toInteger=Ef,r.toLength=If,r.toLower=vu,r.toNumber=kf,r.toSafeInteger=Pf,r.toString=Of,r.toUpper=_u,r.trim=wu,r.trimEnd=Su,r.trimStart=Eu,r.truncate=Iu,r.unescape=ku,r.uniqueId=Wu,r.upperCase=Xd,r.upperFirst=Zd,r.each=ha,r.eachRight=da,r.first=yo,Nu(r,function(){var t={};return ln(r,function(e,n){yc.call(r.prototype,n)||(t[n]=e)}),t}(),{chain:!1}),r.VERSION="4.17.4",a(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){r[t].placeholder=r}),a(["drop","take"],function(t,e){X.prototype[t]=function(r){r=r===rt?1:Yc(Ef(r),0);var n=this.__filtered__&&!e?new X(this):this.clone();return n.__filtered__?n.__takeCount__=Gc(r,n.__takeCount__):n.__views__.push({size:Gc(r,Ct),type:t+(n.__dir__<0?"Right":"")}),n},X.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),a(["filter","map","takeWhile"],function(t,e){var r=e+1,n=r==Ot||3==r;X.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ws(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}}),a(["head","last"],function(t,e){var r="take"+(e?"Right":"");X.prototype[t]=function(){return this[r](1).value()[0]}}),a(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");X.prototype[t]=function(){return this.__filtered__?new X(this):this[r](1)}}),X.prototype.compact=function(){return this.filter(Ru)},X.prototype.find=function(t){return this.filter(t).head()},X.prototype.findLast=function(t){return this.reverse().find(t)},X.prototype.invokeMap=ri(function(t,e){return"function"==typeof t?new X(this):this.map(function(r){return kn(r,t,e)})}),X.prototype.reject=function(t){return this.filter(Ta(ws(t)))},X.prototype.slice=function(t,e){t=Ef(t);var r=this;return r.__filtered__&&(t>0||e<0)?new X(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==rt&&(e=Ef(e),r=e<0?r.dropRight(-e):r.take(e-t)),r)},X.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},X.prototype.toArray=function(){return this.take(Ct)},ln(X.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),s=r[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);s&&(r.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,f=e instanceof X,u=a[0],c=f||yd(e),h=function(t){var e=s.apply(r,p([t],a));return i&&d?e[0]:e};c&&n&&"function"==typeof u&&1!=u.length&&(f=c=!1);var d=this.__chain__,l=!!this.__actions__.length,b=o&&!d,g=f&&!l;if(!o&&c){e=g?e:new X(this);var y=t.apply(e,a);return y.__actions__.push({func:Qo,args:[h],thisArg:rt}),new P(y,d)}return b&&g?t.apply(this,a):(y=this.thru(h),b?i?y.value()[0]:y.value():y)})}),a(["pop","push","shift","sort","splice","unshift"],function(t){var e=dc[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);r.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(yd(r)?r:[],t)}return this[n](function(r){return e.apply(yd(r)?r:[],t)})}}),ln(X.prototype,function(t,e){var n=r[e];if(n){var i=n.name+"";(sh[i]||(sh[i]=[])).push({name:e,func:n})}}),sh[Qi(rt,bt).name]=[{name:"wrapper",func:rt}],X.prototype.clone=$,X.prototype.reverse=tt,X.prototype.value=Le,r.prototype.at=Zh,r.prototype.chain=$o,r.prototype.commit=ta,r.prototype.next=ea,r.prototype.plant=na,r.prototype.reverse=ia,r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=sa,r.prototype.first=r.prototype.head,Mc&&(r.prototype[Mc]=ra),r}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Br._=Yr,define(function(){return Yr})):Tr?((Tr.exports=Yr)._=Yr,Rr._=Yr):Br._=Yr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],157:[function(t,e,r){(function(r){"use strict";function n(){c.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(t,e){return t<>>32-e}function s(t,e,r,n,s,o,a){return i(t+(e&r|~e&n)+s+o|0,a)+e|0}function o(t,e,r,n,s,o,a){return i(t+(e&n|r&~n)+s+o|0,a)+e|0}function a(t,e,r,n,s,o,a){return i(t+(e^r^n)+s+o|0,a)+e|0}function f(t,e,r,n,s,o,a){return i(t+(r^(e|~n))+s+o|0,a)+e|0}var u=t("inherits"),c=t("hash-base"),h=new Array(16);u(n,c),n.prototype._update=function(){for(var t=h,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,u=this._d;r=s(r,n,i,u,t[0],3614090360,7),u=s(u,r,n,i,t[1],3905402710,12),i=s(i,u,r,n,t[2],606105819,17),n=s(n,i,u,r,t[3],3250441966,22),r=s(r,n,i,u,t[4],4118548399,7),u=s(u,r,n,i,t[5],1200080426,12),i=s(i,u,r,n,t[6],2821735955,17),n=s(n,i,u,r,t[7],4249261313,22),r=s(r,n,i,u,t[8],1770035416,7),u=s(u,r,n,i,t[9],2336552879,12),i=s(i,u,r,n,t[10],4294925233,17),n=s(n,i,u,r,t[11],2304563134,22),r=s(r,n,i,u,t[12],1804603682,7),u=s(u,r,n,i,t[13],4254626195,12),i=s(i,u,r,n,t[14],2792965006,17),n=s(n,i,u,r,t[15],1236535329,22),r=o(r,n,i,u,t[1],4129170786,5),u=o(u,r,n,i,t[6],3225465664,9),i=o(i,u,r,n,t[11],643717713,14),n=o(n,i,u,r,t[0],3921069994,20),r=o(r,n,i,u,t[5],3593408605,5),u=o(u,r,n,i,t[10],38016083,9),i=o(i,u,r,n,t[15],3634488961,14),n=o(n,i,u,r,t[4],3889429448,20),r=o(r,n,i,u,t[9],568446438,5),u=o(u,r,n,i,t[14],3275163606,9),i=o(i,u,r,n,t[3],4107603335,14),n=o(n,i,u,r,t[8],1163531501,20),r=o(r,n,i,u,t[13],2850285829,5),u=o(u,r,n,i,t[2],4243563512,9),i=o(i,u,r,n,t[7],1735328473,14),n=o(n,i,u,r,t[12],2368359562,20),r=a(r,n,i,u,t[5],4294588738,4),u=a(u,r,n,i,t[8],2272392833,11),i=a(i,u,r,n,t[11],1839030562,16),n=a(n,i,u,r,t[14],4259657740,23),r=a(r,n,i,u,t[1],2763975236,4),u=a(u,r,n,i,t[4],1272893353,11),i=a(i,u,r,n,t[7],4139469664,16),n=a(n,i,u,r,t[10],3200236656,23),r=a(r,n,i,u,t[13],681279174,4),u=a(u,r,n,i,t[0],3936430074,11),i=a(i,u,r,n,t[3],3572445317,16),n=a(n,i,u,r,t[6],76029189,23),r=a(r,n,i,u,t[9],3654602809,4),u=a(u,r,n,i,t[12],3873151461,11),i=a(i,u,r,n,t[15],530742520,16),n=a(n,i,u,r,t[2],3299628645,23),r=f(r,n,i,u,t[0],4096336452,6),u=f(u,r,n,i,t[7],1126891415,10),i=f(i,u,r,n,t[14],2878612391,15),n=f(n,i,u,r,t[5],4237533241,21),r=f(r,n,i,u,t[12],1700485571,6),u=f(u,r,n,i,t[3],2399980690,10),i=f(i,u,r,n,t[10],4293915773,15),n=f(n,i,u,r,t[1],2240044497,21),r=f(r,n,i,u,t[8],1873313359,6),u=f(u,r,n,i,t[15],4264355552,10),i=f(i,u,r,n,t[6],2734768916,15),n=f(n,i,u,r,t[13],1309151649,21),r=f(r,n,i,u,t[4],4149444226,6),u=f(u,r,n,i,t[11],3174756917,10),i=f(i,u,r,n,t[2],718787259,15),n=f(n,i,u,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+u|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,"hash-base":158,inherits:153}],158:[function(t,e,r){"use strict";function n(t,e){if(!s.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}function i(t){o.call(this),this._block=s.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var s=t("safe-buffer").Buffer,o=t("stream").Transform;t("inherits")(i,o),i.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(n(t,"Data"),this._finalized)throw new Error("Digest already called");s.isBuffer(t)||(t=s.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=f,(f=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*f);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=i},{inherits:153,"safe-buffer":200,stream:209}],159:[function(t,e,r){function n(t){this.rand=t||new s.Rand}var i=t("bn.js"),s=t("brorand");e.exports=n,n.create=function(t){return new n(t)},n.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},n.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},n.prototype.test=function(t,e,r){var n=t.bitLength(),s=i.mont(t),o=new i(1).toRed(s);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),f=0;!a.testn(f);f++);for(var u=t.shrn(f),c=a.toRed(s);e>0;e--){var h=this._randrange(new i(2),a);r&&r(h);var d=h.toRed(s).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var l=1;l0;e--){var c=this._randrange(new i(2),o),h=t.gcd(c);if(0!==h.cmpn(1))return h;var d=c.toRed(n).redPow(f);if(0!==d.cmp(s)&&0!==d.cmp(u)){for(var l=1;l>8,o=255&i;s?r.push(s,o):r.push(o)}return r}function i(t){return 1===t.length?"0"+t:t}function s(t){for(var e="",r=0;r=6?"utf-8":"binary"}e.exports=r}).call(this,t("_process"))},{_process:173}],170:[function(t,e,r){var n=Math.pow(2,30)-1;e.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>n||e!==e)throw new TypeError("Bad key length")}},{}],171:[function(t,e,r){function n(t,e,r){var n=i(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=n(e):e.length1)for(var r=1;r=e.length){s++;break}var o=e.slice(2,i-1);e.slice(i-1,i);if(("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&s++,o.length<8&&s++,s)throw new Error("decryption error");return e.slice(i)}function s(t,e){t=new r(t),e=new r(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));for(var s=-1;++sh||new u(e).cmp(f.modulus)>=0)throw new Error("decryption error");var l;l=s?d(new u(e),f):c(e,f);var p=new r(h-l.length);if(p.fill(0),l=r.concat([p,l],h),4===a)return n(f,l);if(1===a)return i(f,l,s);if(3===a)return l;throw new Error("unknown padding")}}).call(this,t("buffer").Buffer)},{"./mgf":175,"./withPublic":178,"./xor":179,"bn.js":64,"browserify-rsa":87,buffer:98,"create-hash":102,"parse-asn1":166}],177:[function(t,e,r){(function(r){function n(t,e){var n=t.modulus.byteLength(),i=e.length,s=f("sha1").update(new r("")).digest(),o=s.length,d=2*o;if(i>n-d-2)throw new Error("message too long");var l=new r(n-i-d-2);l.fill(0);var p=n-o-1,b=a(o),g=c(r.concat([s,l,new r([1]),e],p),u(b,p)),y=c(b,u(g,o));return new h(r.concat([new r([0]),y,g],n))}function i(t,e,n){var i=e.length,o=t.modulus.byteLength();if(i>o-11)throw new Error("message too long");var a;return n?(a=new r(o-i-3),a.fill(255)):a=s(o-i-3),new h(r.concat([new r([0,n?1:2]),a,new r([0]),e],o))}function s(t,e){for(var n,i=new r(t),s=0,o=a(2*t),f=0;s=0)throw new Error("data too long for modulus")}return r?l(a,f):d(a,f)}}).call(this,t("buffer").Buffer)},{"./mgf":175,"./withPublic":178,"./xor":179,"bn.js":64,"browserify-rsa":87,buffer:98,"create-hash":102,"parse-asn1":166,randombytes:184}],178:[function(t,e,r){(function(r){function n(t,e){return new r(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}var i=t("bn.js");e.exports=n}).call(this,t("buffer").Buffer)},{"bn.js":64,buffer:98}],179:[function(t,e,r){e.exports=function(t,e){for(var r=t.length,n=-1;++n1&&(n=r[0]+"@",t=r[1]),t=t.replace(T,"."),n+s(t.split("."),e).join(".")}function a(t){for(var e,r,n=[],i=0,s=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function u(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:S}function c(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function h(t,e,r){var n=0;for(t=r?N(t/A):t>>1,t+=N(t/e);t>C*I>>1;n+=S)t=N(t/C);return N(n+(C+1)*t/(t+k))}function d(t){var e,r,n,s,o,a,c,d,l,p,b=[],g=t.length,y=0,m=O,v=P;for(r=t.lastIndexOf(x),r<0&&(r=0),n=0;n=128&&i("not-basic"),b.push(t.charCodeAt(n));for(s=r>0?r+1:0;s=g&&i("invalid-input"),d=u(t.charCodeAt(s++)),(d>=S||d>N((w-y)/a))&&i("overflow"),y+=d*a,l=c<=v?E:c>=v+I?I:c-v,!(dN(w/p)&&i("overflow"),a*=p;e=b.length+1,v=h(y-o,e,0==o),N(y/e)>w-m&&i("overflow"),m+=N(y/e),y%=e,b.splice(y++,0,m)}return f(b)}function l(t){var e,r,n,s,o,f,u,d,l,p,b,g,y,m,v,_=[];for(t=a(t),g=t.length,e=O,r=0,o=P,f=0;f=e&&bN((w-r)/y)&&i("overflow"),r+=(u-e)*y,e=u,f=0;fw&&i("overflow"),b==e){for(d=r,l=S;p=l<=o?E:l>=o+I?I:l-o,!(d= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=S-E,N=Math.floor,U=String.fromCharCode;if(v={version:"1.4.1",ucs2:{decode:a,encode:f},decode:d,encode:l,toASCII:b,toUnicode:p},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return v});else if(g&&y)if(e.exports==g)y.exports=v;else for(_ in v)v.hasOwnProperty(_)&&(g[_]=v[_]);else n.punycode=v}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],181:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,s){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var f=1e3;s&&"number"==typeof s.maxKeys&&(f=s.maxKeys);var u=t.length;f>0&&u>f&&(u=f);for(var c=0;c=0?(h=b.substr(0,g),d=b.substr(g+1)):(h=b,d=""),l=decodeURIComponent(h),p=decodeURIComponent(d),n(o,l)?i(o[l])?o[l].push(p):o[l]=[o[l],p]:o[l]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],182:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n65536)throw new Error("requested too many random bytes");var i=new n.Uint8Array(t);t>0&&a.getRandomValues(i);var s=o.from(i.buffer);return"function"==typeof e?r.nextTick(function(){e(null,s)}):s}var o=t("safe-buffer").Buffer,a=n.crypto||n.msCrypto;a&&a.getRandomValues?e.exports=s:e.exports=i}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:173,"safe-buffer":200}],185:[function(t,e,r){e.exports=t("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":186}],186:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);u.call(this,t),c.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||o(s,this)}function s(t){t.end()}var o=t("process-nextick-args"),a=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=n;var f=t("core-util-is");f.inherits=t("inherits");var u=t("./_stream_readable"),c=t("./_stream_writable");f.inherits(n,u);for(var h=a(c.prototype),d=0;d0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===j.prototype||(e=i(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):c(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?c(t,o,e,!1):m(t,o)):c(t,o,e,!1))):n||(o.reading=!1)}return d(o)}function c(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&g(t)),m(t,e)}function h(t,e){var r;return s(e)||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function d(t){return!t.ended&&(t.needReadable||t.length=Y?t=Y:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function p(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=l(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function b(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,g(t)}}function g(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?T(y,t):y(t))}function y(t){H("emit readable"),t.emit("readable"),I(t)}function m(t,e){e.readingMore||(e.readingMore=!0,T(v,t,e))}function v(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=A(t,e.buffer,e.decoder),r}function A(t,e,r){var n;return ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}function O(t,e){var r=j.allocUnsafe(t),n=e.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}function x(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,T(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return H("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?x(this):g(this),null;if(0===(t=p(t,e))&&e.ended)return 0===e.length&&x(this),null;var n=e.needReadable;H("need readable",n),(0===e.length||e.length-t0?k(t,e):null,null===i?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&x(this)),null!==i&&this.emit("data",i),i},f.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},f.prototype.pipe=function(t,e){function n(t,e){H("onunpipe"),t===d&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,s())}function i(){H("onend"),t.end()}function s(){H("cleanup"),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("drain",g),t.removeListener("error",f),t.removeListener("unpipe",n),d.removeListener("end",i),d.removeListener("end",h),d.removeListener("data",a),y=!0,!l.awaitDrain||t._writableState&&!t._writableState.needDrain||g()}function a(e){H("ondata"),m=!1,!1!==t.write(e)||m||((1===l.pipesCount&&l.pipes===t||l.pipesCount>1&&-1!==R(l.pipes,t))&&!y&&(H("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,m=!0),d.pause())}function f(e){H("onerror",e),h(),t.removeListener("error",f),0===N(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",c),h()}function c(){H("onfinish"),t.removeListener("close",u),h()}function h(){H("unpipe"),d.unpipe(t)}var d=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=t;break;case 1:l.pipes=[l.pipes,t];break;default:l.pipes.push(t)}l.pipesCount+=1,H("pipe count=%d opts=%j",l.pipesCount,e);var p=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr,b=p?i:h;l.endEmitted?T(b):d.once("end",b),t.on("unpipe",n);var g=_(d);t.on("drain",g);var y=!1,m=!1;return d.on("data",a),o(t,"error",f),t.once("close",u),t.once("finish",c),t.emit("pipe",d),l.flowing||(H("pipe resume"),d.resume()),t},f.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?setImmediate:P;u.WritableState=f;var B=t("core-util-is");B.inherits=t("inherits");var R={deprecate:t("util-deprecate")},T=t("./internal/streams/stream"),M=t("safe-buffer").Buffer,C=n.Uint8Array||function(){},N=t("./internal/streams/destroy");B.inherits(u,T),f.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(f.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}();var U;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(U=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(t){return!!U.call(this,t)||t&&t._writableState instanceof f}})):U=function(t){return t instanceof this},u.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},u.prototype.write=function(t,e,r){var n=this._writableState,i=!1,f=o(t)&&!n.objectMode;return f&&!M.isBuffer(t)&&(t=s(t)),"function"==typeof e&&(r=e,e=null),f?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=a),n.ended?c(this,r):(f||h(this,n,t,r))&&(n.pendingcb++,i=l(this,n,f,t,e,r)),i},u.prototype.cork=function(){this._writableState.corked++},u.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},u.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},u.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},u.prototype._writev=null,u.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||k(this,n,r)},Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),u.prototype.destroy=N.destroy,u.prototype._undestroy=N.undestroy,u.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":186,"./internal/streams/destroy":192,"./internal/streams/stream":193,_process:173,"core-util-is":100,inherits:194,"process-nextick-args":172,"safe-buffer":200,"util-deprecate":213}],191:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,r){t.copy(e,r)}var s=t("safe-buffer").Buffer;e.exports=function(){function t(){n(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return s.alloc(0);if(1===this.length)return this.head.data;for(var e=s.allocUnsafe(t>>>0),r=this.head,n=0;r;)i(r.data,e,n),n+=r.data.length,r=r.next;return e},t}()},{"safe-buffer":200}],192:[function(t,e,r){"use strict";function n(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;if(n||i)return void(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||o(s,this,t));this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(o(s,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})}function i(){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 s(t,e){t.emit("error",e)}var o=t("process-nextick-args");e.exports={destroy:n,undestroy:i}},{"process-nextick-args":172}],193:[function(t,e,r){e.exports=t("events").EventEmitter},{events:134}],194:[function(t,e,r){arguments[4][149][0].apply(r,arguments)},{dup:149}],195:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":196}],196:[function(t,e,r){r=e.exports=t("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":186,"./lib/_stream_passthrough.js":187,"./lib/_stream_readable.js":188,"./lib/_stream_transform.js":189,"./lib/_stream_writable.js":190}],197:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":196}],198:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":190}],199:[function(t,e,r){(function(r){"use strict";function n(){h.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function i(t,e){return t<>>32-e}function s(t,e,r,n,s,o,a,f){return i(t+(e^r^n)+o+a|0,f)+s|0}function o(t,e,r,n,s,o,a,f){return i(t+(e&r|~e&n)+o+a|0,f)+s|0}function a(t,e,r,n,s,o,a,f){return i(t+((e|~r)^n)+o+a|0,f)+s|0}function f(t,e,r,n,s,o,a,f){return i(t+(e&n|r&~n)+o+a|0,f)+s|0}function u(t,e,r,n,s,o,a,f){return i(t+(e^(r|~n))+o+a|0,f)+s|0}var c=t("inherits"),h=t("hash-base");c(n,h),n.prototype._update=function(){for(var t=new Array(16),e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,c=this._c,h=this._d,d=this._e;r=s(r,n,c,h,d,t[0],0,11),c=i(c,10),d=s(d,r,n,c,h,t[1],0,14),n=i(n,10),h=s(h,d,r,n,c,t[2],0,15),r=i(r,10),c=s(c,h,d,r,n,t[3],0,12),d=i(d,10),n=s(n,c,h,d,r,t[4],0,5),h=i(h,10),r=s(r,n,c,h,d,t[5],0,8),c=i(c,10),d=s(d,r,n,c,h,t[6],0,7),n=i(n,10),h=s(h,d,r,n,c,t[7],0,9),r=i(r,10),c=s(c,h,d,r,n,t[8],0,11),d=i(d,10),n=s(n,c,h,d,r,t[9],0,13),h=i(h,10),r=s(r,n,c,h,d,t[10],0,14),c=i(c,10),d=s(d,r,n,c,h,t[11],0,15),n=i(n,10),h=s(h,d,r,n,c,t[12],0,6),r=i(r,10),c=s(c,h,d,r,n,t[13],0,7),d=i(d,10),n=s(n,c,h,d,r,t[14],0,9),h=i(h,10),r=s(r,n,c,h,d,t[15],0,8),c=i(c,10),d=o(d,r,n,c,h,t[7],1518500249,7),n=i(n,10),h=o(h,d,r,n,c,t[4],1518500249,6),r=i(r,10),c=o(c,h,d,r,n,t[13],1518500249,8),d=i(d,10),n=o(n,c,h,d,r,t[1],1518500249,13),h=i(h,10),r=o(r,n,c,h,d,t[10],1518500249,11),c=i(c,10),d=o(d,r,n,c,h,t[6],1518500249,9),n=i(n,10),h=o(h,d,r,n,c,t[15],1518500249,7),r=i(r,10),c=o(c,h,d,r,n,t[3],1518500249,15),d=i(d,10),n=o(n,c,h,d,r,t[12],1518500249,7),h=i(h,10),r=o(r,n,c,h,d,t[0],1518500249,12),c=i(c,10),d=o(d,r,n,c,h,t[9],1518500249,15),n=i(n,10),h=o(h,d,r,n,c,t[5],1518500249,9),r=i(r,10),c=o(c,h,d,r,n,t[2],1518500249,11),d=i(d,10),n=o(n,c,h,d,r,t[14],1518500249,7),h=i(h,10),r=o(r,n,c,h,d,t[11],1518500249,13),c=i(c,10),d=o(d,r,n,c,h,t[8],1518500249,12),n=i(n,10),h=a(h,d,r,n,c,t[3],1859775393,11),r=i(r,10),c=a(c,h,d,r,n,t[10],1859775393,13),d=i(d,10),n=a(n,c,h,d,r,t[14],1859775393,6),h=i(h,10),r=a(r,n,c,h,d,t[4],1859775393,7),c=i(c,10),d=a(d,r,n,c,h,t[9],1859775393,14),n=i(n,10),h=a(h,d,r,n,c,t[15],1859775393,9),r=i(r,10),c=a(c,h,d,r,n,t[8],1859775393,13),d=i(d,10),n=a(n,c,h,d,r,t[1],1859775393,15),h=i(h,10),r=a(r,n,c,h,d,t[2],1859775393,14),c=i(c,10),d=a(d,r,n,c,h,t[7],1859775393,8),n=i(n,10),h=a(h,d,r,n,c,t[0],1859775393,13),r=i(r,10),c=a(c,h,d,r,n,t[6],1859775393,6),d=i(d,10),n=a(n,c,h,d,r,t[13],1859775393,5),h=i(h,10),r=a(r,n,c,h,d,t[11],1859775393,12),c=i(c,10),d=a(d,r,n,c,h,t[5],1859775393,7),n=i(n,10),h=a(h,d,r,n,c,t[12],1859775393,5),r=i(r,10),c=f(c,h,d,r,n,t[1],2400959708,11),d=i(d,10),n=f(n,c,h,d,r,t[9],2400959708,12),h=i(h,10),r=f(r,n,c,h,d,t[11],2400959708,14),c=i(c,10),d=f(d,r,n,c,h,t[10],2400959708,15),n=i(n,10),h=f(h,d,r,n,c,t[0],2400959708,14),r=i(r,10),c=f(c,h,d,r,n,t[8],2400959708,15),d=i(d,10),n=f(n,c,h,d,r,t[12],2400959708,9),h=i(h,10),r=f(r,n,c,h,d,t[4],2400959708,8),c=i(c,10),d=f(d,r,n,c,h,t[13],2400959708,9),n=i(n,10),h=f(h,d,r,n,c,t[3],2400959708,14),r=i(r,10),c=f(c,h,d,r,n,t[7],2400959708,5),d=i(d,10),n=f(n,c,h,d,r,t[15],2400959708,6),h=i(h,10),r=f(r,n,c,h,d,t[14],2400959708,8),c=i(c,10),d=f(d,r,n,c,h,t[5],2400959708,6),n=i(n,10),h=f(h,d,r,n,c,t[6],2400959708,5),r=i(r,10),c=f(c,h,d,r,n,t[2],2400959708,12),d=i(d,10),n=u(n,c,h,d,r,t[4],2840853838,9),h=i(h,10),r=u(r,n,c,h,d,t[0],2840853838,15),c=i(c,10),d=u(d,r,n,c,h,t[5],2840853838,5),n=i(n,10),h=u(h,d,r,n,c,t[9],2840853838,11),r=i(r,10),c=u(c,h,d,r,n,t[7],2840853838,6),d=i(d,10),n=u(n,c,h,d,r,t[12],2840853838,8),h=i(h,10),r=u(r,n,c,h,d,t[2],2840853838,13),c=i(c,10),d=u(d,r,n,c,h,t[10],2840853838,12),n=i(n,10),h=u(h,d,r,n,c,t[14],2840853838,5),r=i(r,10),c=u(c,h,d,r,n,t[1],2840853838,12),d=i(d,10),n=u(n,c,h,d,r,t[3],2840853838,13),h=i(h,10),r=u(r,n,c,h,d,t[8],2840853838,14),c=i(c,10),d=u(d,r,n,c,h,t[11],2840853838,11),n=i(n,10),h=u(h,d,r,n,c,t[6],2840853838,8),r=i(r,10),c=u(c,h,d,r,n,t[15],2840853838,5),d=i(d,10),n=u(n,c,h,d,r,t[13],2840853838,6),h=i(h,10);var l=this._a,p=this._b,b=this._c,g=this._d,y=this._e;l=u(l,p,b,g,y,t[5],1352829926,8),b=i(b,10),y=u(y,l,p,b,g,t[14],1352829926,9),p=i(p,10),g=u(g,y,l,p,b,t[7],1352829926,9),l=i(l,10),b=u(b,g,y,l,p,t[0],1352829926,11),y=i(y,10),p=u(p,b,g,y,l,t[9],1352829926,13),g=i(g,10),l=u(l,p,b,g,y,t[2],1352829926,15),b=i(b,10),y=u(y,l,p,b,g,t[11],1352829926,15),p=i(p,10),g=u(g,y,l,p,b,t[4],1352829926,5),l=i(l,10),b=u(b,g,y,l,p,t[13],1352829926,7),y=i(y,10),p=u(p,b,g,y,l,t[6],1352829926,7),g=i(g,10),l=u(l,p,b,g,y,t[15],1352829926,8),b=i(b,10),y=u(y,l,p,b,g,t[8],1352829926,11),p=i(p,10),g=u(g,y,l,p,b,t[1],1352829926,14),l=i(l,10),b=u(b,g,y,l,p,t[10],1352829926,14),y=i(y,10),p=u(p,b,g,y,l,t[3],1352829926,12),g=i(g,10),l=u(l,p,b,g,y,t[12],1352829926,6),b=i(b,10),y=f(y,l,p,b,g,t[6],1548603684,9),p=i(p,10),g=f(g,y,l,p,b,t[11],1548603684,13),l=i(l,10),b=f(b,g,y,l,p,t[3],1548603684,15),y=i(y,10),p=f(p,b,g,y,l,t[7],1548603684,7),g=i(g,10),l=f(l,p,b,g,y,t[0],1548603684,12),b=i(b,10),y=f(y,l,p,b,g,t[13],1548603684,8),p=i(p,10),g=f(g,y,l,p,b,t[5],1548603684,9),l=i(l,10),b=f(b,g,y,l,p,t[10],1548603684,11),y=i(y,10),p=f(p,b,g,y,l,t[14],1548603684,7),g=i(g,10),l=f(l,p,b,g,y,t[15],1548603684,7),b=i(b,10),y=f(y,l,p,b,g,t[8],1548603684,12),p=i(p,10),g=f(g,y,l,p,b,t[12],1548603684,7),l=i(l,10),b=f(b,g,y,l,p,t[4],1548603684,6),y=i(y,10),p=f(p,b,g,y,l,t[9],1548603684,15),g=i(g,10),l=f(l,p,b,g,y,t[1],1548603684,13),b=i(b,10),y=f(y,l,p,b,g,t[2],1548603684,11),p=i(p,10),g=a(g,y,l,p,b,t[15],1836072691,9),l=i(l,10),b=a(b,g,y,l,p,t[5],1836072691,7),y=i(y,10),p=a(p,b,g,y,l,t[1],1836072691,15),g=i(g,10),l=a(l,p,b,g,y,t[3],1836072691,11),b=i(b,10),y=a(y,l,p,b,g,t[7],1836072691,8),p=i(p,10),g=a(g,y,l,p,b,t[14],1836072691,6),l=i(l,10),b=a(b,g,y,l,p,t[6],1836072691,6),y=i(y,10),p=a(p,b,g,y,l,t[9],1836072691,14),g=i(g,10),l=a(l,p,b,g,y,t[11],1836072691,12),b=i(b,10),y=a(y,l,p,b,g,t[8],1836072691,13),p=i(p,10),g=a(g,y,l,p,b,t[12],1836072691,5),l=i(l,10),b=a(b,g,y,l,p,t[2],1836072691,14),y=i(y,10),p=a(p,b,g,y,l,t[10],1836072691,13),g=i(g,10),l=a(l,p,b,g,y,t[0],1836072691,13),b=i(b,10),y=a(y,l,p,b,g,t[4],1836072691,7),p=i(p,10),g=a(g,y,l,p,b,t[13],1836072691,5),l=i(l,10),b=o(b,g,y,l,p,t[8],2053994217,15),y=i(y,10),p=o(p,b,g,y,l,t[6],2053994217,5),g=i(g,10),l=o(l,p,b,g,y,t[4],2053994217,8),b=i(b,10),y=o(y,l,p,b,g,t[1],2053994217,11),p=i(p,10),g=o(g,y,l,p,b,t[3],2053994217,14),l=i(l,10),b=o(b,g,y,l,p,t[11],2053994217,14),y=i(y,10),p=o(p,b,g,y,l,t[15],2053994217,6),g=i(g,10),l=o(l,p,b,g,y,t[0],2053994217,14),b=i(b,10),y=o(y,l,p,b,g,t[5],2053994217,6),p=i(p,10),g=o(g,y,l,p,b,t[12],2053994217,9),l=i(l,10),b=o(b,g,y,l,p,t[2],2053994217,12),y=i(y,10),p=o(p,b,g,y,l,t[13],2053994217,9),g=i(g,10),l=o(l,p,b,g,y,t[9],2053994217,12),b=i(b,10),y=o(y,l,p,b,g,t[7],2053994217,5),p=i(p,10),g=o(g,y,l,p,b,t[10],2053994217,15),l=i(l,10),b=o(b,g,y,l,p,t[14],2053994217,8),y=i(y,10),p=s(p,b,g,y,l,t[12],0,8),g=i(g,10),l=s(l,p,b,g,y,t[15],0,5),b=i(b,10),y=s(y,l,p,b,g,t[10],0,12),p=i(p,10),g=s(g,y,l,p,b,t[4],0,9),l=i(l,10),b=s(b,g,y,l,p,t[1],0,12),y=i(y,10),p=s(p,b,g,y,l,t[5],0,5),g=i(g,10),l=s(l,p,b,g,y,t[8],0,14),b=i(b,10),y=s(y,l,p,b,g,t[7],0,6),p=i(p,10),g=s(g,y,l,p,b,t[6],0,8),l=i(l,10),b=s(b,g,y,l,p,t[2],0,13),y=i(y,10),p=s(p,b,g,y,l,t[13],0,6),g=i(g,10),l=s(l,p,b,g,y,t[14],0,5),b=i(b,10),y=s(y,l,p,b,g,t[0],0,15),p=i(p,10),g=s(g,y,l,p,b,t[3],0,13),l=i(l,10),b=s(b,g,y,l,p,t[9],0,11),y=i(y,10),p=s(p,b,g,y,l,t[11],0,11),g=i(g,10);var m=this._b+c+g|0;this._b=this._c+h+y|0,this._c=this._d+d+l|0,this._d=this._e+r+p|0,this._e=this._a+n+b|0,this._a=m},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:98,"hash-base":136,inherits:153}],200:[function(t,e,r){function n(t,e){for(var r in t)e[r]=t[r]}function i(t,e,r){return o(t,e,r)}var s=t("buffer"),o=s.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=s:(n(s,r),r.Buffer=i),n(o,i),i.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return o(t,e,r)},i.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=o(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return s.SlowBuffer(t)}},{buffer:98}],201:[function(t,e,r){function n(t,e){this._block=i.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}var i=t("safe-buffer").Buffer;n.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=i.from(t,e));for(var r=this._block,n=this._blockSize,s=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=4294967295&r,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=n},{"safe-buffer":200}],202:[function(t,e,r){var r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":203,"./sha1":204,"./sha224":205,"./sha256":206,"./sha384":207,"./sha512":208}],203:[function(t,e,r){function n(){this.init(),this._w=h,f.call(this,64,56)}function i(t){return t<<5|t>>>27}function s(t){return t<<30|t>>>2}function o(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var a=t("inherits"),f=t("./hash"),u=t("safe-buffer").Buffer,c=[1518500249,1859775393,-1894007588,-899497514],h=new Array(80);a(n,f),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,a=0|this._c,f=0|this._d,u=0|this._e,h=0;h<16;++h)e[h]=t.readInt32BE(4*h);for(;h<80;++h)e[h]=e[h-3]^e[h-8]^e[h-14]^e[h-16];for(var d=0;d<80;++d){var l=~~(d/20),p=i(r)+o(l,n,a,f)+u+e[d]+c[l]|0;u=f,f=a,a=s(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0},n.prototype._hash=function(){var t=u.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],204:[function(t,e,r){function n(){this.init(),this._w=d,u.call(this,64,56)}function i(t){return t<<1|t>>>31}function s(t){return t<<5|t>>>27}function o(t){return t<<30|t>>>2}function a(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var f=t("inherits"),u=t("./hash"),c=t("safe-buffer").Buffer,h=[1518500249,1859775393,-1894007588,-899497514],d=new Array(80);f(n,u),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,f=0|this._c,u=0|this._d,c=0|this._e,d=0;d<16;++d)e[d]=t.readInt32BE(4*d);for(;d<80;++d)e[d]=i(e[d-3]^e[d-8]^e[d-14]^e[d-16]);for(var l=0;l<80;++l){var p=~~(l/20),b=s(r)+a(p,n,f,u)+c+e[l]+h[p]|0;c=u,u=f,f=o(n),n=r,r=b}this._a=r+this._a|0,this._b=n+this._b|0,this._c=f+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},n.prototype._hash=function(){var t=c.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],205:[function(t,e,r){function n(){this.init(),this._w=f,o.call(this,64,56)}var i=t("inherits"),s=t("./sha256"),o=t("./hash"),a=t("safe-buffer").Buffer,f=new Array(64);i(n,s),n.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},n.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=n},{"./hash":201,"./sha256":206,inherits:153,"safe-buffer":200}],206:[function(t,e,r){function n(){this.init(),this._w=p,h.call(this,64,56)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function a(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function u(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}var c=t("inherits"),h=t("./hash"),d=t("safe-buffer").Buffer,l=[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],p=new Array(64);c(n,h),n.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},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,c=0|this._c,h=0|this._d,d=0|this._e,p=0|this._f,b=0|this._g,g=0|this._h,y=0;y<16;++y)e[y]=t.readInt32BE(4*y);for(;y<64;++y)e[y]=u(e[y-2])+e[y-7]+f(e[y-15])+e[y-16]|0;for(var m=0;m<64;++m){var v=g+a(d)+i(d,p,b)+l[m]+e[m]|0,_=o(r)+s(r,n,c)|0;g=b,b=p,p=d,d=h+v|0,h=c,c=n,n=r,r=v+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=c+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=g+this._h|0},n.prototype._hash=function(){var t=d.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],207:[function(t,e,r){function n(){this.init(),this._w=f,o.call(this,128,112)}var i=t("inherits"),s=t("./sha512"),o=t("./hash"),a=t("safe-buffer").Buffer,f=new Array(160);i(n,s),n.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},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=a.allocUnsafe(48);return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=n},{"./hash":201,"./sha512":208,inherits:153,"safe-buffer":200}],208:[function(t,e,r){function n(){this.init(),this._w=y,p.call(this,128,112)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function a(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function u(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function c(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function h(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function d(t,e){return t>>>0>>0?1:0}var l=t("inherits"),p=t("./hash"),b=t("safe-buffer").Buffer,g=[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],y=new Array(160);l(n,p),n.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},n.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,l=0|this._ch,p=0|this._dh,b=0|this._eh,y=0|this._fh,m=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,E=0|this._dl,I=0|this._el,k=0|this._fl,A=0|this._gl,P=0|this._hl,O=0;O<32;O+=2)e[O]=t.readInt32BE(4*O),e[O+1]=t.readInt32BE(4*O+4);for(;O<160;O+=2){var x=e[O-30],B=e[O-30+1],R=f(x,B),T=u(B,x);x=e[O-4],B=e[O-4+1];var M=c(x,B),C=h(B,x),N=e[O-14],U=e[O-14+1],j=e[O-32],L=e[O-32+1],D=T+U|0,K=R+N+d(D,T)|0;D=D+C|0,K=K+M+d(D,C)|0,D=D+L|0,K=K+j+d(D,L)|0,e[O]=K,e[O+1]=D}for(var H=0;H<160;H+=2){K=e[H],D=e[H+1];var F=s(r,n,l),z=s(_,w,S),q=o(r,_),V=o(_,r),Y=a(b,I),G=a(I,b),W=g[H],X=g[H+1],Z=i(b,y,m),J=i(I,k,A),Q=P+G|0,$=v+Y+d(Q,P)|0;Q=Q+J|0,$=$+Z+d(Q,J)|0,Q=Q+X|0,$=$+W+d(Q,X)|0,Q=Q+D|0,$=$+K+d(Q,D)|0;var tt=V+z|0,et=q+F+d(tt,V)|0;v=m,P=A,m=y,A=k,y=b,k=I,I=E+Q|0, +b=p+$+d(I,E)|0,p=l,E=S,l=n,S=w,n=r,w=_,_=Q+tt|0,r=$+et+d(_,Q)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+I|0,this._fl=this._fl+k|0,this._gl=this._gl+A|0,this._hl=this._hl+P|0,this._ah=this._ah+r+d(this._al,_)|0,this._bh=this._bh+n+d(this._bl,w)|0,this._ch=this._ch+l+d(this._cl,S)|0,this._dh=this._dh+p+d(this._dl,E)|0,this._eh=this._eh+b+d(this._el,I)|0,this._fh=this._fh+y+d(this._fl,k)|0,this._gh=this._gh+m+d(this._gl,A)|0,this._hh=this._hh+v+d(this._hl,P)|0},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=b.allocUnsafe(64);return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=n},{"./hash":201,inherits:153,"safe-buffer":200}],209:[function(t,e,r){function n(){i.call(this)}e.exports=n;var i=t("events").EventEmitter;t("inherits")(n,i),n.Readable=t("readable-stream/readable.js"),n.Writable=t("readable-stream/writable.js"),n.Duplex=t("readable-stream/duplex.js"),n.Transform=t("readable-stream/transform.js"),n.PassThrough=t("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(t,e){function r(e){t.writable&&!1===t.write(e)&&u.pause&&u.pause()}function n(){u.readable&&u.resume&&u.resume()}function s(){c||(c=!0,t.end())}function o(){c||(c=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(f(),0===i.listenerCount(this,"error"))throw t}function f(){u.removeListener("data",r),t.removeListener("drain",n),u.removeListener("end",s),u.removeListener("close",o),u.removeListener("error",a),t.removeListener("error",a),u.removeListener("end",f),u.removeListener("close",f),t.removeListener("close",f)}var u=this;u.on("data",r),t.on("drain",n),t._isStdio||e&&!1===e.end||(u.on("end",s),u.on("close",o));var c=!1;return u.on("error",a),t.on("error",a),u.on("end",f),u.on("close",f),t.on("close",f),t.emit("pipe",u),t}},{events:134,inherits:153,"readable-stream/duplex.js":185,"readable-stream/passthrough.js":195,"readable-stream/readable.js":196,"readable-stream/transform.js":197,"readable-stream/writable.js":198}],210:[function(t,e,r){"use strict";function n(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function i(t){var e=n(t);if("string"!=typeof e&&(m.isEncoding===v||!v(t)))throw new Error("Unknown encoding: "+t);return e||t}function s(t){this.encoding=i(t);var e;switch(this.encoding){case"utf16le":this.text=d,this.end=l,e=4;break;case"utf8":this.fillLast=u,e=4;break;case"base64":this.text=p,this.end=b,e=3;break;default:return this.write=g,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=m.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function a(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0)}function f(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�".repeat(r);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�".repeat(r+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�".repeat(r+2)}}function u(t){var e=this.lastTotal-this.lastNeed,r=f(this,t,e);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){var r=a(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�".repeat(this.lastTotal-this.lastNeed):e}function d(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function p(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function b(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function g(t){return t.toString(this.encoding)}function y(t){return t&&t.length?this.write(t):""}var m=t("safe-buffer").Buffer,v=m.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(l),b=["'"].concat(p),g=["%","/","?",";","#"].concat(b),y=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,v=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},E=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&n127?C+="x":C+=M[N];if(!C.match(m)){var j=R.slice(0,A),L=R.slice(A+1),D=M.match(v);D&&(j.push(D[1]),L.unshift(D[2])),L.length&&(a="/"+L.join(".")+a),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=f.toASCII(this.hostname));var K=this.port?":"+this.port:"",H=this.hostname||"";this.host=H+K,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!_[p])for(var A=0,T=b.length;A0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],P=(r.host||t.host||E.length>1)&&("."===A||".."===A)||""===A,O=0,x=E.length;x>=0;x--)A=E[x],"."===A?E.splice(x,1):".."===A?(E.splice(x,1),O++):O&&(E.splice(x,1),O--);if(!v&&!_)for(;O--;O)E.unshift("..");!v||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),P&&"/"!==E.join("/").substr(-1)&&E.push("");var B=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(I){r.hostname=r.host=B?"":E.length?E.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return v=v||r.host&&E.length,v&&!B&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":212,punycode:180,querystring:183}],212:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],213:[function(t,e,r){(function(t){function r(t,e){function r(){if(!i){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}if(n("noDeprecation"))return t;var i=!1;return r}function n(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],214:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],215:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(e)?n.showHidden=e:e&&r._extend(n,e),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),f(n,t,n.depth)}function s(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function o(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function f(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=f(t,i,n)),i}var s=u(t,e);if(s)return s;var o=Object.keys(e),b=a(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(A(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(I(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var y="",m=!1,_=["{","}"];if(p(e)&&(m=!0,_=["[","]"]),A(e)){y=" [Function"+(e.name?": "+e.name:"")+"]"}if(S(e)&&(y=" "+RegExp.prototype.toString.call(e)),I(e)&&(y=" "+Date.prototype.toUTCString.call(e)),k(e)&&(y=" "+c(e)),0===o.length&&(!m||0==e.length))return _[0]+y+_[1];if(n<0)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var w;return w=m?h(t,e,n,b,o):o.map(function(r){return d(t,e,n,b,r,m)}),t.seen.pop(),l(w,y,_)}function u(t,e){if(w(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return m(e)?t.stylize(""+e,"number"):b(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var s=[],o=0,a=e.length;o-1&&(a=s?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function l(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return null==t}function m(t){return"number"==typeof t}function v(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return E(t)&&"[object RegExp]"===O(t)}function E(t){return"object"==typeof t&&null!==t}function I(t){return E(t)&&"[object Date]"===O(t)}function k(t){return E(t)&&("[object Error]"===O(t)||t instanceof Error)}function A(t){return"function"==typeof t}function P(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function O(t){return Object.prototype.toString.call(t)}function x(t){return t<10?"0"+t.toString(10):t.toString(10)}function B(){var t=new Date,e=[x(t.getHours()),x(t.getMinutes()),x(t.getSeconds())].join(":");return[t.getDate(),N[t.getMonth()],e].join(" ")}function R(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var T=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),a=n[r];r",main:"index.js",scripts:{lint:"gulp lint",test:"gulp test",coverage:"gulp coverage",build:"gulp"},keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],repository:{type:"git",url:"https://github.com/bitpay/bitcore-lib/tree/cash"},browser:{request:"browser-request"},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","phantomjs-prebuilt":"^2.1.16"},devDependencies:{"bitcore-build":"https://github.com/bitpay/bitcore-build.git#d4e8b2b2f1e2c065c3a807dcb6a6250f61d67ab3",brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0"},license:"MIT"}},{}],"bitcore-lib":[function(t,e,r){(function(r,n){"use strict";var i=e.exports;i.version="v"+t("./package.json").version,i.versionGuard=function(t){if(void 0!==t){throw new Error("More than one instance of bitcore-lib-cash found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.")}},i.versionGuard(r._bitcoreCash),r._bitcoreCash=i.version,i.crypto={},i.crypto.BN=t("./lib/crypto/bn"),i.crypto.ECDSA=t("./lib/crypto/ecdsa"),i.crypto.Hash=t("./lib/crypto/hash"),i.crypto.Random=t("./lib/crypto/random"),i.crypto.Point=t("./lib/crypto/point"),i.crypto.Signature=t("./lib/crypto/signature"),i.encoding={},i.encoding.Base58=t("./lib/encoding/base58"),i.encoding.Base58Check=t("./lib/encoding/base58check"),i.encoding.BufferReader=t("./lib/encoding/bufferreader"),i.encoding.BufferWriter=t("./lib/encoding/bufferwriter"),i.encoding.Varint=t("./lib/encoding/varint"),i.util={},i.util.buffer=t("./lib/util/buffer"),i.util.js=t("./lib/util/js"),i.util.preconditions=t("./lib/util/preconditions"),i.util.base32=t("./lib/util/base32"),i.util.convertBits=t("./lib/util/convertBits"),i.errors=t("./lib/errors"),i.Address=t("./lib/address"),i.Block=t("./lib/block"),i.MerkleBlock=t("./lib/block/merkleblock"),i.BlockHeader=t("./lib/block/blockheader"),i.HDPrivateKey=t("./lib/hdprivatekey.js"),i.HDPublicKey=t("./lib/hdpublickey.js"),i.Networks=t("./lib/networks"),i.Opcode=t("./lib/opcode"),i.PrivateKey=t("./lib/privatekey"),i.PublicKey=t("./lib/publickey"),i.Script=t("./lib/script"),i.Transaction=t("./lib/transaction"),i.URI=t("./lib/uri"),i.Unit=t("./lib/unit"),i.deps={},i.deps.bnjs=t("bn.js"),i.deps.bs58=t("bs58"),i.deps.Buffer=n,i.deps.elliptic=t("elliptic"),i.deps._=t("lodash"),i.Transaction.sighash=t("./lib/transaction/sighash")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"./lib/address":1,"./lib/block":4,"./lib/block/blockheader":3,"./lib/block/merkleblock":5,"./lib/crypto/bn":6,"./lib/crypto/ecdsa":7,"./lib/crypto/hash":8,"./lib/crypto/point":9,"./lib/crypto/random":10,"./lib/crypto/signature":11,"./lib/encoding/base58":12,"./lib/encoding/base58check":13,"./lib/encoding/bufferreader":14,"./lib/encoding/bufferwriter":15,"./lib/encoding/varint":16,"./lib/errors":17,"./lib/hdprivatekey.js":19,"./lib/hdpublickey.js":20,"./lib/networks":21,"./lib/opcode":22,"./lib/privatekey":23,"./lib/publickey":24,"./lib/script":25,"./lib/transaction":28,"./lib/transaction/sighash":36,"./lib/unit":40,"./lib/uri":41,"./lib/util/base32":42,"./lib/util/buffer":43,"./lib/util/convertBits":44,"./lib/util/js":45,"./lib/util/preconditions":46,"./package.json":217,"bn.js":64,bs58:95,buffer:98,elliptic:118,lodash:156}]},{},[]); \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index a871c358..0ceddc01 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -# Bitcore Cash v0.17.0 +# Bitcore Cash v0.18.0 ## Principles diff --git a/package-lock.json b/package-lock.json index 1a9596be..e95cac93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bitcore-lib-cash", - "version": "0.16.3", + "version": "0.18.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 19fc338f..e49ce217 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitcore-lib-cash", - "version": "0.17.0", + "version": "0.18.0", "description": "A pure and powerful JavaScript Bitcoin Cash library.", "author": "BitPay ", "main": "index.js",