From 3d27f818480089337f1178a1d42966979b44e72e Mon Sep 17 00:00:00 2001 From: Emilio Almansi Date: Sun, 14 Jan 2018 14:50:42 -0300 Subject: [PATCH] Removed intermediate files from repo. --- README.md | 2 +- dist/bitcoincashjs.0.1.7.min.js | 1 - dist/bitcoincashjs.0.1.8.min.js | 1 + gulpfile.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 dist/bitcoincashjs.0.1.7.min.js create mode 100644 dist/bitcoincashjs.0.1.8.min.js diff --git a/README.md b/README.md index c3a0b30..b405a2f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ $ bower install --save bitcoincashjs ### Manually -You may also download the distribution file manually and place it within your third-party scripts directory: [dist/bitcoincashjs.0.1.7.min.js](https://cdn.rawgit.com/bitcoincashjs/bitcoincashjs/master/dist/bitcoincashjs.0.1.7.min.js). +You may also download the distribution file manually and place it within your third-party scripts directory: [dist/bitcoincashjs.0.1.8.min.js](https://cdn.rawgit.com/bitcoincashjs/bitcoincashjs/master/dist/bitcoincashjs.0.1.8.min.js). ## Examples diff --git a/dist/bitcoincashjs.0.1.7.min.js b/dist/bitcoincashjs.0.1.7.min.js deleted file mode 100644 index a3a2ff9..0000000 --- a/dist/bitcoincashjs.0.1.7.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,t.bch=e()}})(function(){var t=Math.LN2,r=Math.log,o=Math.pow,s=Math.abs,e=Math.clz32,f=Math.max,a=String.fromCharCode,p=Math.ceil,n=Math.round,u=Math.min,h=Math.floor,d,i,c;return function d(c,e,t){function r(i,o){if(!e[i]){if(!c[i]){var s="function"==typeof require&&require;if(!o&&s)return s(i,!0);if(n)return n(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var f=e[i]={exports:{}};c[i][0].call(f.exports,function(t){var e=c[i][1][t];return r(e?e:t)},f,f.exports,d,c,e,t)}return e[i].exports}for(var n="function"==typeof require&&require,a=0;a"},t.exports=o;var g=e("./script")}).call(this,e("buffer").Buffer)},{"./crypto/hash":9,"./encoding/base58check":14,"./errors":18,"./networks":33,"./publickey":36,"./script":37,"./util/js":55,"./util/preconditions":56,buffer:126,cashaddrjs:128,lodash:204}],2:[function(e,t){(function(r,a){"use strict";var o=t.exports;o.version="v"+e("../package.json").version,o.versionGuard=function(e){if(e!==void 0){throw new Error("More than one instance of bitcoincashjs found. Please make sure to require bitcoincashjs and check that submodules do not also include their own bitcoincashjs dependency.")}},o.versionGuard(r._bch),r._bch=o.version,o.crypto={},o.crypto.BN=e("./crypto/bn"),o.crypto.ECDSA=e("./crypto/ecdsa"),o.crypto.Hash=e("./crypto/hash"),o.crypto.Random=e("./crypto/random"),o.crypto.Point=e("./crypto/point"),o.crypto.Signature=e("./crypto/signature"),o.encoding={},o.encoding.Base58=e("./encoding/base58"),o.encoding.Base58Check=e("./encoding/base58check"),o.encoding.BufferReader=e("./encoding/bufferreader"),o.encoding.BufferWriter=e("./encoding/bufferwriter"),o.encoding.Varint=e("./encoding/varint"),o.util={},o.util.buffer=e("./util/buffer"),o.util.js=e("./util/js"),o.util.preconditions=e("./util/preconditions"),o.errors=e("./errors"),o.Address=e("./address"),o.Block=e("./block"),o.BlockHeader=e("./block/blockheader"),o.HDPrivateKey=e("./hdprivatekey.js"),o.HDPublicKey=e("./hdpublickey.js"),o.MerkleBlock=e("./block/merkleblock"),o.Message=e("./message"),o.Mnemonic=e("./mnemonic"),o.Networks=e("./networks"),o.Opcode=e("./opcode"),o.PrivateKey=e("./privatekey"),o.PublicKey=e("./publickey"),o.Script=e("./script"),o.Transaction=e("./transaction"),o.Unit=e("./unit"),o.URI=e("./uri"),o.deps={},o.deps.bnjs=e("bn.js"),o.deps.bs58=e("bs58"),o.deps.Buffer=a,o.deps.elliptic=e("elliptic"),o.deps._=e("lodash"),o.Transaction.sighash=e("./transaction/sighash")}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"../package.json":269,"./address":1,"./block":5,"./block/blockheader":4,"./block/merkleblock":6,"./crypto/bn":7,"./crypto/ecdsa":8,"./crypto/hash":9,"./crypto/point":10,"./crypto/random":11,"./crypto/signature":12,"./encoding/base58":13,"./encoding/base58check":14,"./encoding/bufferreader":15,"./encoding/bufferwriter":16,"./encoding/varint":17,"./errors":18,"./hdprivatekey.js":20,"./hdpublickey.js":21,"./message":22,"./mnemonic":23,"./networks":33,"./opcode":34,"./privatekey":35,"./publickey":36,"./script":37,"./transaction":40,"./transaction/sighash":48,"./unit":52,"./uri":53,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,"bn.js":75,bs58:123,buffer:126,elliptic:168,lodash:204}],3:[function(e,t){(function(r){"use strict";function a(e){return this instanceof a?(o.extend(this,a._from(e)),this):new a(e)}var o=e("lodash"),n=e("./blockheader"),i=e("../crypto/bn"),d=e("../util/buffer"),s=e("../encoding/bufferreader"),c=e("../encoding/bufferwriter"),f=e("../crypto/hash"),p=e("../transaction"),l=e("../util/preconditions");a.MAX_BLOCK_SIZE=1e6,a._from=function(e){var t={};if(d.isBuffer(e))t=a._fromBufferReader(s(e));else if(o.isObject(e))t=a._fromObject(e);else throw new TypeError("Unrecognized argument for Block");return t},a._fromObject=function(e){var t=[];e.transactions.forEach(function(e){e instanceof p?t.push(e):t.push(p().fromObject(e))});var r={header:n.fromObject(e.header),transactions:t};return r},a.fromObject=function(e){var t=a._fromObject(e);return new a(t)},a._fromBufferReader=function(e){var t={};l.checkState(!e.finished(),"No block data received"),t.header=n.fromBufferReader(e);var r=e.readVarintNum();t.transactions=[];for(var a=0;a"},a.Values={START_OF_BLOCK:8,NULL_HASH:new r("0000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=a}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../transaction":40,"../util/buffer":54,"../util/preconditions":56,"./blockheader":4,buffer:126,lodash:204}],4:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../crypto/bn"),i=e("../util/buffer"),d=e("../encoding/bufferreader"),s=e("../encoding/bufferwriter"),c=e("../crypto/hash"),f=e("../util/js"),p=e("../util/preconditions"),u=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);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&&p.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};u._from=function(e){var t={};if(i.isBuffer(e))t=u._fromBufferReader(d(e));else if(a.isObject(e))t=u._fromObject(e);else throw new TypeError("Unrecognized argument for BlockHeader");return t},u._fromObject=function(e){p.checkArgument(e,"data is required");var t=e.prevHash,o=e.merkleRoot;a.isString(e.prevHash)&&(t=i.reverse(new r(e.prevHash,"hex"))),a.isString(e.merkleRoot)&&(o=i.reverse(new r(e.merkleRoot,"hex")));var n={hash:e.hash,version:e.version,prevHash:t,merkleRoot:o,time:e.time,timestamp:e.time,bits:e.bits,nonce:e.nonce};return n},u.fromObject=function(e){var t=u._fromObject(e);return new u(t)},u.fromRawBlock=function(e){i.isBuffer(e)||(e=new r(e,"binary"));var t=d(e);t.pos=u.Constants.START_OF_HEADER;var a=u._fromBufferReader(t);return new u(a)},u.fromBuffer=function(e){var t=u._fromBufferReader(d(e));return new u(t)},u.fromString=function(e){var t=new r(e,"hex");return u.fromBuffer(t)},u._fromBufferReader=function(e){var t={version:e.readInt32LE(),prevHash:e.read(32),merkleRoot:e.read(32),time:e.readUInt32LE(),bits:e.readUInt32LE(),nonce:e.readUInt32LE()};return t},u.fromBufferReader=function(e){var t=u._fromBufferReader(e);return new u(t)},u.prototype.toObject=u.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:i.reverse(this.prevHash).toString("hex"),merkleRoot:i.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},u.prototype.toBuffer=function(){return this.toBufferWriter().concat()},u.prototype.toString=function(){return this.toBuffer().toString("hex")},u.prototype.toBufferWriter=function(e){return e||(e=new s),e.writeInt32LE(this.version),e.write(this.prevHash),e.write(this.merkleRoot),e.writeUInt32LE(this.time),e.writeUInt32LE(this.bits),e.writeUInt32LE(this.nonce),e},u.prototype.getTargetDifficulty=function(e){e=e||this.bits;for(var t=new o(16777215&e),r=8*((e>>>24)-3);0e+u.Constants.MAX_TIME_OFFSET)},u.prototype.validProofOfWork=function(){var e=new o(this.id,"hex"),t=this.getTargetDifficulty();return!(0"},u.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new o("10000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=u}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],5:[function(e,t){"use strict";t.exports=e("./block"),t.exports.BlockHeader=e("./blockheader"),t.exports.MerkleBlock=e("./merkleblock")},{"./block":3,"./blockheader":4,"./merkleblock":6}],6:[function(e,t){(function(r){"use strict";function a(e){if(!(this instanceof a))return new a(e);var t={};if(i.isBuffer(e))t=a._fromBufferReader(d(e));else if(o.isObject(e)){var r;r=e.header instanceof n?e.header:n.fromObject(e.header),t={header:r,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}else throw new TypeError("Unrecognized argument for MerkleBlock");return o.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}var o=e("lodash"),n=e("./blockheader"),i=e("../util/buffer"),d=e("../encoding/bufferreader"),s=e("../encoding/bufferwriter"),c=e("../crypto/hash"),f=e("../util/js"),p=e("../transaction"),u=e("../util/preconditions");a.fromBuffer=function(e){return a.fromBufferReader(d(e))},a.fromBufferReader=function(e){return new a(a._fromBufferReader(e))},a.prototype.toBuffer=function(){return this.toBufferWriter().concat()},a.prototype.toBufferWriter=function(e){e||(e=new s),e.write(this.header.toBuffer()),e.writeUInt32LE(this.numTransactions),e.writeVarintNum(this.hashes.length);for(var t=0;tthis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var o=1&this.flags[a.flagBitsUsed>>3]>>>(7&a.flagBitsUsed++);if(0===e||!o){if(a.hashesUsed>=this.hashes.length)return null;var n=this.hashes[a.hashesUsed++];return 0===e&&o&&a.txs.push(n),new r(n,"hex")}var i=this._traverseMerkleTree(e-1,2*t,a),d=i;return 2*t+1>e},a.prototype._calcTreeHeight=function(){for(var e=0;1e.size?t=a.trim(t,i):i=e.length||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return a.fromSM(e,{endian:"little"})},a.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},a.prototype.gt=function(e){return 0this.cmp(e)},a.trim=function(e,t){return e.slice(t-e.length,e.length)},a.pad=function(e,t,a){for(var o=new r(a),n=0;ne;e++){this.sig.i=e;var t;try{t=this.toPublicKey()}catch(t){console.error(t);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},u.fromString=function(e){var t=JSON.parse(e);return new u(t)},u.prototype.randomK=function(){var e=o.getN(),t;do t=a.fromBuffer(i.getRandomBuffer(32));while(!(t.lt(e)&&t.gt(a.Zero)));return this.k=t,this},u.prototype.deterministicK=function(e){f.isUndefined(e)&&(e=0);var t=new r(32);t.fill(1);var n=new r(32);n.fill(0);var d=this.privkey.bn.toBuffer({size:32}),p="little"===this.endian?c.reverse(this.hashbuf):this.hashbuf;n=s.sha256hmac(r.concat([t,new r([0]),d,p]),n),t=s.sha256hmac(t,n),n=s.sha256hmac(r.concat([t,new r([1]),d,p]),n),t=s.sha256hmac(t,n),t=s.sha256hmac(t,n);for(var u=a.fromBuffer(t),l=o.getN(),b=0;b>1?e.add(s):e,f=o.fromX(1&t,c),u=f.mul(s);if(!u.isInfinity())throw new Error("nR is not a valid curve point");var l=i.neg().mod(s),b=e.invm(s),h=f.mul(r).add(n.mul(l)).mul(b),g=d.fromPoint(h,this.sig.compressed);return g},u.prototype.sigError=function(){if(!c.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,r=this.sig.s;if(!(t.gt(a.Zero)&&t.lt(o.getN()))||!(r.gt(a.Zero)&&r.lt(o.getN())))return"r and s not in range";var i=a.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),e=o.getN(),n=r.invm(e),d=n.mul(i).mod(e),s=n.mul(t).mod(e),f=o.getG().mulAdd(d,this.pubkey.point,s);return f.isInfinity()?"p is infinity":0!==f.getX().mod(e).cmp(t)&&"Invalid signature"},u.toLowS=function(e){return e.gt(a.fromBuffer(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=o.getN().sub(e)),e},u.prototype._findSignature=function(t,n){var e=o.getN(),i=o.getG(),d=0,c,f,p,l;do(!this.k||0=p.cmp(a.Zero)||0>=l.cmp(a.Zero));return l=u.toLowS(l),{s:l,r:p}},u.prototype.sign=function(){var t=this.hashbuf,r=this.privkey,o=r.bn;p.checkState(t&&r&&o,new Error("invalid parameters")),p.checkState(c.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=a.fromBuffer(t,this.endian?{endian:this.endian}:void 0),e=this._findSignature(o,i);return e.compressed=this.pubkey.compressed,this.sig=new n(e),this},u.prototype.signRandomK=function(){return this.randomK(),this.sign()},u.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},u.prototype.verify=function(){return this.verified=!this.sigError(),this},u.sign=function(e,t,r){return u().set({hashbuf:e,endian:r,privkey:t}).sign().sig},u.verify=function(e,t,r,a){return u().set({hashbuf:e,endian:a,sig:t,pubkey:r}).verify().verified},t.exports=u}).call(this,e("buffer").Buffer)},{"../publickey":36,"../util/buffer":54,"../util/preconditions":56,"./bn":7,"./hash":9,"./point":10,"./random":11,"./signature":12,buffer:126,lodash:204}],9:[function(e,t){(function(r){"use strict";var a=e("crypto"),o=e("../util/buffer"),n=e("../util/preconditions"),i=t.exports;i.sha1=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha1").update(e).digest()},i.sha1.blocksize=512,i.sha256=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha256").update(e).digest()},i.sha256.blocksize=512,i.sha256sha256=function(e){return n.checkArgument(o.isBuffer(e)),i.sha256(i.sha256(e))},i.ripemd160=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("ripemd160").update(e).digest()},i.sha256ripemd160=function(e){return n.checkArgument(o.isBuffer(e)),i.ripemd160(i.sha256(e))},i.sha512=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha512").update(e).digest()},i.sha512.blocksize=1024,i.hmac=function(e,t,a){n.checkArgument(o.isBuffer(t)),n.checkArgument(o.isBuffer(a)),n.checkArgument(e.blocksize);var d=e.blocksize/8;if(a.length>d)a=e(a);else if(a>>=8)}return t},t.exports=o}).call(this,e("_process"),e("buffer").Buffer)},{_process:222,buffer:126,crypto:156}],12:[function(e,t){(function(r){"use strict";var a=e("./bn"),o=e("lodash"),n=e("../util/preconditions"),d=e("../util/buffer"),i=e("../util/js"),s=function e(t,o){if(!(this instanceof e))return new e(t,o);if(t instanceof a)this.set({r:t,s:o});else if(t){this.set(t)}};s.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i="undefined"==typeof e.i?this.i:e.i,this.compressed="undefined"==typeof e.compressed?this.compressed:e.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},s.fromCompact=function(e){n.checkArgument(d.isBuffer(e),"Argument is expected to be a Buffer");var t=new s,r=!0,o=e.slice(0,1)[0]-27-4;0>o&&(r=!1,o+=4);var i=e.slice(1,33),c=e.slice(33,65);return n.checkArgument(0==o||1==o||2==o||3==o,new Error("i must be 0, 1, 2, or 3")),n.checkArgument(32===i.length,new Error("r must be 32 bytes")),n.checkArgument(32===c.length,new Error("s must be 32 bytes")),t.compressed=r,t.i=o,t.r=a.fromBuffer(i),t.s=a.fromBuffer(c),t},s.fromDER=s.fromBuffer=function(e,t){var r=s.parseDER(e,t),a=new s;return a.r=r.r,a.s=r.s,a},s.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),a=new s.fromDER(r,!1);return a.nhashtype=t,a},s.fromString=function(e){var t=new r(e,"hex");return s.fromDER(t)},s.parseDER=function(e,t){n.checkArgument(d.isBuffer(e),new Error("DER formatted signature should be a buffer")),o.isUndefined(t)&&(t=!0);var i=e[0];n.checkArgument(48===i,new Error("Header byte should be 0x30"));var c=e[1],f=e.slice(2).length;n.checkArgument(!t||c===f,new Error("Length byte should length of what follows")),c=ce.length)return!1;if(73=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var a=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&a[0])return!1;if(1s.SIGHASH_SINGLE?!1:!0},s.prototype.toTxFormat=function(){var e=this.toDER(),t=new r(1);return t.writeUInt8(this.nhashtype,0),r.concat([e,t])},s.SIGHASH_ALL=1,s.SIGHASH_NONE=2,s.SIGHASH_SINGLE=3,s.SIGHASH_FORKID=64,s.SIGHASH_ANYONECANPAY=128,t.exports=s}).call(this,e("buffer").Buffer)},{"../util/buffer":54,"../util/js":55,"../util/preconditions":56,"./bn":7,buffer:126,lodash:204}],13:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("bs58"),n=e("buffer"),i=["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],d=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t)){this.fromBuffer(t)}else if("string"==typeof t){this.fromString(t)}else t&&this.set(t)};d.validCharacters=function(e){return n.Buffer.isBuffer(e)&&(e=e.toString()),a.every(a.map(e,function(e){return a.includes(i,e)}))},d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},d.encode=function(e){if(!n.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return o.encode(e)},d.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new r(o.decode(e))},d.prototype.fromBuffer=function(e){return this.buf=e,this},d.prototype.fromString=function(e){var t=d.decode(e);return this.buf=t,this},d.prototype.toBuffer=function(){return this.buf},d.prototype.toString=function(){return d.encode(this.buf)},t.exports=d}).call(this,e("buffer").Buffer)},{bs58:123,buffer:126,lodash:204}],14:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./base58"),n=e("buffer"),i=e("../crypto/hash").sha256sha256,d=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t)){this.fromBuffer(t)}else if("string"==typeof t){this.fromString(t)}else t&&this.set(t)};d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},d.validChecksum=function(e,t){return a.isString(e)&&(e=new n.Buffer(o.decode(e))),a.isString(t)&&(t=new n.Buffer(o.decode(t))),t||(t=e.slice(-4),e=e.slice(0,-4)),d.checksum(e).toString("hex")===t.toString("hex")},d.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var t=new r(o.decode(e));if(4>t.length)throw new Error("Input string too short");var a=t.slice(0,-4),n=t.slice(-4),d=i(a),c=d.slice(0,4);if(n.toString("hex")!==c.toString("hex"))throw new Error("Checksum mismatch");return a},d.checksum=function(e){return i(e).slice(0,4)},d.encode=function(e){if(!r.isBuffer(e))throw new Error("Input must be a buffer");var t=new r(e.length+4),a=d.checksum(e);return e.copy(t),a.copy(t,e.length),o.encode(t)},d.prototype.fromBuffer=function(e){return this.buf=e,this},d.prototype.fromString=function(e){var t=d.decode(e);return this.buf=t,this},d.prototype.toBuffer=function(){return this.buf},d.prototype.toString=function(){return d.encode(this.buf)},t.exports=d}).call(this,e("buffer").Buffer)},{"../crypto/hash":9,"./base58":13,buffer:126,lodash:204}],15:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../util/preconditions"),n=e("../util/buffer"),i=e("../crypto/bn"),d=function e(t){if(!(this instanceof e))return new e(t);if(!a.isUndefined(t))if(r.isBuffer(t))this.set({buf:t});else if(a.isString(t)){var o=new r(t,"hex");if(2*o.length!=t.length)throw new TypeError("Invalid hex string");this.set({buf:o})}else if(a.isObject(t)){this.set(t)}else throw new TypeError("Unrecognized argument for BufferReader")};d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},d.prototype.eof=function(){return this.pos>=this.buf.length},d.prototype.finished=d.prototype.eof,d.prototype.read=function(e){o.checkArgument(!a.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos+=e,t},d.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},d.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return++this.pos,e},d.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos+=2,e},d.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos+=2,e},d.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos+=4,e},d.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos+=4,e},d.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos+=4,e},d.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=i.fromBuffer(e);return this.pos+=8,t},d.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=4294967296*t+e,a;if(9007199254740991>=r)a=new i(r);else{var o=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);a=new i(o,10,"le")}return this.pos+=8,a},d.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(9007199254740992>=r)return r;throw new Error("number too large to retain precision - use readVarintBN");break;default:return e;}},d.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return o.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},d.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);return 253===e?this.read(3):254===e?this.read(5):255===e?this.read(9):this.read(1)},d.prototype.readVarintBN=function(){var e=this.readUInt8();return 253===e?new i(this.readUInt16LE()):254===e?new i(this.readUInt32LE()):255===e?this.readUInt64LEBN():new i(e)},d.prototype.reverse=function(){for(var e=new r(this.buf.length),t=0;te?(t=new r(1),t.writeUInt8(e,0)):65536>e?(t=new r(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):4294967296>e?(t=new r(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=new r(9),t.writeUInt8(255,0),t.writeInt32LE(-1&e,1),t.writeUInt32LE(h(e/4294967296),5)),t},i.varintBufBN=function(e){var t=e.toNumber(),a;if(253>t)a=new r(1),a.writeUInt8(t,0);else if(65536>t)a=new r(3),a.writeUInt8(253,0),a.writeUInt16LE(t,1);else if(4294967296>t)a=new r(5),a.writeUInt8(254,0),a.writeUInt32LE(t,1);else{var o=new i;o.writeUInt8(255),o.writeUInt64LEBN(e);var a=o.concat()}return a},t.exports=i}).call(this,e("buffer").Buffer)},{"../util/buffer":54,assert:72,buffer:126}],17:[function(e,t){(function(r){"use strict";var a=e("./bufferwriter"),o=e("./bufferreader"),n=e("../crypto/bn"),i=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t))this.buf=t;else if("number"==typeof t){this.fromNumber(t)}else if(t instanceof n){this.fromBN(t)}else if(t){this.set(t)}};i.prototype.set=function(e){return this.buf=e.buf||this.buf,this},i.prototype.fromString=function(e){return this.set({buf:new r(e,"hex")}),this},i.prototype.toString=function(){return this.buf.toString("hex")},i.prototype.fromBuffer=function(e){return this.buf=e,this},i.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},i.prototype.fromBN=function(e){return this.buf=a().writeVarintBN(e).concat(),this},i.prototype.fromNumber=function(e){return this.buf=a().writeVarintNum(e).concat(),this},i.prototype.toBuffer=function(){return this.buf},i.prototype.toBN=function(){return o(this.buf).readVarintBN()},i.prototype.toNumber=function(){return o(this.buf).readVarintNum()},t.exports=i}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"./bufferreader":15,"./bufferwriter":16,buffer:126}],18:[function(e,t){"use strict";function r(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var a=e("lodash"),o=function(e,t){var o=function(){if(a.isString(t.message))this.message=r(t.message,arguments);else if(a.isFunction(t.message))this.message=t.message.apply(null,arguments);else throw new Error("Invalid error definition for "+t.name);this.stack=this.message+"\n"+new Error().stack};return o.prototype=Object.create(e.prototype),o.prototype.name=e.prototype.name+t.name,e[t.name]=o,t.errors&&n(o,t.errors),o},n=function(e,t){a.each(t,function(t){o(e,t)})},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+new Error().stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bitcore.Error";var d=e("./spec");(function(e,t){return n(e,t),e})(i.Error,d),t.exports=i.Error,t.exports.extend=function(e){return o(i.Error,e)}},{"./spec":19,lodash:204}],19:[function(e,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:"Invalid network: must be \"livenet\" or \"testnet\", got {0}"},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+"http://bitcore.io/"+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+r(arguments[0])}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:"Invalid entropy: more than 512 bits is non standard, got \"{0}\""},{name:"NotEnoughEntropy",message:"Invalid entropy: at least 128 bits needed, got \"{0}\""}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:"Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got \"{0}\""}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:"Invalid length for xpubkey: got \"{0}\""},{name:"InvalidPath",message:"Invalid derivation path, it should look like: \"m/1/100\", got \"{0}\""},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]},{name:"Mnemonic",message:"Internal Error on bitcore-mnemonic module {0}",errors:[{name:"InvalidEntropy",message:"Entropy length must be an even multiple of 11 bits: {0}"},{name:"UnknownWordlist",message:"Could not detect the used word list: {0}"},{name:"InvalidMnemonic",message:"Mnemonic string is invalid: {0}"}]}]},{}],20:[function(e,t){(function(r){"use strict";function a(e){if(e instanceof a)return e;if(!(this instanceof a))return new a(e);if(!e)return this._generateRandomly();if(u.get(e))return this._generateRandomly(e);if(i.isString(e)||y.isBuffer(e)){if(a.isValidSerialized(e))this._buildFromSerialized(e);else if(_.isValidJSON(e))this._buildFromJSON(e);else if(y.isBuffer(e)&&a.isValidSerialized(e.toString()))this._buildFromSerialized(e.toString());else throw a.getSerializedError(e);}else if(i.isObject(e))this._buildFromObject(e);else throw new m.UnrecognizedArgument(e)}var o=e("assert"),n=e("buffer"),i=e("lodash"),d=e("./util/preconditions"),s=e("./crypto/bn"),c=e("./encoding/base58"),f=e("./encoding/base58check"),p=e("./crypto/hash"),u=e("./networks"),l=e("./crypto/point"),b=e("./privatekey"),h=e("./crypto/random"),g=e("./errors"),m=g.HDPrivateKey,y=e("./util/buffer"),_=e("./util/js"),v=1/8;a.isValidPath=function(e,t){if(i.isString(e)){var r=a._getDerivationIndexes(e);return null!==r&&i.every(r,a.isValidPath)}return!!i.isNumber(e)&&(e=a.Hardened)||t,e512*v)throw new m.InvalidEntropyArgument.TooMuchEntropy(e);var o=p.sha512hmac(e,new n.Buffer("Bitcoin seed"));return new a({network:u.get(t)||u.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:o.slice(0,32),chainCode:o.slice(32,64)})},a.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var t=e("./hdpublickey");this._hdPublicKey=new t(this)}},a.prototype._buildFromBuffers=function(e){a._validateBufferArguments(e),_.defineImmutable(this,{_buffers:e});var t=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,y.emptyBuffer(1),e.privateKey],o=n.Buffer.concat(t);if(!e.checksum||!e.checksum.length)e.checksum=f.checksum(o);else if(e.checksum.toString()!==f.checksum(o).toString())throw new g.InvalidB58Checksum(o);var i=u.get(y.integerFromBuffer(e.version)),d;d=f.encode(n.Buffer.concat(t)),e.xprivkey=new r(d);var c=new b(s.fromBuffer(e.privateKey),i),l=c.toPublicKey(),h=a.ParentFingerPrintSize,m=p.sha256ripemd160(l.toBuffer()).slice(0,h);return _.defineImmutable(this,{xprivkey:d,network:i,depth:y.integerFromSingleByteBuffer(e.depth),privateKey:c,publicKey:l,fingerPrint:m}),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},a._validateBufferArguments=function(e){var t=function(t,r){var a=e[t];o(y.isBuffer(a),t+" argument is not a buffer"),o(a.length===r,t+" has not the expected size: found "+a.length+", expected "+r)};t("version",a.VersionSize),t("depth",a.DepthSize),t("parentFingerPrint",a.ParentFingerPrintSize),t("childIndex",a.ChildIndexSize),t("chainCode",a.ChainCodeSize),t("privateKey",a.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",a.CheckSumSize)},a.prototype.toString=function(){return this.xprivkey},a.prototype.inspect=function(){return""},a.prototype.toObject=a.prototype.toJSON=function(){return{network:u.get(y.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:y.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:y.integerFromBuffer(this.fingerPrint),parentFingerPrint:y.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:y.integerFromBuffer(this._buffers.childIndex),chainCode:y.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:y.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},a.fromBuffer=function(e){return new a(e.toString())},a.prototype.toBuffer=function(){return y.copy(this._buffers.xprivkey)},a.DefaultDepth=0,a.DefaultFingerprint=0,a.DefaultChildIndex=0,a.Hardened=2147483648,a.MaxIndex=2*a.Hardened,a.RootElementAlias=["m","M","m'","M'"],a.VersionSize=4,a.DepthSize=1,a.ParentFingerPrintSize=4,a.ChildIndexSize=4,a.ChainCodeSize=32,a.PrivateKeySize=32,a.CheckSumSize=4,a.DataLength=78,a.SerializedByteSize=82,a.VersionStart=0,a.VersionEnd=a.VersionStart+a.VersionSize,a.DepthStart=a.VersionEnd,a.DepthEnd=a.DepthStart+a.DepthSize,a.ParentFingerPrintStart=a.DepthEnd,a.ParentFingerPrintEnd=a.ParentFingerPrintStart+a.ParentFingerPrintSize,a.ChildIndexStart=a.ParentFingerPrintEnd,a.ChildIndexEnd=a.ChildIndexStart+a.ChildIndexSize,a.ChainCodeStart=a.ChildIndexEnd,a.ChainCodeEnd=a.ChainCodeStart+a.ChainCodeSize,a.PrivateKeyStart=a.ChainCodeEnd+1,a.PrivateKeyEnd=a.PrivateKeyStart+a.PrivateKeySize,a.ChecksumStart=a.PrivateKeyEnd,a.ChecksumEnd=a.ChecksumStart+a.CheckSumSize,o(a.ChecksumEnd===a.SerializedByteSize),t.exports=a}).call(this,e("buffer").Buffer)},{"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./crypto/random":11,"./encoding/base58":13,"./encoding/base58check":14,"./errors":18,"./hdpublickey":21,"./networks":33,"./privatekey":35,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,assert:72,buffer:126,lodash:204}],21:[function(e,t){(function(r){"use strict";function a(e){if(e instanceof a)return e;if(!(this instanceof a))return new a(e);if(!e)throw new m.MustSupplyArgument;else if(n.isString(e)||v.isBuffer(e)){var t=a.getSerializedError(e);if(!t)return this._buildFromSerialized(e);if(v.isBuffer(e)&&!a.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof m.ArgumentIsPrivateExtended)return new p(e).hdPublicKey;throw t}else{if(n.isObject(e))return e instanceof p?this._buildFromPrivate(e):this._buildFromObject(e);throw new m.UnrecognizedArgument(e)}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=e("lodash"),i=e("./util/preconditions"),d=e("./crypto/bn"),s=e("./encoding/base58"),c=e("./encoding/base58check"),f=e("./crypto/hash"),p=e("./hdprivatekey"),u=e("./networks"),l=e("./crypto/point"),b=e("./publickey"),h=e("./errors"),g=h,m=h.HDPublicKey,y=e("assert"),_=e("./util/js"),v=e("./util/buffer");a.isValidPath=function(e){if(n.isString(e)){var t=p._getDerivationIndexes(e);return null!==t&&n.every(t,a.isValidPath)}return!!n.isNumber(e)&&0<=e&&e=a.Hardened||t)throw new m.InvalidIndexCantDeriveHardened;if(0>e)throw new m.InvalidPath(e);var r=v.integerAsBuffer(e),o=v.concat([this.publicKey.toBuffer(),r]),n=f.sha512hmac(o,this._buffers.chainCode),i=d.fromBuffer(n.slice(0,32),{size:32}),s=n.slice(32,64),c;try{c=b.fromPoint(l.getG().mul(i).add(this.publicKey.point))}catch(t){return this._deriveWithNumber(e+1)}var p=new a({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:s,publicKey:c});return p},a.prototype._deriveFromString=function(e){if(n.includes(e,"'"))throw new m.InvalidIndexCantDeriveHardened;else if(!a.isValidPath(e))throw new m.InvalidPath(e);var t=p._getDerivationIndexes(e),r=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return r},a.isValidSerialized=function(e,t){return n.isNull(a.getSerializedError(e,t))},a.getSerializedError=function(e,t){if(!(n.isString(e)||v.isBuffer(e)))return new m.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new g.InvalidB58Char("(unknown)",e);try{e=c.decode(e)}catch(t){return new g.InvalidB58Checksum(e)}if(e.length!==a.DataSize)return new m.InvalidLength(e);if(!n.isUndefined(t)){var r=a._validateNetwork(e,t);if(r)return r}var o=v.integerFromBuffer(e.slice(0,4));return o===u.livenet.xprivkey||o===u.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},a._validateNetwork=function(e,t){var r=u.get(t);if(!r)return new g.InvalidNetworkArgument(t);var o=e.slice(a.VersionStart,a.VersionEnd);return v.integerFromBuffer(o)===r.xpubkey?null:new g.InvalidNetwork(o)},a.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=l.getG().mul(d.fromBuffer(t.privateKey));return t.publicKey=l.pointToCompressed(r),t.version=v.integerAsBuffer(u.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},a.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(u.get(e.network).xpubkey):e.version,depth:n.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:n.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:n.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:n.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:n.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:n.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},a.prototype._buildFromSerialized=function(e){var t=c.decode(e),r={version:t.slice(a.VersionStart,a.VersionEnd),depth:t.slice(a.DepthStart,a.DepthEnd),parentFingerPrint:t.slice(a.ParentFingerPrintStart,a.ParentFingerPrintEnd),childIndex:t.slice(a.ChildIndexStart,a.ChildIndexEnd),chainCode:t.slice(a.ChainCodeStart,a.ChainCodeEnd),publicKey:t.slice(a.PublicKeyStart,a.PublicKeyEnd),checksum:t.slice(a.ChecksumStart,a.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},a.prototype._buildFromBuffers=function(e){a._validateBufferArguments(e),_.defineImmutable(this,{_buffers:e});var t=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],o=v.concat(t),n=c.checksum(o);if(!e.checksum||!e.checksum.length)e.checksum=n;else if(e.checksum.toString("hex")!==n.toString("hex"))throw new g.InvalidB58Checksum(o,n);var i=u.get(v.integerFromBuffer(e.version)),d;d=c.encode(v.concat(t)),e.xpubkey=new r(d);var s=new b(e.publicKey,{network:i}),p=a.ParentFingerPrintSize,l=f.sha256ripemd160(s.toBuffer()).slice(0,p);return _.defineImmutable(this,{xpubkey:d,network:i,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:s,fingerPrint:l}),this},a._validateBufferArguments=function(e){var t=function(t,r){var a=e[t];y(v.isBuffer(a),t+" argument is not a buffer, it's "+("undefined"==typeof a?"undefined":o(a))),y(a.length===r,t+" has not the expected size: found "+a.length+", expected "+r)};t("version",a.VersionSize),t("depth",a.DepthSize),t("parentFingerPrint",a.ParentFingerPrintSize),t("childIndex",a.ChildIndexSize),t("chainCode",a.ChainCodeSize),t("publicKey",a.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",a.CheckSumSize)},a.fromString=function(e){return i.checkArgument(n.isString(e),"No valid string was provided"),new a(e)},a.fromObject=function(e){return i.checkArgument(n.isObject(e),"No valid argument was provided"),new a(e)},a.prototype.toString=function(){return this.xpubkey},a.prototype.inspect=function(){return""},a.prototype.toObject=a.prototype.toJSON=function(){return{network:u.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}},a.fromBuffer=function(e){return new a(e)},a.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},a.Hardened=2147483648,a.RootElementAlias=["m","M"],a.VersionSize=4,a.DepthSize=1,a.ParentFingerPrintSize=4,a.ChildIndexSize=4,a.ChainCodeSize=32,a.PublicKeySize=33,a.CheckSumSize=4,a.DataSize=78,a.SerializedByteSize=82,a.VersionStart=0,a.VersionEnd=a.VersionStart+a.VersionSize,a.DepthStart=a.VersionEnd,a.DepthEnd=a.DepthStart+a.DepthSize,a.ParentFingerPrintStart=a.DepthEnd,a.ParentFingerPrintEnd=a.ParentFingerPrintStart+a.ParentFingerPrintSize,a.ChildIndexStart=a.ParentFingerPrintEnd,a.ChildIndexEnd=a.ChildIndexStart+a.ChildIndexSize,a.ChainCodeStart=a.ChildIndexEnd,a.ChainCodeEnd=a.ChainCodeStart+a.ChainCodeSize,a.PublicKeyStart=a.ChainCodeEnd,a.PublicKeyEnd=a.PublicKeyStart+a.PublicKeySize,a.ChecksumStart=a.PublicKeyEnd,a.ChecksumEnd=a.ChecksumStart+a.CheckSumSize,y(a.PublicKeyEnd===a.DataSize),y(a.ChecksumEnd===a.SerializedByteSize),t.exports=a}).call(this,e("buffer").Buffer)},{"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./encoding/base58":13,"./encoding/base58check":14,"./errors":18,"./hdprivatekey":20,"./networks":33,"./publickey":36,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,assert:72,buffer:126,lodash:204}],22:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./util/preconditions"),n=e("./address"),i=e("./publickey"),d=e("./privatekey"),s=e("./encoding/bufferwriter"),c=e("./crypto/ecdsa"),f=e("./crypto/signature"),p=e("./crypto/hash").sha256sha256,u=e("./util/js"),l=function e(t){return this instanceof e?(o.checkArgument(a.isString(t),"First argument should be a string"),this.message=t,this):new e(t)};l.MAGIC_BYTES=new r("Bitcoin Signed Message:\n"),l.prototype.magicHash=function(){var e=s.varintBufNum(l.MAGIC_BYTES.length),t=new r(this.message),a=s.varintBufNum(t.length),o=r.concat([e,l.MAGIC_BYTES,a,t]),n=p(o);return n},l.prototype._sign=function(e){console.log(e),o.checkArgument(e instanceof d,"First argument should be an instance of PrivateKey");var t=this.magicHash(),r=new c;return r.hashbuf=t,r.privkey=e,r.pubkey=e.toPublicKey(),r.signRandomK(),r.calci(),r.sig},l.prototype.sign=function(e){var t=this._sign(e);return t.toCompact().toString("base64")},l.prototype._verify=function(e,t){o.checkArgument(e instanceof i,"First argument should be an instance of PublicKey"),o.checkArgument(t instanceof f,"Second argument should be an instance of Signature");var r=this.magicHash(),a=c.verify(r,t,e);return a||(this.error="The signature was invalid"),a},l.prototype.verify=function(e,t){o.checkArgument(e),o.checkArgument(t&&a.isString(t)),a.isString(e)&&(e=n.fromString(e));var i=f.fromCompact(new r(t,"base64")),d=new c;d.hashbuf=this.magicHash(),d.sig=i;var s=d.toPublicKey(),p=n.fromPublicKey(s,e.network);return e.toString()===p.toString()?this._verify(s,i):(this.error="The signature did not match the message digest",!1)},l.fromString=function(e){return new l(e)},l.fromJSON=function(e){return u.isValidJSON(e)&&(e=JSON.parse(e)),new l(e.message)},l.prototype.toObject=function(){return{message:this.message}},l.prototype.toJSON=function(){return JSON.stringify(this.toObject())},l.prototype.toString=function(){return this.message},l.prototype.inspect=function(){return""},t.exports=l}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/ecdsa":8,"./crypto/hash":9,"./crypto/signature":12,"./encoding/bufferwriter":16,"./privatekey":35,"./publickey":36,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],23:[function(e,t){"use strict";t.exports=e("./mnemonic")},{"./mnemonic":24}],24:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../util/preconditions"),n=e("../crypto/bn"),d=e("../errors"),i=e("../crypto/hash"),s=e("../hdprivatekey"),c=e("./pbkdf2"),f=e("../crypto/random"),p=e("unorm"),u=function e(t,o){if(!(this instanceof e))return new e(t,o);a.isArray(t)&&(o=t,t=null);var n,i,s;if(r.isBuffer(t))s=t;else if(a.isString(t))i=p.nfkd(t);else if(a.isNumber(t))n=t;else if(t)throw new d.InvalidArgument("data","Must be a Buffer, a string or an integer");if(n=n||128,o=o||e._getDictionary(i),i&&!o)throw new d.UnknownWordlist(i);if(o=o||e.Words.ENGLISH,s&&(i=e._entropy2mnemonic(s,o)),i&&!e.isValid(i,o))throw new d.InvalidMnemonic(i);if(0!=n%32||128>n)throw new d.InvalidArgument("ENT","Values must be ENT > 128 and ENT % 32 == 0");i=i||e._mnemonic(n,o),Object.defineProperty(this,"wordlist",{configurable:!1,value:o}),Object.defineProperty(this,"phrase",{configurable:!1,value:i})};u.Words=e("./words"),u.isValid=function(e,t){if(e=p.nfkd(e),t=t||u._getDictionary(e),!t)return!1;for(var a=e.split(" "),o="",n=0,i;ni)return!1;o+=("00000000000"+i.toString(2)).slice(-11)}var d=o.length/33,s=o.slice(-d),c=o.slice(0,o.length-d),f=new r(c.length/8);for(n=0;no)return!1;return!0},u._getDictionary=function(e){if(!e)return null;for(var t=Object.keys(u.Words),r=0,a;r"},u._mnemonic=function(e,t){var r=f.getRandomBuffer(e/8);return u._entropy2mnemonic(r,t)},u._entropy2mnemonic=function(e,t){for(var r="",a=0;a4294967295*d)throw Error("Requested key length too long");if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError("key must a string or Buffer");if("string"!=typeof t&&!r.isBuffer(t))throw new TypeError("salt must a string or Buffer");"string"==typeof e&&(e=new r(e)),"string"==typeof t&&(t=new r(t));var s=new r(n),c=new r(d),f=new r(d),u=new r(t.length+4),b=p(n/d);t.copy(u,0,0,t.length);for(var l=1;l<=b;l++){u[t.length+0]=255&l>>24,u[t.length+1]=255&l>>16,u[t.length+2]=255&l>>8,u[t.length+3]=255&l>>0,c=a.createHmac("sha512",e).update(u).digest(),c.copy(f,0,0,d);for(var i=1;i=e,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.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},a.reverseMap=[],a.map)a.reverseMap[a.map[c]]=c;i.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./util/buffer":54,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],35:[function(e,t){(function(r){"use strict";function a(e,t){if(!(this instanceof a))return new a(e,t);if(e instanceof a)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new d(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(f.getN()))throw new TypeError("Number must be less than N");if("undefined"==typeof r.network)throw new TypeError("Must specify the network (\"livenet\" or \"testnet\")");return s.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 o=e("lodash"),n=e("./address"),i=e("./encoding/base58check"),d=e("./crypto/bn"),s=e("./util/js"),c=e("./networks"),f=e("./crypto/point"),p=e("./publickey"),u=e("./crypto/random"),l=e("./util/preconditions");a.prototype._classifyArguments=function(e,t){var n={compressed:!0,network:t?c.get(t):c.defaultNetwork};if(o.isUndefined(e)||o.isNull(e))n.bn=a._getRandomBN();else if(e instanceof d)n.bn=e;else if(e instanceof r||e instanceof Uint8Array)n=a._transformBuffer(e,t);else if(e.bn&&e.network)n=a._transformObject(e);else if(!t&&c.get(e))n.bn=a._getRandomBN(),n.network=c.get(e);else if("string"==typeof e)s.isHexa(e)?n.bn=new d(new r(e,"hex")):n=a._transformWIF(e,t);else throw new TypeError("First argument is an unrecognized data type.");return n},a._getRandomBN=function(){var e,t;do{var r=u.getRandomBuffer(32);t=d.fromBuffer(r),e=t.lt(f.getN())}while(!e);return t},a._transformBuffer=function(e,t){var r={};if(32===e.length)return a._transformBNBuffer(e,t);if(r.network=c.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==c.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else if(33===e.length)r.compressed=!1;else throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");return r.bn=d.fromBuffer(e.slice(1,33)),r},a._transformBNBuffer=function(e,t){var r={network:c.get(t)||c.defaultNetwork,bn:d.fromBuffer(e),compressed:!1};return r},a._transformWIF=function(e,t){return a._transformBuffer(i.decode(e),t)},a.fromBuffer=function(e,t){return new a(e,t)},a._transformObject=function(e){var t=new d(e.bn,"hex"),r=c.get(e.network);return{bn:t,network:r,compressed:e.compressed}},a.fromString=a.fromWIF=function(e){return l.checkArgument(o.isString(e),"First argument is expected to be a string."),new a(e)},a.fromObject=function(e){return l.checkArgument(o.isObject(e),"First argument is expected to be an object."),new a(e)},a.fromRandom=function(e){var t=a._getRandomBN();return new a(t,e)},a.getValidationError=function(e,t){var r;try{new a(e,t)}catch(t){r=t}return r},a.isValid=function(e,t){return!!e&&!a.getValidationError(e,t)},a.prototype.toString=function(){return this.toBuffer().toString("hex")},a.prototype.toWIF=function(){var e=this.network,t=this.compressed,a;return a=t?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})]),i.encode(a)},a.prototype.toBigNumber=function(){return this.bn},a.prototype.toBuffer=function(){return this.bn.toBuffer()},a.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},a.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=p.fromPrivateKey(this)),this._pubkey},a.prototype.toAddress=function(e){var t=this.toPublicKey();return n.fromPublicKey(t,e||this.network)},a.prototype.toObject=a.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},a.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/bn":7,"./crypto/point":10,"./crypto/random":11,"./encoding/base58check":14,"./networks":33,"./publickey":36,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],36:[function(e,t){(function(r){"use strict";function a(e,t){if(!(this instanceof a))return new a(e,t);if(f.checkArgument(e,"First argument is required, please include public key data."),e instanceof a)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),d.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||s.defaultNetwork}),this}var o=e("./crypto/bn"),n=e("./crypto/point"),i=e("./crypto/hash"),d=e("./util/js"),s=e("./networks"),c=e("lodash"),f=e("./util/preconditions");a.prototype._classifyArgs=function(e,t){var o={compressed:c.isUndefined(t.compressed)||t.compressed};if(e instanceof n)o.point=e;else if(e.x&&e.y)o=a._transformObject(e);else if("string"==typeof e)o=a._transformDER(new r(e,"hex"));else if(a._isBuffer(e))o=a._transformDER(e);else if(a._isPrivateKey(e))o=a._transformPrivateKey(e);else throw new TypeError("First argument is an unrecognized data format.");return o.network||(o.network=c.isUndefined(t.network)?void 0:s.get(t.network)),o},a._isPrivateKey=function(t){var r=e("./privatekey");return t instanceof r},a._isBuffer=function(e){return e instanceof r||e instanceof Uint8Array},a._transformPrivateKey=function(e){f.checkArgument(a._isPrivateKey(e),"Must be an instance of PrivateKey");var t={point:n.getG().mul(e.bn),compressed:e.compressed,network:e.network};return t},a._transformDER=function(e,t){f.checkArgument(a._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r={};t=!!c.isUndefined(t)||t;var i,d,s,p;if(4===e[0]||!t&&(6===e[0]||7===e[0])){if(s=e.slice(1,33),p=e.slice(33,65),32!==s.length||32!==p.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");i=new o(s),d=new o(p),r.point=new n(i,d),r.compressed=!1}else if(3===e[0])s=e.slice(1),i=new o(s),r=a._transformX(!0,i),r.compressed=!0;else if(2===e[0])s=e.slice(1),i=new o(s),r=a._transformX(!1,i),r.compressed=!0;else throw new TypeError("Invalid DER format public key");return r},a._transformX=function(e,t){f.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={point:n.fromX(e,t)};return r},a._transformObject=function(e){var t=new o(e.x,"hex"),r=new o(e.y,"hex"),i=new n(t,r);return new a(i,{compressed:e.compressed})},a.fromPrivateKey=function(e){f.checkArgument(a._isPrivateKey(e),"Must be an instance of PrivateKey");var t=a._transformPrivateKey(e);return new a(t.point,{compressed:t.compressed,network:t.network})},a.fromDER=a.fromBuffer=function(e,t){f.checkArgument(a._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r=a._transformDER(e,t);return new a(r.point,{compressed:r.compressed})},a.fromPoint=function(e,t){return f.checkArgument(e instanceof n,"First argument must be an instance of Point."),new a(e,{compressed:t})},a.fromString=function(e,t){var o=new r(e,t||"hex"),n=a._transformDER(o);return new a(n.point,{compressed:n.compressed})},a.fromX=function(e,t){var r=a._transformX(e,t);return new a(r.point,{compressed:r.compressed})},a.getValidationError=function(e){var t;try{new a(e)}catch(r){t=r}return t},a.isValid=function(e){return!a.getValidationError(e)},a.prototype.toObject=a.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},a.prototype.toBuffer=a.prototype.toDER=function(){var e=this.point.getX(),t=this.point.getY(),a=e.toBuffer({size:32}),o=t.toBuffer({size:32}),n;if(!this.compressed)return n=new r([4]),r.concat([n,a,o]);var i=o[o.length-1]%2;return n=i?new r([3]):new r([2]),r.concat([n,a])},a.prototype._getID=function(){return i.sha256ripemd160(this.toBuffer())},a.prototype.toAddress=function(t){var r=e("./address");return r.fromPublicKey(this,t||this.network)},a.prototype.toString=function(){return this.toDER().toString("hex")},a.prototype.inspect=function(){return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./networks":33,"./privatekey":35,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],37:[function(e,t){"use strict";t.exports=e("./script"),t.exports.Interpreter=e("./interpreter")},{"./interpreter":38,"./script":39}],38:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./script"),d=e("../opcode"),s=e("../crypto/bn"),n=e("../crypto/hash"),i=e("../crypto/signature"),c=e("../publickey"),f=function e(t){return this instanceof e?void(t?(this.initialize(),this.set(t)):this.initialize()):new e(t)};f.prototype.verify=function(t,r,n,i,d){var s=e("../transaction");a.isUndefined(n)&&(n=new s),a.isUndefined(i)&&(i=0),a.isUndefined(d)&&(d=0),this.set({script:t,tx:n,nin:i,flags:d});var c;if(0!=(d&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;d&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var p=this.stack;if(this.initialize(),this.set({script:r,stack:p,tx:n,nin:i,flags:d}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var u=this.stack[this.stack.length-1];if(!f.castToBool(u))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(d&f.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var l=c[c.length-1],b=o.fromBuffer(l);return c.pop(),this.initialize(),this.set({script:b,stack:c,tx:n,nin:i,flags:d}),!!this.evaluate()&&(0===c.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!f.castToBool(c[c.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},t.exports=f,f.prototype.initialize=function(){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin="undefined"==typeof e.nin?this.nin:e.nin,this.stack=e.stack||this.stack,this.altstack=e.altack||this.altstack,this.pc="undefined"==typeof e.pc?this.pc:e.pc,this.pbegincodehash="undefined"==typeof e.pbegincodehash?this.pbegincodehash:e.pbegincodehash,this.nOpCount="undefined"==typeof e.nOpCount?this.nOpCount:e.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags="undefined"==typeof e.flags?this.flags:e.flags},f.true=new r([1]),f.false=new r([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.LOCKTIME_THRESHOLD=5e8,f.LOCKTIME_THRESHOLD_BN=new s(f.LOCKTIME_THRESHOLD),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.castToBool=function(e){for(var t=0;t=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&!e.gt(new s(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal()},f.prototype.step=function(){var e=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),t=-1===this.vfExec.indexOf(!1),r=this.script.chunks[this.pc],p,u,l,b,h,g,m,y,_,v,S,I,x,w,A,E,P;this.pc++;var B=r.opcodenum;if(a.isUndefined(B))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(r.buf&&r.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(B>d.OP_16&&201<++this.nOpCount)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(B===d.OP_CAT||B===d.OP_SUBSTR||B===d.OP_LEFT||B===d.OP_RIGHT||B===d.OP_INVERT||B===d.OP_AND||B===d.OP_OR||B===d.OP_XOR||B===d.OP_2MUL||B===d.OP_2DIV||B===d.OP_MUL||B===d.OP_DIV||B===d.OP_MOD||B===d.OP_LSHIFT||B===d.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(t&&0<=B&&B<=d.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(!r.buf)this.stack.push(f.false);else if(r.len!==r.buf.length)throw new Error("Length of push value not equal to length of data");else this.stack.push(r.buf)}else if(t||d.OP_IF<=B&&B<=d.OP_ENDIF)switch(B){case d.OP_1NEGATE:case d.OP_1:case d.OP_2:case d.OP_3:case d.OP_4:case d.OP_5:case d.OP_6:case d.OP_7:case d.OP_8:case d.OP_9:case d.OP_10:case d.OP_11:case d.OP_12:case d.OP_13:case d.OP_14:case d.OP_15:case d.OP_16:h=B-(d.OP_1-1),p=new s(h).toScriptNumBuffer(),this.stack.push(p);break;case d.OP_NOP:break;case d.OP_NOP2:case d.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var O=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e,5);if(O.lt(new s(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(O))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case d.OP_NOP1:case d.OP_NOP3:case d.OP_NOP4:case d.OP_NOP5:case d.OP_NOP6:case d.OP_NOP7:case d.OP_NOP8:case d.OP_NOP9:case d.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case d.OP_IF:case d.OP_NOTIF:{if(E=!1,t){if(1>this.stack.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;p=this.stack.pop(),E=f.castToBool(p),B===d.OP_NOTIF&&(E=!E)}this.vfExec.push(E)}break;case d.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 d.OP_ENDIF:{if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop()}break;case d.OP_VERIFY:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=this.stack[this.stack.length-1],E=f.castToBool(p),E)this.stack.pop();else return this.errstr="SCRIPT_ERR_VERIFY",!1}break;case d.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;break;case d.OP_TOALTSTACK:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop())}break;case d.OP_FROMALTSTACK:{if(1>this.altstack.length)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop())}break;case d.OP_2DROP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop()}break;case d.OP_2DUP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1],this.stack.push(u),this.stack.push(l)}break;case d.OP_3DUP:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-3],l=this.stack[this.stack.length-2];var R=this.stack[this.stack.length-1];this.stack.push(u),this.stack.push(l),this.stack.push(R)}break;case d.OP_2OVER:{if(4>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-4],l=this.stack[this.stack.length-3],this.stack.push(u),this.stack.push(l)}break;case d.OP_2ROT:{if(6>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack.splice(this.stack.length-6,2),this.stack.push(b[0]),this.stack.push(b[1])}break;case d.OP_2SWAP:{if(4>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack.splice(this.stack.length-4,2),this.stack.push(b[0]),this.stack.push(b[1])}break;case d.OP_IFDUP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1],E=f.castToBool(p),E&&this.stack.push(p)}break;case d.OP_DEPTH:p=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(p);break;case d.OP_DROP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop()}break;case d.OP_DUP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1])}break;case d.OP_NIP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1)}break;case d.OP_OVER:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2])}break;case d.OP_PICK:case d.OP_ROLL:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=this.stack[this.stack.length-1],y=s.fromScriptNumBuffer(p,e),h=y.toNumber(),this.stack.pop(),0>h||h>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-h-1],B===d.OP_ROLL&&this.stack.splice(this.stack.length-h-1,1),this.stack.push(p)}break;case d.OP_ROT:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=this.stack[this.stack.length-3],m=this.stack[this.stack.length-2];var j=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=m,this.stack[this.stack.length-2]=j,this.stack[this.stack.length-1]=g}break;case d.OP_SWAP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=this.stack[this.stack.length-2],m=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=m,this.stack[this.stack.length-1]=g}break;case d.OP_TUCK:{if(2>this.stack.length)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 d.OP_SIZE:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new s(this.stack[this.stack.length-1].length),this.stack.push(y.toScriptNumBuffer())}break;case d.OP_EQUAL:case d.OP_EQUALVERIFY:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1];var T=u.toString("hex")===l.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(T?f.true:f.false),B===d.OP_EQUALVERIFY)if(T)this.stack.pop();else return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1}break;case d.OP_1ADD:case d.OP_1SUB:case d.OP_NEGATE:case d.OP_ABS:case d.OP_NOT:case d.OP_0NOTEQUAL:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1],y=s.fromScriptNumBuffer(p,e),B===d.OP_1ADD?y=y.add(s.One):B===d.OP_1SUB?y=y.sub(s.One):B===d.OP_NEGATE?y=y.neg():B===d.OP_ABS?0>y.cmp(s.Zero)&&(y=y.neg()):B===d.OP_NOT?y=new s((0===y.cmp(s.Zero))+0):B===d.OP_0NOTEQUAL?y=new s((0!==y.cmp(s.Zero))+0):void 0,this.stack.pop(),this.stack.push(y.toScriptNumBuffer())}break;case d.OP_ADD:case d.OP_SUB:case d.OP_BOOLAND:case d.OP_BOOLOR:case d.OP_NUMEQUAL:case d.OP_NUMEQUALVERIFY:case d.OP_NUMNOTEQUAL:case d.OP_LESSTHAN:case d.OP_GREATERTHAN:case d.OP_LESSTHANOREQUAL:case d.OP_GREATERTHANOREQUAL:case d.OP_MIN:case d.OP_MAX:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(_=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e),y=new s(0),B===d.OP_ADD?y=_.add(v):B===d.OP_SUB?y=_.sub(v):B===d.OP_BOOLAND?y=new s((0!==_.cmp(s.Zero)&&0!==v.cmp(s.Zero))+0):B===d.OP_BOOLOR?y=new s((0!==_.cmp(s.Zero)||0!==v.cmp(s.Zero))+0):B===d.OP_NUMEQUAL?y=new s((0===_.cmp(v))+0):B===d.OP_NUMEQUALVERIFY?y=new s((0===_.cmp(v))+0):B===d.OP_NUMNOTEQUAL?y=new s((0!==_.cmp(v))+0):B===d.OP_LESSTHAN?y=new s((0>_.cmp(v))+0):B===d.OP_GREATERTHAN?y=new s((0<_.cmp(v))+0):B===d.OP_LESSTHANOREQUAL?y=new s((0>=_.cmp(v))+0):B===d.OP_GREATERTHANOREQUAL?y=new s((0<=_.cmp(v))+0):B===d.OP_MIN?y=0>_.cmp(v)?_:v:B===d.OP_MAX?y=0<_.cmp(v)?_:v:void 0,(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),B===d.OP_NUMEQUALVERIFY))if(f.castToBool(this.stack[this.stack.length-1]))this.stack.pop();else return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1}break;case d.OP_WITHIN:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=s.fromScriptNumBuffer(this.stack[this.stack.length-3],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e);var N=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e);E=0>=v.cmp(_)&&0>_.cmp(N),this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(E?f.true:f.false)}break;case d.OP_RIPEMD160:case d.OP_SHA1:case d.OP_SHA256:case d.OP_HASH160:case d.OP_HASH256:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1];var C;B===d.OP_RIPEMD160?C=n.ripemd160(p):B===d.OP_SHA1?C=n.sha1(p):B===d.OP_SHA256?C=n.sha256(p):B===d.OP_HASH160?C=n.sha256ripemd160(p):B===d.OP_HASH256&&(C=n.sha256sha256(p)),this.stack.pop(),this.stack.push(C)}break;case d.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case d.OP_CHECKSIG:case d.OP_CHECKSIGVERIFY:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=this.stack[this.stack.length-2],I=this.stack[this.stack.length-1],x=new o().set({chunks:this.script.chunks.slice(this.pbegincodehash)});var z=new o().add(S);if(x.findAndDelete(z),!this.checkSignatureEncoding(S)||!this.checkPubkeyEncoding(I))return!1;try{w=i.fromTxFormat(S),A=c.fromBuffer(I,!1),P=this.tx.verifySignature(w,A,this.nin,x)}catch(t){P=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(P?f.true:f.false),B===d.OP_CHECKSIGVERIFY)if(P)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1}break;case d.OP_CHECKMULTISIG:case d.OP_CHECKMULTISIGVERIFY:{var M=1;if(this.stack.lengthU||20D||D>U)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var q=++M;if(M+=D,this.stack.lengthU&&(P=!1)}for(;1this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.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(P?f.true:f.false),B===d.OP_CHECKMULTISIGVERIFY)if(P)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1;}return!0}}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../crypto/signature":12,"../opcode":34,"../publickey":36,"../transaction":40,"./script":39,buffer:126,lodash:204}],39:[function(e,t){(function(r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=e("../address"),n=e("../encoding/bufferreader"),d=e("../encoding/bufferwriter"),i=e("../crypto/hash"),c=e("../opcode"),f=e("../publickey"),s=e("../crypto/signature"),p=e("../networks"),u=e("../util/preconditions"),l=e("lodash"),b=e("../errors"),h=e("buffer"),g=e("../util/buffer"),m=e("../util/js"),y=function e(t){return this instanceof e?(this.chunks=[],g.isBuffer(t))?e.fromBuffer(t):t instanceof o?e.fromAddress(t):t instanceof e?e.fromBuffer(t.toBuffer()):"string"==typeof t?e.fromString(t):void("undefined"!=typeof t&&this.set(t)):new e(t)};y.prototype.set=function(e){return this.chunks=e.chunks||this.chunks,this},y.fromBuffer=function(t){var e=new y;e.chunks=[];for(var r=new n(t);!r.finished();)try{var a=r.readUInt8(),o,i;0"},y.prototype.isPublicKeyHashOut=function(){return!!(5===this.chunks.length&&this.chunks[0].opcodenum===c.OP_DUP&&this.chunks[1].opcodenum===c.OP_HASH160&&this.chunks[2].buf&&20===this.chunks[2].buf.length&&this.chunks[3].opcodenum===c.OP_EQUALVERIFY&&this.chunks[4].opcodenum===c.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},y.prototype.getPublicKey=function(){return u.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return u.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===c.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4===t||6===t||7===t)&&65===e.length?r=!0:(3===t||2===t)&&33===e.length&&(r=!0),r)return f.isValid(e)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===c.OP_HASH160&&20===e[1]&&e[e.length-1]===c.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(1>=this.chunks.length)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf;if(!t)return!1;var r;try{r=y.fromBuffer(t)}catch(t){if(t instanceof b.Script.InvalidBuffer)return!1;throw t}var a=r.classify();return a!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return 3r)a=c.OP_PUSHDATA1;else if(65536>r)a=c.OP_PUSHDATA2;else if(4294967296>r)a=c.OP_PUSHDATA4;else throw new Error("You can't push that much data");return this._insertAtPosition({buf:e,len:r,opcodenum:a},t),this},y.prototype.removeCodeseparators=function(){for(var e=[],t=0;t=r[0]?a===c.OP_1+(r[0]-1):1===r.length&&129===r[0]?a===c.OP_1NEGATE:75>=r.length?a===r.length:255>=r.length?a===c.OP_PUSHDATA1:!(65535>=r.length)||a===c.OP_PUSHDATA2},y.prototype._decodeOP_N=function(e){if(e===c.OP_0)return 0;if(e>=c.OP_1&&e<=c.OP_16)return e-(c.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},y.prototype.getSignatureOperationsCount=function(e){e=!!l.isUndefined(e)||e;var t=this,r=0,a=c.OP_INVALIDOPCODE;return l.each(t.chunks,function(o){var n=o.opcodenum;n==c.OP_CHECKSIG||n==c.OP_CHECKSIGVERIFY?r++:(n==c.OP_CHECKMULTISIG||n==c.OP_CHECKMULTISIGVERIFY)&&(e&&a>=c.OP_1&&a<=c.OP_16?r+=t._decodeOP_N(a):r+=20),a=n}),r},t.exports=y}).call(this,e("buffer").Buffer)},{"../address":1,"../crypto/hash":9,"../crypto/signature":12,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../errors":18,"../networks":33,"../opcode":34,"../publickey":36,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],40:[function(e,t){"use strict";t.exports=e("./transaction"),t.exports.Input=e("./input"),t.exports.Output=e("./output"),t.exports.UnspentOutput=e("./unspentoutput"),t.exports.Signature=e("./signature"),t.exports.Sighash=e("./sighash")},{"./input":41,"./output":47,"./sighash":48,"./signature":49,"./transaction":50,"./unspentoutput":51}],41:[function(e,t){"use strict";t.exports=e("./input"),t.exports.PublicKey=e("./publickey"),t.exports.PublicKeyHash=e("./publickeyhash"),t.exports.MultiSig=e("./multisig.js"),t.exports.MultiSigScriptHash=e("./multisigscripthash.js")},{"./input":42,"./multisig.js":43,"./multisigscripthash.js":44,"./publickey":45,"./publickeyhash":46}],42:[function(e,t){"use strict";function r(e){return this instanceof r?e?this._fromObject(e):void 0:new r(e)}var a=e("lodash"),o=e("../../util/preconditions"),n=e("../../errors"),i=e("../../encoding/bufferwriter"),d=e("buffer"),s=e("../../util/buffer"),c=e("../../util/js"),f=e("../../script"),p=e("../sighash"),u=e("../output"),l=4294967295,b=l;r.MAXINT=l,r.DEFAULT_SEQNUMBER=b,r.DEFAULT_LOCKTIME_SEQNUMBER=l-1,r.DEFAULT_RBF_SEQNUMBER=l-2,Object.defineProperty(r.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new f(this._scriptBuffer),this._script._isInput=!0),this._script)}}),r.fromObject=function(e){o.checkArgument(a.isObject(e));var t=new r;return t._fromObject(e)},r.prototype._fromObject=function(e){var t;if(t=a.isString(e.prevTxId)&&c.isHexa(e.prevTxId)?new d.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof u?e.output:new u(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=a.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=a.isUndefined(e.sequenceNumber)?a.isUndefined(e.seqnum)?b:e.seqnum:e.sequenceNumber,a.isUndefined(e.script)&&a.isUndefined(e.scriptBuffer))throw new n.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},r.prototype.toObject=r.prototype.toJSON=function(){var e={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(e.scriptString=this.script.toString()),this.output&&(e.output=this.output.toObject()),e},r.fromBufferReader=function(e){var t=new r;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},r.prototype.toBufferWriter=function(e){e||(e=new i),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},r.prototype.setScript=function(e){if(this._script=null,e instanceof f)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(c.isHexa(e))this._scriptBuffer=new d.Buffer(e,"hex");else if(a.isString(e))this._script=new f(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(s.isBuffer(e))this._scriptBuffer=new d.Buffer(e);else throw new TypeError("Invalid argument type: script");return this},r.prototype.getSignatures=function(){throw new n.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},r.prototype.isFullySigned=function(){throw new n.AbstractMethodInvoked("Input#isFullySigned")},r.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},r.prototype.addSignature=function(){throw new n.AbstractMethodInvoked("Input#addSignature")},r.prototype.clearSignatures=function(){throw new n.AbstractMethodInvoked("Input#clearSignatures")},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,p.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},r.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},r.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},t.exports=r},{"../../encoding/bufferwriter":16,"../../errors":18,"../../script":37,"../../util/buffer":54,"../../util/js":55,"../../util/preconditions":56,"../output":47,"../sighash":48,buffer:126,lodash:204}],43:[function(e,t){"use strict";function r(e,t,r,o){i.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,o=o||e.signatures,this.publicKeys=a.sortBy(t,function(e){return e.toString("hex")}),s.checkState(c.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},a.each(this.publicKeys,function(e,t){n.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=o?this._deserializeSignatures(o):Array(this.publicKeys.length)}var a=e("lodash"),o=e("inherits"),n=e("../transaction"),i=e("./input"),d=e("../output"),s=e("../../util/preconditions"),c=e("../../script"),f=e("../../crypto/signature"),p=e("../sighash"),u=e("../../publickey"),l=e("../../util/buffer"),b=e("../signature");o(r,i),r.prototype.toObject=function(){var e=i.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=a.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},r.prototype._deserializeSignatures=function(e){return a.map(e,function(e){return e?new b(e):void 0})},r.prototype._serializeSignatures=function(){return a.map(this.signatures,function(e){return e?e.toObject():void 0})},r.prototype.getSignatures=function(e,t,r,o){s.checkState(this.output instanceof d),o=o||f.SIGHASH_ALL|f.SIGHASH_FORKID;var n=this,i=[];return a.each(this.publicKeys,function(a){a.toString()===t.publicKey.toString()&&i.push(new b({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:p.sign(e,t,o,r,n.output.script,n.output.satoshisBN),sigtype:o}))}),i},r.prototype.addSignature=function(e,t){return s.checkState(!this.isFullySigned(),"All needed signatures have already been added"),s.checkArgument(!a.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),s.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},r.prototype._updateScript=function(){return this.setScript(c.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},r.prototype._createSignatures=function(){return a.map(a.filter(this.signatures,function(e){return!a.isUndefined(e)}),function(e){return l.concat([e.signature.toDER(),l.integerAsSingleByteBuffer(e.sigtype)])})},r.prototype.clearSignatures=function(){this.signatures=Array(this.publicKeys.length),this._updateScript()},r.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},r.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},r.prototype.countSignatures=function(){return a.reduce(this.signatures,function(e,t){return e+!!t},0)},r.prototype.publicKeysWithoutSignature=function(){var e=this;return a.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,p.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},r.normalizeSignatures=function(e,t,r,a,o){return o.map(function(o){var n=null;return a=a.filter(function(a){if(n)return!0;var i=new b({signature:f.fromTxFormat(a),publicKey:o,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});i.signature.nhashtype=i.sigtype;var d=p.verify(e,i.signature,i.publicKey,i.inputIndex,t.output.script);return!d||(n=i,!1)}),n?n:null})},r.OPCODES_SIZE=1,r.SIGNATURE_SIZE=73,r.prototype._estimateSize=function(){return r.OPCODES_SIZE+this.threshold*r.SIGNATURE_SIZE},t.exports=r},{"../../crypto/signature":12,"../../publickey":36,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"../transaction":50,"./input":42,inherits:201,lodash:204}],44:[function(e,t){"use strict";function r(e,t,r,o){n.apply(this,arguments);var i=this;t=t||e.publicKeys,r=r||e.threshold,o=o||e.signatures,this.publicKeys=a.sortBy(t,function(e){return e.toString("hex")}),this.redeemScript=s.buildMultisigOut(this.publicKeys,r),d.checkState(s.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},a.each(this.publicKeys,function(e,t){i.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=o?this._deserializeSignatures(o):Array(this.publicKeys.length)}var a=e("lodash"),o=e("inherits"),n=e("./input"),i=e("../output"),d=e("../../util/preconditions"),s=e("../../script"),c=e("../../crypto/signature"),f=e("../sighash"),p=e("../../publickey"),u=e("../../util/buffer"),l=e("../signature");o(r,n),r.prototype.toObject=function(){var e=n.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=a.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},r.prototype._deserializeSignatures=function(e){return a.map(e,function(e){return e?new l(e):void 0})},r.prototype._serializeSignatures=function(){return a.map(this.signatures,function(e){return e?e.toObject():void 0})},r.prototype.getSignatures=function(e,t,r,o){d.checkState(this.output instanceof i),o=o||c.SIGHASH_ALL|c.SIGHASH_FORKID;var n=this,s=[];return a.each(this.publicKeys,function(a){a.toString()===t.publicKey.toString()&&s.push(new l({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:f.sign(e,t,o,r,n.redeemScript,n.output.satoshisBN),sigtype:o}))}),s},r.prototype.addSignature=function(e,t){return d.checkState(!this.isFullySigned(),"All needed signatures have already been added"),d.checkArgument(!a.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),d.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},r.prototype._updateScript=function(){return this.setScript(s.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},r.prototype._createSignatures=function(){return a.map(a.filter(this.signatures,function(e){return!a.isUndefined(e)}),function(e){return u.concat([e.signature.toDER(),u.integerAsSingleByteBuffer(e.sigtype)])})},r.prototype.clearSignatures=function(){this.signatures=Array(this.publicKeys.length),this._updateScript()},r.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},r.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},r.prototype.countSignatures=function(){return a.reduce(this.signatures,function(e,t){return e+!!t},0)},r.prototype.publicKeysWithoutSignature=function(){var e=this;return a.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript,this.output.satoshisBN)},r.OPCODES_SIZE=7,r.SIGNATURE_SIZE=74,r.PUBKEY_SIZE=34,r.prototype._estimateSize=function(){return r.OPCODES_SIZE+this.threshold*r.SIGNATURE_SIZE+this.publicKeys.length*r.PUBKEY_SIZE},t.exports=r},{"../../crypto/signature":12,"../../publickey":36,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201,lodash:204}],45:[function(e,t){"use strict";function r(){i.apply(this,arguments)}var a=e("inherits"),o=e("../../util/preconditions"),n=e("../../util/buffer"),i=e("./input"),d=e("../output"),s=e("../sighash"),c=e("../../script"),f=e("../../crypto/signature"),p=e("../signature");a(r,i),r.prototype.getSignatures=function(e,t,r,a){o.checkState(this.output instanceof d),a=a||f.SIGHASH_ALL|f.SIGHASH_FORKID;var n=t.toPublicKey();return n.toString()===this.output.script.getPublicKey().toString("hex")?[new p({publicKey:n,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:s.sign(e,t,a,r,this.output.script,this.output.satoshisBN),sigtype:a})]:[]},r.prototype.addSignature=function(e,t){return o.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(c.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},r.prototype.clearSignatures=function(){return this.setScript(c.empty()),this},r.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},r.SCRIPT_MAX_SIZE=73,r.prototype._estimateSize=function(){return r.SCRIPT_MAX_SIZE},t.exports=r},{"../../crypto/signature":12,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201}],46:[function(e,t){"use strict";function r(){d.apply(this,arguments)}var a=e("inherits"),o=e("../../util/preconditions"),n=e("../../util/buffer"),i=e("../../crypto/hash"),d=e("./input"),s=e("../output"),c=e("../sighash"),f=e("../../script"),p=e("../../crypto/signature"),u=e("../signature");a(r,d),r.prototype.getSignatures=function(e,t,r,a,d){return o.checkState(this.output instanceof s),d=d||i.sha256ripemd160(t.publicKey.toBuffer()),a=a||p.SIGHASH_ALL|p.SIGHASH_FORKID,n.equals(d,this.output.script.getPublicKeyHash())?[new u({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(e,t,a,r,this.output.script,this.output.satoshisBN),sigtype:a})]:[]},r.prototype.addSignature=function(e,t){return o.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this},r.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},r.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},r.SCRIPT_MAX_SIZE=107,r.prototype._estimateSize=function(){return r.SCRIPT_MAX_SIZE},t.exports=r},{"../../crypto/hash":9,"../../crypto/signature":12,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201}],47:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);if(!a.isObject(e))throw new TypeError("Unrecognized argument for Output");else if(this.satoshis=e.satoshis,i.isBuffer(e.script))this._scriptBuffer=e.script;else{var t;t=a.isString(e.script)&&d.isHexa(e.script)?new n.Buffer(e.script,"hex"):e.script,this.setScript(t)}}var a=e("lodash"),o=e("../crypto/bn"),n=e("buffer"),i=e("../util/buffer"),d=e("../util/js"),s=e("../encoding/bufferwriter"),c=e("../script"),f=e("../util/preconditions"),p=e("../errors");Object.defineProperty(r.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(r.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof o?(this._satoshisBN=e,this._satoshis=e.toNumber()):a.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=o.fromNumber(this._satoshis)):(f.checkArgument(d.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=o.fromNumber(e),this._satoshis=e),f.checkState(d.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),r.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis===this._satoshisBN.toNumber()?!!(0>this._satoshis)&&"transaction txout negative":"transaction txout satoshis has corrupted value"},Object.defineProperty(r.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),f.checkState(d.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),r.prototype.toObject=r.prototype.toJSON=function(){var e={satoshis:this.satoshis,script:this._scriptBuffer.toString("hex")};return e},r.fromObject=function(e){return new r(e)},r.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(t instanceof p.Script.InvalidBuffer)this._script=null;else throw t}},r.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(a.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else if(i.isBuffer(e))this.setScriptFromBuffer(e);else throw new TypeError("Invalid argument type: script");return this},r.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},r.fromBufferReader=function(e){var t={satoshis:e.readUInt64LEBN()},a=e.readVarintNum();return t.script=0===a?new n.Buffer([]):e.read(a),new r(t)},r.prototype.toBufferWriter=function(e){e||(e=new s),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},t.exports=r},{"../crypto/bn":7,"../encoding/bufferwriter":16,"../errors":18,"../script":37,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],48:[function(e,t){(function(r){"use strict";var a=e("buffer"),o=e("../crypto/signature"),n=e("../script"),d=e("./output"),s=e("../encoding/bufferreader"),c=e("../encoding/bufferwriter"),f=e("../crypto/bn"),p=e("../crypto/hash"),i=e("../crypto/ecdsa"),u=e("../util/preconditions"),l=e("../util/buffer"),b=e("lodash"),h=function(e,t,r,a,n){function i(e,t){var r=new c;b.isUndefined(t)?b.each(e.outputs,function(e){e.toBufferWriter(r)}):e.outputs[t].toBufferWriter(r);var a=r.toBuffer(),o=p.sha256sha256(a);return o}var d=e.inputs[r];u.checkArgument(n instanceof f,"For ForkId=0 signatures, satoshis or complete input must be provided");var h=l.emptyBuffer(32),g=l.emptyBuffer(32),m=l.emptyBuffer(32);t&o.SIGHASH_ANYONECANPAY||(h=function(e){var t=new c;b.each(e.inputs,function(e){t.writeReverse(e.prevTxId),t.writeUInt32LE(e.outputIndex)});var r=t.toBuffer(),a=p.sha256sha256(r);return a}(e)),t&o.SIGHASH_ANYONECANPAY||(31&t)==o.SIGHASH_SINGLE||(31&t)==o.SIGHASH_NONE||(g=function(e){var t=new c;b.each(e.inputs,function(e){t.writeUInt32LE(e.sequenceNumber)});var r=t.toBuffer(),a=p.sha256sha256(r);return a}(e)),(31&t)!=o.SIGHASH_SINGLE&&(31&t)!=o.SIGHASH_NONE?m=i(e):(31&t)==o.SIGHASH_SINGLE&&r>>0);var v=y.toBuffer(),S=p.sha256sha256(v);return S=new s(S).readReverse(),S},g=function(t,u,l,b,g){var m=e("./transaction"),y=e("./input"),_=m.shallowCopy(t);if(b=new n(b),u&o.SIGHASH_FORKID&&!0)return h(_,u,l,b,g);b.removeCodeseparators();var v;for(v=0;v<_.inputs.length;v++)_.inputs[v]=new y(_.inputs[v]).setScript(n.empty());if(_.inputs[l]=new y(_.inputs[l]).setScript(b),(31&u)===o.SIGHASH_NONE||(31&u)===o.SIGHASH_SINGLE)for(v=0;v<_.inputs.length;v++)v!==l&&(_.inputs[v].sequenceNumber=0);if((31&u)===o.SIGHASH_NONE)_.outputs=[];else if((31&u)===o.SIGHASH_SINGLE){if(l>=_.outputs.length)return new r("0000000000000000000000000000000000000000000000000000000000000001","hex");for(_.outputs.length=l+1,v=0;vt?!e.disableMoreOutputThanInput&&(r=new s.Transaction.InvalidOutputAmountSum):r=this._hasFeeError(e,t),r||this._hasDustOutputs(e)||this._isMissingSignatures(e)},a.prototype._hasFeeError=function(e,t){if(!o.isUndefined(this._fee)&&this._fee!==t)return new s.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=h(a.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new s.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new s.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}if(!e.disableSmallFees){var n=p(this._estimateFee()/a.FEE_SECURITY_MARGIN);if(t"},a.prototype.toBuffer=function(){var e=new l;return this.toBufferWriter(e).toBuffer()},a.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),o.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),o.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),e},a.prototype.fromBuffer=function(e){var t=new u(e);return this.fromBufferReader(t)},a.prototype.fromBufferReader=function(e){n.checkArgument(!e.finished(),"No transaction data received");var t,r,a;for(this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t=a.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new s.Transaction.BlockHeightTooHigh;if(0>e)throw new s.Transaction.NLockTimeOutOfRange;for(var t=0;to&&(e+=a.CHANGE_OUTPUT_MAX_SIZE),p(e/1e3)*(r||a.FEE_PER_KB)},a.prototype._estimateSize=function(){var e=a.MAXIMUM_EXTRA_SIZE;return o.each(this.inputs,function(t){e+=t._estimateSize()}),o.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},a.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=o.without(this.outputs,t),this._outputAmount=void 0},a.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},a.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return d(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||d(e.script.toBuffer(),t.script.toBuffer())}),t}),this},a.prototype.shuffleOutputs=function(){return this.sortOutputs(o.shuffle)},a.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},a.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},a.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==o.difference(this.outputs,e).length;if(t)throw new s.Transaction.InvalidSorting;if(!o.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=o.findIndex(e,r)}return this.outputs=e,this},a.prototype.removeInput=function(e,t){var r;if(r=!t&&o.isNumber(e)?e:o.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t}),0>r||r>=this.inputs.length)throw new s.Transaction.InvalidIndex(r,this.inputs.length);var a=this.inputs[r];this.inputs=o.without(this.inputs,a),this._inputAmount=void 0,this._updateChangeOutput()},a.prototype.sign=function(e,t){n.checkState(this.hasAllUtxoInfo());var r=this;return o.isArray(e)?(o.each(e,function(e){r.sign(e,t)}),this):(o.each(this.getSignatures(e,t),function(e){r.applySignature(e)}),this)},a.prototype.getSignatures=function(e,t){e=new E(e),t=t||g.SIGHASH_ALL|g.SIGHASH_FORKID;var r=this,a=[],n=b.sha256ripemd160(e.publicKey.toBuffer());return o.each(this.inputs,function(i,d){o.each(i.getSignatures(r,e,d,t,n),function(e){a.push(e)})}),a},a.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},a.prototype.isFullySigned=function(){return o.each(this.inputs,function(e){if(e.isFullySigned===v.prototype.isFullySigned)throw new s.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),o.every(o.map(this.inputs,function(e){return e.isFullySigned()}))},a.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===v.prototype.isValidSignature)throw new s.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[e.inputIndex].isValidSignature(t,e)},a.prototype.verifySignature=function(e,t,r,a){return m.verify(this,e,t,r,a)},a.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new P(0),t=0,r;t1e6)return"transaction over the maximum block size";var n={};for(t=0;tc.length||100=v.MAXINT-1&&(t.sequenceNumber=v.DEFAULT_RBF_SEQNUMBER);return this},t.exports=a}).call(this,e("buffer").Buffer)},{"../address":1,"../crypto/bn":7,"../crypto/hash":9,"../crypto/signature":12,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../errors":18,"../privatekey":35,"../script":37,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,"./input":41,"./output":47,"./sighash":48,"./unspentoutput":51,buffer:126,"buffer-compare":124,lodash:204}],51:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);o.checkArgument(a.isObject(e),"Must provide an object from where to extract data");var t=e.address?new d(e.address):void 0,c=e.txid?e.txid:e.txId;if(!c||!n.isHexaString(c)||64"},r.prototype.toString=function(){return this.txId+":"+this.outputIndex},r.fromObject=function(e){return new r(e)},r.prototype.toObject=r.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:s.fromSatoshis(this.satoshis).toBTC()}},t.exports=r},{"../address":1,"../script":37,"../unit":52,"../util/js":55,"../util/preconditions":56,lodash:204}],52:[function(e,t){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);if(a.isNumber(t)){if(0>=t)throw new o.Unit.InvalidRate(t);e/=t,t=r.BTC}this._value=this._from(e,t);var n=this;Object.keys(i).forEach(function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})})}var a=e("lodash"),o=e("./errors"),n=e("./util/preconditions"),i={BTC:[100000000,8],mBTC:[100000,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(i).forEach(function(e){r[e]=e}),r.fromObject=function(e){return n.checkArgument(a.isObject(e),"Argument is expected to be an object"),new r(e.amount,e.code)},r.fromBTC=function(e){return new r(e,r.BTC)},r.fromMillis=r.fromMilis=function(e){return new r(e,r.mBTC)},r.fromMicros=r.fromBits=function(e){return new r(e,r.bits)},r.fromSatoshis=function(e){return new r(e,r.satoshis)},r.fromFiat=function(e,t){return new r(e,t)},r.prototype._from=function(e,t){if(!i[t])throw new o.Unit.UnknownCode(t);return parseInt((e*i[t][0]).toFixed())},r.prototype.to=function(e){if(a.isNumber(e)){if(0>=e)throw new o.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!i[e])throw new o.Unit.UnknownCode(e);var t=this._value/i[e][0];return parseFloat(t.toFixed(i[e][1]))},r.prototype.toBTC=function(){return this.to(r.BTC)},r.prototype.toMillis=r.prototype.toMilis=function(){return this.to(r.mBTC)},r.prototype.toMicros=r.prototype.toBits=function(){return this.to(r.bits)},r.prototype.toSatoshis=function(){return this.to(r.satoshis)},r.prototype.atRate=function(e){return this.to(e)},r.prototype.toString=function(){return this.satoshis+" satoshis"},r.prototype.toObject=r.prototype.toJSON=function(){return{amount:this.BTC,code:r.BTC}},r.prototype.inspect=function(){return""},t.exports=r},{"./errors":18,"./util/preconditions":56,lodash:204}],53:[function(e,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=e("lodash"),o=e("url"),n=e("./address"),i=e("./unit"),d=function e(t,a){if(!(this instanceof e))return new e(t,a);if(this.extras={},this.knownParams=a||[],this.address=this.network=this.amount=this.message=null,"string"==typeof t){var o=e.parse(t);o.amount&&(o.amount=this._parseAmount(o.amount)),this._fromObject(o)}else if("object"===("undefined"==typeof t?"undefined":r(t)))this._fromObject(t);else throw new TypeError("Unrecognized data format.")};d.fromString=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return new d(e)},d.fromObject=function(e){return new d(e)},d.isValid=function(e,t){try{new d(e,t)}catch(e){return!1}return!0},d.parse=function(e){var t=o.parse(e,!0);if("bitcoincash:"!==t.protocol)throw new TypeError("Invalid bitcoin cash URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(e);return t.query.address=r&&r[1]||void 0,t.query},d.Members=["address","amount","message","label","r"],d.prototype._fromObject=function(e){if(!n.isValid(e.address))throw new TypeError("Invalid bitcoin address");for(var t in this.address=new n(e.address),this.network=this.address.network,this.amount=e.amount,e)if("address"!=t&&"amount"!=t){if(/^req-/.exec(t)&&-1===this.knownParams.indexOf(t))throw Error("Unknown required argument "+t);var r=-1"},t.exports=d},{"./address":1,"./unit":52,lodash:204,url:263}],54:[function(e,t){(function(r){"use strict";function a(e,t){if(e.length!==t.length)return!1;for(var r=e.length,a=0;a>24,255&e>>16,255&e>>8,255&e])},integerFromBuffer:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e[0]<<24|e[1]<<16|e[2]<<8|e[3]},integerFromSingleByteBuffer:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e[0]},bufferToHex:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e.toString("hex")},reverse:function(e){for(var t=new o.Buffer(e.length),r=0;r=e))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=d.byteLength(e);else if(d.isBuffer(e))this.value=e,this.length=e.length;else return t.error("Unsupported type: "+typeof e)}var n=e("inherits"),i=e("../base").Reporter,d=e("buffer").Buffer;n(a,i),r.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=o,o.prototype.join=function(e,t){return(e||(e=new d(this.length)),t||(t=0),0===this.length)?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):d.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":60,buffer:126,inherits:201}],60:[function(e,t,r){var a=r;a.Reporter=e("./reporter").Reporter,a.DecoderBuffer=e("./buffer").DecoderBuffer,a.EncoderBuffer=e("./buffer").EncoderBuffer,a.Node=e("./node")},{"./buffer":59,"./node":61,"./reporter":62}],61:[function(e,t){function r(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||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 a=e("../base").Reporter,o=e("../base").EncoderBuffer,n=e("../base").DecoderBuffer,i=e("minimalistic-assert"),d=["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"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(d);t.exports=r;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];r.prototype.clone=function(){var e=this._baseState,t={};c.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},r.prototype._wrap=function(){var e=this._baseState;s.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},r.prototype._init=function(e){var t=this._baseState;i(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),i.equal(t.children.length,1,"Root node can have only one child")},r.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(i(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(i(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var a=e[r];t[a]=r}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){r.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),d.forEach(function(e){r.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return i(null===t.tag),t.tag=e,this._useArgs(r),this}}),r.prototype.use=function(e){i(e);var t=this._baseState;return i(null===t.use),t.use=e,this},r.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},r.prototype.def=function(e){var t=this._baseState;return i(null===t["default"]),t["default"]=e,t.optional=!0,this},r.prototype.explicit=function(e){var t=this._baseState;return i(null===t.explicit&&null===t.implicit),t.explicit=e,this},r.prototype.implicit=function(e){var t=this._baseState;return i(null===t.explicit&&null===t.implicit),t.implicit=e,this},r.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},r.prototype.key=function(e){var t=this._baseState;return i(null===t.key),t.key=e,this},r.prototype.any=function(){var e=this._baseState;return e.any=!0,this},r.prototype.choice=function(e){var t=this._baseState;return i(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},r.prototype.contains=function(e){var t=this._baseState;return i(null===t.use),t.contains=e,this},r.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var a=r["default"],o=!0,i=null;if(null!==r.key&&(i=e.enterKey(r.key)),r.optional){var d=null;if(null===r.explicit?null===r.implicit?null!==r.tag&&(d=r.tag):d=r.implicit:d=r.explicit,null===d&&!r.any){var s=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(t){o=!1}e.restore(s)}else if(o=this._peekTag(e,d,r.any),e.isError(o))return o}var c;if(r.obj&&o&&(c=e.enterObject()),o){if(null!==r.explicit){var f=this._decodeTag(e,r.explicit);if(e.isError(f))return f;e=f}var p=e.offset;if(null===r.use&&null===r.choice){if(r.any)var s=e.save();var u=this._decodeTag(e,null===r.implicit?r.tag:r.implicit,r.any);if(e.isError(u))return u;r.any?a=e.raw(s):e=u}if(t&&t.track&&null!==r.tag&&t.track(e.path(),p,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),a=r.any?a:null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),e.isError(a))return a;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(e,t)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new n(a);a=this._getUse(r.contains,e._reporterState.obj)._decode(l,t)}}return r.obj&&o&&(a=e.leaveObject(c)),null!==r.key&&(null!==a||!0===o)?e.leaveKey(i,r.key,a):null!==i&&e.exitKey(i),a},r.prototype._decodeGeneric=function(e,t,r){var a=this._baseState;if("seq"===e||"set"===e)return null;return"seqof"===e||"setof"===e?this._decodeList(t,e,a.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&a.args?this._decodeObjid(t,a.args[0],a.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,a.args&&a.args[0],r):null===a.use?t.error("unknown tag: "+e):this._getUse(a.use,t._reporterState.obj)._decode(t,r)},r.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),i(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},r.prototype._decodeChoice=function(e,t){var r=this._baseState,a=null,o=!1;return Object.keys(r.choice).some(function(n){var i=e.save(),d=r.choice[n];try{var s=d._decode(e,t);if(e.isError(s))return!1;a={type:n,value:s},o=!0}catch(t){return e.restore(i),!1}return!0},this),o?a:e.error("Choice not matched")},r.prototype._createEncoderBuffer=function(e){return new o(e,this.reporter)},r.prototype._encode=function(e,t,r){var a=this._baseState;if(null===a["default"]||a["default"]!==e){var o=this._encodeValue(e,t,r);return void 0===o||this._skipDefault(o,t,r)?void 0:o}},r.prototype._encodeValue=function(e,t,r){var o=this._baseState;if(null===o.parent)return o.children[0]._encode(e,t||new a);var n=null;if(this.reporter=t,o.optional&&void 0===e)if(null!==o["default"])e=o["default"];else return;var i=null,d=!1;if(o.any)n=this._createEncoderBuffer(e);else if(o.choice)n=this._encodeChoice(e,t);else if(o.contains)i=this._getUse(o.contains,r)._encode(e,t),d=!0;else if(o.children)i=o.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var a=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var o=r._encode(e[r._baseState.key],t,e);return t.leaveKey(a),o},this).filter(function(e){return e}),i=this._createEncoderBuffer(i);else if("seqof"===o.tag||"setof"===o.tag){if(!(o.args&&1===o.args.length))return t.error("Too many args for : "+o.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var s=this.clone();s._baseState.implicit=null,i=this._createEncoderBuffer(e.map(function(r){var a=this._baseState;return this._getUse(a.args[0],e)._encode(r,t)},s))}else null===o.use?(i=this._encodePrimitive(o.tag,e),d=!0):n=this._getUse(o.use,r)._encode(e,t);var n;if(!o.any&&null===o.choice){var c=null===o.implicit?o.tag:o.implicit,f=null===o.implicit?"universal":"context";null===c?null===o.use&&t.error("Tag could be omitted only for .use()"):null===o.use&&(n=this._encodeComposite(c,d,f,i))}return null!==o.explicit&&(n=this._encodeComposite(o.explicit,!1,"context",n)),n},r.prototype._encodeChoice=function(e,t){var r=this._baseState,a=r.choice[e.type];return a||i(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),a._encode(e.value,t)},r.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},r.prototype._isNumstr=function(e){return /^[0-9 ]*$/.test(e)},r.prototype._isPrintstr=function(e){return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":60,"minimalistic-assert":209}],62:[function(e,t,r){function a(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}var n=e("inherits");r.Reporter=a,a.prototype.isError=function(e){return e instanceof o},a.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},a.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},a.prototype.enterKey=function(e){return this._reporterState.path.push(e)},a.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},a.prototype.leaveKey=function(e,t,r){var a=this._reporterState;this.exitKey(e),null!==a.obj&&(a.obj[t]=r)},a.prototype.path=function(){return this._reporterState.path.join("/")},a.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},a.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},a.prototype.error=function(e){var t=this._reporterState,r=e instanceof o,a;if(a=r?e:new o(t.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!t.options.partial)throw a;return r||t.errors.push(a),a},a.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e};n(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{inherits:201}],63:[function(e,t,r){var a=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=a._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=a._reverse(r.tag)},{"../constants":64}],64:[function(e,t,r){var a=r;a._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var a=e[r];t[a]=r}),t},a.der=e("./der")},{"./der":63}],65:[function(e,t){function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new o,this.tree._init(e.body)}function o(e){c.Node.call(this,"der",e)}function n(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var a=p.tagClass[r>>6],o=0==(32&r);if(31==(31&r)){var n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;var i=p.tag[r];return{cls:a,primitive:o,tag:r,tagStr:i}}function i(e,t,r){var a=e.readUInt8(r);if(e.isError(a))return a;if(!t&&128===a)return null;if(0==(128&a))return a;var o=127&a;if(4a?2e3+a:1900+a}else return e.error("Decoding "+t+" time is not supported yet");return Date.UTC(a,o-1,n,i,d,s,0)},o.prototype._decodeNull=function(){return null},o.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},o.prototype._decodeInt=function(e,t){var r=e.raw(),a=new f(r);return t&&(a=t[a.toString(10)]||a),a},o.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":57,inherits:201}],66:[function(e,t,r){var a=r;a.der=e("./der"),a.pem=e("./pem")},{"./der":65,"./pem":67}],67:[function(e,t){function r(e){n.call(this,e),this.enc="pem"}var a=e("inherits"),o=e("buffer").Buffer,n=e("./der");a(r,n),t.exports=r,r.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),a=t.label.toUpperCase(),d=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,f=0,i;fe?"0"+e:e}function n(e,t,r,a){var o;if("seqof"===e?e="seq":"setof"===e&&(e="set"),f.tagByName.hasOwnProperty(e))o=f.tagByName[e];else if("number"==typeof e&&(0|e)===e)o=e;else return a.error("Unknown tag: "+e);return 31<=o?a.error("Multi-octet tag encoding unsupported"):(t||(o|=32),o|=f.tagClassByName[r||"universal"]<<6,o)}var i=e("inherits"),d=e("buffer").Buffer,s=e("../../asn1"),c=s.base,f=s.constants.der;t.exports=r,r.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(a,c.Node),a.prototype._encodeComposite=function(e,t,r,a){var o=n(e,t,r,this.reporter);if(128>a.length){var s=new d(2);return s[0]=o,s[1]=a.length,this._createEncoderBuffer([s,a])}for(var c=1,f=a.length;256<=f;f>>=8)c++;var s=new d(2+c);s[0]=o,s[1]=128|c;for(var f=1+c,i=a.length;0>=8)s[f]=255&i;return this._createEncoderBuffer([s,a])},a.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new d(2*e.length),a=0;a>=7)o++;for(var i=new d(o),s=i.length-1,a=e.length-1,n;0<=a;a--)for(n=e[a],i[s--]=127&n;0<(n>>=7);)i[s--]=128|127&n;return this._createEncoderBuffer(i)},a.prototype._encodeTime=function(e,t){var r=new Date(e),a;return"gentime"===t?a=[o(r.getFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?a=[o(r.getFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(a,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!d.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new d(r)}if(d.isBuffer(e)){var a=e.length;0===e.length&&a++;var o=new d(a);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var a=1,n=e;256<=n;n>>=8)a++;for(var o=Array(a),n=o.length-1;0<=n;n--)o[n]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new d(o))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},a.prototype._skipDefault=function(e,t,r){var a=this._baseState,o;if(null===a["default"])return!1;var n=e.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a["default"],t,r).join()),n.length!==a.defaultBuffer.length)return!1;for(o=0;o=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return o}function c(e,t,a,o){for(var n=0,r=u(e.length,a),d=t,i;d>>o}return t}function b(e,t,o){o.negative=t.negative^e.negative;var n=0|e.length+t.length;o.length=n,n=0|n-1;var d=0|e.words[0],a=0|t.words[0],s=d*a,r=67108863&s,c=0|s/67108864;o.words[0]=r;for(var p=1;p>>26,b=67108863&c,h=u(p,t.length-1),g=f(0,p-e.length+1),m;g<=h;g++)m=0|p-g,d=0|e.words[m],a=0|t.words[g],s=d*a+b,l+=0|s/67108864,b=67108863&s;o.words[p]=0|b,c=0|l}return 0==c?o.length--:o.words[p]=0|c,o.strip()}function h(e,t,o){o.negative=t.negative^e.negative,o.length=e.length+t.length;for(var n=0,d=0,s=0,c;s>>26),d+=c>>>26,c&=67108863}o.words[s]=p,n=c,c=d}return 0==n?o.length--:o.words[s]=n,o.strip()}function g(e,t,r){var a=new m;return a.mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}function y(e,t){this.name=e,this.p=new d(t,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=d._prime(e);this.m=t.p,this.prime=t}else o(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){I.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new d(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)}var w=Math.imul;"object"==typeof r?r.exports=d:a.BN=d,d.BN=d,d.wordSize=26;var A;try{A=t("buffer").Buffer}catch(t){}d.isBN=function(e){return!!(e instanceof d)||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,t){return 0e.cmp(t)?e:t},d.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),o(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,"");var a=0;"-"===e[0]&&a++,16===t?this._parseHex(e,a):this._parseBase(e,t,a),"-"===e[0]&&(this.negative=1),this.strip();"le"!==r||this._initArray(this.toArray(),t,r)},d.prototype._initNumber=function(e,t,r){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(o(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3);"le"!==r||this._initArray(this.toArray(),t,r)},d.prototype._initArray=function(e,t,r){if(o("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=p(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);return this.strip()},d.prototype._parseHex=function(e,t){this.length=p((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)n=s(e,r,r+6),this.words[o]|=67108863&n<>>26-a,a+=24,26<=a&&(a-=26,o++);r+6!==t&&(n=s(e,t,r+6),this.words[o]|=67108863&n<>>26-a),this.strip()},d.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var a=0,o=1;67108863>=o;o*=t)a++;a--,o=0|o/t;for(var n=e.length-r,d=n%a,s=u(n,n-d)+r,f=0,p=r;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f);if(0!=d){var i=1;for(f=c(e,p,e.length,t),p=0;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f)}},d.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t"};var E=["","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"],P=[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],B=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,10000000,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];d.prototype.toString=function(e,t){e=e||10,t=0|t||1;var a;if(16===e||"hex"===e){a="";for(var n=0,d=0,s=0;s>>24-n,a=0!=d||s!==this.length-1?E[6-f.length]+f+a:f+a,n+=2,26<=n&&(n-=26,s--)}for(0!=d&&(a=d.toString(16)+a);0!=a.length%t;)a="0"+a;return 0!==this.negative&&(a="-"+a),a}if(e===(0|e)&&2<=e&&36>=e){var p=P[e],u=B[e];a="";var l=this.clone();for(l.negative=0;!l.isZero();){var c=l.modn(u).toString(e);l=l.idivn(u),a=l.isZero()?c+a:E[p-c.length]+c+a}for(this.isZero()&&(a="0"+a);0!=a.length%t;)a="0"+a;return 0!==this.negative&&(a="-"+a),a}o(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=a&&(t+=7,a>>>=7),8<=a&&(t+=4,a>>>=4),2<=a&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 0==(8191&a)&&(t+=13,a>>>=13),0==(127&a)&&(t+=7,a>>>=7),0==(15&a)&&(t+=4,a>>>=4),0==(3&a)&&(t+=2,a>>>=2),0==(1&a)&&t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){o("number"==typeof e&&0<=e);var t=0|p(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,t){o("number"==typeof e&&0<=e);var r=0|e/26,a=e%26;return this._expand(r+1),t?this.words[r]|=1<e.length?(r=this,a=e):(r=e,a=this);for(var o=0,n=0;n>>26;for(;0!=o&&n>>26;if(this.length=r.length,0!=o)this.words[this.length]=o,this.length++;else if(r!==this)for(;ne.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var o,a;0>26,this.words[d]=67108863&t;for(;0!=n&&d>26,this.words[d]=67108863&t;if(0==n&&d>>13,f=0|n[1],p=8191&f,u=f>>>13,l=0|n[2],b=8191&l,h=l>>>13,g=0|n[3],m=8191&g,y=g>>>13,_=0|n[4],v=8191&_,S=_>>>13,k=0|n[5],I=8191&k,x=k>>>13,A=0|n[6],E=8191&A,P=A>>>13,B=0|n[7],O=8191&B,R=B>>>13,j=0|n[8],T=8191&j,N=j>>>13,C=0|n[9],z=8191&C,M=C>>>13,U=0|a[0],L=8191&U,D=U>>>13,q=0|a[1],H=8191&q,F=q>>>13,K=0|a[2],V=8191&K,G=K>>>13,W=0|a[3],Y=8191&W,X=W>>>13,Z=0|a[4],J=8191&Z,Q=Z>>>13,$=0|a[5],ee=8191&$,te=$>>>13,re=0|a[6],ae=8191&re,oe=re>>>13,ne=0|a[7],ie=8191&ne,de=ne>>>13,se=0|a[8],ce=8191&se,fe=se>>>13,pe=0|a[9],ue=8191&pe,le=pe>>>13,be,he,ge;r.negative=e.negative^t.negative,r.length=19,be=w(s,L),he=w(s,D),he=0|he+w(c,L),ge=w(c,D);var me=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(me>>>26),me&=67108863,be=w(p,L),he=w(p,D),he=0|he+w(u,L),ge=w(u,D),be=0|be+w(s,H),he=0|he+w(s,F),he=0|he+w(c,H),ge=0|ge+w(c,F);var ye=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ye>>>26),ye&=67108863,be=w(b,L),he=w(b,D),he=0|he+w(h,L),ge=w(h,D),be=0|be+w(p,H),he=0|he+w(p,F),he=0|he+w(u,H),ge=0|ge+w(u,F),be=0|be+w(s,V),he=0|he+w(s,G),he=0|he+w(c,V),ge=0|ge+w(c,G);var _e=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(_e>>>26),_e&=67108863,be=w(m,L),he=w(m,D),he=0|he+w(y,L),ge=w(y,D),be=0|be+w(b,H),he=0|he+w(b,F),he=0|he+w(h,H),ge=0|ge+w(h,F),be=0|be+w(p,V),he=0|he+w(p,G),he=0|he+w(u,V),ge=0|ge+w(u,G),be=0|be+w(s,Y),he=0|he+w(s,X),he=0|he+w(c,Y),ge=0|ge+w(c,X);var ve=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ve>>>26),ve&=67108863,be=w(v,L),he=w(v,D),he=0|he+w(S,L),ge=w(S,D),be=0|be+w(m,H),he=0|he+w(m,F),he=0|he+w(y,H),ge=0|ge+w(y,F),be=0|be+w(b,V),he=0|he+w(b,G),he=0|he+w(h,V),ge=0|ge+w(h,G),be=0|be+w(p,Y),he=0|he+w(p,X),he=0|he+w(u,Y),ge=0|ge+w(u,X),be=0|be+w(s,J),he=0|he+w(s,Q),he=0|he+w(c,J),ge=0|ge+w(c,Q);var Se=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Se>>>26),Se&=67108863,be=w(I,L),he=w(I,D),he=0|he+w(x,L),ge=w(x,D),be=0|be+w(v,H),he=0|he+w(v,F),he=0|he+w(S,H),ge=0|ge+w(S,F),be=0|be+w(m,V),he=0|he+w(m,G),he=0|he+w(y,V),ge=0|ge+w(y,G),be=0|be+w(b,Y),he=0|he+w(b,X),he=0|he+w(h,Y),ge=0|ge+w(h,X),be=0|be+w(p,J),he=0|he+w(p,Q),he=0|he+w(u,J),ge=0|ge+w(u,Q),be=0|be+w(s,ee),he=0|he+w(s,te),he=0|he+w(c,ee),ge=0|ge+w(c,te);var ke=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ke>>>26),ke&=67108863,be=w(E,L),he=w(E,D),he=0|he+w(P,L),ge=w(P,D),be=0|be+w(I,H),he=0|he+w(I,F),he=0|he+w(x,H),ge=0|ge+w(x,F),be=0|be+w(v,V),he=0|he+w(v,G),he=0|he+w(S,V),ge=0|ge+w(S,G),be=0|be+w(m,Y),he=0|he+w(m,X),he=0|he+w(y,Y),ge=0|ge+w(y,X),be=0|be+w(b,J),he=0|he+w(b,Q),he=0|he+w(h,J),ge=0|ge+w(h,Q),be=0|be+w(p,ee),he=0|he+w(p,te),he=0|he+w(u,ee),ge=0|ge+w(u,te),be=0|be+w(s,ae),he=0|he+w(s,oe),he=0|he+w(c,ae),ge=0|ge+w(c,oe);var Ie=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ie>>>26),Ie&=67108863,be=w(O,L),he=w(O,D),he=0|he+w(R,L),ge=w(R,D),be=0|be+w(E,H),he=0|he+w(E,F),he=0|he+w(P,H),ge=0|ge+w(P,F),be=0|be+w(I,V),he=0|he+w(I,G),he=0|he+w(x,V),ge=0|ge+w(x,G),be=0|be+w(v,Y),he=0|he+w(v,X),he=0|he+w(S,Y),ge=0|ge+w(S,X),be=0|be+w(m,J),he=0|he+w(m,Q),he=0|he+w(y,J),ge=0|ge+w(y,Q),be=0|be+w(b,ee),he=0|he+w(b,te),he=0|he+w(h,ee),ge=0|ge+w(h,te),be=0|be+w(p,ae),he=0|he+w(p,oe),he=0|he+w(u,ae),ge=0|ge+w(u,oe),be=0|be+w(s,ie),he=0|he+w(s,de),he=0|he+w(c,ie),ge=0|ge+w(c,de);var xe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(xe>>>26),xe&=67108863,be=w(T,L),he=w(T,D),he=0|he+w(N,L),ge=w(N,D),be=0|be+w(O,H),he=0|he+w(O,F),he=0|he+w(R,H),ge=0|ge+w(R,F),be=0|be+w(E,V),he=0|he+w(E,G),he=0|he+w(P,V),ge=0|ge+w(P,G),be=0|be+w(I,Y),he=0|he+w(I,X),he=0|he+w(x,Y),ge=0|ge+w(x,X),be=0|be+w(v,J),he=0|he+w(v,Q),he=0|he+w(S,J),ge=0|ge+w(S,Q),be=0|be+w(m,ee),he=0|he+w(m,te),he=0|he+w(y,ee),ge=0|ge+w(y,te),be=0|be+w(b,ae),he=0|he+w(b,oe),he=0|he+w(h,ae),ge=0|ge+w(h,oe),be=0|be+w(p,ie),he=0|he+w(p,de),he=0|he+w(u,ie),ge=0|ge+w(u,de),be=0|be+w(s,ce),he=0|he+w(s,fe),he=0|he+w(c,ce),ge=0|ge+w(c,fe);var we=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(we>>>26),we&=67108863,be=w(z,L),he=w(z,D),he=0|he+w(M,L),ge=w(M,D),be=0|be+w(T,H),he=0|he+w(T,F),he=0|he+w(N,H),ge=0|ge+w(N,F),be=0|be+w(O,V),he=0|he+w(O,G),he=0|he+w(R,V),ge=0|ge+w(R,G),be=0|be+w(E,Y),he=0|he+w(E,X),he=0|he+w(P,Y),ge=0|ge+w(P,X),be=0|be+w(I,J),he=0|he+w(I,Q),he=0|he+w(x,J),ge=0|ge+w(x,Q),be=0|be+w(v,ee),he=0|he+w(v,te),he=0|he+w(S,ee),ge=0|ge+w(S,te),be=0|be+w(m,ae),he=0|he+w(m,oe),he=0|he+w(y,ae),ge=0|ge+w(y,oe),be=0|be+w(b,ie),he=0|he+w(b,de),he=0|he+w(h,ie),ge=0|ge+w(h,de),be=0|be+w(p,ce),he=0|he+w(p,fe),he=0|he+w(u,ce),ge=0|ge+w(u,fe),be=0|be+w(s,ue),he=0|he+w(s,le),he=0|he+w(c,ue),ge=0|ge+w(c,le);var Ae=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ae>>>26),Ae&=67108863,be=w(z,H),he=w(z,F),he=0|he+w(M,H),ge=w(M,F),be=0|be+w(T,V),he=0|he+w(T,G),he=0|he+w(N,V),ge=0|ge+w(N,G),be=0|be+w(O,Y),he=0|he+w(O,X),he=0|he+w(R,Y),ge=0|ge+w(R,X),be=0|be+w(E,J),he=0|he+w(E,Q),he=0|he+w(P,J),ge=0|ge+w(P,Q),be=0|be+w(I,ee),he=0|he+w(I,te),he=0|he+w(x,ee),ge=0|ge+w(x,te),be=0|be+w(v,ae),he=0|he+w(v,oe),he=0|he+w(S,ae),ge=0|ge+w(S,oe),be=0|be+w(m,ie),he=0|he+w(m,de),he=0|he+w(y,ie),ge=0|ge+w(y,de),be=0|be+w(b,ce),he=0|he+w(b,fe),he=0|he+w(h,ce),ge=0|ge+w(h,fe),be=0|be+w(p,ue),he=0|he+w(p,le),he=0|he+w(u,ue),ge=0|ge+w(u,le);var Ee=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ee>>>26),Ee&=67108863,be=w(z,V),he=w(z,G),he=0|he+w(M,V),ge=w(M,G),be=0|be+w(T,Y),he=0|he+w(T,X),he=0|he+w(N,Y),ge=0|ge+w(N,X),be=0|be+w(O,J),he=0|he+w(O,Q),he=0|he+w(R,J),ge=0|ge+w(R,Q),be=0|be+w(E,ee),he=0|he+w(E,te),he=0|he+w(P,ee),ge=0|ge+w(P,te),be=0|be+w(I,ae),he=0|he+w(I,oe),he=0|he+w(x,ae),ge=0|ge+w(x,oe),be=0|be+w(v,ie),he=0|he+w(v,de),he=0|he+w(S,ie),ge=0|ge+w(S,de),be=0|be+w(m,ce),he=0|he+w(m,fe),he=0|he+w(y,ce),ge=0|ge+w(y,fe),be=0|be+w(b,ue),he=0|he+w(b,le),he=0|he+w(h,ue),ge=0|ge+w(h,le);var Pe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Pe>>>26),Pe&=67108863,be=w(z,Y),he=w(z,X),he=0|he+w(M,Y),ge=w(M,X),be=0|be+w(T,J),he=0|he+w(T,Q),he=0|he+w(N,J),ge=0|ge+w(N,Q),be=0|be+w(O,ee),he=0|he+w(O,te),he=0|he+w(R,ee),ge=0|ge+w(R,te),be=0|be+w(E,ae),he=0|he+w(E,oe),he=0|he+w(P,ae),ge=0|ge+w(P,oe),be=0|be+w(I,ie),he=0|he+w(I,de),he=0|he+w(x,ie),ge=0|ge+w(x,de),be=0|be+w(v,ce),he=0|he+w(v,fe),he=0|he+w(S,ce),ge=0|ge+w(S,fe),be=0|be+w(m,ue),he=0|he+w(m,le),he=0|he+w(y,ue),ge=0|ge+w(y,le);var Be=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Be>>>26),Be&=67108863,be=w(z,J),he=w(z,Q),he=0|he+w(M,J),ge=w(M,Q),be=0|be+w(T,ee),he=0|he+w(T,te),he=0|he+w(N,ee),ge=0|ge+w(N,te),be=0|be+w(O,ae),he=0|he+w(O,oe),he=0|he+w(R,ae),ge=0|ge+w(R,oe),be=0|be+w(E,ie),he=0|he+w(E,de),he=0|he+w(P,ie),ge=0|ge+w(P,de),be=0|be+w(I,ce),he=0|he+w(I,fe),he=0|he+w(x,ce),ge=0|ge+w(x,fe),be=0|be+w(v,ue),he=0|he+w(v,le),he=0|he+w(S,ue),ge=0|ge+w(S,le);var Oe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Oe>>>26),Oe&=67108863,be=w(z,ee),he=w(z,te),he=0|he+w(M,ee),ge=w(M,te),be=0|be+w(T,ae),he=0|he+w(T,oe),he=0|he+w(N,ae),ge=0|ge+w(N,oe),be=0|be+w(O,ie),he=0|he+w(O,de),he=0|he+w(R,ie),ge=0|ge+w(R,de),be=0|be+w(E,ce),he=0|he+w(E,fe),he=0|he+w(P,ce),ge=0|ge+w(P,fe),be=0|be+w(I,ue),he=0|he+w(I,le),he=0|he+w(x,ue),ge=0|ge+w(x,le);var Re=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Re>>>26),Re&=67108863,be=w(z,ae),he=w(z,oe),he=0|he+w(M,ae),ge=w(M,oe),be=0|be+w(T,ie),he=0|he+w(T,de),he=0|he+w(N,ie),ge=0|ge+w(N,de),be=0|be+w(O,ce),he=0|he+w(O,fe),he=0|he+w(R,ce),ge=0|ge+w(R,fe),be=0|be+w(E,ue),he=0|he+w(E,le),he=0|he+w(P,ue),ge=0|ge+w(P,le);var je=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(je>>>26),je&=67108863,be=w(z,ie),he=w(z,de),he=0|he+w(M,ie),ge=w(M,de),be=0|be+w(T,ce),he=0|he+w(T,fe),he=0|he+w(N,ce),ge=0|ge+w(N,fe),be=0|be+w(O,ue),he=0|he+w(O,le),he=0|he+w(R,ue),ge=0|ge+w(R,le);var Te=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Te>>>26),Te&=67108863,be=w(z,ce),he=w(z,fe),he=0|he+w(M,ce),ge=w(M,fe),be=0|be+w(T,ue),he=0|he+w(T,le),he=0|he+w(N,ue),ge=0|ge+w(N,le);var Ne=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ne>>>26),Ne&=67108863,be=w(z,ue),he=w(z,le),he=0|he+w(M,ue),ge=w(M,le);var Ce=0|(0|o+be)+((8191&he)<<13);return o=0|(0|ge+(he>>>13))+(Ce>>>26),Ce&=67108863,i[0]=me,i[1]=ye,i[2]=_e,i[3]=ve,i[4]=Se,i[5]=ke,i[6]=Ie,i[7]=xe,i[8]=we,i[9]=Ae,i[10]=Ee,i[11]=Pe,i[12]=Be,i[13]=Oe,i[14]=Re,i[15]=je,i[16]=Te,i[17]=Ne,i[18]=Ce,0!=o&&(i[19]=o,r.length++),r};w||(O=b),d.prototype.mulTo=function(e,t){var r=this.length+e.length,a;return a=10===this.length&&10===e.length?O(this,e,t):63>r?b(this,e,t):1024>r?h(this,e,t):g(this,e,t),a},m.prototype.makeRBT=function(e){for(var r=Array(e),t=d.prototype._countBits(e)-1,a=0;a>=1;return a},m.prototype.permute=function(e,t,r,a,o,n){for(var d=0;d>>=1)o++;return 1<=a))for(var o=0,n;oo?0:0|o/67108864;return e},m.prototype.convert13b=function(e,t,r,a){for(var n=0,d=0;d>>=13,r[2*d+1]=8191&n,n>>>=13;for(d=2*t;de);for(var t=0,r=0;r>=26,t+=0|a/67108864,t+=n>>>26,this.words[r]=67108863&n}return 0!=t&&(this.words[r]=t,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var t=l(e);if(0===t.length)return new d(1);for(var r=this,a=0;a>>26-t<<26-t,d=(0|this.words[a])-i<>>26-t}n&&(this.words[a]=n,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;ar)for(this.length-=r,c=0;c=n);c--){var p=0|this.words[c];this.words[c]=i<<26-d|p>>>d,i=p&(67108863^67108863>>>d<>>t<e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},d.prototype.addn=function(e){return this.clone().iaddn(e)},d.prototype.subn=function(e){return this.clone().isubn(e)},d.prototype.iabs=function(){return this.negative=0,this},d.prototype.abs=function(){return this.clone().iabs()},d.prototype._ishlnsubmul=function(e,t,r){var a=e.length+r,n;this._expand(a);var i=0,d;for(n=0;n>26)-(0|s/67108864),this.words[n+r]=67108863&d}for(;n>26,this.words[n+r]=67108863&d;if(0==i)return this.strip();for(o(-1==i),i=0,n=0;n>26,this.words[n]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,t){var r=this.length-e.length,o=this.clone(),n=e,s=0|n.words[n.length-1],c=this._countBits(s);r=26-c,0!=r&&(n=n.ushln(r),o.iushln(r),s=0|n.words[n.length-1]);var f=o.length-n.length,p;if("mod"!==t){p=new d(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new d(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,t):(i=this.neg().divmod(e.neg(),t),"div"!==t&&(n=i.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:i.div,mod:n})},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0===t.div.negative?t.mod:t.mod.isub(e),a=e.ushrn(1),o=e.andln(1),n=r.cmp(a);return 0>n||1===o&&0===n?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},d.prototype.modn=function(e){o(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+(0|this.words[r]))%e;return t},d.prototype.idivn=function(e){o(67108863>=e);for(var t=0,r=this.length-1,a;0<=r;r--)a=(0|this.words[r])+67108864*t,this.words[r]=0|a/e,t=a%e;return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){o(0===e.negative),o(!e.isZero());var t=this,r=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var a=new d(1),n=new d(0),s=new d(0),c=new d(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var p=r.clone(),u=t.clone();!t.isZero();){for(var l=0,i=1;0==(t.words[0]&i)&&26>l;++l,i<<=1);if(0b;++b,h<<=1);if(0c;++c,i<<=1);if(0f;++f,p<<=1);if(0u.cmpn(0)&&u.iadd(e),u},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var o=this.clone(),a=e.clone();o.negative=0,a.negative=0;for(var n=0;o.isEven()&&a.isEven();n++)o.iushrn(1),a.iushrn(1);do{for(;o.isEven();)o.iushrn(1);for(;a.isEven();)a.iushrn(1);var i=o.cmp(a);if(0>i){var r=o;o=a,a=r}else if(0===i||0===a.cmpn(1))break;o.isub(a)}while(!0);return a.iushln(n)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return 0==(1&this.words[0])},d.prototype.isOdd=function(){return 1==(1&this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){o("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,i&=67108863,this.words[d]=i;return 0!=n&&(this.words[d]=n,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var t=0>e;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(1=e,"Number is too big");var a=0|this.words[0];r=a===e?0:ae.length)return 1;if(this.lengtha&&(t=1);break}}return t},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return 0<=this.cmpn(e)},d.prototype.gte=function(e){return 0<=this.cmp(e)},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return 0>=this.cmpn(e)},d.prototype.lte=function(e){return 0>=this.cmp(e)},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new I(e)},d.prototype.toRed=function(e){return o(!this.red,"Already a number in reduction context"),o(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return o(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return o(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return o(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return o(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return o(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return o(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return o(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return o(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return o(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return o(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return o(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return o(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return o(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var R={k256:null,p224:null,p192:null,p25519:null};y.prototype._tmp=function(){var e=new d(null);return e.words=Array(p(this.n/13)),e},y.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var a=r=e.length)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=n&r,o=10;o>>22,n=i}n>>>=22,e.words[o-10]=n,e.length-=0===n&&10>>=26,e.words[r]=o,t=a}return 0!=t&&(e.words[e.length++]=t),e},d._prime=function(e){if(R[e])return R[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new v;else if("p192"===e)t=new S;else if("p25519"===e)t=new k;else throw new Error("Unknown prime "+e);return R[e]=t,t},I.prototype._verify1=function(e){o(0===e.negative,"red works only with positives"),o(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){o(0==(e.negative|t.negative),"red works only with positives"),o(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(o(1==a%2),3===a){var n=this.m.add(new d(1)).iushrn(2);return this.pow(e,n)}for(var f=this.m.subn(1),p=0;!f.isZero()&&0===f.andln(1);)p++,f.iushrn(1);o(!f.isZero());var s=new d(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new d(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var g=this.pow(h,f),c=this.pow(e,f.addn(1).iushrn(1)),r=this.pow(e,f),t=p;0!==r.cmp(s);){for(var m=r,y=0;0!==m.cmp(s);y++)m=m.redSqr();o(y>p,n!==a[0]&&(n=this.sqr(n)),0==u&&0==i){s=0;continue}i<<=1,i|=u,s++,s!=r&&(0!==o||0!==p)||(n=this.mul(n,a[i]),s=0,i=0)}c=26}return n},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},d.mont=function(e){return new x(e)},i(x,I),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var a=e.imul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).iushrn(this.shift),n=o;return 0<=o.cmp(this.m)?n=o.isub(this.m):0>o.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},x.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new d(0)._forceRed(this);var a=e.mul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).iushrn(this.shift),n=o;return 0<=o.cmp(this.m)?n=o.isub(this.m):0>o.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},x.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})("undefined"==typeof r||r,this)},{buffer:77}],72:[function(e,t){(function(r){"use strict";function a(e,t){if(e===t)return 0;for(var r=e.length,a=t.length,o=0,n=u(r,a);o>18]+d[63&e>>12]+d[63&e>>6]+d[63&e]}function n(e,t,r){for(var a=[],n=t,i;n>16,d[f++]=255&n>>8,d[f++]=255&n;return 2===i?(n=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,d[f++]=255&n):1===i&&(n=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,d[f++]=255&n>>8,d[f++]=255&n),d},r.fromByteArray=function(e){for(var t=e.length,r=t%3,a="",o=[],s=16383,c=0,i=t-r,f;ci?i:c+s));return 1==r?(f=e[t-1],a+=d[f>>2],a+=d[63&f<<4],a+="=="):2==r&&(f=(e[t-2]<<8)+e[t-1],a+=d[f>>10],a+=d[63&f>>4],a+=d[63&f<<2],a+="="),o.push(a),o.join("")};for(var d=[],s=[],c="undefined"==typeof Uint8Array?Array:Uint8Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,i=f.length;pe,this.isSmall=!0}function g(e){return-Je?[e]:1e14>e?[e%1e7,h(e/1e7)]:[e%1e7,h(e/1e7)%1e7,h(e/1e14)]}function m(e){_(e);var t=e.length;return 4>t&&0>C(e,Q)?0===t?0:1===t?e[0]:2===t?e[0]+e[1]*X:e[0]+(e[1]+e[2]*X)*X:e}function _(e){for(var t=e.length;0===e[--t];);e.length=t+1}function n(e){for(var t=Array(e),r=-1;++r=d?1:0,n[c]=s-r*d;for(;c=t.length?y(e,t):y(t,e)}function I(e,t){var a=e.length,o=Array(a),r=X,n,d;for(d=0;di?(i+=d,r=1):r=0,n[s]=i;for(s=o;si)i+=d;else{n[s++]=i;break}n[s]=i}for(;si?i+f:i;return s=m(s),"number"==typeof s?(o&&(s=-s),new d(s)):new t(s,o)}function A(e,t){var a=e.length,o=t.length,d=n(a+o),r=X,s,c,f,i,p;for(f=0;f=r)return A(e,t);r=p(r/2);var o=e.slice(r),n=e.slice(0,r),a=t.slice(r),i=t.slice(0,r),d=B(n,i),s=B(o,a),c=B(k(n,o),k(i,a)),u=k(k(d,P(v(v(c,d),s),r)),P(s,2*r));return _(u),u}function O(e,t){return 0<-0.012*e-0.012*t+1.5e-5*e*t}function b(e,r,a){return e_?(f[g+v]=_+o,_=-1):(f[g+v]=_,_=0);for(;0!==_;){for(b-=1,y=0,v=0;vy?(f[g+v]=y+o,y=0):(f[g+v]=y,y=1);_+=y}d[g]=b}return f=T(f,c)[0],[m(d),m(f)]}function j(e,t){for(var r=e.length,a=t.length,o=[],n=[],i=X,d,s,c,f,u;r;){if(n.unshift(e[--r]),_(n),0>C(n,t)){o.push(0);continue}s=n.length,c=n[s-1]*i+n[s-2],f=t[a-1]*i+t[a-2],s>a&&(c=(c+1)*i),d=p(c/f);do{if(u=E(t,d),0>=C(u,n))break;d--}while(d);o.push(d),n=v(n,u)}return o.reverse(),[m(o),m(n)]}function T(e,t){var r=e.length,a=n(r),o,i,d,s;for(d=0,o=r-1;0<=o;--o)s=d*X+e[o],i=S(s/t),d=s-i*t,a[o]=0|i;return[a,0|d]}function N(r,o){var i=Y(o),n=r.value,a=i.value,c,f;if(0===a)throw new Error("Cannot divide by zero");if(r.isSmall)return i.isSmall?[new d(S(n/a)),new d(n%a)]:[e[0],r];if(i.isSmall){if(1===a)return[r,e[0]];if(-1==a)return[r.negate(),e[0]];var p=s(a);if(p=n.length+a.length?R(n,a):j(n,a),f=c[0];var h=r.sign!==i.sign,g=c[1],y=r.sign;return"number"==typeof f?(h&&(f=-f),f=new d(f)):f=new t(f,h),"number"==typeof g?(y&&(g=-g),g=new d(g)):g=new t(g,y),[f,g]}function C(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var r=e.length-1;0<=r;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function z(e){var t=e.abs();return!t.isUnit()&&(t.equals(2)||t.equals(3)||t.equals(5)||(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5)?!1:!!t.lesser(25)||void 0))}function M(e){return("number"==typeof e||"string"==typeof e)&&+s(e)<=X||e instanceof t&&1>=e.value.length}function U(e,t,r){t=Y(t);for(var a=e.isNegative(),o=t.isNegative(),n=a?e.not():e,d=o?t.not():t,s=0,f=0,p=null,u=null,l=[];!n.isZero()||!d.isZero();)p=N(n,te),s=p[1].toJSNumber(),a&&(s=te-1-s),u=N(d,te),f=u[1].toJSNumber(),o&&(f=te-1-f),n=p[0],d=u[0],l.push(r(s,f));for(var b=0===r(a?1:0,o?1:0)?c(0):c(-1),h=l.length-1;0<=h;h-=1)b=b.multiply(te).add(c(l[h]));return b}function L(e){var t=e.value,r="number"==typeof t?t|re:t[0]+t[1]*X|ae;return r&-r}function D(e,t){return e=Y(e),t=Y(t),e.greater(t)?e:t}function q(e,t){return e=Y(e),t=Y(t),e.lesser(t)?e:t}function H(r,a){if(r=Y(r).abs(),a=Y(a).abs(),r.equals(a))return r;if(r.isZero())return a;if(a.isZero())return r;for(var o=e[1],n,i;r.isEven()&&a.isEven();)n=u(L(r),L(a)),r=r.divide(n),a=a.divide(n),o=o.multiply(n);for(;r.isEven();)r=r.divide(L(r));do{for(;a.isEven();)a=a.divide(L(a));r.greater(a)&&(i=a,a=r,r=i),a=a.subtract(r)}while(!a.isZero());return o.isUnit()?r:r.multiply(o)}function F(t,r,a){var o=e[0],n=e[1],d;for(d=t.length-1;0<=d;d--)o=o.add(t[d].times(n)),n=n.times(r);return a?o.negate():o}function K(e){var t=e.value;return"number"==typeof t&&(t=[t]),1===t.length&&35>=t[0]?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t[0]):"<"+t+">"}function V(e,t){if(t=c(t),t.isZero()){if(e.isZero())return"0";throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1))return e.isZero()?"0":e.isNegative()?Array(1-e).join("10"):"1"+Array(+e).join("01");var r="";if(e.isNegative()&&t.isPositive()&&(r="-",e=e.abs()),t.equals(1))return e.isZero()?"0":r+Array(+e+1).join(1);for(var a=[],o=e,i;o.isNegative()||0<=o.compareAbs(t);){i=o.divmod(t),o=i.quotient;var d=i.remainder;d.isNegative()&&(d=t.minus(d).abs(),o=o.next()),a.push(K(d))}return a.push(K(o)),r+a.reverse().join("")}function G(e){if(g(+e)){var a=+e;if(a===S(a))return new d(a);throw"Invalid integer: "+e}var o="-"===e[0];o&&(e=e.slice(1));var n=e.split(/e/i);if(2i)throw new Error("Cannot include negative exponent part for integers");s+=Array(i+1).join("0"),e=s}var f=/^([0-9][0-9]*)$/.test(e);if(!f)throw new Error("Invalid integer: "+e);for(var p=[],r=e.length,u=Z,l=r-u;0l&&(l=0),r-=u;return _(p),new t(p,o)}function W(e){if(g(e)){if(e!==S(e))throw new Error(e+" is not an integer.");return new d(e)}return G(e.toString())}function Y(e){return"number"==typeof e?W(e):"string"==typeof e?G(e):e}var X=1e7,Z=7,J=9007199254740992,Q=l(J);t.prototype=Object.create(e.prototype),d.prototype=Object.create(e.prototype),t.prototype.add=function(e){var r=Y(e);if(this.sign!==r.sign)return this.subtract(r.negate());var o=this.value,a=r.value;return r.isSmall?new t(I(o,s(a)),this.sign):new t(k(o,a),this.sign)},t.prototype.plus=t.prototype.add,d.prototype.add=function(e){var r=Y(e),o=this.value;if(0>o!==r.sign)return this.subtract(r.negate());var a=r.value;if(r.isSmall){if(g(o+a))return new d(o+a);a=l(s(a))}return new t(I(a,s(o)),0>o)},d.prototype.plus=d.prototype.add,t.prototype.subtract=function(e){var t=Y(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,a=t.value;return t.isSmall?w(r,s(a),this.sign):x(r,a,this.sign)},t.prototype.minus=t.prototype.subtract,d.prototype.subtract=function(e){var t=Y(e),r=this.value;if(0>r!==t.sign)return this.add(t.negate());var a=t.value;return t.isSmall?new d(r-a):w(a,s(r),0<=r)},d.prototype.minus=d.prototype.subtract,t.prototype.negate=function(){return new t(this.value,!this.sign)},d.prototype.negate=function(){var e=this.sign,t=new d(-this.value);return t.sign=!e,t},t.prototype.abs=function(){return new t(this.value,!1)},d.prototype.abs=function(){return new d(s(this.value))},t.prototype.multiply=function(r){var o=Y(r),n=this.value,a=o.value,i=this.sign!==o.sign,d;if(o.isSmall){if(0===a)return e[0];if(1===a)return this;if(-1===a)return this.negate();if(d=s(a),da?1:-1):-1},t.prototype.compare=function(e){if(e===Infinity)return-1;if(e===-Infinity)return 1;var t=Y(e),r=this.value,a=t.value;return this.sign===t.sign?t.isSmall?this.sign?-1:1:C(r,a)*(this.sign?-1:1):t.sign?1:-1},t.prototype.compareTo=t.prototype.compare,d.prototype.compare=function(e){if(e===Infinity)return-1;if(e===-Infinity)return 1;var t=Y(e),r=this.value,a=t.value;return t.isSmall?r==a?0:r>a?1:-1:0>r===t.sign?0>r?1:-1:0>r?-1:1},d.prototype.compareTo=d.prototype.compare,t.prototype.equals=function(e){return 0===this.compare(e)},d.prototype.eq=d.prototype.equals=t.prototype.eq=t.prototype.equals,t.prototype.notEquals=function(e){return 0!==this.compare(e)},d.prototype.neq=d.prototype.notEquals=t.prototype.neq=t.prototype.notEquals,t.prototype.greater=function(e){return 0this.compare(e)},d.prototype.lt=d.prototype.lesser=t.prototype.lt=t.prototype.lesser,t.prototype.greaterOrEquals=function(e){return 0<=this.compare(e)},d.prototype.geq=d.prototype.greaterOrEquals=t.prototype.geq=t.prototype.greaterOrEquals,t.prototype.lesserOrEquals=function(e){return 0>=this.compare(e)},d.prototype.leq=d.prototype.lesserOrEquals=t.prototype.leq=t.prototype.lesserOrEquals,t.prototype.isEven=function(){return 0==(1&this.value[0])},d.prototype.isEven=function(){return 0==(1&this.value)},t.prototype.isOdd=function(){return 1==(1&this.value[0])},d.prototype.isOdd=function(){return 1==(1&this.value)},t.prototype.isPositive=function(){return!this.sign},d.prototype.isPositive=function(){return 0this.value},t.prototype.isUnit=function(){return!1},d.prototype.isUnit=function(){return 1===s(this.value)},t.prototype.isZero=function(){return!1},d.prototype.isZero=function(){return 0===this.value},t.prototype.isDivisibleBy=function(t){var r=Y(t),a=r.value;return 0!==a&&(1===a||(2===a?this.isEven():this.mod(r).equals(e[0])))},d.prototype.isDivisibleBy=t.prototype.isDivisibleBy,t.prototype.isPrime=function(){var r=z(this);if(void 0!==r)return r;for(var o=this.abs(),n=o.prev(),s=[2,3,5,7,11,13,17,19],a=n,f,d,t,i;a.isEven();)a=a.divide(2);for(t=0;t-J?new d(e-1):new t(Q,!0)};for(var $=[1];2*$[$.length-1]<=X;)$.push(2*$[$.length-1]);var ee=$.length,te=$[ee-1];t.prototype.shiftLeft=function(e){if(!M(e))throw new Error(e+" is too large for shifting.");if(e=+e,0>e)return this.shiftRight(-e);for(var t=this;e>=ee;)t=t.multiply(te),e-=ee-1;return t.multiply($[e])},d.prototype.shiftLeft=t.prototype.shiftLeft,t.prototype.shiftRight=function(e){var t;if(!M(e))throw new Error(e+" is too large for shifting.");if(e=+e,0>e)return this.shiftLeft(-e);for(var r=this;e>=ee;){if(r.isZero())return r;t=N(r,te),r=t[1].isNegative()?t[0].prev():t[0],e-=ee-1}return t=N(r,$[e]),t[1].isNegative()?t[0].prev():t[0]},d.prototype.shiftRight=t.prototype.shiftRight,t.prototype.not=function(){return this.negate().prev()},d.prototype.not=t.prototype.not,t.prototype.and=function(e){return U(this,e,function(e,t){return e&t})},d.prototype.and=t.prototype.and,t.prototype.or=function(e){return U(this,e,function(e,t){return e|t})},d.prototype.or=t.prototype.or,t.prototype.xor=function(e){return U(this,e,function(e,t){return e^t})},d.prototype.xor=t.prototype.xor;var re=1073741824,ae=(X&-X)*(X&-X)|re,oe=function(e,t){for(var a=e.length,o=s(t),n=0,n,i;n=o){if("1"===i&&1===o)continue;throw new Error(i+" is not a valid digit in base "+t+".")}else if(i.charCodeAt(0)-87>=o)throw new Error(i+" is not a valid digit in base "+t+".");if(2<=t&&36>=t&&a<=36.7368005696771/r(t)){var f=parseInt(e,t);if(isNaN(f))throw new Error(i+" is not a valid digit in base "+t+".");return new d(parseInt(e,t))}t=Y(t);var p=[],u="-"===e[0];for(n=u?1:0;n=l)p.push(Y(i));else if(97<=l&&122>=l)p.push(Y(i.charCodeAt(0)-87));else if("<"===i){var b=n;do n++;while(">"!==e[n]);p.push(Y(e.slice(b+1,n)))}else throw new Error(i+" is not a valid character")}return F(p,t,u)};t.prototype.toString=function(e){if(void 0===e&&(e=10),10!==e)return V(this,e);for(var t=this.value,r=t.length,a=t[--r]+"",o;0<=--r;)o=t[r]+"",a+="0000000".slice(o.length)+o;var n=this.sign?"-":"";return n+a},d.prototype.toString=function(e){return void 0===e&&(e=10),10==e?this.value+"":V(this,e)},t.prototype.toJSON=d.prototype.toJSON=function(){return this.toString()},t.prototype.valueOf=function(){return+this.toString()},t.prototype.toJSNumber=t.prototype.valueOf,d.prototype.valueOf=function(){return this.value},d.prototype.toJSNumber=d.prototype.valueOf;for(var ne=0;1e3>ne;ne++)e[ne]=new d(ne),0=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return o}function s(e,t,a,o){for(var n=0,r=u(e.length,a),d=t,i;de&&(this.sign=!0,e=-e),void(67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(o(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3));if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),o(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,"");var a=0;"-"===e[0]&&a++,16===t?this._parseHex(e,a):this._parseBase(e,t,a),"-"===e[0]&&(this.sign=!0),this.strip()},n.prototype._initArray=function(e,t,r){if(o("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=p(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);else if("le"===r)for(var a=0,i=0,d;a>>26-n,n+=24,26<=n&&(n-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t){this.length=p((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)n=d(e,r,r+6),this.words[o]|=67108863&n<>>26-a,a+=24,26<=a&&(a-=26,o++);if(r+6!==t){var n=d(e,t,r+6);this.words[o]|=67108863&n<>>26-a}this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var a=0,o=1;67108863>=o;o*=t)a++;a--,o=0|o/t;for(var n=e.length-r,d=n%a,c=u(n,n-d)+r,f=0,p=r;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f);if(0!=d){for(var i=1,f=s(e,p,e.length,t),p=0;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f)}},n.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t"};var y=["","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"],_=[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],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,10000000,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(e,t){if(e=e||10,16===e||"hex"===e){for(var a="",n=0,t=0|t||1,d=0,s=0;s>>24-n,a=0!=d||s!==this.length-1?y[6-f.length]+f+a:f+a,n+=2,26<=n&&(n-=26,s--)}for(0!=d&&(a=d.toString(16)+a);0!=a.length%t;)a="0"+a;return this.sign&&(a="-"+a),a}if(e===(0|e)&&2<=e&&36>=e){var p=_[e],u=v[e],a="",l=this.clone();for(l.sign=!1;0!==l.cmpn(0);){var c=l.modn(u).toString(e);l=l.idivn(u),a=0===l.cmpn(0)?c+a:y[p-c.length]+c+a}return 0===this.cmpn(0)&&(a="0"+a),this.sign&&(a="-"+a),a}o(!1,"Base should be between 2 and 36")},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toArray=function(){this.strip();var e=Array(this.byteLength());e[0]=0;for(var t=this.clone(),r=0,a;0!==t.cmpn(0);r++)a=t.andln(255),t.ishrn(8),e[e.length-r-1]=a;return e},n.prototype._countBits=e?function(t){return 32-e(t)}:function(e){var a=e,t=0;return 4096<=a&&(t+=13,a>>>=13),64<=a&&(t+=7,a>>>=7),8<=a&&(t+=4,a>>>=4),2<=a&&(t+=2,a>>>=2),t+a},n.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 0==(8191&a)&&(t+=13,a>>>=13),0==(127&a)&&(t+=7,a>>>=7),0==(15&a)&&(t+=4,a>>>=4),0==(3&a)&&(t+=2,a>>>=2),0==(1&a)&&t++,t},n.prototype.bitLength=function(){var e=0,t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.iand=function(e){this.sign=this.sign&&e.sign;var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.ixor=function(e){this.sign=this.sign||e.sign;var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.setn=function(e,t){o("number"==typeof e&&0<=e);for(var r=0|e/26,a=e%26;this.length<=r;)this.words[this.length++]=0;return t?this.words[r]|=1<e.length?(r=this,a=e):(r=e,a=this);for(var o=0,n=0,t;n>>26;for(;0!=o&&n>>26}if(this.length=r.length,0!=o)this.words[this.length]=o,this.length++;else if(r!==this)for(;ne.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(e.sign){e.sign=!1;var t=this.iadd(e);return e.sign=!0,t._normSign()}if(this.sign)return this.sign=!1,this.iadd(e),this.sign=!0,this._normSign();var r=this.cmp(e);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var o,a;0>26,this.words[d]=67108863&t;for(;0!=n&&d>26,this.words[d]=67108863&t}if(0==n&&d>>26,s=67108863&o,c=u(n,e.length-1),p=f(0,n-this.length+1);p<=c;p++){var l=n-p,i=0|this.words[l],a=0|e.words[p],b=i*a,r=67108863&b;d=0|d+(0|b/67108864),r=0|r+s,s=67108863&r,d=0|d+(r>>>26)}t.words[n]=s,o=d}return 0==o?t.length--:t.words[n]=o,t.strip()},n.prototype._bigMulTo=function(e,t){t.sign=e.sign!==this.sign,t.length=this.length+e.length;for(var o=0,n=0,d=0,s;d>>26),n+=s>>>26,s&=67108863}t.words[d]=c,o=s,s=n}return 0==o?t.length--:t.words[d]=o,t.strip()},n.prototype.mulTo=function(e,t){var r;return r=63>this.length+e.length?this._smallMulTo(e,t):this._bigMulTo(e,t),r},n.prototype.mul=function(e){var t=new n(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},n.prototype.imul=function(e){if(0===this.cmpn(0)||0===e.cmpn(0))return this.words[0]=0,this.length=1,this;var t=this.length,o=e.length;this.sign=e.sign!==this.sign,this.length+=e.length,this.words[this.length-1]=0;for(var n=this.length-2;0<=n;n--){for(var d=0,s=0,c=u(n,o-1),p=f(0,n-t+1);p<=c;p++){var l=n-p,i=this.words[l],a=e.words[p],b=i*a,r=67108863&b;d+=0|b/67108864,r+=s,s=67108863&r,d+=r>>>26}this.words[n]=s,this.words[n+1]+=d,d=0}for(var d=0,l=1,h;l>>26;return this.strip()},n.prototype.imuln=function(e){o("number"==typeof e);for(var t=0,r=0;r>=26,t+=0|a/67108864,t+=n>>>26,this.words[r]=67108863&n}return 0!=t&&(this.words[r]=t,this.length++),this},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.mul(this)},n.prototype.ishln=function(e){o("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26;if(0!=t){for(var a=0,n=0;n>>26-t<<26-t,d=this.words[n]-i<>>26-t}a&&(this.words[n]=a,this.length++)}if(0!=r){for(var n=this.length-1;0<=n;n--)this.words[n+r]=this.words[n];for(var n=0;nr){this.length-=r;for(var c=0;c=n);c--)p=this.words[c],this.words[c]=i<<26-d|p>>>d,i=p&(67108863^67108863>>>d<>>t<e?this.isubn(-e):this.sign?1===this.length&&this.words[0]e)return this.iaddn(-e);if(this.sign)return this.sign=!1,this.iaddn(e),this.sign=!0,this;this.words[0]-=e;for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.sign=!1,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,r,a){var n=e.length+a,d;if(this.words.length>26)-(0|c/67108864),this.words[d+a]=67108863&s}for(;d>26,this.words[d+a]=67108863&s}if(0==t)return this.strip();o(-1==t),t=0;for(var d=0,s;d>26,this.words[d]=67108863&s;return this.sign=!0,this.strip()},n.prototype._wordDiv=function(e,t){var r=this.length-e.length,o=this.clone(),d=e,s=d.words[d.length-1],c=this._countBits(s);r=26-c,0!=r&&(d=d.shln(r),o.ishln(r),s=d.words[d.length-1]);var f=o.length-d.length,p;if("mod"!==t){p=new n(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t)},n.prototype.div=function(e){return this.divmod(e,"div").div},n.prototype.mod=function(e){return this.divmod(e,"mod").mod},n.prototype.divRound=function(e){var t=this.divmod(e);if(0===t.mod.cmpn(0))return t.div;var r=t.div.sign?t.mod.isub(e):t.mod,a=e.shrn(1),o=e.andln(1),n=r.cmp(a);return 0>n||1===o&&0===n?t.div:t.div.sign?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){o(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+this.words[r])%e;return t},n.prototype.idivn=function(e){o(67108863>=e);for(var t=0,r=this.length-1,a;0<=r;r--)a=this.words[r]+67108864*t,this.words[r]=0|a/e,t=a%e;return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){o(!e.sign),o(0!==e.cmpn(0));var t=this,r=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),i=new n(0),d=new n(0),s=new n(1),c=0;t.isEven()&&r.isEven();)t.ishrn(1),r.ishrn(1),++c;for(var f=r.clone(),p=t.clone();0!==t.cmpn(0);){for(;t.isEven();)t.ishrn(1),a.isEven()&&i.isEven()?(a.ishrn(1),i.ishrn(1)):(a.iadd(f).ishrn(1),i.isub(p).ishrn(1));for(;r.isEven();)r.ishrn(1),d.isEven()&&s.isEven()?(d.ishrn(1),s.ishrn(1)):(d.iadd(f).ishrn(1),s.isub(p).ishrn(1));0<=t.cmp(r)?(t.isub(r),a.isub(d),i.isub(s)):(r.isub(t),d.isub(a),s.isub(i))}return{a:d,b:s,gcd:r.ishln(c)}},n.prototype._invmp=function(e){o(!e.sign),o(0!==e.cmpn(0));var t=this,r=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),i=new n(0),d=r.clone();0i){var r=o;o=a,a=r}else if(0===i||0===a.cmpn(1))break;o.isub(a)}while(!0);return a.ishln(n)},n.prototype.invm=function(e){return this.egcd(e).a.mod(e)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){o("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,d&=67108863,this.words[n]=d;return 0!=i&&(this.words[n]=i,this.length++),this},n.prototype.cmpn=function(e){var t=0>e;if(t&&(e=-e),this.sign&&!t)return-1;if(!this.sign&&t)return 1;e&=67108863,this.strip();var r;if(1e.length)return 1;if(this.lengtha&&(t=1);break}}return t},n.red=function(e){return new g(e)},n.prototype.toRed=function(e){return o(!this.red,"Already a number in reduction context"),o(!this.sign,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return o(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return o(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return o(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return o(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return o(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return o(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return o(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return o(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return o(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return o(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return o(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return o(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return o(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};i.prototype._tmp=function(){var e=new n(null);return e.words=Array(p(this.n/13)),e},i.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var a=r=e.length)return e.words[0]=0,void(e.length=1);var n=e.words[9];t.words[t.length++]=n&r;for(var o=10,i;o>>22,n=i;e.words[o-10]=n>>>22,e.length-=9},c.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0,a,o;r>>=26,e.words[r]=o,t=a}return 0!=t&&(e.words[e.length++]=t),e},n._prime=function(e){if(S[e])return S[e];var t;if("k256"===e)t=new c;else if("p224"===e)t=new l;else if("p192"===e)t=new b;else if("p25519"===e)t=new h;else throw new Error("Unknown prime "+e);return S[e]=t,t},g.prototype._verify1=function(e){o(!e.sign,"red works only with positives"),o(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){o(!e.sign&&!t.sign,"red works only with positives"),o(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.mod(this.m)._forceRed(this)},g.prototype.neg=function(e){var t=e.clone();return t.sign=!t.sign,t.iadd(this.m)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},g.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.shln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e)},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(0===e.cmpn(0))return e.clone();var a=this.m.andln(3);if(o(1==a%2),3===a){var d=this.m.add(new n(1)).ishrn(2),f=this.pow(e,d);return f}for(var r=this.m.subn(1),p=0;0!==r.cmpn(0)&&0===r.andln(1);)p++,r.ishrn(1);o(0!==r.cmpn(0));var s=new n(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new n(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var g=this.pow(h,r),f=this.pow(e,r.addn(1).ishrn(1)),c=this.pow(e,r),t=p;0!==c.cmp(s);){for(var m=c,y=0;0!==m.cmp(s);y++)m=m.redSqr();o(yo.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},m.prototype.mul=function(e,r){if(0===e.cmpn(0)||0===r.cmpn(0))return new n(0)._forceRed(this);var a=e.mul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).ishrn(this.shift),i=o;return 0<=o.cmp(this.m)?i=o.isub(this.m):0>o.cmpn(0)&&(i=o.iadd(this.m)),i._forceRed(this)},m.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})("undefined"==typeof r||r,this)},{}],76:[function(e,t){function a(e){this.rand=e}var o;if(t.exports=function(e){return o||(o=new a(null)),o.generate(e)},t.exports.Rand=a,a.prototype.generate=function(e){return this._rand(e)},a.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^i[255&f>>>16]^d[255&p>>>8]^s[255&u]^t[l++],g=n[f>>>24]^i[255&p>>>16]^d[255&u>>>8]^s[255&c]^t[l++],m=n[p>>>24]^i[255&u>>>16]^d[255&c>>>8]^s[255&f]^t[l++],y=n[u>>>24]^i[255&c>>>16]^d[255&f>>>8]^s[255&p]^t[l++],c=h,f=g,p=m,u=y;return h=(a[c>>>24]<<24|a[255&f>>>16]<<16|a[255&p>>>8]<<8|a[255&u])^t[l++],g=(a[f>>>24]<<24|a[255&p>>>16]<<16|a[255&u>>>8]<<8|a[255&c])^t[l++],m=(a[p>>>24]<<24|a[255&u>>>16]<<16|a[255&c>>>8]<<8|a[255&f])^t[l++],y=(a[u>>>24]<<24|a[255&c>>>16]<<16|a[255&f>>>8]<<8|a[255&p])^t[l++],h>>>=0,g>>>=0,m>>>=0,y>>>=0,[h,g,m,y]}function n(e){this._key=r(e),this._reset()}var d=e("safe-buffer").Buffer,i=[0,1,2,4,8,16,32,64,128,27,54],s=function(){for(var e=Array(256),r=0;256>r;r++)e[r]=128>r?r<<1:283^r<<1;for(var a=[],o=[],n=[[],[],[],[]],d=[[],[],[],[]],s=0,c=0,f=0,i;256>f;++f){i=c^c<<1^c<<2^c<<3^c<<4,i=99^(i>>>8^255&i),a[s]=i,o[i]=s;var p=e[s],u=e[p],l=e[u],b=257*e[i]^16843008*i;n[0][s]=b<<24|b>>>8,n[1][s]=b<<16|b>>>16,n[2][s]=b<<8|b>>>24,n[3][s]=b,b=16843009*l^65537*u^257*p^16843008*s,d[0][i]=b<<24|b>>>8,d[1][i]=b<<16|b>>>16,d[2][i]=b<<8|b>>>24,d[3][i]=b,0==s?s=c=1:(s=p^e[e[e[l^p]]],c^=e[e[c]])}return{SBOX:a,INV_SBOX:o,SUB_MIX:n,INV_SUB_MIX:d}}();n.blockSize=16,n.keySize=32,n.prototype.blockSize=n.blockSize,n.prototype.keySize=n.keySize,n.prototype._reset=function(){for(var e=this._key,r=e.length,a=r+6,o=4*(a+1),n=[],d=0;d>>24,c=s.SBOX[c>>>24]<<24|s.SBOX[255&c>>>16]<<16|s.SBOX[255&c>>>8]<<8|s.SBOX[255&c],c^=i[0|d/r]<<24):6>>24]<<24|s.SBOX[255&c>>>16]<<16|s.SBOX[255&c>>>8]<<8|s.SBOX[255&c]),n[d]=n[d-r]^c}for(var t=[],f=0;ff||4>=p?u:s.INV_SUB_MIX[0][s.SBOX[u>>>24]]^s.INV_SUB_MIX[1][s.SBOX[255&u>>>16]]^s.INV_SUB_MIX[2][s.SBOX[255&u>>>8]]^s.INV_SUB_MIX[3][s.SBOX[255&u]]}this._nRounds=a,this._keySchedule=n,this._invKeySchedule=t},n.prototype.encryptBlockRaw=function(e){return e=r(e),o(e,this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},n.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=d.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},n.prototype.decryptBlock=function(e){e=r(e);var t=e[1];e[1]=e[3],e[3]=t;var a=o(e,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),n=d.allocUnsafe(16);return n.writeUInt32BE(a[0],0),n.writeUInt32BE(a[3],4),n.writeUInt32BE(a[2],8),n.writeUInt32BE(a[1],12),n},n.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=n},{"safe-buffer":251}],79:[function(e,t){function r(e,t){var r=0;e.length!==t.length&&r++;for(var a=u(e.length,t.length),o=0;ot&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=f(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&r(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},o.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},o.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},t.exports=o},{"./aes":78,"./ghash":83,"./incr32":84,"buffer-xor":125,"cipher-base":131,inherits:201,"safe-buffer":251}],80:[function(e,t,r){var a=e("./encrypter"),o=e("./decrypter"),n=e("./modes/list.json");r.createCipher=r.Cipher=a.createCipher,r.createCipheriv=r.Cipheriv=a.createCipheriv,r.createDecipher=r.Decipher=o.createDecipher,r.createDecipheriv=r.Decipheriv=o.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(n)}},{"./decrypter":81,"./encrypter":82,"./modes/list.json":92}],81:[function(e,t,r){function a(e,t,r){p.call(this),this._cache=new o,this._last=void 0,this._cipher=new u.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}function o(){this.cache=s.allocUnsafe(0)}function n(e){for(var t=e[15],r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}var n=e("safe-buffer").Buffer,i=n.alloc(16,0);o.prototype.ghash=function(e){for(var t=-1;++t++o;){for(i=0!=(this.state[~~(o/8)]&1<<7-o%8),i&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),d=0!=(1&e[3]),n=3;0>>1|(1&e[n-1])<<31;e[0]>>>=1,d&&(e[0]^=-520093696)}this.state=a(t)},o.prototype.update=function(e){this.cache=n.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":251}],84:[function(e,t){t.exports=function(e){for(var t=e.length,r;t--;)if(r=e.readUInt8(t),255===r)e.writeUInt8(0,t);else{r++,e.writeUInt8(r,t);break}}},{}],85:[function(e,t,r){var a=e("buffer-xor");r.encrypt=function(e,t){var r=a(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var o=e._cipher.decryptBlock(t);return a(o,r)}},{"buffer-xor":125}],86:[function(e,t,r){function a(e,t,r){var a=t.length,i=n(t,e._cache);return e._cache=e._cache.slice(a),e._prev=o.concat([e._prev,r?t:i]),i}var o=e("safe-buffer").Buffer,n=e("buffer-xor");r.encrypt=function(e,t,r){for(var n=o.allocUnsafe(0),i;t.length;)if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),e._cache.length<=t.length)i=e._cache.length,n=o.concat([n,a(e,t.slice(0,i),r)]),t=t.slice(i);else{n=o.concat([n,a(e,t,r)]);break}return n}},{"buffer-xor":125,"safe-buffer":251}],87:[function(e,t,r){function a(e,t,r){for(var a=-1,n=0,i,d,s;++a<8;)i=e._cipher.encryptBlock(e._prev),d=t&1<<7-a?128:0,s=i[0]^d,n+=(128&s)>>a%8,e._prev=o(e._prev,r?d:s);return n}function o(e,t){var r=e.length,a=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++a>7;return o}var n=e("safe-buffer").Buffer;r.encrypt=function(e,t,r){for(var o=t.length,d=n.allocUnsafe(o),s=-1;++s=e.cmpn(0))throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}var d=e("bn.js"),i=e("elliptic").ec,c=e("parse-asn1"),s=e("./curves.json");t.exports=function(e,t,n,s,f){var p=c(n);if("ec"===p.type){if("ecdsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");return a(e,t,p)}if("dsa"===p.type){if("dsa"!==s)throw new Error("wrong public key type");return o(e,t,p)}if("rsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");t=r.concat([f,t]);for(var l=p.modulus.byteLength(),b=[1],h=0;t.length+b.length+2h?1:0;for(l=u(e.length,b.length),e.length!==b.length&&(m=1),g=-1;++g=f;t--)p=(p<<1)+o[t];s.push(p)}for(var u=this.jpoint(null,null,null),a=this.jpoint(null,null,null),l=n;0f)break;var i=n[f];c(0!==i),s="affine"===e.type?0>1]):s.mixedAdd(o[-i-1>>1].neg()):0>1]):s.add(o[-i-1>>1].neg())}return"affine"===e.type?s.toP():s},r.prototype._wnafMulAdd=function(e,t,r,o,n){for(var c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,h=0,g=0;gg)break;for(var v=0;v>1]:0>E&&(i=u[v][-E-1>>1].neg());x="affine"===i.type?x.mixedAdd(i):x.add(i)}}for(var g=0;g=p((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,o=0;o":""},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),a=this.z.redSqr();a=a.redIAdd(a);var o=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=o.redAdd(r),i=e.redSub(a),d=o.redSub(r),s=n.redMul(i),c=e.redMul(d),f=n.redMul(d),p=i.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),a=this.y.redSqr(),o,n,i;if(this.curve.twisted){var d=this.curve._mulA(r),e=d.redAdd(a);if(this.zOne)o=t.redSub(r).redSub(a).redMul(e.redSub(this.curve.two)),n=e.redMul(d.redSub(a)),i=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);o=t.redSub(r).redISub(a).redMul(c),n=e.redMul(d.redSub(a)),i=e.redMul(c)}}else{var d=r.redAdd(a),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=d.redSub(s).redSub(s);o=this.curve._mulC(t.redISub(d)).redMul(c),n=this.curve._mulC(d).redMul(r.redISub(a)),i=d.redMul(c)}return this.curve.point(o,n,i)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),a=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),o=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),i=a.redSub(r),e=n.redSub(o),d=n.redAdd(o),s=a.redAdd(r),c=i.redMul(e),f=d.redMul(s),p=i.redMul(s),u=e.redMul(d);return this.curve.point(c,f,u,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),a=r.redSqr(),o=this.x.redMul(t.x),n=this.y.redMul(t.y),i=this.curve.d.redMul(o).redMul(n),e=a.redSub(i),d=a.redAdd(i),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(n),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(d).redMul(n.redSub(this.curve._mulA(o))),p=e.redMul(d)):(f=r.redMul(d).redMul(n.redSub(o)),p=this.curve._mulC(e).redMul(d)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},a.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},a.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var a=e.clone(),o=this.curve.redN.redMul(this.z);;){if(a.iadd(this.curve.n),0<=a.cmp(this.curve.p))return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}return!1},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],110:[function(e,t,r){"use strict";var a=r;a.base=e("./base"),a.short=e("./short"),a.mont=e("./mont"),a.edwards=e("./edwards")},{"./base":108,"./edwards":109,"./mont":111,"./short":112}],111:[function(e,t){"use strict";function r(e){d.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){d.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),n=e("bn.js"),i=e("inherits"),d=o.base,s=e("../../elliptic"),c=s.utils;i(r,d),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),a=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),o=a.redSqrt();return 0===o.redSqr().cmp(a)},i(a,d.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(c.toArray(e,t),1)},r.prototype.point=function(e,t){return new a(this,e,t)},r.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),a=r.redSqr(),o=t.redSub(a),n=t.redMul(a),i=o.redMul(a.redAdd(this.curve.a24.redMul(o)));return this.curve.point(n,i)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),a=this.x.redSub(this.z),o=e.x.redAdd(e.z),n=e.x.redSub(e.z),i=n.redMul(r),d=o.redMul(a),s=t.z.redMul(i.redAdd(d).redSqr()),c=t.x.redMul(i.redISub(d).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,a=this.curve.point(null,null),o=this,n=[];0!==r.cmpn(0);r.iushrn(1))n.push(r.andln(1));for(var d=n.length-1;0<=d;d--)0===n[d]?(t=t.diffAdd(a,o),a=a.dbl()):(a=t.diffAdd(a,o),t=t.dbl());return a},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],112:[function(e,t){"use strict";function r(e){c.call(this,"short",e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function a(e,t,r,a){c.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(t,16),this.y=new d(r,16),a&&(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 o(e,t,r,a){c.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===a?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(t,16),this.y=new d(r,16),this.z=new d(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var n=e("../curve"),i=e("../../elliptic"),d=e("bn.js"),s=e("inherits"),c=n.base,f=i.utils.assert;s(r,c),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new d(e.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=0>a[0].cmp(a[1])?a[0]:a[1],t=t.toRed(this.red)}if(e.lambda)r=new d(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var n;return n=e.basis?e.basis.map(function(e){return{a:new d(e.a,16),b:new d(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:n}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:d.mont(e),r=new d(2).toRed(t).redInvm(),a=r.redNeg(),o=new d(3).toRed(t).redNeg().redSqrt().redMul(r),n=a.redAdd(o).fromRed(),i=a.redSub(o).fromRed();return[n,i]},r.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(h(this.n.bitLength()/2)),a=e,o=this.n.clone(),n=new d(1),s=new d(0),c=new d(0),f=new d(1),p=0,i,u,l,b,g,m,_,v,r,S;0!==a.cmpn(0);){S=o.div(a),v=o.sub(S.mul(a)),r=c.sub(S.mul(n));var k=f.sub(S.mul(s));if(!l&&0>v.cmp(t))i=_.neg(),u=n,l=v.neg(),b=r;else if(l&&2==++p)break;_=v,o=a,a=v,c=n,n=r,f=s,s=k}g=v.neg(),m=r;var y=l.sqr().add(b.sqr()),I=g.sqr().add(m.sqr());return 0<=I.cmp(y)&&(g=i,m=u),l.negative&&(l=l.neg(),b=b.neg()),g.negative&&(g=g.neg(),m=m.neg()),[{a:l,b:b},{a:g,b:m}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],a=t[1],o=a.b.mul(e).divRound(this.n),n=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),d=n.mul(a.a),s=o.mul(r.b),c=n.mul(a.b),f=e.sub(i).sub(d),p=s.add(c).neg();return{k1:f,k2:p}},r.prototype.pointFromX=function(e,t){e=new d(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),a=r.redSqrt();if(0!==a.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=a.fromRed().isOdd();return(t&&!o||!t&&o)&&(a=a.redNeg()),this.point(e,a)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,a=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,r){for(var a=this._endoWnafT1,o=this._endoWnafT2,n=0;n":""},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),a=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,a)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),a=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(a),n=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new d(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o):this.curve._wnafMulAdd(1,a,o,2)},a.prototype.jmulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o,!0):this.curve._wnafMulAdd(1,a,o,2,!0)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,a=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(a)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(a)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,c.BasePoint),r.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),a=this.y.redMul(t).redMul(e);return this.curve.point(r,a)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),a=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(a),i=this.y.redMul(t.redMul(e.z)),d=e.y.redMul(a.redMul(this.z)),s=o.redSub(n),c=i.redSub(d);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=o.redMul(r),u=c.redSqr().redIAdd(f).redISub(p).redISub(p),l=c.redMul(p.redISub(u)).redISub(i.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),a=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),d=a.redSub(o),s=n.redSub(i);if(0===d.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=d.redSqr(),c=r.redMul(d),f=a.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),u=s.redMul(f.redISub(p)).redISub(n.redMul(c)),l=this.z.redMul(d);return this.curve.jpoint(p,u,l)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],113:[function(e,t,r){"use strict";function a(e){this.curve="short"===e.type?new d.curve.short(e):"edwards"===e.type?new d.curve.edwards(e):new d.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}var n=r,i=e("hash.js"),d=e("../elliptic"),s=d.utils.assert;n.PresetCurve=a,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:i.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"]}),o("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:i.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=e("./precomputed/secp256k1")}catch(t){c=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})},{"../elliptic":107,"./precomputed/secp256k1":120,"hash.js":185}],114:[function(e,t){"use strict";function r(e){return this instanceof r?void("string"==typeof e&&(d(n.curves.hasOwnProperty(e),"Unknown curve "+e),e=n.curves[e]),e instanceof n.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash):new r(e)}var a=e("bn.js"),o=e("hmac-drbg"),n=e("../../elliptic"),i=n.utils,d=i.assert,s=e("./key"),c=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new s(this,e)},r.prototype.keyFromPrivate=function(e,t){return s.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return s.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||n.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new a(2));do{var d=new a(t.generate(r));if(0=h.cmpn(1)||0<=h.cmp(l))){var g=this.g.mul(h);if(!g.isInfinity()){var m=g.getX(),y=m.umod(this.n);if(0!==y.cmpn(0)){var _=h.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),0!==_.cmpn(0)){var v=(g.getY().isOdd()?1:0)|(0===m.cmp(y)?0:2);return i.canonical&&0<_.cmp(this.nh)&&(_=this.n.sub(_),v^=1),new c({r:y,s:_,recoveryParam:v})}}}}},r.prototype.verify=function(e,t,o,n){e=this._truncateToN(new a(e,16)),o=this.keyFromPublic(o,n),t=new c(t,"hex");var i=t.r,r=t.s;if(0>i.cmpn(1)||0<=i.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var d=r.invm(this.n),s=d.mul(e).umod(this.n),f=d.mul(i).umod(this.n);if(!this.curve._maxwellTrick){var u=this.g.mulAdd(s,o.getPublic(),f);return!u.isInfinity()&&0===u.getX().umod(this.n).cmp(i)}var u=this.g.jmulAdd(s,o.getPublic(),f);return!u.isInfinity()&&u.eqXToP(i)},r.prototype.recoverPubKey=function(t,o,i,f){d((3&i)===i,"The recovery param is more than two bits"),o=new c(o,f);var p=this.n,n=new a(t),e=o.r,r=o.s,s=1&i,u=i>>1;if(0<=e.cmp(this.curve.p.umod(this.curve.n))&&u)throw new Error("Unable to find sencond key candinate");e=u?this.curve.pointFromX(e.add(this.curve.n),s):this.curve.pointFromX(e,s);var l=o.r.invm(p),b=p.sub(n).mul(l).umod(p),h=r.mul(l).umod(p);return this.g.mulAdd(b,e,h)},r.prototype.getKeyRecoveryParam=function(t,e,r,a){if(e=new c(e,a),null!==e.recoveryParam)return e.recoveryParam;for(var o=0;4>o;o++){var n;try{n=this.recoverPubKey(t,e,o)}catch(t){continue}if(n.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":107,"./key":115,"./signature":116,"bn.js":106,"hmac-drbg":198}],115:[function(e,t){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.fromPublic=function(e,t,a){return t instanceof r?t:new r(e,{pub:t,pubEnc:a})},r.fromPrivate=function(e,t,a){return t instanceof r?t:new r(e,{priv:t,privEnc:a})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new a(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?("mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y))):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return""}},{"../../elliptic":107,"bn.js":106}],116:[function(e,a){"use strict";function o(e,t){return e instanceof o?e:void(this._importDER(e,t)||(p(e.r&&e.s,"Signature without r or s"),this.r=new f(e.r,16),this.s=new f(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function n(){this.place=0}function i(e,t){var r=e[t.place++];if(!(128&r))return r;for(var a=0,o=0,n=t.place;o<(15&r);o++,n++)a<<=8,a|=e[n];return t.place=n,a}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&ta)return void e.push(a);var o=1+(r(a)/t>>>3);for(e.push(128|o);--o;)e.push(255&a>>>(o<<3));e.push(a)}var f=e("bn.js"),s=e("../../elliptic"),u=s.utils,p=u.assert;a.exports=o,o.prototype._importDER=function(e,t){e=u.toArray(e,t);var a=new n;if(48!==e[a.place++])return!1;var o=i(e,a);if(o+a.place!==e.length)return!1;if(2!==e[a.place++])return!1;var d=i(e,a),c=e.slice(a.place,d+a.place);if(a.place+=d,2!==e[a.place++])return!1;var r=i(e,a);if(e.length!==r+a.place)return!1;var p=e.slice(a.place,r+a.place);return 0===c[0]&&128&c[1]&&(c=c.slice(1)),0===p[0]&&128&p[1]&&(p=p.slice(1)),this.r=new f(c),this.s=new f(p),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var a=[2];c(a,t.length),a=a.concat(t),a.push(2),c(a,r.length);var o=a.concat(r),n=[48];return c(n,o.length),n=n.concat(o),u.encode(n,e)}},{"../../elliptic":107,"bn.js":106}],117:[function(e,t){"use strict";function r(e){if(i("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);var e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=p(e.n.bitLength()/8),this.hash=a.sha512}var a=e("hash.js"),o=e("../../elliptic"),n=o.utils,i=n.assert,d=n.parseBytes,s=e("./key"),c=e("./signature");t.exports=r,r.prototype.sign=function(e,t){e=d(e);var a=this.keyFromSecret(t),o=this.hashInt(a.messagePrefix(),e),r=this.g.mul(o),n=this.encodePoint(r),i=this.hashInt(n,a.pubBytes(),e).mul(a.priv()),s=o.add(i).umod(this.curve.n);return this.makeSignature({R:r,S:s,Rencoded:n})},r.prototype.verify=function(e,t,r){e=d(e),t=this.makeSignature(t);var a=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),a.pubBytes(),e),n=this.g.mul(t.S()),i=t.R().add(a.pub().mul(o));return i.eq(n)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(a>>1)-1?(a>>1)-d:d,o.isubn(n)}else n=0;r.push(n);for(var s=0!==o.cmpn(0)&&0===o.andln(a-1)?t+1:1,c=1;c>8,t[o]&=255;for(;d;)t.push(255&d),d>>=8}for(r=0;"1"===e[r]&&rt[a]?1:0,0==r);++a);return 0==r&&(t.length>e.length?r=-1:e.length>t.length&&(r=1)),r}},{}],125:[function(e,t){(function(e){t.exports=function(t,r){for(var a=u(t.length,r.length),o=new e(a),n=0;nQ)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=d.prototype,t}function d(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(e)}return i(e,t,r)}function i(e,t,r){if("number"==typeof e)throw new TypeError("\"value\" argument must not be a number");return W(e)?b(e,t,r):"string"==typeof e?p(e,t):h(e)}function s(e){if("number"!=typeof e)throw new TypeError("\"size\" argument must be a number");else if(0>e)throw new RangeError("\"size\" argument must not be negative")}function c(e,t,r){return s(e),0>=e?n(e):void 0===t?n(e):"string"==typeof r?n(e).fill(t,r):n(e).fill(t)}function f(e){return s(e),n(0>e?0:0|g(e))}function p(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!d.isEncoding(t))throw new TypeError("\"encoding\" must be a valid string encoding");var r=0|m(e,t),a=n(r),o=a.write(e,t);return o!==r&&(a=a.slice(0,o)),a}function l(e){for(var t=0>e.length?0:0|g(e.length),r=n(t),a=0;at||e.byteLength=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return 0|e}function m(e,t){if(d.isBuffer(e))return e.length;if(Y(e)||W(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(a)return H(e).length;t=(""+t).toLowerCase(),a=!0;}}function y(e,t,r){var a=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0;}}function _(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function v(e,t,r,a,o){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):2147483647r&&(r=-2147483648),r=+r,X(r)&&(r=o?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(0>r)if(o)r=0;else return-1;if("string"==typeof t&&(t=d.from(t,a)),d.isBuffer(t))return 0===t.length?-1:S(e,t,r,a,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):S(e,[t],r,a,o);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,a,o){function n(e,t){return 1==d?e[t]:e.readUInt16BE(t*d)}var d=1,s=e.length,c=t.length;if(void 0!==a&&(a=(a+"").toLowerCase(),"ucs2"===a||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(2>e.length||2>t.length)return-1;d=2,s/=2,c/=2,r/=2}var f;if(o){var i=-1;for(f=r;fs&&(r=s-c),f=r;0<=f;f--){for(var p=!0,u=0;uo&&(a=o)):a=o;var n=t.length;if(0!=n%2)throw new TypeError("Invalid hex string");a>n/2&&(a=n/2);for(var d=0,i;dn&&(i=n):2==d?(s=e[o+1],128==(192&s)&&(p=(31&n)<<6|63&s,127p||57343p&&(i=p))):void 0}null===i?(i=65533,d=1):65535>>10),i=56320|1023&i),a.push(i),o+=d}return O(a)}function O(e){var t=e.length;if(t<=$)return a.apply(String,e);for(var r="",o=0;ot)&&(t=0),(!r||0>r||r>a)&&(r=a);for(var o="",n=t;ne)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function z(e,t,r,a,o,n){if(!d.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,r,a){if(r+a>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function U(e,t,r,a,o){return t=+t,r>>>=0,o||M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,r,a,23,4),r+4}function L(e,t,r,a,o){return t=+t,r>>>=0,o||M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,r,a,52,8),r+8}function D(e){if(e=e.trim().replace(ee,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function H(e,t){t=t||Infinity;for(var r=e.length,a=null,o=[],n=0,i;ni){if(!a){if(56319i){-1<(t-=3)&&o.push(239,191,189),a=i;continue}i=(a-55296<<10|i-56320)+65536}else a&&-1<(t-=3)&&o.push(239,191,189);if(a=null,128>i){if(0>(t-=1))break;o.push(i)}else if(2048>i){if(0>(t-=2))break;o.push(192|i>>6,128|63&i)}else if(65536>i){if(0>(t-=3))break;o.push(224|i>>12,128|63&i>>6,128|63&i)}else if(1114112>i){if(0>(t-=4))break;o.push(240|i>>18,128|63&i>>12,128|63&i>>6,128|63&i)}else throw new Error("Invalid code point")}return o}function F(e){for(var t=[],r=0;r(t-=2));++a)o=e.charCodeAt(a),n=o>>8,i=o%256,r.push(i),r.push(n);return r}function V(e){return Z.toByteArray(D(e))}function G(e,t,r,a){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function W(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function Y(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function X(e){return e!==e}var Z=e("base64-js"),J=e("ieee754");r.Buffer=d,r.SlowBuffer=function(e){return+e!=e&&(e=0),d.alloc(+e)},r.INSPECT_MAX_BYTES=50;var Q=2147483647;r.kMaxLength=Q,d.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(e,t,r){return i(e,t,r)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(e,t,r){return c(e,t,r)},d.allocUnsafe=function(e){return f(e)},d.allocUnsafeSlow=function(e){return f(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer},d.compare=function(e,t){if(!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,a=t.length,o=0,n=u(r,a);ot&&(e+=" ... ")),""},d.prototype.compare=function(e,t,r,a,o){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===o&&(o=this.length),0>t||r>e.length||0>a||o>this.length)throw new RangeError("out of range index");if(a>=o&&t>=r)return 0;if(a>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,o>>>=0,this===e)return 0;for(var n=o-a,s=r-t,c=u(n,s),f=this.slice(a,o),p=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((void 0===r||r>o)&&(r=o),0r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var n=!1;;)switch(a){case"hex":return k(this,e,t,r);case"utf8":case"utf-8":return I(this,e,t,r);case"ascii":return x(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(n)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),n=!0;}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;d.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e],o=1,n=0;++n>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e+--t],o=1;0>>=0,t||C(e,1,this.length),this[e]},d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e],n=1,d=0;++d=n&&(a-=o(2,8*t)),a},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var a=t,n=1,i=this[e+--a];0=n&&(i-=o(2,8*t)),i},d.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),J.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),J.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),J.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),J.read(this,e,!1,52,8)},d.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var n=o(2,8*r)-1;z(this,e,t,r,n,0)}var d=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!a){var n=o(2,8*r)-1;z(this,e,t,r,n,0)}var d=r-1,i=1;for(this[t+d]=255&e;0<=--d&&(i*=256);)this[t+d]=255&e/i;return t+r},d.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var n=o(2,8*r-1);z(this,e,t,r,n-1,-n)}var d=0,i=1,s=0;for(this[t]=255&e;++de&&0==s&&0!==this[t+d-1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},d.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var n=o(2,8*r-1);z(this,e,t,r,n-1,-n)}var d=r-1,i=1,s=0;for(this[t+d]=255&e;0<=--d&&(i*=256);)0>e&&0==s&&0!==this[t+d+1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},d.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},d.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},d.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},d.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},d.prototype.copy=function(e,t,r,a){if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>a)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-to)for(n=0;no&&(e=o)}if(void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!d.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else"number"==typeof e&&(e&=255);if(0>t||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var n;if("number"==typeof e)for(n=t;na,`Invalid value: ${a}.`),t+="qpzry9x8gf2tvdw0s3jn54khce6mua7l"[a];return t},decode:function(e){r("string"==typeof e,`Invalid base32-encoded string: ${e}.`);let t=[];for(const o of e)r(o in a,`Invalid value: ${o}.`),t.push(a[o]);return t}}},{"./ensure":130}],128:[function(e,t){function r(e){let t=!1,r=!1;for(const a of e)if(t=t||a!==a.toUpperCase(),r=r||a!==a.toLowerCase(),t&&r)return!1;return!0}function a(e){switch(e){case"P2PKH":return 0;case"P2SH":return 8;default:throw new Error(`Invalid type: ${e}.`);}}function o(e){switch(120&e){case 0:return"P2PKH";case 8:return"P2SH";default:throw new Error(`Invalid address type in version byte: ${e}.`);}}function n(e){switch(8*e.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: ${e.length}.`);}}function i(e){switch(7&e){case 0:return 160;case 1:return 192;case 2:return 224;case 3:return 256;case 4:return 320;case 5:return 384;case 6:return 448;case 7:return 512;}}function d(e){const t=[];for(const r of e)t.push(31&r.charCodeAt(0));return t}function s(e){const t=[];for(let r=0;8>r;++r)t.push(e.and(31).toJSNumber()),e=e.shiftRight(5);return t.reverse()}function c(e,t){const r=d(e).concat([0]);return f(r.concat(t)).equals(0)}function f(e){const t=[656907472481,522768456162,1044723512260,748107326120,130178868336];let r=p(1);for(let a of e){let e=r.shiftRight(35);r=r.and(34359738367).shiftLeft(5).xor(a);for(let a=0;a{let o=0,n=0,i=[];const d=(1<s||0!=s>>t)throw new Error(`Invalid value: ${s}.`);for(o=o<=r;)n-=r,i.push(o>>n&d)}if(!a)0=t||o<{if(!e)throw new Error(t)}},{}],131:[function(e,t){function r(e){o.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var a=e("safe-buffer").Buffer,o=e("stream").Transform,n=e("string_decoder").StringDecoder,i=e("inherits");i(r,o),r.prototype.update=function(e,t,r){"string"==typeof e&&(e=a.from(e,t));var o=this._update(e);return this.hashMode?this:(r&&(o=this._toString(o,r)),o)},r.prototype.setAutoPadding=function(){},r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},r.prototype._transform=function(e,t,r){var a;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(t){a=t}finally{r(a)}},r.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)},r.prototype._finalOrDigest=function(e){var t=this.__final()||a.alloc(0);return e&&(t=this._toString(t,e,!0)),t},r.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new n(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var a=this._decoder.write(e);return r&&(a+=this._decoder.end()),a},t.exports=r},{inherits:201,"safe-buffer":251,stream:260,string_decoder:261}],132:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(r){return"[object Error]"===t(r)||r instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":202}],133:[function(e,t){(function(r){function a(e){this.curveType=d[e],this.curveType||(this.curveType={name:e}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function o(e,t,a){Array.isArray(e)||(e=e.toArray());var o=new r(e);if(a&&o.length>>2),d=0,i=0;d>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,a=-271733879,o=-1732584194,c=271733878,d=0;d>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t){return e<>>32-t}var a=e("./make-hash");t.exports=function(e){return a(e,r)}},{"./make-hash":152}],154:[function(e,t){"use strict";function r(e,t){n.call(this,"digest"),"string"==typeof t&&(t=d.from(t));var r="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>r){var a="rmd160"===e?new s:c(e);t=a.update(t).digest()}else t.lengths?t=e(t):t.length>>1],r=d.r28shl(r,i),a=d.r28shl(a,i),d.pc2(r,a,e.keys,n)},a.prototype._update=function(e,t,a,o){var n=this._desState,i=d.readUInt32BE(e,t),s=d.readUInt32BE(e,t+4);d.ip(i,s,n.tmp,0),i=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,i,s,n.tmp,0):this._decrypt(n,i,s,n.tmp,0),i=n.tmp[0],s=n.tmp[1],d.writeUInt32BE(a,i,o),d.writeUInt32BE(a,s,o+4)},a.prototype._pad=function(e,t){for(var r=e.length-t,a=t;a>>0,p=f}d.rip(u,p,n,c)},a.prototype._decrypt=function(e,a,o,n,c){for(var p=o,u=a,r=e.keys.length-2;0<=r;r-=2){var i=e.keys[r],l=e.keys[r+1];d.expand(p,e.tmp,0),i^=e.tmp[0],l^=e.tmp[1];var b=d.substitute(i,l),s=d.permute(b),f=p;p=(u^s)>>>0,u=f}d.rip(p,u,n,c)}},{"../des":157,inherits:201,"minimalistic-assert":209}],161:[function(e,t){"use strict";function r(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),a=t.slice(8,16),n=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:a}),s.create({type:"encrypt",key:n})]:[s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:a}),s.create({type:"decrypt",key:r})]}function a(e){d.call(this,e);var t=new r(this.type,this.options.key);this._edeState=t}var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),d=i.Cipher,s=i.DES;n(a,d),t.exports=a,a.create=function(e){return new a(e)},a.prototype._update=function(e,t,r,a){var o=this._edeState;o.ciphers[0]._update(e,t,r,a),o.ciphers[1]._update(r,a,r,a),o.ciphers[2]._update(r,a,r,a)},a.prototype._pad=s.prototype._pad,a.prototype._unpad=s.prototype._unpad},{"../des":157,inherits:201,"minimalistic-assert":209}],162:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){var r=e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t];return r>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=255&t>>>16,e[2+r]=255&t>>>8,e[3+r]=255&t},r.ip=function(e,t,r,a){for(var o=0,n=0,d=6;0<=d;d-=2){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>>i+d}for(var d=6;0<=d;d-=2){for(var i=1;25>=i;i+=8)n<<=1,n|=1&t>>>i+d;for(var i=1;25>=i;i+=8)n<<=1,n|=1&e>>>i+d}r[a+0]=o>>>0,r[a+1]=n>>>0},r.rip=function(e,t,r,a){for(var o=0,n=0,d=0;4>d;d++)for(var i=24;0<=i;i-=8)o<<=1,o|=1&t>>>i+d,o<<=1,o|=1&e>>>i+d;for(var d=4;8>d;d++)for(var i=24;0<=i;i-=8)n<<=1,n|=1&t>>>i+d,n<<=1,n|=1&e>>>i+d;r[a+0]=o>>>0,r[a+1]=n>>>0},r.pc1=function(e,t,r,a){for(var o=0,n=0,d=7;5<=d;d--){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d}for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var d=1;3>=d;d++){for(var i=0;24>=i;i+=8)n<<=1,n|=1&t>>i+d;for(var i=0;24>=i;i+=8)n<<=1,n|=1&e>>i+d}for(var i=0;24>=i;i+=8)n<<=1,n|=1&e>>i+d;r[a+0]=o>>>0,r[a+1]=n>>>0},r.r28shl=function(e,t){return 268435455&e<>>28-t};var a=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,o){for(var n=0,d=0,s=a.length>>>1,c=0;c>>a[c];for(var c=s;c>>a[c];r[o+0]=n>>>0,r[o+1]=d>>>0},r.expand=function(e,t,r){var a=0,o=0;a=(1&e)<<5|e>>>27;for(var n=23;15<=n;n-=4)a<<=6,a|=63&e>>>n;for(var n=11;3<=n;n-=4)o|=63&e>>>n,o<<=6;o|=(31&e)<<1|e>>>31,t[r+0]=a>>>0,t[r+1]=o>>>0};var o=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,a=0;4>a;a++){var n=63&e>>>18-6*a,i=o[64*a+n];r<<=4,r|=i}for(var a=0;4>a;a++){var n=63&t>>>18-6*a,i=o[256+64*a+n];r<<=4,r|=i}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r];return t>>>0},r.padSplit=function(e,t,r){for(var a=e.toString(2);a.lengthe)return 2===t||5===t?new d([140,123]):new d([140,39]);t=new d(t);for(var r,n;;){for(r=new d(i(p(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(l),!t.cmp(l))for(;r.mod(s).cmp(v);)r.iadd(S);else if(!t.cmp(b))for(;r.mod(m).cmp(y);)r.iadd(S);if(n=r.shrn(1),a(n)&&a(r)&&o(n)&&o(r)&&f.test(n)&&f.test(r))return r}}var i=e("randombytes");t.exports=n,n.simpleSieve=a,n.fermatTest=o;var d=e("bn.js"),s=new d(24),c=e("miller-rabin"),f=new c,u=new d(1),l=new d(2),b=new d(5),h=new d(16),g=new d(8),m=new d(10),y=new d(3),_=new d(7),v=new d(11),S=new d(4),k=new d(12),I=null},{"bn.js":167,"miller-rabin":207,randombytes:234}],166:[function(e,t){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],167:[function(e,t,r){arguments[4][71][0].apply(r,arguments)},{buffer:77,dup:71}],168:[function(e,t,r){"use strict";var a=r;a.version=e("../package.json").version,a.utils=e("./elliptic/utils"),a.rand=e("brorand"),a.hmacDRBG=e("./elliptic/hmac-drbg"),a.curve=e("./elliptic/curve"),a.curves=e("./elliptic/curves"),a.ec=e("./elliptic/ec")},{"../package.json":181,"./elliptic/curve":171,"./elliptic/curves":174,"./elliptic/ec":175,"./elliptic/hmac-drbg":178,"./elliptic/utils":180,brorand:76}],169:[function(e,t){"use strict";function r(e,t){this.type=e,this.p=new o(t.p,16),this.red=t.prime?o.red(t.prime):o.mont(this.p),this.zero=new o(0).toRed(this.red),this.one=new o(1).toRed(this.red),this.two=new o(2).toRed(this.red),this.n=t.n&&new o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,]}function a(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=e("bn.js"),n=e("../../elliptic"),d=n.utils.getNAF,s=n.utils.getJSF,c=n.utils.assert;t.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){var r=e._getDoubles(),o=d(t,1),n=(1<=c;t--)f=(f<<1)+o[t];s.push(f)}for(var p=this.jpoint(null,null,null),a=this.jpoint(null,null,null),u=n;0f)break;var i=n[f];c(0!==i),s="affine"===e.type?0>1]):s.mixedAdd(o[-i-1>>1].neg()):0>1]):s.add(o[-i-1>>1].neg())}return"affine"===e.type?s.toP():s},r.prototype._wnafMulAdd=function(e,t,r,o){for(var n=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0,h=0;hh)break;for(var _=0;_>1]:0>A&&(i=c[_][-A-1>>1].neg());I="affine"===i.type?I.mixedAdd(i):I.add(i)}}for(var h=0;h":""},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),a=this.z.redSqr();a=a.redIAdd(a);var o=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=o.redAdd(r),i=e.redSub(a),d=o.redSub(r),s=n.redMul(i),c=e.redMul(d),f=n.redMul(d),p=i.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),a=this.y.redSqr(),o,n,i;if(this.curve.twisted){var d=this.curve._mulA(r),e=d.redAdd(a);if(this.zOne)o=t.redSub(r).redSub(a).redMul(e.redSub(this.curve.two)),n=e.redMul(d.redSub(a)),i=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);o=t.redSub(r).redISub(a).redMul(c),n=e.redMul(d.redSub(a)),i=e.redMul(c)}}else{var d=r.redAdd(a),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=d.redSub(s).redSub(s);o=this.curve._mulC(t.redISub(d)).redMul(c),n=this.curve._mulC(d).redMul(r.redISub(a)),i=d.redMul(c)}return this.curve.point(o,n,i)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),a=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),o=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),i=a.redSub(r),e=n.redSub(o),d=n.redAdd(o),s=a.redAdd(r),c=i.redMul(e),f=d.redMul(s),p=i.redMul(s),u=e.redMul(d);return this.curve.point(c,f,u,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),a=r.redSqr(),o=this.x.redMul(t.x),n=this.y.redMul(t.y),i=this.curve.d.redMul(o).redMul(n),e=a.redSub(i),d=a.redAdd(i),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(n),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(d).redMul(n.redSub(this.curve._mulA(o))),p=e.redMul(d)):(f=r.redMul(d).redMul(n.redSub(o)),p=this.curve._mulC(e).redMul(d)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},{"../../elliptic":168,"../curve":171,"bn.js":75,inherits:201}],171:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{"./base":169,"./edwards":170,"./mont":172,"./short":173,dup:110}],172:[function(e,t){"use strict";function r(e){d.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){d.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),n=e("bn.js"),i=e("inherits"),d=o.base;i(r,d),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),a=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),o=a.redSqrt();return 0===o.redSqr().cmp(a)},i(a,d.BasePoint),r.prototype.point=function(e,t){return new a(this,e,t)},r.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),a=r.redSqr(),o=t.redSub(a),n=t.redMul(a),i=o.redMul(a.redAdd(this.curve.a24.redMul(o)));return this.curve.point(n,i)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),a=this.x.redSub(this.z),o=e.x.redAdd(e.z),n=e.x.redSub(e.z),i=n.redMul(r),d=o.redMul(a),s=t.z.redMul(i.redAdd(d).redSqr()),c=t.x.redMul(i.redISub(d).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,a=this.curve.point(null,null),o=this,n=[];0!==r.cmpn(0);r.ishrn(1))n.push(r.andln(1));for(var d=n.length-1;0<=d;d--)0===n[d]?(t=t.diffAdd(a,o),a=a.dbl()):(a=t.diffAdd(a,o),t=t.dbl());return a},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":171,"bn.js":75,inherits:201}],173:[function(e,t){"use strict";function r(e){c.call(this,"short",e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function a(e,t,r,a){c.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(t,16),this.y=new d(r,16),a&&(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 o(e,t,r,a){c.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===a?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(t,16),this.y=new d(r,16),this.z=new d(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var n=e("../curve"),i=e("../../elliptic"),d=e("bn.js"),s=e("inherits"),c=n.base,f=i.utils.assert;s(r,c),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new d(e.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=0>a[0].cmp(a[1])?a[0]:a[1],t=t.toRed(this.red)}if(e.lambda)r=new d(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var n;return n=e.basis?e.basis.map(function(e){return{a:new d(e.a,16),b:new d(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:n}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:d.mont(e),r=new d(2).toRed(t).redInvm(),a=r.redNeg(),o=new d(3).toRed(t).redNeg().redSqrt().redMul(r),n=a.redAdd(o).fromRed(),i=a.redSub(o).fromRed();return[n,i]},r.prototype._getEndoBasis=function(e){for(var t=this.n.shrn(h(this.n.bitLength()/2)),a=e,o=this.n.clone(),n=new d(1),s=new d(0),c=new d(0),f=new d(1),p=0,i,u,l,b,g,m,_,v,r,S;0!==a.cmpn(0);){S=o.div(a),v=o.sub(S.mul(a)),r=c.sub(S.mul(n));var k=f.sub(S.mul(s));if(!l&&0>v.cmp(t))i=_.neg(),u=n,l=v.neg(),b=r;else if(l&&2==++p)break;_=v,o=a,a=v,c=n,n=r,f=s,s=k}g=v.neg(),m=r;var y=l.sqr().add(b.sqr()),I=g.sqr().add(m.sqr());return 0<=I.cmp(y)&&(g=i,m=u),l.sign&&(l=l.neg(),b=b.neg()),g.sign&&(g=g.neg(),m=m.neg()),[{a:l,b:b},{a:g,b:m}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],a=t[1],o=a.b.mul(e).divRound(this.n),n=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),d=n.mul(a.a),s=o.mul(r.b),c=n.mul(a.b),f=e.sub(i).sub(d),p=s.add(c).neg();return{k1:f,k2:p}},r.prototype.pointFromX=function(e,t){t=new d(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),a=r.redSqrt(),o=a.fromRed().isOdd();return(e&&!o||!e&&o)&&(a=a.redNeg()),this.point(t,a)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,a=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t){for(var r=this._endoWnafT1,a=this._endoWnafT2,o=0;o":""},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),a=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,a)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),a=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(a),n=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new d(e,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o):this.curve._wnafMulAdd(1,a,o,2)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,a=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(a)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(a)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,c.BasePoint),r.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),a=this.y.redMul(t).redMul(e);return this.curve.point(r,a)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),a=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(a),i=this.y.redMul(t.redMul(e.z)),d=e.y.redMul(a.redMul(this.z)),s=o.redSub(n),c=i.redSub(d);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=o.redMul(r),u=c.redSqr().redIAdd(f).redISub(p).redISub(p),l=c.redMul(p.redISub(u)).redISub(i.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),a=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),d=a.redSub(o),s=n.redSub(i);if(0===d.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=d.redSqr(),c=r.redMul(d),f=a.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),u=s.redMul(f.redISub(p)).redISub(n.redMul(c)),l=this.z.redMul(d);return this.curve.jpoint(p,u,l)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":168,"../curve":171,"bn.js":75,inherits:201}],174:[function(e,t,r){"use strict";function a(e){this.curve="short"===e.type?new d.curve.short(e):"edwards"===e.type?new d.curve.edwards(e):new d.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}var n=r,i=e("hash.js"),d=e("../elliptic"),s=d.utils.assert;n.PresetCurve=a,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=e("./precomputed/secp256k1")}catch(t){c=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})},{"../elliptic":168,"./precomputed/secp256k1":179,"hash.js":185}],175:[function(e,t){"use strict";function r(e){return this instanceof r?void("string"==typeof e&&(i(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash):new r(e)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert,d=e("./key"),c=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new d(this,e)},r.prototype.keyFromPrivate=function(e,t){return d.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return d.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});var t=new o.hmacDRBG({hash:this.hash,pers:e.pers,entropy:e.entropy||o.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new a(2));do{var i=new a(t.generate(r));if(0u;u++)p.unshift(0);for(var i=e.toArray(),u=i.length;u=h.cmpn(1)||0<=h.cmp(b))continue;var g=this.g.mul(h);if(g.isInfinity())continue;var m=g.getX().mod(this.n);if(0===m.cmpn(0))continue;var y=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e)).mod(this.n);if(0===y.cmpn(0))continue;return d.canonical&&0i.cmpn(1)||0<=i.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var d=r.invm(this.n),s=d.mul(e).mod(this.n),f=d.mul(i).mod(this.n),u=this.g.mulAdd(s,o.getPublic(),f);return!u.isInfinity()&&0===u.getX().mod(this.n).cmp(i)}},{"../../elliptic":168,"./key":176,"./signature":177,"bn.js":75}],176:[function(e,t){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils;t.exports=r,r.fromPublic=function(e,t,a){return t instanceof r?t:new r(e,{pub:t,pubEnc:a})},r.fromPrivate=function(e,t,a){return t instanceof r?t:new r(e,{priv:t,privEnc:a})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof e&&(t=e,e=null),!t)return this.pub;for(var r=this.ec.curve.p.byteLength(),a=this.pub.getX().toArray(),o=a.length;o"}},{"../../elliptic":168,"bn.js":75}],177:[function(e,t){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(i(e.r&&e.s,"Signature without r or s"),this.r=new a(e.r,16),this.s=new a(e.s,16)))}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.prototype._importDER=function(e,t){if(e=n.toArray(e,t),6>e.length||48!==e[0]||2!==e[2])return!1;var r=e[1];if(1+r>e.length)return!1;var o=e[3];if(128<=o)return!1;if(4+o+2>=e.length)return!1;if(2!==e[4+o])return!1;var i=e[5+o];return!(128<=i)&&!(4+o+2+i>e.length)&&(this.r=new a(e.slice(4,4+o)),this.s=new a(e.slice(4+o+2,4+o+2+i)),!0)},r.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r));var a=t.length+r.length+4,o=[48,a,2,t.length];return o=o.concat(t,[2,r.length],r),n.encode(o,e)}},{"../../elliptic":168,"bn.js":75}],178:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc),a=n.toArray(e.nonce,e.nonceEnc),o=n.toArray(e.pers,e.persEnc);i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,a,o)}var a=e("hash.js"),o=e("../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.prototype._init=function(e,t,r){var a=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this.reseed=1},r.prototype.generate=function(e,t,r,a){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(a=r,r=t,t=null),r&&(r=n.toArray(r,a),this._update(r));for(var o=[];o.length>8,i=255&o;n?r.push(n,i):r.push(i)}else if("hex"===t){e=e.replace(/[^a-z0-9]+/ig,""),0!=e.length%2&&(e="0"+e);for(var a=0;a(a>>1)-1?(a>>1)-d:d,o.isubn(n)}else n=0;r.push(n);for(var s=0!==o.cmpn(0)&&0===o.andln(a-1)?t+1:1,c=1;ce||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,o,s,c,i;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var f=new Error("Uncaught, unspecified \"error\" event. ("+t+")");throw f.context=t,f}if(r=this._events[e],d(r))return!1;if(a(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(n(r))for(s=Array.prototype.slice.call(arguments,1),i=r.slice(),o=i.length,c=0;co&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),o||(o=!0,t.apply(this,arguments))}if(!a(t))throw TypeError("listener must be a function");var o=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,o,d,s;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],d=r.length,o=-1,r===t||a(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(r)){for(s=d;0o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],183:[function(e,t){var r=e("safe-buffer").Buffer,a=e("md5.js");t.exports=function(e,t,o,n){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=o/8,d=r.alloc(i),s=r.alloc(n||0),c=r.alloc(0),f;0=this._blockSize;){for(var n=this._blockOffset;n=this._delta8){e=this.pending;var a=e.length%this._delta8;this.pending=e.slice(e.length-a,e.length),0===this.pending.length&&(this.pending=null),e=o.join32(e,0,e.length-a,this.endian);for(var r=0;r>>24,o[n++]=255&e>>>16,o[n++]=255&e>>>8,o[n++]=255&e}else for(o[n++]=255&e,o[n++]=255&e>>>8,o[n++]=255&e>>>16,o[n++]=255&e>>>24,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,i=8;ithis.blockSize&&(e=new this.Hash().update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=e?t^r^a:31>=e?t&r|~t&a:47>=e?(t|~r)^a:63>=e?t&a|r&~a:t^(r|~a)}function i(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function d(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var c=e("./utils"),f=e("./common"),p=c.rotl32,u=c.sum32,l=c.sum32_3,b=c.sum32_4,h=f.BlockHash;c.inherits(o,h),a.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(e,t){for(var a=this.h[0],o=this.h[1],c=this.h[2],f=this.h[3],h=this.h[4],y=a,_=o,v=c,S=f,k=h,I=0,x;80>I;I++)x=u(p(b(a,n(I,o,c,f),e[g[I]+t],i(I)),m[I]),h),a=h,h=f,f=p(c,10),c=o,o=x,x=u(p(b(y,n(79-I,_,v,S),e[r[I]+t],d(I)),s[I]),k),y=k,k=S,S=p(v,10),v=_,_=x;x=l(this.h[1],c,S),this.h[1]=l(this.h[2],f,k),this.h[2]=l(this.h[3],h,y),this.h[3]=l(this.h[4],a,_),this.h[4]=l(this.h[0],o,v),this.h[0]=x},o.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var g=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],r=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],s=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":186,"./utils":196}],189:[function(e,t,r){"use strict";r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":190,"./sha/224":191,"./sha/256":192,"./sha/384":193,"./sha/512":194}],190:[function(e,t){"use strict";function r(){return this instanceof r?void(i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)):new r}var a=e("../utils"),o=e("../common"),n=e("./common"),f=a.rotl32,p=a.sum32,u=a.sum32_5,l=n.ft_1,i=o.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];a.inherits(r,i),t.exports=r,r.blockSize=512,r.outSize=160,r.hmacStrength=80,r.padLength=64,r.prototype._update=function(r,o){for(var n=this.W,g=0;16>g;g++)n[g]=r[o+g];for(;gn;n++)o[n]=t[r+n];for(;ni&&(i+=4294967296),i}function o(e,t,a,o,n,i){var d=t&o^~t&i;return 0>d&&(d+=4294967296),d}function n(e,t,a,o,n){var i=e&a^e&n^a&n;return 0>i&&(i+=4294967296),i}function d(e,t,a,o,n,i){var d=t&o^t&i^o&i;return 0>d&&(d+=4294967296),d}function s(e,t){var a=y(e,t,28),o=y(t,e,2),n=y(t,e,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function c(e,t){var a=_(e,t,28),o=_(t,e,2),n=_(t,e,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function f(e,t){var a=y(e,t,14),o=y(e,t,18),n=y(t,e,9),i=a^o^n;return 0>i&&(i+=4294967296),i}function p(e,t){var a=_(e,t,14),o=_(e,t,18),n=_(t,e,9),i=a^o^n;return 0>i&&(i+=4294967296),i}function u(e,t){var a=y(e,t,1),o=y(e,t,8),n=v(e,t,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function l(e,t){var a=_(e,t,1),o=_(e,t,8),n=S(e,t,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function b(e,t){var a=y(e,t,19),o=y(t,e,29),n=v(e,t,6),i=a^o^n;return 0>i&&(i+=4294967296),i}function h(e,t){var a=_(e,t,19),o=_(t,e,29),n=S(e,t,6),i=a^o^n;return 0>i&&(i+=4294967296),i}var i=e("../utils"),g=e("../common"),m=e("minimalistic-assert"),y=i.rotr64_hi,_=i.rotr64_lo,v=i.shr64_hi,S=i.shr64_lo,k=i.sum64,I=i.sum64_hi,x=i.sum64_lo,w=i.sum64_4_hi,A=i.sum64_4_lo,E=i.sum64_5_hi,P=i.sum64_5_lo,B=g.BlockHash,O=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];i.inherits(r,B),t.exports=r,r.blockSize=1024,r.outSize=512,r.hmacStrength=192,r.padLength=128,r.prototype._prepareBlock=function(e,t){for(var r=this.W,a=0;32>a;a++)r[a]=e[t+a];for(;a>>3},r.g1_256=function(e){return d(e,17)^d(e,19)^e>>>10}},{"../utils":196}],196:[function(e,t,r){"use strict";function a(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function n(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var d=e("minimalistic-assert"),i=e("inherits");r.inherits=i,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(!("string"==typeof e))for(a=0;a>8,i=255&o;n?r.push(n,i):r.push(i)}else if("hex"===t)for(e=e.replace(/[^a-z0-9]+/ig,""),0!=e.length%2&&(e="0"+e),a=0;a>>0}return n},r.split32=function(e,t){for(var r=Array(4*e.length),a=0,o=0,n;a>>24,r[o+1]=255&n>>>16,r[o+2]=255&n>>>8,r[o+3]=255&n):(r[o+3]=n>>>24,r[o+2]=255&n>>>16,r[o+1]=255&n>>>8,r[o]=255&n);return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,a){return e+t+r+a>>>0},r.sum32_5=function(t,r,a,o,n){return t+r+a+o+n>>>0},r.sum64=function(e,t,r,a){var o=e[t],n=e[t+1],i=a+n>>>0,d=(i>>0,e[t+1]=i},r.sum64_hi=function(e,t,r,a){var o=(t+a>>>0>>0},r.sum64_lo=function(e,t,r,a){return t+a>>>0},r.sum64_4_hi=function(e,t,r,a,o,n,i,d){var s=0,c=t;c=c+a>>>0,s+=c>>0,s+=c>>0,s+=c>>0},r.sum64_4_lo=function(e,t,r,a,o,n,i,d){return t+a+n+d>>>0},r.sum64_5_hi=function(e,t,r,a,o,n,i,d,s,c){var f=0,p=t;p=p+a>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0},r.sum64_5_lo=function(e,t,r,a,o,n,i,d,s,c){return t+a+n+d+c>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:197,"minimalistic-assert":209}],197:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],198:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),a=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");n(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,a,i)}var a=e("hash.js"),o=e("minimalistic-crypto-utils"),n=e("minimalistic-assert");t.exports=r,r.prototype._init=function(e,t,r){var a=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},r.prototype.generate=function(e,t,r,a){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(a=r,r=t,t=null),r&&(r=o.toArray(r,a||"hex"),this._update(r));for(var n=[];n.length>1,l=-7,b=a?c-1:0,i=a?-1:1,d=t[r+b],s,e;for(b+=i,s=d&(1<<-l)-1,d>>=-l,l+=f;0>=-l,l+=n;0>1,_=23===u?5.960464477539063e-8-6.617444900424222e-24:0,v=p?0:l-1,i=p?1:-1,d=0>n||0===n&&0>1/n?1:0,S,k,m;for(n=s(n),isNaN(n)||n===Infinity?(k=isNaN(n)?1:0,S=g):(S=h(r(n)/t),1>n*(m=o(2,-S))&&(S--,m*=2),n+=1<=S+y?_/m:_*o(2,1-y),2<=n*m&&(S++,m/=2),S+y>=g?(k=0,S=g):1<=S+y?(k=(n*m-1)*o(2,u),S+=y):(k=n*o(2,y-1)*o(2,u),S=0));8<=u;a[f+v]=255&k,v+=i,k/=256,u-=8);for(S=S<"']/g,pt=RegExp(ct.source),ut=RegExp(ft.source),bt=/<%-([\s\S]+?)%>/g,ht=/<%([\s\S]+?)%>/g,mt=/<%=([\s\S]+?)%>/g,lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gt=/^\w*$/,yt=/^\./,_t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/[\\^$.*+?()[\]{}|]/g,St=RegExp(vt.source),kt=/^\s+|\s+$/g,It=/^\s+/,xt=/\s+$/,wt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,At=/\{\n\/\* \[wrapped with (.+)\] \*/,Et=/,? & /,Pt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Bt=/\\(\\)?/g,Ot=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rt=/\w*$/,jt=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Ct=/^0o[0-7]+$/i,zt=/^(?:0|[1-9]\d*)$/,Mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ut=/($^)/,Lt=/['\n\r\u2028\u2029\\]/g,Dt="\\ud800-\\udfff",qt="\\u2700-\\u27bf",Ht="a-z\\xdf-\\xf6\\xf8-\\xff",Ft="A-Z\\xc0-\\xd6\\xd8-\\xde",Kt="\\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",Vt="['\u2019]",Gt="["+Kt+"]",Wt="["+("\\u0300-\\u036f"+"\\ufe20-\\ufe2f"+"\\u20d0-\\u20ff")+"]",Yt="\\d+",Xt="["+Ht+"]",Zt="[^"+Dt+Kt+Yt+qt+Ht+Ft+"]",Jt="\\ud83c[\\udffb-\\udfff]",Qt="[^"+Dt+"]",$t="(?:\\ud83c[\\udde6-\\uddff]){2}",er="[\\ud800-\\udbff][\\udc00-\\udfff]",tr="["+Ft+"]",rr="(?:"+Xt+"|"+Zt+")",ar="(?:"+Vt+"(?:d|ll|m|re|s|t|ve))?",or="(?:"+Vt+"(?:D|LL|M|RE|S|T|VE))?",nr="(?:"+Wt+"|"+Jt+")"+"?",ir="["+"\\ufe0e\\ufe0f"+"]?",dr="(?:"+"\\u200d"+"(?:"+[Qt,$t,er].join("|")+")"+ir+nr+")*",sr=ir+nr+dr,cr="(?:"+["["+qt+"]",$t,er].join("|")+")"+sr,fr="(?:"+[Qt+Wt+"?",Wt,$t,er,"["+Dt+"]"].join("|")+")",pr=/['’]/g,ur=/[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]/g,lr=RegExp(Jt+"(?="+Jt+")|"+fr+sr,"g"),br=RegExp([tr+"?"+Xt+"+"+ar+"(?="+[Gt,tr,"$"].join("|")+")","(?:"+tr+"|"+Zt+")"+"+"+or+"(?="+[Gt,tr+rr,"$"].join("|")+")",tr+"?"+rr+"+"+ar,tr+"+"+or,"\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)",Yt,cr].join("|"),"g"),hr=/[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/,gr=/[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"],yr=-1,_r={};_r[Je]=_r[Qe]=_r[$e]=_r[et]=_r[tt]=_r[rt]=_r[at]=_r[ot]=_r[nt]=!0,_r[Te]=_r[Ne]=_r[Xe]=_r[Ce]=_r[Ze]=_r[ze]=_r[Me]=_r[Ue]=_r[De]=_r[qe]=_r[He]=_r[Ke]=_r[Ve]=_r[Ge]=_r[Ye]=!1;var vr={};vr[Te]=vr[Ne]=vr[Xe]=vr[Ze]=vr[Ce]=vr[ze]=vr[Je]=vr[Qe]=vr[$e]=vr[et]=vr[tt]=vr[De]=vr[qe]=vr[He]=vr[Ke]=vr[Ve]=vr[Ge]=vr[We]=vr[rt]=vr[at]=vr[ot]=vr[nt]=!0,vr[Me]=vr[Ue]=vr[Ye]=!1;var Sr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kr=parseFloat,Ir=parseInt,xr="object"==typeof e&&e&&e.Object===Object&&e,wr="object"==typeof self&&self&&self.Object===Object&&self,Ar=xr||wr||Function("return this")(),Er="object"==typeof r&&r&&!r.nodeType&&r,Pr=Er&&"object"==typeof t&&t&&!t.nodeType&&t,Br=Pr&&Pr.exports===Er,Or=Br&&xr.process,Rr=function(){try{return Or&&Or.binding&&Or.binding("util")}catch(t){}}(),jr=Rr&&Rr.isArrayBuffer,Tr=Rr&&Rr.isDate,Nr=Rr&&Rr.isMap,Cr=Rr&&Rr.isRegExp,zr=Rr&&Rr.isSet,Mr=Rr&&Rr.isTypedArray,Ur=j("length"),Lr=T({À:"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"}),Dr=T({"&":"&","<":"<",">":">",'"':""","'":"'"}),qr=T({"&":"&","<":"<",">":">",""":"\"","'":"'"}),Hr=function e(t){function r(e){if(Fn(e)&&!js(e)&&!(e instanceof x)){if(e instanceof _)return e;if(Ti.call(e,"__wrapped__"))return ln(e)}return new _(e)}function d(){}function _(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function x(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Re,this.__views__=[]}function T(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function $t(e,t,r,a,o,n){var i=t&ue,d=t&le,c;if(r&&(c=o?r(e,a,o,n):r(e)),void 0!==c)return c;if(!Hn(e))return e;var f=js(e);if(!f){var p=Hd(e),u=p==Ue||p==Le;if(Ns(e))return Ca(e,i);if(p!=He&&p!=Te&&(!u||o)){if(!vr[p])return o?e:{};c=Ho(e,p,$t,i)}else if(c=d||u?{}:qo(e),!i)return d?Za(e,Xt(c,e)):Xa(e,Yt(c,e))}else if(c=Do(e),!i)return Wa(e,c);n||(n=new Pt);var l=n.get(e);if(l)return l;n.set(e,c);var b=t&be?d?Bo:Po:d?oi:ai,h=f?void 0:b(e);return s(h||e,function(a,o){h&&(o=a,a=e[o]),Vt(c,o,$t(a,t,r,o,e,n))}),c}function er(e){var t=ai(e);return function(r){return tr(r,e,t)}}function tr(e,t,r){var a=r.length;if(null==e)return!a;for(e=xi(e);a--;){var o=r[a],n=t[o],i=e[o];if(void 0===i&&!(o in e)||!n(i))return!1}return!0}function rr(e,t,r){if("function"!=typeof e)throw new Ei(ce);return Vd(function(){e.apply(void 0,r)},t)}function ar(e,t,r,a){var o=-1,n=g,i=!0,d=e.length,s=[],c=t.length;if(!d)return s;r&&(t=y(t,L(r))),a?(n=m,i=!1):t.length>=se&&(n=q,i=!1,t=new ie(t));outer:for(;++or&&(r=-r>o?0:o+r),a=void 0===a||a>o?o:Zn(a),0>a&&(a+=o),a=r>a?0:Jn(a);rt}function xr(e,t){return null!=e&&Ti.call(e,t)}function wr(e,t){return null!=e&&t in xi(e)}function Er(e,t,r){return e>=cd(t,r)&&et?r:0,Vo(t,r)?e[t]:void 0}function aa(e,t,r){var a=-1;t=y(t.length?t:[ui],L(jo()));var o=Jr(e,function(e){var r=y(t,function(t){return t(e)});return{criteria:r,index:++a,value:e}});return C(o,function(e,t){return Ka(e,t,r)})}function oa(e,t){return na(e,t,function(t,r){return ri(e,r)})}function na(e,t,r){for(var a=-1,o=t.length,n={};++at||t>Be)return r;do t%2&&(r+=e),t=rd(t/2),t&&(e+=e);while(t);return r}function ua(e,t){return Gd(an(e,t,ui),e+"")}function la(e){return qt(di(e))}function ba(e,t){var r=di(e);return cn(r,Qt(t,0,r.length))}function ha(e,t,r,a){if(!Hn(e))return e;t=Ta(t,e);for(var o=-1,n=t.length,i=e;null!=i&&++ot&&(t=-t>o?0:o+t),r=r>o?o:r,0>r&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var n=_i(o);++a>>1){for(;a>>1,i=e[n];null!==i&&!Wn(i)&&(r?i<=t:i=se){var c=t?null:Ud(e);if(c)return $(c);i=!1,o=q,s=new ie}else s=t?[]:d;outer:for(;++aa)return a?xa(e[0]):[];for(var o=-1,n=_i(a);++o=a?e:ma(e,t,r)}function Ca(e,t){if(t)return e.slice();var r=e.length,a=Fi?Fi(r):new e.constructor(r);return e.copy(a),a}function za(e){var t=new e.constructor(e.byteLength);return new Hi(t).set(new Hi(e)),t}function Ma(e,t){var r=t?za(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Ua(e,t,r){var o=t?r(Z(e),ue):Z(e);return S(o,a,new e.constructor)}function La(e){var t=new e.constructor(e.source,Rt.exec(e));return t.lastIndex=e.lastIndex,t}function Da(e,t,r){var a=t?r($(e),ue):$(e);return S(a,o,new e.constructor)}function qa(e){return Pd?xi(Pd.call(e)):{}}function Ha(e,t){var r=t?za(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Fa(e,t){if(e!==t){var r=void 0!==e,a=null===e,o=e===e,n=Wn(e),i=void 0!==t,d=null===t,s=t===t,c=Wn(t);if(!d&&!c&&!n&&e>t||n&&i&&s&&!d&&!c||a&&i&&s||!r&&s||!o)return 1;if(!a&&!n&&!c&&e=d)return s;var c=r[a];return s*("desc"==c?-1:1)}return e.index-t.index}function Va(e,t,r,a){for(var o=-1,n=e.length,i=r.length,d=-1,s=t.length,c=sd(n-i,0),f=_i(s+c),p=!a;++do?void 0:n,o=1),t=xi(t);++ai&&d[0]!==c&&d[i-1]!==c?[]:Q(d,c);if(i-=f.length,ir)return r?pa(t,e):t;var a=pa(t,td(e/ae(t)));return W(t)?Na(oe(a),0,e).join(""):a.slice(0,e)}function bo(e,t,r,a){function o(){for(var t=-1,s=arguments.length,c=-1,f=a.length,p=_i(f+s),u=this&&this!==Ar&&this instanceof o?d:e;++cd))return!1;var c=n.get(e);if(c&&n.get(t))return c==t;var f=-1,p=!0,u=r&ge?new ie:void 0;for(n.set(e,t),n.set(t,e);++ft.length?e:br(e,ma(t,0,-1))}function nn(e,t){for(var r=e.length,a=cd(t.length,r),o=Wa(e),n;a--;)n=t[a],e[a]=Vo(n,r)?o[n]:void 0;return e}function dn(e,t,r){var a=t+"";return Gd(e,Fo(a,un(Uo(a),r)))}function sn(e){var t=0,r=0;return function(){var a=fd(),o=16-(a-r);if(r=a,!(0=800)return arguments[0];return e.apply(void 0,arguments)}}function cn(e,t){var r=-1,a=e.length;for(t=void 0===t?a:t;++ro&&(o=sd(a+o,0)),E(e,jo(t,3),o)}function hn(e,t,r){var a=null==e?0:e.length;if(!a)return-1;var o=a-1;return void 0!==r&&(o=Zn(r),o=0>r?sd(a+o,0):cd(o,a-1)),E(e,jo(t,3),o,!0)}function gn(e){var t=null==e?0:e.length;return t?sr(e,1):[]}function mn(e){return e&&e.length?e[0]:void 0}function yn(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}function _n(e,t){return e&&e.length&&t&&t.length?da(e,t):e}function vn(e){return null==e?e:ld.call(e)}function Sn(e){if(!(e&&e.length))return[];var t=0;return e=b(e,function(e){if(Mn(e))return t=sd(e.length,t),!0}),M(t,function(t){return y(e,j(t))})}function kn(e,t){if(!(e&&e.length))return[];var r=Sn(e);return null==t?r:y(r,function(e){return n(t,void 0,e)})}function In(e){var t=r(e);return t.__chain__=!0,t}function xn(e,t){return t(e)}function wn(e,t){var r=js(e)?s:Rd;return r(e,jo(t,3))}function An(e,t){var r=js(e)?c:jd;return r(e,jo(t,3))}function En(e,t){var r=js(e)?y:Jr;return r(e,jo(t,3))}function Pn(e,t,r){return t=r?void 0:t,t=e&&null==t?e.length:t,vo(e,xe,void 0,void 0,void 0,void 0,t)}function Bn(e,t){var r;if("function"!=typeof t)throw new Ei(ce);return e=Zn(e),function(){return 0<--e&&(r=t.apply(this,arguments)),1>=e&&(t=void 0),r}}function On(e,t,r){t=r?void 0:t;var a=vo(e,ve,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=On.placeholder,a}function Rn(e,t,r){t=r?void 0:t;var a=vo(e,Se,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=Rn.placeholder,a}function jn(e,t,r){function a(t){var r=b,a=h;return b=h=void 0,f=t,m=e.apply(a,r),m}function o(e){return f=e,y=Vd(d,t),p?a(e):m}function n(e){var r=e-_,a=e-f,o=t-r;return u?cd(o,g-a):o}function i(e){var r=e-_,a=e-f;return void 0==_||r>=t||0>r||u&&a>=g}function d(){var e=vs();return i(e)?s(e):void(y=Vd(d,n(e)))}function s(e){return(y=void 0,l&&b)?a(e):(b=h=void 0,m)}function c(){var e=vs(),r=i(e);if(b=arguments,h=this,_=e,r){if(void 0===y)return o(_);if(u)return y=Vd(d,t),a(_)}return void 0===y&&(y=Vd(d,t)),m}var f=0,p=!1,u=!1,l=!0,b,h,g,m,y,_;if("function"!=typeof e)throw new Ei(ce);return t=Qn(t)||0,Hn(r)&&(p=!!r.leading,u="maxWait"in r,g=u?sd(Qn(r.maxWait)||0,t):g,l="trailing"in r?!!r.trailing:l),c.cancel=function(){void 0!==y&&Md(y),f=0,b=_=h=y=void 0},c.flush=function(){return void 0===y?m:s(vs())},c}function Tn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ei(ce);var r=function(){var a=arguments,o=t?t.apply(this,a):a[0],n=r.cache;if(n.has(o))return n.get(o);var i=e.apply(this,a);return r.cache=n.set(o,i)||n,i};return r.cache=new(Tn.Cache||ne),r}function Nn(e){if("function"!=typeof e)throw new Ei(ce);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2]);}return!e.apply(this,t)}}function Cn(e,t){return e===t||e!==e&&t!==t}function zn(e){return null!=e&&qn(e.length)&&!Ln(e)}function Mn(e){return Fn(e)&&zn(e)}function Un(e){if(!Fn(e))return!1;var t=gr(e);return t==Me||t=="[object DOMException]"||"string"==typeof e.message&&"string"==typeof e.name&&!Vn(e)}function Ln(e){if(!Hn(e))return!1;var t=gr(e);return t==Ue||t==Le||t=="[object AsyncFunction]"||t=="[object Proxy]"}function Dn(e){return"number"==typeof e&&e==Zn(e)}function qn(e){return"number"==typeof e&&-1e?-1:1;return t*1.7976931348623157e308}return e===e?e:0}function Zn(e){var t=Xn(e),r=t%1;return t===t?r?t-r:t:0}function Jn(e){return e?Qt(Zn(e),0,Re):0}function Qn(e){if("number"==typeof e)return e;if(Wn(e))return Oe;if(Hn(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Hn(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(kt,"");var r=Tt.test(e);return r||Ct.test(e)?Ir(e.slice(2),r?2:8):jt.test(e)?Oe:+e}function $n(e){return Ya(e,oi(e))}function ei(e){return null==e?"":Ia(e)}function ti(e,t,r){var a=null==e?void 0:br(e,t);return void 0===a?r:a}function ri(e,t){return null!=e&&Lo(e,t,wr)}function ai(e){return zn(e)?Dt(e):Yr(e)}function oi(e){return zn(e)?Dt(e,!0):Xr(e)}function ni(e,t){if(null==e)return{};var r=y(Bo(e),function(e){return[e]});return t=jo(t),na(e,r,function(e,r){return t(e,r[0])})}function ii(e,t,r){t=Ta(t,e);var a=-1,o=t.length;for(o||(o=1,e=void 0);++ar)return!1;var a=t.length-1;return r==a?t.pop():Wi.call(t,r,1),--this.size,!0},te.prototype.get=function(e){var t=this.__data__,r=Gt(t,e);return 0>r?void 0:t[r][1]},te.prototype.has=function(e){return-1a?(++this.size,r.push([e,t])):r[a][1]=t,this},ne.prototype.clear=function(){this.size=0,this.__data__={hash:new T,map:new(hd||te),string:new T}},ne.prototype["delete"]=function(e){var t=To(this,e)["delete"](e);return this.size-=t?1:0,t},ne.prototype.get=function(e){return To(this,e).get(e)},ne.prototype.has=function(e){return To(this,e).has(e)},ne.prototype.set=function(e,t){var r=To(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this},ie.prototype.add=ie.prototype.push=function(e){return this.__data__.set(e,fe),this},ie.prototype.has=function(e){return this.__data__.has(e)},Pt.prototype.clear=function(){this.__data__=new te,this.size=0},Pt.prototype["delete"]=function(e){var t=this.__data__,r=t["delete"](e);return this.size=t.size,r},Pt.prototype.get=function(e){return this.__data__.get(e)},Pt.prototype.has=function(e){return this.__data__.has(e)},Pt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof te){var a=r.__data__;if(!hd||a.length=t}),Rs=Ur(function(){return arguments}())?Ur:function(e){return Fn(e)&&Ti.call(e,"callee")&&!Gi.call(e,"callee")},js=_i.isArray,Ts=jr?L(jr):function(e){return Fn(e)&&gr(e)==Xe},Ns=od||yi,Cs=Tr?L(Tr):function(e){return Fn(e)&&gr(e)==ze},zs=Nr?L(Nr):function(e){return Fn(e)&&Hd(e)==De},Ms=Cr?L(Cr):function(e){return Fn(e)&&gr(e)==Ke},Us=zr?L(zr):function(e){return Fn(e)&&Hd(e)==Ve},Ls=Mr?L(Mr):function(e){return Fn(e)&&qn(e.length)&&!!_r[gr(e)]},Ds=go(Zr),qs=go(function(e,t){return e<=t}),Hs=Qa(function(e,t){if(Jo(t)||zn(t))return void Ya(t,ai(t),e);for(var r in t)Ti.call(t,r)&&Vt(e,r,t[r])}),Fs=Qa(function(e,t){Ya(t,oi(t),e)}),Ks=Qa(function(e,t,r,a){Ya(t,oi(t),e,a)}),Vs=Qa(function(e,t,r,a){Ya(t,ai(t),e,a)}),Gs=Eo(Jt),Ws=ua(function(e){return e.push(void 0,So),n(Ks,void 0,e)}),Ys=ua(function(e){return e.push(void 0,ko),n($s,void 0,e)}),Xs=fo(function(e,t,r){e[t]=r},pi(ui)),Zs=fo(function(e,t,r){Ti.call(e,t)?e[t].push(r):e[t]=[r]},jo),Js=ua(Rr),Qs=Qa(function(e,t,r){ea(e,t,r)}),$s=Qa(function(e,t,r,a){ea(e,t,r,a)}),ec=Eo(function(e,t){var r={};if(null==e)return r;var a=!1;t=y(t,function(t){return t=Ta(t,e),a||(a=1--e)return t.apply(this,arguments)}},r.ary=Pn,r.assign=Hs,r.assignIn=Fs,r.assignInWith=Ks,r.assignWith=Vs,r.at=Gs,r.before=Bn,r.bind=Ss,r.bindAll=lc,r.bindKey=ks,r.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},r.chain=In,r.chunk=function(e,t,r){t=(r?Go(e,t,r):void 0===t)?1:sd(Zn(t),0);var a=null==e?0:e.length;if(!a||1>t)return[];for(var o=0,n=0,i=_i(td(a/t));ot?0:t,a)):[]},r.dropRight=function(e,t,r){var a=null==e?0:e.length;return a?(t=r||void 0===t?1:Zn(t),t=a-t,ma(e,0,0>t?0:t)):[]},r.dropRightWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!0,!0):[]},r.dropWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!0):[]},r.fill=function(e,t,r,a){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&Go(e,t,r)&&(r=0,a=o),ir(e,t,r,a)):[]},r.filter=function(e,t){var r=js(e)?b:dr;return r(e,jo(t,3))},r.flatMap=function(e,t){return sr(En(e,t),1)},r.flatMapDeep=function(e,t){return sr(En(e,t),Pe)},r.flatMapDepth=function(e,t,r){return r=void 0===r?1:Zn(r),sr(En(e,t),r)},r.flatten=gn,r.flattenDeep=function(e){var t=null==e?0:e.length;return t?sr(e,Pe):[]},r.flattenDepth=function(e,t){var r=null==e?0:e.length;return r?(t=void 0===t?1:Zn(t),sr(e,t)):[]},r.flip=function(e){return vo(e,Ae)},r.flow=bc,r.flowRight=hc,r.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,a={},o;++t>>0,!r)?[]:(e=ei(e),e&&("string"==typeof t||null!=t&&!Ms(t))&&(t=Ia(t),!t&&W(e))?Na(oe(e),0,r):e.split(t,r))},r.spread=function(e,t){if("function"!=typeof e)throw new Ei(ce);return t=null==t?0:sd(Zn(t),0),ua(function(r){var a=r[t],o=Na(r,0,t);return a&&v(o,a),n(e,this,o)})},r.tail=function(e){var t=null==e?0:e.length;return t?ma(e,1,t):[]},r.take=function(e,t,r){return e&&e.length?(t=r||void 0===t?1:Zn(t),ma(e,0,0>t?0:t)):[]},r.takeRight=function(e,t,r){var a=null==e?0:e.length;return a?(t=r||void 0===t?1:Zn(t),t=a-t,ma(e,0>t?0:t,a)):[]},r.takeRightWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!1,!0):[]},r.takeWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3)):[]},r.tap=function(e,t){return t(e),e},r.throttle=function(e,t,r){var a=!0,o=!0;if("function"!=typeof e)throw new Ei(ce);return Hn(r)&&(a="leading"in r?!!r.leading:a,o="trailing"in r?!!r.trailing:o),jn(e,t,{leading:a,maxWait:t,trailing:o})},r.thru=xn,r.toArray=Yn,r.toPairs=rc,r.toPairsIn=ac,r.toPath=function(e){return js(e)?y(e,fn):Wn(e)?[e]:Wa(Wd(ei(e)))},r.toPlainObject=$n,r.transform=function(e,t,r){var a=js(e),o=a||Ns(e)||Ls(e);if(t=jo(t,4),null==r){var n=e&&e.constructor;r=o?a?new n:[]:Hn(e)?Ln(n)?Od(Ki(e)):{}:{}}return(o?s:cr)(e,function(e,a,o){return t(r,e,a,o)}),r},r.unary=function(e){return Pn(e,1)},r.union=rs,r.unionBy=as,r.unionWith=os,r.uniq=function(e){return e&&e.length?xa(e):[]},r.uniqBy=function(e,t){return e&&e.length?xa(e,jo(t,2)):[]},r.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?xa(e,void 0,t):[]},r.unset=function(e,t){return null==e||wa(e,t)},r.unzip=Sn,r.unzipWith=kn,r.update=function(e,t,r){return null==e?e:Aa(e,t,ja(r))},r.updateWith=function(e,t,r,a){return a="function"==typeof a?a:void 0,null==e?e:Aa(e,t,ja(r),a)},r.values=di,r.valuesIn=function(e){return null==e?[]:D(e,oi(e))},r.without=ns,r.words=fi,r.wrap=function(e,t){return As(ja(t),e)},r.xor=is,r.xorBy=ds,r.xorWith=ss,r.zip=cs,r.zipObject=function(e,t){return Oa(e||[],t||[],Vt)},r.zipObjectDeep=function(e,t){return Oa(e||[],t||[],ha)},r.zipWith=fs,r.entries=rc,r.entriesIn=ac,r.extend=Fs,r.extendWith=Ks,bi(r,r),r.add=Ic,r.attempt=uc,r.camelCase=oc,r.capitalize=si,r.ceil=xc,r.clamp=function(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=Qn(r),r=r===r?r:0),void 0!==t&&(t=Qn(t),t=t===t?t:0),Qt(Qn(e),t,r)},r.clone=function(e){return $t(e,be)},r.cloneDeep=function(e){return $t(e,ue|be)},r.cloneDeepWith=function(e,t){return t="function"==typeof t?t:void 0,$t(e,ue|be,t)},r.cloneWith=function(e,t){return t="function"==typeof t?t:void 0,$t(e,be,t)},r.conformsTo=function(e,t){return null==t||tr(e,t,ai(t))},r.deburr=ci,r.defaultTo=function(e,t){return null==e||e!==e?t:e},r.divide=wc,r.endsWith=function(e,t,r){e=ei(e),t=Ia(t);var a=e.length;r=void 0===r?a:Qt(Zn(r),0,a);var o=r;return r-=t.length,0<=r&&e.slice(r,o)==t},r.eq=Cn,r.escape=function(e){return e=ei(e),e&&ut.test(e)?e.replace(ft,Dr):e},r.escapeRegExp=function(e){return e=ei(e),e&&St.test(e)?e.replace(vt,"\\$&"):e},r.every=function(e,t,r){var a=js(e)?l:or;return r&&Go(e,t,r)&&(t=void 0),a(e,jo(t,3))},r.find=ls,r.findIndex=bn,r.findKey=function(e,t){return A(e,jo(t,3),cr)},r.findLast=bs,r.findLastIndex=hn,r.findLastKey=function(e,t){return A(e,jo(t,3),fr)},r.floor=Ac,r.forEach=wn,r.forEachRight=An,r.forIn=function(e,t){return null==e?e:Td(e,jo(t,3),oi)},r.forInRight=function(e,t){return null==e?e:Nd(e,jo(t,3),oi)},r.forOwn=function(e,t){return e&&cr(e,jo(t,3))},r.forOwnRight=function(e,t){return e&&fr(e,jo(t,3))},r.get=ti,r.gt=Bs,r.gte=Os,r.has=function(e,t){return null!=e&&Lo(e,t,xr)},r.hasIn=ri,r.head=mn,r.identity=ui,r.includes=function(e,t,r,a){e=zn(e)?e:di(e),r=r&&!a?Zn(r):0;var o=e.length;return 0>r&&(r=sd(o+r,0)),Gn(e)?r<=o&&-1o&&(o=sd(a+o,0)),P(e,t,o)},r.inRange=function(e,t,r){return t=Xn(t),void 0===r?(r=t,t=0):r=Xn(r),e=Qn(e),Er(e,t,r)},r.invoke=Js,r.isArguments=Rs,r.isArray=js,r.isArrayBuffer=Ts,r.isArrayLike=zn,r.isArrayLikeObject=Mn,r.isBoolean=function(e){return!0===e||!1===e||Fn(e)&&gr(e)==Ce},r.isBuffer=Ns,r.isDate=Cs,r.isElement=function(e){return Fn(e)&&1===e.nodeType&&!Vn(e)},r.isEmpty=function(e){if(null==e)return!0;if(zn(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Ns(e)||Ls(e)||Rs(e)))return!e.length;var t=Hd(e);if(t==De||t==Ve)return!e.size;if(Jo(e))return!Yr(e).length;for(var r in e)if(Ti.call(e,r))return!1;return!0},r.isEqual=function(e,t){return Fr(e,t)},r.isEqualWith=function(e,t,r){r="function"==typeof r?r:void 0;var a=r?r(e,t):void 0;return void 0===a?Fr(e,t,void 0,r):!!a},r.isError=Un,r.isFinite=function(e){return"number"==typeof e&&nd(e)},r.isFunction=Ln,r.isInteger=Dn,r.isLength=qn,r.isMap=zs,r.isMatch=function(e,t){return e===t||Vr(e,t,No(t))},r.isMatchWith=function(e,t,r){return r="function"==typeof r?r:void 0,Vr(e,t,No(t),r)},r.isNaN=function(e){return Kn(e)&&e!=+e},r.isNative=function(e){if(Fd(e))throw new Si("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Gr(e)},r.isNil=function(e){return null==e},r.isNull=function(e){return null===e},r.isNumber=Kn,r.isObject=Hn,r.isObjectLike=Fn,r.isPlainObject=Vn,r.isRegExp=Ms,r.isSafeInteger=function(e){return Dn(e)&&e>=-Be&&e<=Be},r.isSet=Us,r.isString=Gn,r.isSymbol=Wn,r.isTypedArray=Ls,r.isUndefined=function(e){return void 0===e},r.isWeakMap=function(e){return Fn(e)&&Hd(e)==Ye},r.isWeakSet=function(e){return Fn(e)&&gr(e)=="[object WeakSet]"},r.join=function(e,t){return null==e?"":id.call(e,t)},r.kebabCase=nc,r.last=yn,r.lastIndexOf=function(e,t,r){var a=null==e?0:e.length;if(!a)return-1;var o=a;return void 0!==r&&(o=Zn(r),o=0>o?sd(a+o,0):cd(o,a-1)),t===t?re(e,t,o):E(e,O,o,!0)},r.lowerCase=ic,r.lowerFirst=dc,r.lt=Ds,r.lte=qs,r.max=function(e){return e&&e.length?nr(e,ui,Sr):void 0},r.maxBy=function(e,t){return e&&e.length?nr(e,jo(t,2),Sr):void 0},r.mean=function(e){return R(e,ui)},r.meanBy=function(e,t){return R(e,jo(t,2))},r.min=function(e){return e&&e.length?nr(e,ui,Zr):void 0},r.minBy=function(e,t){return e&&e.length?nr(e,jo(t,2),Zr):void 0},r.stubArray=mi,r.stubFalse=yi,r.stubObject=function(){return{}},r.stubString=function(){return""},r.stubTrue=function(){return!0},r.multiply=Ec,r.nth=function(e,t){return e&&e.length?ra(e,Zn(t)):void 0},r.noConflict=function(){return Ar._===this&&(Ar._=Ui),this},r.noop=hi,r.now=vs,r.pad=function(e,t,r){e=ei(e),t=Zn(t);var a=t?ae(e):0;if(!t||a>=t)return e;var o=(t-a)/2;return lo(rd(o),r)+e+lo(td(o),r)},r.padEnd=function(e,t,r){e=ei(e),t=Zn(t);var a=t?ae(e):0;return t&&at){var a=e;e=t,t=a}if(r||e%1||t%1){var o=ud();return cd(e+o*(t-e+kr("1e-"+((o+"").length-1))),t)}return ca(e,t)},r.reduce=function(e,t,r){var a=js(e)?S:N,o=3>arguments.length;return a(e,jo(t,4),r,o,Rd)},r.reduceRight=function(e,t,r){var a=js(e)?k:N,o=3>arguments.length;return a(e,jo(t,4),r,o,jd)},r.repeat=function(e,t,r){return t=(r?Go(e,t,r):void 0===t)?1:Zn(t),pa(ei(e),t)},r.replace=function(){var e=arguments,t=ei(e[0]);return 3>e.length?t:t.replace(e[1],e[2])},r.result=ii,r.round=Pc,r.runInContext=e,r.sample=function(e){var t=js(e)?qt:la;return t(e)},r.size=function(e){if(null==e)return 0;if(zn(e))return Gn(e)?ae(e):e.length;var t=Hd(e);return t==De||t==Ve?e.size:Yr(e).length},r.snakeCase=sc,r.some=function(e,t,r){var a=js(e)?I:ya;return r&&Go(e,t,r)&&(t=void 0),a(e,jo(t,3))},r.sortedIndex=function(e,t){return _a(e,t)},r.sortedIndexBy=function(e,t,r){return va(e,t,jo(r,2))},r.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var a=_a(e,t);if(ae||e>Be)return[];var r=Re,a=cd(e,Re);t=jo(t),e-=Re;for(var o=M(a,t);++r=n)return e;var d=r-ae(a);if(1>d)return a;var s=i?Na(i,0,d).join(""):e.slice(0,d);if(void 0===o)return s+a;if(i&&(d+=s.length-d),Ms(o)){if(e.slice(d).search(o)){var c=s,f;for(o.global||(o=wi(o.source,ei(Rt.exec(o))+"g")),o.lastIndex=0;f=o.exec(c);)var p=f.index;s=s.slice(0,void 0===p?d:p)}}else if(e.indexOf(Ia(o),d)!=d){var u=s.lastIndexOf(o);-1a.__dir__?"Right":"")}),a},x.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),s(["filter","map","takeWhile"],function(e,t){var r=t+1;x.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:jo(e,3),type:r}),t.__filtered__=t.__filtered__||r==Ee||r==3,t}}),s(["head","last"],function(e,t){var r="take"+(t?"Right":"");x.prototype[e]=function(){return this[r](1).value()[0]}}),s(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");x.prototype[e]=function(){return this.__filtered__?new x(this):this[r](1)}}),x.prototype.compact=function(){return this.filter(ui)},x.prototype.find=function(e){return this.filter(e).head()},x.prototype.findLast=function(e){return this.reverse().find(e)},x.prototype.invokeMap=ua(function(e,t){return"function"==typeof e?new x(this):this.map(function(r){return Rr(r,e,t)})}),x.prototype.reject=function(e){return this.filter(Nn(jo(e)))},x.prototype.slice=function(e,t){e=Zn(e);var r=this;return r.__filtered__&&(0t)?new x(r):(0>e?r=r.takeRight(-e):e&&(r=r.drop(e)),void 0!==t&&(t=Zn(t),r=0>t?r.dropRight(-t):r.take(t-e)),r)},x.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},x.prototype.toArray=function(){return this.take(Re)},cr(x.prototype,function(e,t){var a=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),n=r[o?"take"+("last"==t?"Right":""):t],i=o||/^find/.test(t);n&&(r.prototype[t]=function(){var t=this.__wrapped__,d=o?[1]:arguments,s=t instanceof x,c=d[0],f=s||js(t),p=function(e){var t=n.apply(r,v([e],d));return o&&u?t[0]:t};f&&a&&"function"==typeof c&&1!=c.length&&(s=f=!1);var u=this.__chain__,l=!!this.__actions__.length,b=i&&!u,h=s&&!l;if(!i&&f){t=h?t:new x(this);var g=e.apply(t,d);return g.__actions__.push({func:xn,args:[p],thisArg:void 0}),new _(g,u)}return b&&h?e.apply(this,d):(g=this.thru(p),b?o?g.value()[0]:g.value():g)})}),s(["pop","push","shift","sort","splice","unshift"],function(e){var t=Pi[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);r.prototype[e]=function(){var e=arguments;if(o&&!this.__chain__){var r=this.value();return t.apply(js(r)?r:[],e)}return this[a](function(r){return t.apply(js(r)?r:[],e)})}}),cr(x.prototype,function(e,t){var a=r[t];if(a){var o=a.name+"",n=Sd[o]||(Sd[o]=[]);n.push({name:t,func:a})}}),Sd[co(void 0,ye).name]=[{name:"wrapper",func:void 0}],x.prototype.clone=function(){var e=new x(this.__wrapped__);return e.__actions__=Wa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Wa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Wa(this.__views__),e},x.prototype.reverse=function(){if(this.__filtered__){var e=new x(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},x.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=js(e),a=0>t,o=r?e.length:0,n=Mo(0,o,this.__views__),i=n.start,d=n.end,s=d-i,c=a?d:i-1,f=this.__iteratees__,p=f.length,u=0,l=cd(s,this.__takeCount__);if(!r||!a&&o==s&&l==s)return Pa(e,this.__actions__);var b=[];outer:for(;s--&&u=this.__values__.length,t=e?void 0:this.__values__[this.__index__++];return{done:e,value:t}},r.prototype.plant=function(e){for(var t=this,r,a;t instanceof d;){a=ln(t),a.__index__=0,a.__values__=void 0,r?o.__wrapped__=a:r=a;var o=a;t=t.__wrapped__}return o.__wrapped__=e,r},r.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof x){var t=e;return this.__actions__.length&&(t=new x(this)),t=t.reverse(),t.__actions__.push({func:xn,args:[vn],thisArg:void 0}),new _(t,this.__chain__)}return this.thru(vn)},r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=function(){return Pa(this.__wrapped__,this.__actions__)},r.prototype.first=r.prototype.head,Xi&&(r.prototype[Xi]=function(){return this}),r}();"function"==typeof d&&"object"==typeof d.amd&&d.amd?(Ar._=Hr,d(function(){return Hr})):Pr?((Pr.exports=Hr)._=Hr,Er._=Hr):Ar._=Hr}).call(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],205:[function(e,t){(function(r){"use strict";function a(){d.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function o(e,t){return e<>>32-t}function n(e,t,r,a,n,i,d){return 0|o(0|e+(t&r|~t&a)+n+i,d)+t}function s(e,t,r,a,n,i,c){return 0|o(0|e+(t&a|r&~a)+n+i,c)+t}function f(e,t,r,a,n,i,d){return 0|o(0|e+(t^r^a)+n+i,d)+t}function p(e,t,r,a,n,i,c){return 0|o(0|e+(r^(t|~a))+n+i,c)+t}var i=e("inherits"),d=e("hash-base"),c=Array(16);i(a,d),a.prototype._update=function(){for(var e=c,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,o=this._c,i=this._d;r=n(r,a,o,i,e[0],3614090360,7),i=n(i,r,a,o,e[1],3905402710,12),o=n(o,i,r,a,e[2],606105819,17),a=n(a,o,i,r,e[3],3250441966,22),r=n(r,a,o,i,e[4],4118548399,7),i=n(i,r,a,o,e[5],1200080426,12),o=n(o,i,r,a,e[6],2821735955,17),a=n(a,o,i,r,e[7],4249261313,22),r=n(r,a,o,i,e[8],1770035416,7),i=n(i,r,a,o,e[9],2336552879,12),o=n(o,i,r,a,e[10],4294925233,17),a=n(a,o,i,r,e[11],2304563134,22),r=n(r,a,o,i,e[12],1804603682,7),i=n(i,r,a,o,e[13],4254626195,12),o=n(o,i,r,a,e[14],2792965006,17),a=n(a,o,i,r,e[15],1236535329,22),r=s(r,a,o,i,e[1],4129170786,5),i=s(i,r,a,o,e[6],3225465664,9),o=s(o,i,r,a,e[11],643717713,14),a=s(a,o,i,r,e[0],3921069994,20),r=s(r,a,o,i,e[5],3593408605,5),i=s(i,r,a,o,e[10],38016083,9),o=s(o,i,r,a,e[15],3634488961,14),a=s(a,o,i,r,e[4],3889429448,20),r=s(r,a,o,i,e[9],568446438,5),i=s(i,r,a,o,e[14],3275163606,9),o=s(o,i,r,a,e[3],4107603335,14),a=s(a,o,i,r,e[8],1163531501,20),r=s(r,a,o,i,e[13],2850285829,5),i=s(i,r,a,o,e[2],4243563512,9),o=s(o,i,r,a,e[7],1735328473,14),a=s(a,o,i,r,e[12],2368359562,20),r=f(r,a,o,i,e[5],4294588738,4),i=f(i,r,a,o,e[8],2272392833,11),o=f(o,i,r,a,e[11],1839030562,16),a=f(a,o,i,r,e[14],4259657740,23),r=f(r,a,o,i,e[1],2763975236,4),i=f(i,r,a,o,e[4],1272893353,11),o=f(o,i,r,a,e[7],4139469664,16),a=f(a,o,i,r,e[10],3200236656,23),r=f(r,a,o,i,e[13],681279174,4),i=f(i,r,a,o,e[0],3936430074,11),o=f(o,i,r,a,e[3],3572445317,16),a=f(a,o,i,r,e[6],76029189,23),r=f(r,a,o,i,e[9],3654602809,4),i=f(i,r,a,o,e[12],3873151461,11),o=f(o,i,r,a,e[15],530742520,16),a=f(a,o,i,r,e[2],3299628645,23),r=p(r,a,o,i,e[0],4096336452,6),i=p(i,r,a,o,e[7],1126891415,10),o=p(o,i,r,a,e[14],2878612391,15),a=p(a,o,i,r,e[5],4237533241,21),r=p(r,a,o,i,e[12],1700485571,6),i=p(i,r,a,o,e[3],2399980690,10),o=p(o,i,r,a,e[10],4293915773,15),a=p(a,o,i,r,e[1],2240044497,21),r=p(r,a,o,i,e[8],1873313359,6),i=p(i,r,a,o,e[15],4264355552,10),o=p(o,i,r,a,e[6],2734768916,15),a=p(a,o,i,r,e[13],1309151649,21),r=p(r,a,o,i,e[4],4149444226,6),i=p(i,r,a,o,e[11],3174756917,10),o=p(o,i,r,a,e[2],718787259,15),a=p(a,o,i,r,e[9],3951481745,21),this._a=0|this._a+r,this._b=0|this._b+a,this._c=0|this._c+o,this._d=0|this._d+i},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},{inherits:201,"safe-buffer":251,stream:260}],207:[function(e,t){function r(e){this.rand=e||new a.Rand}var o=e("bn.js"),a=e("brorand");t.exports=r,r.create=function(e){return new r(e)},r.prototype._randbelow=function(e){var t=e.bitLength(),r=p(t/8);do var n=new o(this.rand.generate(r));while(0<=n.cmp(e));return n},r.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},r.prototype.test=function(e,t,r){var n=e.bitLength(),c=o.mont(e),p=new o(1).toRed(c);t||(t=f(1,0|n/48));for(var u=e.subn(1),l=0;!u.testn(l);l++);for(var s=e.shrn(l),d=u.toRed(c),b=!0;0>8,i=255&o;n?r.push(n,i):r.push(i)}return r},n.zero2=a,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],211:[function(e,t){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],212:[function(e,t,r){"use strict";var a=e("asn1.js");r.certificate=e("./certificate");var o=a.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=o;var n=a.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=n;var i=a.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(d),this.key("subjectPublicKey").bitstr())});r.PublicKey=i;var d=a.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),s=a.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(d),this.key("subjectPrivateKey").octstr())});r.PrivateKey=s;var c=a.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=c;var f=a.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=f,r.DSAparam=a.define("DSAparam",function(){this.int()});var p=a.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(u),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=p;var u=a.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=a.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":213,"asn1.js":57}],213:[function(e,t){"use strict";var r=e("asn1.js"),a=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),n=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),i=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())}),d=r.define("RelativeDistinguishedName",function(){this.setof(o)}),s=r.define("RDNSequence",function(){this.seqof(d)}),c=r.define("Name",function(){this.choice({rdnSequence:this.use(s)})}),f=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(a),this.key("notAfter").use(a))}),p=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),u=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(n),this.key("issuer").use(c),this.key("validity").use(f),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(i),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(p).optional())}),l=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(u),this.key("signatureAlgorithm").use(n),this.key("signatureValue").bitstr())});t.exports=l},{"asn1.js":57}],214:[function(e,t){(function(r){var a=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,n=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,i=e("evp_bytestokey"),d=e("browserify-aes");t.exports=function(e,t){var s=e.toString(),c=s.match(a),f;if(!c){var p=s.match(n);f=new r(p[2].replace(/\r?\n/g,""),"base64")}else{var u="aes"+c[1],l=new r(c[2],"hex"),b=new r(c[3].replace(/\r?\n/g,""),"base64"),h=i(t,l.slice(0,8),parseInt(c[1],10)).key,g=[],m=d.createDecipheriv(u,h,l);g.push(m.update(b)),g.push(m.final()),f=r.concat(g)}var y=s.match(o)[1];return{tag:y,data:f}}}).call(this,e("buffer").Buffer)},{"browserify-aes":80,buffer:126,evp_bytestokey:183}],215:[function(e,t){(function(r){function a(e){var t;"object"!=typeof e||r.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new r(e));var a=d(e,t),i=a.tag,s=a.data,c,f;switch(i){case"CERTIFICATE":f=n.certificate.decode(s,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=n.PublicKey.decode(s,"der")),c=f.algorithm.algorithm.join("."),c){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(f.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return f.subjectPrivateKey=f.subjectPublicKey,{type:"ec",data:f};case"1.2.840.10040.4.1":return f.algorithm.params.pub_key=n.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+c);}throw new Error("unknown key type "+i);case"ENCRYPTED PRIVATE KEY":s=n.EncryptedPrivateKey.decode(s,"der"),s=o(s,t);case"PRIVATE KEY":switch(f=n.PrivateKey.decode(s,"der"),c=f.algorithm.algorithm.join("."),c){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:n.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=n.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+c);}throw new Error("unknown key type "+i);case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(s,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(s,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(s,"der")};case"EC PRIVATE KEY":return s=n.ECPrivateKey.decode(s,"der"),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error("unknown key type "+i);}}function o(e,t){var a=e.algorithm.decrypt.kde.kdeparams.salt,o=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=i[e.algorithm.decrypt.cipher.algo.join(".")],d=e.algorithm.decrypt.cipher.iv,f=e.subjectPrivateKey,p=parseInt(n.split("-")[1],10)/8,u=c.pbkdf2Sync(t,a,o,p),l=s.createDecipheriv(n,u,d),b=[];return b.push(l.update(f)),b.push(l.final()),r.concat(b)}var n=e("./asn1"),i=e("./aesid.json"),d=e("./fixProc"),s=e("browserify-aes"),c=e("pbkdf2");t.exports=a,a.signature=n.signature}).call(this,e("buffer").Buffer)},{"./aesid.json":211,"./asn1":212,"./fixProc":214,"browserify-aes":80,buffer:126,pbkdf2:216}],216:[function(e,t,r){r.pbkdf2=e("./lib/async"),r.pbkdf2Sync=e("./lib/sync")},{"./lib/async":217,"./lib/sync":220}],217:[function(e,t){(function(r,a){function o(e){if(a.process&&!a.process.browser)return Promise.resolve(!1);if(!p||!p.importKey||!p.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];b=b||f.alloc(8);var t=n(b,b,10,128,e).then(function(){return!0}).catch(function(){return!1});return l[e]=t,t}function n(e,t,r,a,o){return p.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return p.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:o}},e,a<<3)}).then(function(e){return f.from(e)})}function i(e,t){e.then(function(e){r.nextTick(function(){t(null,e)})},function(a){r.nextTick(function(){t(a)})})}var d=e("./precondition"),s=e("./default-encoding"),c=e("./sync"),f=e("safe-buffer").Buffer,p=a.crypto&&a.crypto.subtle,u={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[],b;t.exports=function(e,t,p,l,b,h){if(f.isBuffer(e)||(e=f.from(e,s)),f.isBuffer(t)||(t=f.from(t,s)),d(p,l),"function"==typeof b&&(h=b,b=void 0),"function"!=typeof h)throw new Error("No callback provided to pbkdf2");b=b||"sha1";var g=u[b.toLowerCase()];return g&&"function"==typeof a.Promise?void i(o(g).then(function(r){return r?n(e,t,p,l,g):c(e,t,p,l,b)}),h):r.nextTick(function(){var r;try{r=c(e,t,p,l,b)}catch(t){return h(t)}h(null,r)})}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./default-encoding":218,"./precondition":219,"./sync":220,_process:222,"safe-buffer":251}],218:[function(e,t){(function(e){var r;if(e.browser)r="utf-8";else{var a=parseInt(e.version.split(".")[0].slice(1),10);r=6<=a?"utf-8":"binary"}t.exports=r}).call(this,e("_process"))},{_process:222}],219:[function(e,t){t.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(0>e)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(0>t||t>1073741823||t!==t)throw new TypeError("Bad key length")}},{}],220:[function(e,t){function r(e,t,r){var o=a(e),n="sha512"===e||"sha384"===e?128:64;t.length>n?t=o(t):t.length=t.length){n++;break}var i=t.slice(2,o-1),d=t.slice(o-1,o);if(("0002"!==a.toString("hex")&&!r||"0001"!==a.toString("hex")&&r)&&n++,8>i.length&&n++,n)throw new Error("decryption error");return t.slice(o)}function d(e,t){e=new r(e),t=new r(t);var a=0,o=e.length;e.length!==t.length&&(a++,o=u(e.length,t.length));for(var n=-1;++np||0<=new i(t).cmp(c.modulus))throw new Error("decryption error");var u=d?l(new i(t),c):f(t,c);var b=new r(p-u.length);if(b.fill(0),u=r.concat([b,u],p),4===s)return a(c,u);if(1===s)return o(c,u,d);if(3===s)return u;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":224,"./withPublic":228,"./xor":229,"bn.js":225,"browserify-rsa":98,buffer:126,"create-hash":151,"parse-asn1":215}],227:[function(e,t){(function(r){function a(e,t){var a=e.modulus.byteLength(),o=t.length,n=s("sha1").update(new r("")).digest(),i=n.length,u=2*i;if(o>a-u-2)throw new Error("message too long");var l=new r(a-o-u-2);l.fill(0);var b=a-i-1,h=d(i),g=f(r.concat([n,l,new r([1]),t],b),c(h,b)),m=f(h,c(g,i));return new p(r.concat([new r([0]),m,g],a))}function o(e,t,a){var o=t.length,i=e.modulus.byteLength();if(o>i-11)throw new Error("message too long");var d;return a?(d=new r(i-o-3),d.fill(255)):d=n(i-o-3),new p(r.concat([new r([0,a?1:2]),d,new r([0]),t],i))}function n(e){for(var t=new r(e),a=0,o=d(2*e),n=0,i;a=o&&r>>10),e=56320|1023&e),t+=C(e),t}).join("")}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:S}function u(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function l(e,t,r){var a=0;for(e=r?N(e/A):e>>1,e+=N(e/t);e>T*x>>1;a+=S)e=N(e/T);return N(a+(T+1)*e/(e+w))}function b(e){var r=[],a=e.length,o=0,i=P,n=E,d,c,u,b,h,g,m,y,_,t;for(c=e.lastIndexOf(B),0>c&&(c=0),u=0;u=a&&s("invalid-input"),y=p(e.charCodeAt(b++)),(y>=S||y>N((v-o)/g))&&s("overflow"),o+=y*g,_=m<=n?I:m>=n+x?x:m-n,y<_)break;t=S-_,g>N(v/t)&&s("overflow"),g*=t}d=r.length+1,n=l(o-h,d,0==h),N(o/d)>v-i&&s("overflow"),i+=N(o/d),o%=d,r.splice(o++,0,i)}return f(r)}function g(e){var r=[],a,o,n,i,d,f,p,b,h,g,t,m,y,_,k;for(e=c(e),m=e.length,a=P,o=0,d=E,f=0;ft&&r.push(C(t));for(n=i=r.length,i&&r.push(B);n=a&&tN((v-o)/y)&&s("overflow"),o+=(p-a)*y,a=p,f=0;fv&&s("overflow"),t==a){for(b=o,h=S;;h+=S){if(g=h<=d?I:h>=d+x?x:h-d,b= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=S-I,N=h,C=a,z,M;if(z={version:"1.4.1",ucs2:{decode:c,encode:f},decode:b,encode:g,toASCII:function(e){return i(e,function(e){return O.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return i(e,function(e){return k.test(e)?b(e.slice(4).toLowerCase()):e})}},"function"==typeof d&&"object"==typeof d.amd&&d.amd)d("punycode",function(){return z});else if(!(m&&y))o.punycode=z;else if(t.exports==m)y.exports=z;else for(M in z)z.hasOwnProperty(M)&&(m[M]=z[M])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],231:[function(e,t){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,n){t=t||"&",o=o||"=";var d={};if("string"!=typeof e||0===e.length)return d;var s=/\+/g;e=e.split(t);var c=1e3;n&&"number"==typeof n.maxKeys&&(c=n.maxKeys);var f=e.length;0c&&(f=c);for(var p=0;pl||0>e)throw new TypeError("offset must be a uint32");if(e>p||e>t)throw new RangeError("offset out of range")}function i(e,t,r){if("number"!=typeof e||e!==e)throw new TypeError("size must be a number");if(e>l||0>e)throw new TypeError("size must be a uint32");if(e+t>r||e>p)throw new RangeError("buffer too small")}function d(e,r,a,o){if(t.browser){var n=e.buffer,i=new Uint8Array(n,r,a);return u.getRandomValues(i),o?void t.nextTick(function(){o(null,e)}):e}if(o)return void c(a,function(t,a){return t?o(t):void(a.copy(e,r),o(null,e))});var d=c(a);return d.copy(e,r),e}var s=e("safe-buffer"),c=e("randombytes"),f=s.Buffer,p=s.kMaxLength,u=a.crypto||a.msCrypto,l=4294967295;u&&u.getRandomValues||!t.browser?(r.randomFill=function(e,t,r,o){if(!f.isBuffer(e)&&!(e instanceof a.Uint8Array))throw new TypeError("\"buf\" argument must be a Buffer or Uint8Array");if("function"==typeof t)o=t,t=0,r=e.length;else if("function"==typeof r)o=r,r=e.length-t;else if("function"!=typeof o)throw new TypeError("\"cb\" argument must be a function");return n(t,e.length),i(r,t,e.length),d(e,t,r,o)},r.randomFillSync=function(e,t,r){if("undefined"==typeof t&&(t=0),!f.isBuffer(e)&&!(e instanceof a.Uint8Array))throw new TypeError("\"buf\" argument must be a Buffer or Uint8Array");return n(t,e.length),void 0===r&&(r=e.length-t),i(r,t,e.length),d(e,t,r)}):(r.randomFill=o,r.randomFillSync=o)}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{_process:222,randombytes:234,"safe-buffer":251}],236:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":237}],237:[function(e,t){"use strict";function r(e){return this instanceof r?void(s.call(this,e),c.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",a)):new r(e)}function a(){this.allowHalfOpen||this._writableState.ended||n(o,this)}function o(e){e.end()}var n=e("process-nextick-args"),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=r;var d=e("core-util-is");d.inherits=e("inherits");var s=e("./_stream_readable"),c=e("./_stream_writable");d.inherits(r,s);for(var f=i(c.prototype),p=0,u;p=Y?e=Y:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function b(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=l(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function g(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(F("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?T(y,e):y(e))}function y(e){F("emit readable"),e.emit("readable"),w(e)}function _(e,t){t.readingMore||(t.readingMore=!0,T(v,e,t))}function v(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=E(e,t.buffer,t.decoder),r}function E(e,t,r){var a;return en.length?n.length:e;if(o+=i===n.length?n:n.slice(0,e),e-=i,0===e){i===n.length?(++a,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=n.slice(i));break}++a}return t.length-=a,o}function B(e,t){var r=L.allocUnsafe(e),a=t.head,o=1;for(a.data.copy(r),e-=a.data.length;a=a.next;){var n=a.data,i=e>n.length?n.length:e;if(n.copy(r,r.length-e,0,i),e-=i,0===e){i===n.length?(++o,t.head=a.next?a.next:t.tail=null):(t.head=a,a.data=n.slice(i));break}++o}return t.length-=o,r}function O(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return F("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):m(this),null;if(e=b(e,t),0===e&&t.ended)return 0===t.length&&O(this),null;var a=t.needReadable;F("need readable",a),(0===t.length||t.length-e>>0),r=this.head,n=0;r;)a(r.data,t,n),n+=r.data.length,r=r.next;return t},e}()},{"safe-buffer":251}],243:[function(e,t){"use strict";function r(e,t){e.emit("error",t)}var a=e("process-nextick-args");t.exports={destroy:function(e,t){var o=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?void(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&a(r,this,e)):void(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(a(r,o,e),o._writableState&&(o._writableState.errorEmitted=!0)):t&&t(e)}))},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":221}],244:[function(e,t){t.exports=e("events").EventEmitter},{events:182}],245:[function(e,t,r){arguments[4][197][0].apply(r,arguments)},{dup:197}],246:[function(e,t){t.exports=e("./readable").PassThrough},{"./readable":247}],247:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":237,"./lib/_stream_passthrough.js":238,"./lib/_stream_readable.js":239,"./lib/_stream_transform.js":240,"./lib/_stream_writable.js":241}],248:[function(e,t){t.exports=e("./readable").Transform},{"./readable":247}],249:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":241}],250:[function(e,t){(function(r){"use strict";function a(){p.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function o(e,t){return e<>>32-t}function n(t,r,a,n,i,e,d,c){return 0|o(0|t+(r^a^n)+e+d,c)+i}function d(t,r,a,n,i,e,d,c){return 0|o(0|t+(r&a|~r&n)+e+d,c)+i}function s(t,r,a,n,i,e,d,f){return 0|o(0|t+((r|~a)^n)+e+d,f)+i}function c(t,r,a,n,i,e,c,f){return 0|o(0|t+(r&n|a&~n)+e+c,f)+i}function f(t,r,a,n,i,e,c,f){return 0|o(0|t+(r^(a|~n))+e+c,f)+i}var i=e("inherits"),p=e("hash-base");i(a,p),a.prototype._update=function(){for(var e=Array(16),r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);var a=this._a,i=this._b,p=this._c,u=this._d,l=this._e;a=n(a,i,p,u,l,e[0],0,11),p=o(p,10),l=n(l,a,i,p,u,e[1],0,14),i=o(i,10),u=n(u,l,a,i,p,e[2],0,15),a=o(a,10),p=n(p,u,l,a,i,e[3],0,12),l=o(l,10),i=n(i,p,u,l,a,e[4],0,5),u=o(u,10),a=n(a,i,p,u,l,e[5],0,8),p=o(p,10),l=n(l,a,i,p,u,e[6],0,7),i=o(i,10),u=n(u,l,a,i,p,e[7],0,9),a=o(a,10),p=n(p,u,l,a,i,e[8],0,11),l=o(l,10),i=n(i,p,u,l,a,e[9],0,13),u=o(u,10),a=n(a,i,p,u,l,e[10],0,14),p=o(p,10),l=n(l,a,i,p,u,e[11],0,15),i=o(i,10),u=n(u,l,a,i,p,e[12],0,6),a=o(a,10),p=n(p,u,l,a,i,e[13],0,7),l=o(l,10),i=n(i,p,u,l,a,e[14],0,9),u=o(u,10),a=n(a,i,p,u,l,e[15],0,8),p=o(p,10),l=d(l,a,i,p,u,e[7],1518500249,7),i=o(i,10),u=d(u,l,a,i,p,e[4],1518500249,6),a=o(a,10),p=d(p,u,l,a,i,e[13],1518500249,8),l=o(l,10),i=d(i,p,u,l,a,e[1],1518500249,13),u=o(u,10),a=d(a,i,p,u,l,e[10],1518500249,11),p=o(p,10),l=d(l,a,i,p,u,e[6],1518500249,9),i=o(i,10),u=d(u,l,a,i,p,e[15],1518500249,7),a=o(a,10),p=d(p,u,l,a,i,e[3],1518500249,15),l=o(l,10),i=d(i,p,u,l,a,e[12],1518500249,7),u=o(u,10),a=d(a,i,p,u,l,e[0],1518500249,12),p=o(p,10),l=d(l,a,i,p,u,e[9],1518500249,15),i=o(i,10),u=d(u,l,a,i,p,e[5],1518500249,9),a=o(a,10),p=d(p,u,l,a,i,e[2],1518500249,11),l=o(l,10),i=d(i,p,u,l,a,e[14],1518500249,7),u=o(u,10),a=d(a,i,p,u,l,e[11],1518500249,13),p=o(p,10),l=d(l,a,i,p,u,e[8],1518500249,12),i=o(i,10),u=s(u,l,a,i,p,e[3],1859775393,11),a=o(a,10),p=s(p,u,l,a,i,e[10],1859775393,13),l=o(l,10),i=s(i,p,u,l,a,e[14],1859775393,6),u=o(u,10),a=s(a,i,p,u,l,e[4],1859775393,7),p=o(p,10),l=s(l,a,i,p,u,e[9],1859775393,14),i=o(i,10),u=s(u,l,a,i,p,e[15],1859775393,9),a=o(a,10),p=s(p,u,l,a,i,e[8],1859775393,13),l=o(l,10),i=s(i,p,u,l,a,e[1],1859775393,15),u=o(u,10),a=s(a,i,p,u,l,e[2],1859775393,14),p=o(p,10),l=s(l,a,i,p,u,e[7],1859775393,8),i=o(i,10),u=s(u,l,a,i,p,e[0],1859775393,13),a=o(a,10),p=s(p,u,l,a,i,e[6],1859775393,6),l=o(l,10),i=s(i,p,u,l,a,e[13],1859775393,5),u=o(u,10),a=s(a,i,p,u,l,e[11],1859775393,12),p=o(p,10),l=s(l,a,i,p,u,e[5],1859775393,7),i=o(i,10),u=s(u,l,a,i,p,e[12],1859775393,5),a=o(a,10),p=c(p,u,l,a,i,e[1],2400959708,11),l=o(l,10),i=c(i,p,u,l,a,e[9],2400959708,12),u=o(u,10),a=c(a,i,p,u,l,e[11],2400959708,14),p=o(p,10),l=c(l,a,i,p,u,e[10],2400959708,15),i=o(i,10),u=c(u,l,a,i,p,e[0],2400959708,14),a=o(a,10),p=c(p,u,l,a,i,e[8],2400959708,15),l=o(l,10),i=c(i,p,u,l,a,e[12],2400959708,9),u=o(u,10),a=c(a,i,p,u,l,e[4],2400959708,8),p=o(p,10),l=c(l,a,i,p,u,e[13],2400959708,9),i=o(i,10),u=c(u,l,a,i,p,e[3],2400959708,14),a=o(a,10),p=c(p,u,l,a,i,e[7],2400959708,5),l=o(l,10),i=c(i,p,u,l,a,e[15],2400959708,6),u=o(u,10),a=c(a,i,p,u,l,e[14],2400959708,8),p=o(p,10),l=c(l,a,i,p,u,e[5],2400959708,6),i=o(i,10),u=c(u,l,a,i,p,e[6],2400959708,5),a=o(a,10),p=c(p,u,l,a,i,e[2],2400959708,12),l=o(l,10),i=f(i,p,u,l,a,e[4],2840853838,9),u=o(u,10),a=f(a,i,p,u,l,e[0],2840853838,15),p=o(p,10),l=f(l,a,i,p,u,e[5],2840853838,5),i=o(i,10),u=f(u,l,a,i,p,e[9],2840853838,11),a=o(a,10),p=f(p,u,l,a,i,e[7],2840853838,6),l=o(l,10),i=f(i,p,u,l,a,e[12],2840853838,8),u=o(u,10),a=f(a,i,p,u,l,e[2],2840853838,13),p=o(p,10),l=f(l,a,i,p,u,e[10],2840853838,12),i=o(i,10),u=f(u,l,a,i,p,e[14],2840853838,5),a=o(a,10),p=f(p,u,l,a,i,e[1],2840853838,12),l=o(l,10),i=f(i,p,u,l,a,e[3],2840853838,13),u=o(u,10),a=f(a,i,p,u,l,e[8],2840853838,14),p=o(p,10),l=f(l,a,i,p,u,e[11],2840853838,11),i=o(i,10),u=f(u,l,a,i,p,e[6],2840853838,8),a=o(a,10),p=f(p,u,l,a,i,e[15],2840853838,5),l=o(l,10),i=f(i,p,u,l,a,e[13],2840853838,6),u=o(u,10);var b=this._a,h=this._b,g=this._c,m=this._d,y=this._e;b=f(b,h,g,m,y,e[5],1352829926,8),g=o(g,10),y=f(y,b,h,g,m,e[14],1352829926,9),h=o(h,10),m=f(m,y,b,h,g,e[7],1352829926,9),b=o(b,10),g=f(g,m,y,b,h,e[0],1352829926,11),y=o(y,10),h=f(h,g,m,y,b,e[9],1352829926,13),m=o(m,10),b=f(b,h,g,m,y,e[2],1352829926,15),g=o(g,10),y=f(y,b,h,g,m,e[11],1352829926,15),h=o(h,10),m=f(m,y,b,h,g,e[4],1352829926,5),b=o(b,10),g=f(g,m,y,b,h,e[13],1352829926,7),y=o(y,10),h=f(h,g,m,y,b,e[6],1352829926,7),m=o(m,10),b=f(b,h,g,m,y,e[15],1352829926,8),g=o(g,10),y=f(y,b,h,g,m,e[8],1352829926,11),h=o(h,10),m=f(m,y,b,h,g,e[1],1352829926,14),b=o(b,10),g=f(g,m,y,b,h,e[10],1352829926,14),y=o(y,10),h=f(h,g,m,y,b,e[3],1352829926,12),m=o(m,10),b=f(b,h,g,m,y,e[12],1352829926,6),g=o(g,10),y=c(y,b,h,g,m,e[6],1548603684,9),h=o(h,10),m=c(m,y,b,h,g,e[11],1548603684,13),b=o(b,10),g=c(g,m,y,b,h,e[3],1548603684,15),y=o(y,10),h=c(h,g,m,y,b,e[7],1548603684,7),m=o(m,10),b=c(b,h,g,m,y,e[0],1548603684,12),g=o(g,10),y=c(y,b,h,g,m,e[13],1548603684,8),h=o(h,10),m=c(m,y,b,h,g,e[5],1548603684,9),b=o(b,10),g=c(g,m,y,b,h,e[10],1548603684,11),y=o(y,10),h=c(h,g,m,y,b,e[14],1548603684,7),m=o(m,10),b=c(b,h,g,m,y,e[15],1548603684,7),g=o(g,10),y=c(y,b,h,g,m,e[8],1548603684,12),h=o(h,10),m=c(m,y,b,h,g,e[12],1548603684,7),b=o(b,10),g=c(g,m,y,b,h,e[4],1548603684,6),y=o(y,10),h=c(h,g,m,y,b,e[9],1548603684,15),m=o(m,10),b=c(b,h,g,m,y,e[1],1548603684,13),g=o(g,10),y=c(y,b,h,g,m,e[2],1548603684,11),h=o(h,10),m=s(m,y,b,h,g,e[15],1836072691,9),b=o(b,10),g=s(g,m,y,b,h,e[5],1836072691,7),y=o(y,10),h=s(h,g,m,y,b,e[1],1836072691,15),m=o(m,10),b=s(b,h,g,m,y,e[3],1836072691,11),g=o(g,10),y=s(y,b,h,g,m,e[7],1836072691,8),h=o(h,10),m=s(m,y,b,h,g,e[14],1836072691,6),b=o(b,10),g=s(g,m,y,b,h,e[6],1836072691,6),y=o(y,10),h=s(h,g,m,y,b,e[9],1836072691,14),m=o(m,10),b=s(b,h,g,m,y,e[11],1836072691,12),g=o(g,10),y=s(y,b,h,g,m,e[8],1836072691,13),h=o(h,10),m=s(m,y,b,h,g,e[12],1836072691,5),b=o(b,10),g=s(g,m,y,b,h,e[2],1836072691,14),y=o(y,10),h=s(h,g,m,y,b,e[10],1836072691,13),m=o(m,10),b=s(b,h,g,m,y,e[0],1836072691,13),g=o(g,10),y=s(y,b,h,g,m,e[4],1836072691,7),h=o(h,10),m=s(m,y,b,h,g,e[13],1836072691,5),b=o(b,10),g=d(g,m,y,b,h,e[8],2053994217,15),y=o(y,10),h=d(h,g,m,y,b,e[6],2053994217,5),m=o(m,10),b=d(b,h,g,m,y,e[4],2053994217,8),g=o(g,10),y=d(y,b,h,g,m,e[1],2053994217,11),h=o(h,10),m=d(m,y,b,h,g,e[3],2053994217,14),b=o(b,10),g=d(g,m,y,b,h,e[11],2053994217,14),y=o(y,10),h=d(h,g,m,y,b,e[15],2053994217,6),m=o(m,10),b=d(b,h,g,m,y,e[0],2053994217,14),g=o(g,10),y=d(y,b,h,g,m,e[5],2053994217,6),h=o(h,10),m=d(m,y,b,h,g,e[12],2053994217,9),b=o(b,10),g=d(g,m,y,b,h,e[2],2053994217,12),y=o(y,10),h=d(h,g,m,y,b,e[13],2053994217,9),m=o(m,10),b=d(b,h,g,m,y,e[9],2053994217,12),g=o(g,10),y=d(y,b,h,g,m,e[7],2053994217,5),h=o(h,10),m=d(m,y,b,h,g,e[10],2053994217,15),b=o(b,10),g=d(g,m,y,b,h,e[14],2053994217,8),y=o(y,10),h=n(h,g,m,y,b,e[12],0,8),m=o(m,10),b=n(b,h,g,m,y,e[15],0,5),g=o(g,10),y=n(y,b,h,g,m,e[10],0,12),h=o(h,10),m=n(m,y,b,h,g,e[4],0,9),b=o(b,10),g=n(g,m,y,b,h,e[1],0,12),y=o(y,10),h=n(h,g,m,y,b,e[5],0,5),m=o(m,10),b=n(b,h,g,m,y,e[8],0,14),g=o(g,10),y=n(y,b,h,g,m,e[7],0,6),h=o(h,10),m=n(m,y,b,h,g,e[6],0,8),b=o(b,10),g=n(g,m,y,b,h,e[2],0,13),y=o(y,10),h=n(h,g,m,y,b,e[13],0,6),m=o(m,10),b=n(b,h,g,m,y,e[14],0,5),g=o(g,10),y=n(y,b,h,g,m,e[0],0,15),h=o(h,10),m=n(m,y,b,h,g,e[3],0,13),b=o(b,10),g=n(g,m,y,b,h,e[9],0,11),y=o(y,10),h=n(h,g,m,y,b,e[11],0,11),m=o(m,10);var _=0|this._b+p+m;this._b=0|this._c+u+y,this._c=0|this._d+l+b,this._d=0|this._e+a+h,this._e=0|this._a+i+g,this._a=_},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(4294967295>=r)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=4294967295&r;this._block.writeUInt32BE((r-a)/4294967296,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":251}],253:[function(e,t,r){var r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};r.sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":254,"./sha1":255,"./sha224":256,"./sha256":257,"./sha384":258,"./sha512":259}],254:[function(e,t){function r(){this.init(),this._w=c,d.call(this,64,56)}function o(e){return e<<5|e>>>27}function n(e){return e<<30|e>>>2}function i(e,t,r,a){return 0===e?t&r|~t&a:2===e?t&r|t&a|r&a:t^r^a}var a=e("inherits"),d=e("./hash"),s=e("safe-buffer").Buffer,f=[1518500249,1859775393,-1894007588,-899497514],c=Array(80);a(r,d),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(r){for(var p=this._w,u=0|this._a,a=0|this._b,l=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)p[e]=r.readInt32BE(4*e);for(;80>e;++e)p[e]=p[e-3]^p[e-8]^p[e-14]^p[e-16];for(var b=0;80>b;++b){var h=~~(b/20),s=0|o(u)+i(h,a,l,c)+d+p[b]+f[h];d=c,c=l,l=n(a),a=u,u=s}this._a=0|u+this._a,this._b=0|a+this._b,this._c=0|l+this._c,this._d=0|c+this._d,this._e=0|d+this._e},r.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],255:[function(e,t){function r(){this.init(),this._w=p,s.call(this,64,56)}function a(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function n(e){return e<<30|e>>>2}function i(e,t,r,a){return 0===e?t&r|~t&a:2===e?t&r|t&a|r&a:t^r^a}var d=e("inherits"),s=e("./hash"),c=e("safe-buffer").Buffer,f=[1518500249,1859775393,-1894007588,-899497514],p=Array(80);d(r,s),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(r){for(var p=this._w,u=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)p[e]=r.readInt32BE(4*e);for(;80>e;++e)p[e]=a(p[e-3]^p[e-8]^p[e-14]^p[e-16]);for(var h=0;80>h;++h){var g=~~(h/20),s=0|o(u)+i(g,l,b,c)+d+p[h]+f[g];d=c,c=b,b=n(l),l=u,u=s}this._a=0|u+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|d+this._e},r.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],256:[function(e,t){function r(){this.init(),this._w=d,n.call(this,64,56)}var a=e("inherits"),o=e("./sha256"),n=e("./hash"),i=e("safe-buffer").Buffer,d=Array(64);a(r,o),r.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},r.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=r},{"./hash":252,"./sha256":257,inherits:201,"safe-buffer":251}],257:[function(e,t){function r(){this.init(),this._w=l,f.call(this,64,56)}function o(e,t,r){return r^e&(t^r)}function n(e,t,r){return e&t|r&(e|t)}function i(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function s(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function a(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=e("inherits"),f=e("./hash"),p=e("safe-buffer").Buffer,u=[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],l=Array(64);c(r,f),r.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},r.prototype._update=function(t){for(var r=this._w,p=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,m=0|this._e,e=0|this._f,f=0|this._g,g=0|this._h,h=0;16>h;++h)r[h]=t.readInt32BE(4*h);for(;64>h;++h)r[h]=0|d(r[h-2])+r[h-7]+a(r[h-15])+r[h-16];for(var y=0;64>y;++y){var _=0|g+s(m)+o(m,e,f)+u[y]+r[y],v=0|i(p)+n(p,l,b);g=f,f=e,e=m,m=0|c+_,c=b,b=l,l=p,p=0|_+v}this._a=0|p+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|m+this._e,this._f=0|e+this._f,this._g=0|f+this._g,this._h=0|g+this._h},r.prototype._hash=function(){var e=p.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],258:[function(e,t){function r(){this.init(),this._w=d,n.call(this,128,112)}var a=e("inherits"),o=e("./sha512"),n=e("./hash"),i=e("safe-buffer").Buffer,d=Array(160);a(r,o),r.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},r.prototype._hash=function(){function e(e,r,a){t.writeInt32BE(e,a),t.writeInt32BE(r,a+4)}var t=i.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=r},{"./hash":252,"./sha512":259,inherits:201,"safe-buffer":251}],259:[function(e,t){function r(){this.init(),this._w=g,l.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function o(e,t,r){return e&t|r&(e|t)}function n(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function i(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function s(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function c(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function p(e,t){return e>>>0>>0?1:0}var u=e("inherits"),l=e("./hash"),b=e("safe-buffer").Buffer,h=[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],g=Array(160);u(r,l),r.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},r.prototype._update=function(e){for(var t=this._w,r=0|this._ah,u=0|this._bh,l=0|this._ch,b=0|this._dh,g=0|this._eh,m=0|this._fh,y=0|this._gh,_=0|this._hh,v=0|this._al,S=0|this._bl,k=0|this._cl,I=0|this._dl,x=0|this._el,w=0|this._fl,A=0|this._gl,E=0|this._hl,P=0;32>P;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;160>P;P+=2){var B=t[P-30],O=t[P-30+1],R=d(B,O),T=s(O,B);B=t[P-4],O=t[P-4+1];var N=c(B,O),C=f(O,B),z=t[P-14],M=t[P-14+1],U=t[P-32],L=t[P-32+1],D=0|T+M,q=0|R+z+p(D,T);D=0|D+C,q=0|q+N+p(D,C),D=0|D+L,q=0|q+U+p(D,L),t[P]=q,t[P+1]=D}for(var H=0;160>H;H+=2){q=t[H],D=t[H+1];var j=o(r,u,l),F=o(v,S,k),K=n(r,v),V=n(v,r),G=i(g,x),W=i(x,g),Y=h[H],X=h[H+1],Z=a(g,m,y),J=a(x,w,A),Q=0|E+W,$=0|_+G+p(Q,E);Q=0|Q+J,$=0|$+Z+p(Q,J),Q=0|Q+X,$=0|$+Y+p(Q,X),Q=0|Q+D,$=0|$+q+p(Q,D);var ee=0|V+F,te=0|K+j+p(ee,V);_=y,E=A,y=m,A=w,m=g,w=x,x=0|I+Q,g=0|b+$+p(x,I),b=l,I=k,l=u,k=S,u=r,S=v,v=0|Q+ee,r=0|$+te+p(v,Q)}this._al=0|this._al+v,this._bl=0|this._bl+S,this._cl=0|this._cl+k,this._dl=0|this._dl+I,this._el=0|this._el+x,this._fl=0|this._fl+w,this._gl=0|this._gl+A,this._hl=0|this._hl+E,this._ah=0|this._ah+r+p(this._al,v),this._bh=0|this._bh+u+p(this._bl,S),this._ch=0|this._ch+l+p(this._cl,k),this._dh=0|this._dh+b+p(this._dl,I),this._eh=0|this._eh+g+p(this._el,x),this._fh=0|this._fh+m+p(this._fl,w),this._gh=0|this._gh+y+p(this._gl,A),this._hh=0|this._hh+_+p(this._hl,E)},r.prototype._hash=function(){function e(e,r,a){t.writeInt32BE(e,a),t.writeInt32BE(r,a+4)}var t=b.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],260:[function(e,t){function r(){a.call(this)}t.exports=r;var a=e("events").EventEmitter,o=e("inherits");o(r,a),r.Readable=e("readable-stream/readable.js"),r.Writable=e("readable-stream/writable.js"),r.Duplex=e("readable-stream/duplex.js"),r.Transform=e("readable-stream/transform.js"),r.PassThrough=e("readable-stream/passthrough.js"),r.Stream=r,r.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function o(){c.readable&&c.resume&&c.resume()}function n(){f||(f=!0,e.end())}function i(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){if(s(),0===a.listenerCount(this,"error"))throw e}function s(){c.removeListener("data",r),e.removeListener("drain",o),c.removeListener("end",n),c.removeListener("close",i),c.removeListener("error",d),e.removeListener("error",d),c.removeListener("end",s),c.removeListener("close",s),e.removeListener("close",s)}var c=this;c.on("data",r),e.on("drain",o),e._isStdio||t&&!1===t.end||(c.on("end",n),c.on("close",i));var f=!1;return c.on("error",d),e.on("error",d),c.on("end",s),c.on("close",s),e.on("close",s),e.emit("pipe",c),e}},{events:182,inherits:201,"readable-stream/duplex.js":236,"readable-stream/passthrough.js":246,"readable-stream/readable.js":247,"readable-stream/transform.js":248,"readable-stream/writable.js":249}],261:[function(e,t,r){"use strict";function a(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function o(e){var t=a(e);if("string"!=typeof t&&(g.isEncoding===m||!m(e)))throw new Error("Unknown encoding: "+e);return t||e}function n(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=f,this.end=p,t=4;break;case"utf8":this.fillLast=c,t=4;break;case"base64":this.text=u,this.end=l,t=3;break;default:return this.write=b,void(this.end=h);}this.lastNeed=0,this.lastTotal=0,this.lastChar=g.allocUnsafe(t)}function d(e){if(127>=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:-1}function s(e,t,r){var a=t.length-1;if(a=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],a.slice(0,-1)}return a}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0==r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}var g=e("safe-buffer").Buffer,m=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1;}};r.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=S;++S)v[S]=0;y.fromCharCode=[function(e,t,r){return 60>t||13311t?new y(t,o):e(t,r)},function(e,t,r){var a=_[t];return a||(a=e(t,r),!!a.feature&&++v[255&t>>8]>n&&(_[t]=a)),a},function(e,t,r){return!r?new y(t,null):e(t,r)},function(e,t,r){var a;if(t=e},y.isLowSurrogate=function(e){return 56320<=e&&57343>=e},y.prototype.prepFeature=function(){this.feature||(this.feature=y.fromCharCode(this.codepoint,!0).feature)},y.prototype.toString=function(){if(65536>this.codepoint)return a(this.codepoint);var e=this.codepoint-65536;return a(h(e/1024)+55296,e%1024+56320)},y.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},y.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},y.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},y.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},y.prototype.getComposite=function(e){if(this.prepFeature(),!this.feature[2])return null;var t=this.feature[2][e.codepoint];return t?y.fromCharCode(t):null};var i=function(e){this.str=e,this.cursor=0};i.prototype.next=function(){if(!!this.str&&this.cursor","\"","`"," ","\r","\n","\t"]),p=["'"].concat(f),u=["%","/","?",";","#"].concat(p),l=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=e("querystring");a.prototype.parse=function(e,t,r){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),o=-1!==a&&a255?"":this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==S[0]&&(S="/"+S))}if(!g[w])for(var P=0,N=p.length,H;P_.length&&_.unshift(""),r.pathname=_.join("/")}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var v=r.pathname||"",p=r.search||"";r.path=v+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var s=r.pathname&&"/"===r.pathname.charAt(0),S=e.host||e.pathname&&"/"===e.pathname.charAt(0),k=S||s||r.host&&e.pathname,I=k,x=r.pathname&&r.pathname.split("/")||[],_=e.pathname&&e.pathname.split("/")||[],w=r.protocol&&!y[r.protocol];if(w&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===_[0]?_[0]=e.host:_.unshift(e.host)),e.host=null),k=k&&(""===_[0]||""===x[0])),S)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,x=_;else if(_.length)x||(x=[]),x.pop(),x=x.concat(_),r.search=e.search,r.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(w){r.hostname=r.host=x.shift();var A=r.host&&0a)return v(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var n;return n=S?p(e,t,a,g,h):h.map(function(r){return u(e,t,a,g,r,S)}),e.seen.pop(),l(n,_,w)}function c(e,t){if(_(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\"")+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,a,o){for(var n=[],d=0,i=t.length;de.seen.indexOf(c.value)?(d=g(r)?s(e,c.value,null):s(e,c.value,r-1),-1e?"0"+e.toString(10):e.toString(10)}function E(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),j[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;r.format=function(e){if(!y(e)){for(var t=[],r=0;r=n)return e;switch(e){case"%s":return a[r++]+"";case"%d":return+a[r++];case"%j":try{return JSON.stringify(a[r++])}catch(e){return"[Circular]"}default:return e;}}),d=a[r];r",main:"lib/bitcoincash.js",scripts:{build:"npm install && npx gulp build","build:node":"npm install && npx gulp build:node","build:browser":"npm install && npx gulp build:browser","build:test":"npm install && npx gulp build:test",test:"npm install && npx gulp test","test:all":"npm install && npx gulp test:all","test:node":"npm install && npx gulp test:node","test:browser":"npm install && npx gulp test:browser",lint:"npm install && npx gulp lint",coveralls:"npm install && npx gulp coveralls",preversion:"npm install && npm test",version:"npm install && npx gulp version",postversion:"npm install && npx gulp postversion",bump:"npm version patch -m 'Bump version to %s.'"},keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],repository:{type:"git",url:"https://github.com/bitcoincashjs/bitcoincashjs.git"},browser:{request:"browser-request"},dependencies:{"big-integer":"^1.6.26","bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",cashaddrjs:"^0.1.4",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"^4.17.4",unorm:"^1.4.1"},devDependencies:{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-minify":"^0.2.0","babel-preset-env":"^1.6.1",babelify:"^8.0.0",brfs:"^1.4.3",browserify:"^14.5.0",chai:"^1.10.0",coveralls:"^3.0.0",gulp:"^3.8.10","gulp-shell":"^0.6.5",jsdoc:"^3.5.5",jshint:"^2.9.5",karma:"^2.0.0","karma-chrome-launcher":"^2.2.0","karma-detect-browsers":"^2.2.6","karma-firefox-launcher":"^1.1.0","karma-mocha":"^1.3.0",mocha:"^4.1.0",mustache:"^2.3.0",nyc:"^11.4.1","run-sequence":"^2.2.0",sinon:"^1.13.0","uglify-js":"^3.3.4"},license:"MIT"}},{}]},{},[2])(2)}); \ No newline at end of file diff --git a/dist/bitcoincashjs.0.1.8.min.js b/dist/bitcoincashjs.0.1.8.min.js new file mode 100644 index 0000000..0fd53c9 --- /dev/null +++ b/dist/bitcoincashjs.0.1.8.min.js @@ -0,0 +1 @@ +(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,t.bch=e()}})(function(){var t=Math.LN2,r=Math.log,o=Math.pow,s=Math.abs,e=Math.clz32,f=Math.max,a=String.fromCharCode,p=Math.ceil,n=Math.round,u=Math.min,h=Math.floor,d,i,c;return function d(c,e,t){function r(i,o){if(!e[i]){if(!c[i]){var s="function"==typeof require&&require;if(!o&&s)return s(i,!0);if(n)return n(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var f=e[i]={exports:{}};c[i][0].call(f.exports,function(t){var e=c[i][1][t];return r(e?e:t)},f,f.exports,d,c,e,t)}return e[i].exports}for(var n="function"==typeof require&&require,a=0;a"},t.exports=o;var g=e("./script")}).call(this,e("buffer").Buffer)},{"./crypto/hash":9,"./encoding/base58check":14,"./errors":18,"./networks":33,"./publickey":36,"./script":37,"./util/js":55,"./util/preconditions":56,buffer:126,cashaddrjs:128,lodash:204}],2:[function(e,t){(function(r,a){"use strict";var o=t.exports;o.version="v"+e("../package.json").version,o.versionGuard=function(e){if(e!==void 0){throw new Error("More than one instance of bitcoincashjs found. Please make sure to require bitcoincashjs and check that submodules do not also include their own bitcoincashjs dependency.")}},o.versionGuard(r._bch),r._bch=o.version,o.crypto={},o.crypto.BN=e("./crypto/bn"),o.crypto.ECDSA=e("./crypto/ecdsa"),o.crypto.Hash=e("./crypto/hash"),o.crypto.Random=e("./crypto/random"),o.crypto.Point=e("./crypto/point"),o.crypto.Signature=e("./crypto/signature"),o.encoding={},o.encoding.Base58=e("./encoding/base58"),o.encoding.Base58Check=e("./encoding/base58check"),o.encoding.BufferReader=e("./encoding/bufferreader"),o.encoding.BufferWriter=e("./encoding/bufferwriter"),o.encoding.Varint=e("./encoding/varint"),o.util={},o.util.buffer=e("./util/buffer"),o.util.js=e("./util/js"),o.util.preconditions=e("./util/preconditions"),o.errors=e("./errors"),o.Address=e("./address"),o.Block=e("./block"),o.BlockHeader=e("./block/blockheader"),o.HDPrivateKey=e("./hdprivatekey.js"),o.HDPublicKey=e("./hdpublickey.js"),o.MerkleBlock=e("./block/merkleblock"),o.Message=e("./message"),o.Mnemonic=e("./mnemonic"),o.Networks=e("./networks"),o.Opcode=e("./opcode"),o.PrivateKey=e("./privatekey"),o.PublicKey=e("./publickey"),o.Script=e("./script"),o.Transaction=e("./transaction"),o.Unit=e("./unit"),o.URI=e("./uri"),o.deps={},o.deps.bnjs=e("bn.js"),o.deps.bs58=e("bs58"),o.deps.Buffer=a,o.deps.elliptic=e("elliptic"),o.deps._=e("lodash"),o.Transaction.sighash=e("./transaction/sighash")}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"../package.json":269,"./address":1,"./block":5,"./block/blockheader":4,"./block/merkleblock":6,"./crypto/bn":7,"./crypto/ecdsa":8,"./crypto/hash":9,"./crypto/point":10,"./crypto/random":11,"./crypto/signature":12,"./encoding/base58":13,"./encoding/base58check":14,"./encoding/bufferreader":15,"./encoding/bufferwriter":16,"./encoding/varint":17,"./errors":18,"./hdprivatekey.js":20,"./hdpublickey.js":21,"./message":22,"./mnemonic":23,"./networks":33,"./opcode":34,"./privatekey":35,"./publickey":36,"./script":37,"./transaction":40,"./transaction/sighash":48,"./unit":52,"./uri":53,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,"bn.js":75,bs58:123,buffer:126,elliptic:168,lodash:204}],3:[function(e,t){(function(r){"use strict";function a(e){return this instanceof a?(o.extend(this,a._from(e)),this):new a(e)}var o=e("lodash"),n=e("./blockheader"),i=e("../crypto/bn"),d=e("../util/buffer"),s=e("../encoding/bufferreader"),c=e("../encoding/bufferwriter"),f=e("../crypto/hash"),p=e("../transaction"),l=e("../util/preconditions");a.MAX_BLOCK_SIZE=1e6,a._from=function(e){var t={};if(d.isBuffer(e))t=a._fromBufferReader(s(e));else if(o.isObject(e))t=a._fromObject(e);else throw new TypeError("Unrecognized argument for Block");return t},a._fromObject=function(e){var t=[];e.transactions.forEach(function(e){e instanceof p?t.push(e):t.push(p().fromObject(e))});var r={header:n.fromObject(e.header),transactions:t};return r},a.fromObject=function(e){var t=a._fromObject(e);return new a(t)},a._fromBufferReader=function(e){var t={};l.checkState(!e.finished(),"No block data received"),t.header=n.fromBufferReader(e);var r=e.readVarintNum();t.transactions=[];for(var a=0;a"},a.Values={START_OF_BLOCK:8,NULL_HASH:new r("0000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=a}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../transaction":40,"../util/buffer":54,"../util/preconditions":56,"./blockheader":4,buffer:126,lodash:204}],4:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../crypto/bn"),i=e("../util/buffer"),d=e("../encoding/bufferreader"),s=e("../encoding/bufferwriter"),c=e("../crypto/hash"),f=e("../util/js"),p=e("../util/preconditions"),u=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);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&&p.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};u._from=function(e){var t={};if(i.isBuffer(e))t=u._fromBufferReader(d(e));else if(a.isObject(e))t=u._fromObject(e);else throw new TypeError("Unrecognized argument for BlockHeader");return t},u._fromObject=function(e){p.checkArgument(e,"data is required");var t=e.prevHash,o=e.merkleRoot;a.isString(e.prevHash)&&(t=i.reverse(new r(e.prevHash,"hex"))),a.isString(e.merkleRoot)&&(o=i.reverse(new r(e.merkleRoot,"hex")));var n={hash:e.hash,version:e.version,prevHash:t,merkleRoot:o,time:e.time,timestamp:e.time,bits:e.bits,nonce:e.nonce};return n},u.fromObject=function(e){var t=u._fromObject(e);return new u(t)},u.fromRawBlock=function(e){i.isBuffer(e)||(e=new r(e,"binary"));var t=d(e);t.pos=u.Constants.START_OF_HEADER;var a=u._fromBufferReader(t);return new u(a)},u.fromBuffer=function(e){var t=u._fromBufferReader(d(e));return new u(t)},u.fromString=function(e){var t=new r(e,"hex");return u.fromBuffer(t)},u._fromBufferReader=function(e){var t={version:e.readInt32LE(),prevHash:e.read(32),merkleRoot:e.read(32),time:e.readUInt32LE(),bits:e.readUInt32LE(),nonce:e.readUInt32LE()};return t},u.fromBufferReader=function(e){var t=u._fromBufferReader(e);return new u(t)},u.prototype.toObject=u.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:i.reverse(this.prevHash).toString("hex"),merkleRoot:i.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},u.prototype.toBuffer=function(){return this.toBufferWriter().concat()},u.prototype.toString=function(){return this.toBuffer().toString("hex")},u.prototype.toBufferWriter=function(e){return e||(e=new s),e.writeInt32LE(this.version),e.write(this.prevHash),e.write(this.merkleRoot),e.writeUInt32LE(this.time),e.writeUInt32LE(this.bits),e.writeUInt32LE(this.nonce),e},u.prototype.getTargetDifficulty=function(e){e=e||this.bits;for(var t=new o(16777215&e),r=8*((e>>>24)-3);0e+u.Constants.MAX_TIME_OFFSET)},u.prototype.validProofOfWork=function(){var e=new o(this.id,"hex"),t=this.getTargetDifficulty();return!(0"},u.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new o("10000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=u}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],5:[function(e,t){"use strict";t.exports=e("./block"),t.exports.BlockHeader=e("./blockheader"),t.exports.MerkleBlock=e("./merkleblock")},{"./block":3,"./blockheader":4,"./merkleblock":6}],6:[function(e,t){(function(r){"use strict";function a(e){if(!(this instanceof a))return new a(e);var t={};if(i.isBuffer(e))t=a._fromBufferReader(d(e));else if(o.isObject(e)){var r;r=e.header instanceof n?e.header:n.fromObject(e.header),t={header:r,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}else throw new TypeError("Unrecognized argument for MerkleBlock");return o.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}var o=e("lodash"),n=e("./blockheader"),i=e("../util/buffer"),d=e("../encoding/bufferreader"),s=e("../encoding/bufferwriter"),c=e("../crypto/hash"),f=e("../util/js"),p=e("../transaction"),u=e("../util/preconditions");a.fromBuffer=function(e){return a.fromBufferReader(d(e))},a.fromBufferReader=function(e){return new a(a._fromBufferReader(e))},a.prototype.toBuffer=function(){return this.toBufferWriter().concat()},a.prototype.toBufferWriter=function(e){e||(e=new s),e.write(this.header.toBuffer()),e.writeUInt32LE(this.numTransactions),e.writeVarintNum(this.hashes.length);for(var t=0;tthis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var o=1&this.flags[a.flagBitsUsed>>3]>>>(7&a.flagBitsUsed++);if(0===e||!o){if(a.hashesUsed>=this.hashes.length)return null;var n=this.hashes[a.hashesUsed++];return 0===e&&o&&a.txs.push(n),new r(n,"hex")}var i=this._traverseMerkleTree(e-1,2*t,a),d=i;return 2*t+1>e},a.prototype._calcTreeHeight=function(){for(var e=0;1e.size?t=a.trim(t,i):i=e.length||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return a.fromSM(e,{endian:"little"})},a.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},a.prototype.gt=function(e){return 0this.cmp(e)},a.trim=function(e,t){return e.slice(t-e.length,e.length)},a.pad=function(e,t,a){for(var o=new r(a),n=0;ne;e++){this.sig.i=e;var t;try{t=this.toPublicKey()}catch(t){console.error(t);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},u.fromString=function(e){var t=JSON.parse(e);return new u(t)},u.prototype.randomK=function(){var e=o.getN(),t;do t=a.fromBuffer(i.getRandomBuffer(32));while(!(t.lt(e)&&t.gt(a.Zero)));return this.k=t,this},u.prototype.deterministicK=function(e){f.isUndefined(e)&&(e=0);var t=new r(32);t.fill(1);var n=new r(32);n.fill(0);var d=this.privkey.bn.toBuffer({size:32}),p="little"===this.endian?c.reverse(this.hashbuf):this.hashbuf;n=s.sha256hmac(r.concat([t,new r([0]),d,p]),n),t=s.sha256hmac(t,n),n=s.sha256hmac(r.concat([t,new r([1]),d,p]),n),t=s.sha256hmac(t,n),t=s.sha256hmac(t,n);for(var u=a.fromBuffer(t),l=o.getN(),b=0;b>1?e.add(s):e,f=o.fromX(1&t,c),u=f.mul(s);if(!u.isInfinity())throw new Error("nR is not a valid curve point");var l=i.neg().mod(s),b=e.invm(s),h=f.mul(r).add(n.mul(l)).mul(b),g=d.fromPoint(h,this.sig.compressed);return g},u.prototype.sigError=function(){if(!c.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,r=this.sig.s;if(!(t.gt(a.Zero)&&t.lt(o.getN()))||!(r.gt(a.Zero)&&r.lt(o.getN())))return"r and s not in range";var i=a.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),e=o.getN(),n=r.invm(e),d=n.mul(i).mod(e),s=n.mul(t).mod(e),f=o.getG().mulAdd(d,this.pubkey.point,s);return f.isInfinity()?"p is infinity":0!==f.getX().mod(e).cmp(t)&&"Invalid signature"},u.toLowS=function(e){return e.gt(a.fromBuffer(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=o.getN().sub(e)),e},u.prototype._findSignature=function(t,n){var e=o.getN(),i=o.getG(),d=0,c,f,p,l;do(!this.k||0=p.cmp(a.Zero)||0>=l.cmp(a.Zero));return l=u.toLowS(l),{s:l,r:p}},u.prototype.sign=function(){var t=this.hashbuf,r=this.privkey,o=r.bn;p.checkState(t&&r&&o,new Error("invalid parameters")),p.checkState(c.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=a.fromBuffer(t,this.endian?{endian:this.endian}:void 0),e=this._findSignature(o,i);return e.compressed=this.pubkey.compressed,this.sig=new n(e),this},u.prototype.signRandomK=function(){return this.randomK(),this.sign()},u.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},u.prototype.verify=function(){return this.verified=!this.sigError(),this},u.sign=function(e,t,r){return u().set({hashbuf:e,endian:r,privkey:t}).sign().sig},u.verify=function(e,t,r,a){return u().set({hashbuf:e,endian:a,sig:t,pubkey:r}).verify().verified},t.exports=u}).call(this,e("buffer").Buffer)},{"../publickey":36,"../util/buffer":54,"../util/preconditions":56,"./bn":7,"./hash":9,"./point":10,"./random":11,"./signature":12,buffer:126,lodash:204}],9:[function(e,t){(function(r){"use strict";var a=e("crypto"),o=e("../util/buffer"),n=e("../util/preconditions"),i=t.exports;i.sha1=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha1").update(e).digest()},i.sha1.blocksize=512,i.sha256=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha256").update(e).digest()},i.sha256.blocksize=512,i.sha256sha256=function(e){return n.checkArgument(o.isBuffer(e)),i.sha256(i.sha256(e))},i.ripemd160=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("ripemd160").update(e).digest()},i.sha256ripemd160=function(e){return n.checkArgument(o.isBuffer(e)),i.ripemd160(i.sha256(e))},i.sha512=function(e){return n.checkArgument(o.isBuffer(e)),a.createHash("sha512").update(e).digest()},i.sha512.blocksize=1024,i.hmac=function(e,t,a){n.checkArgument(o.isBuffer(t)),n.checkArgument(o.isBuffer(a)),n.checkArgument(e.blocksize);var d=e.blocksize/8;if(a.length>d)a=e(a);else if(a>>=8)}return t},t.exports=o}).call(this,e("_process"),e("buffer").Buffer)},{_process:222,buffer:126,crypto:156}],12:[function(e,t){(function(r){"use strict";var a=e("./bn"),o=e("lodash"),n=e("../util/preconditions"),d=e("../util/buffer"),i=e("../util/js"),s=function e(t,o){if(!(this instanceof e))return new e(t,o);if(t instanceof a)this.set({r:t,s:o});else if(t){this.set(t)}};s.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i="undefined"==typeof e.i?this.i:e.i,this.compressed="undefined"==typeof e.compressed?this.compressed:e.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},s.fromCompact=function(e){n.checkArgument(d.isBuffer(e),"Argument is expected to be a Buffer");var t=new s,r=!0,o=e.slice(0,1)[0]-27-4;0>o&&(r=!1,o+=4);var i=e.slice(1,33),c=e.slice(33,65);return n.checkArgument(0==o||1==o||2==o||3==o,new Error("i must be 0, 1, 2, or 3")),n.checkArgument(32===i.length,new Error("r must be 32 bytes")),n.checkArgument(32===c.length,new Error("s must be 32 bytes")),t.compressed=r,t.i=o,t.r=a.fromBuffer(i),t.s=a.fromBuffer(c),t},s.fromDER=s.fromBuffer=function(e,t){var r=s.parseDER(e,t),a=new s;return a.r=r.r,a.s=r.s,a},s.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),a=new s.fromDER(r,!1);return a.nhashtype=t,a},s.fromString=function(e){var t=new r(e,"hex");return s.fromDER(t)},s.parseDER=function(e,t){n.checkArgument(d.isBuffer(e),new Error("DER formatted signature should be a buffer")),o.isUndefined(t)&&(t=!0);var i=e[0];n.checkArgument(48===i,new Error("Header byte should be 0x30"));var c=e[1],f=e.slice(2).length;n.checkArgument(!t||c===f,new Error("Length byte should length of what follows")),c=ce.length)return!1;if(73=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var a=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&a[0])return!1;if(1s.SIGHASH_SINGLE?!1:!0},s.prototype.toTxFormat=function(){var e=this.toDER(),t=new r(1);return t.writeUInt8(this.nhashtype,0),r.concat([e,t])},s.SIGHASH_ALL=1,s.SIGHASH_NONE=2,s.SIGHASH_SINGLE=3,s.SIGHASH_FORKID=64,s.SIGHASH_ANYONECANPAY=128,t.exports=s}).call(this,e("buffer").Buffer)},{"../util/buffer":54,"../util/js":55,"../util/preconditions":56,"./bn":7,buffer:126,lodash:204}],13:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("bs58"),n=e("buffer"),i=["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],d=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t)){this.fromBuffer(t)}else if("string"==typeof t){this.fromString(t)}else t&&this.set(t)};d.validCharacters=function(e){return n.Buffer.isBuffer(e)&&(e=e.toString()),a.every(a.map(e,function(e){return a.includes(i,e)}))},d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},d.encode=function(e){if(!n.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return o.encode(e)},d.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new r(o.decode(e))},d.prototype.fromBuffer=function(e){return this.buf=e,this},d.prototype.fromString=function(e){var t=d.decode(e);return this.buf=t,this},d.prototype.toBuffer=function(){return this.buf},d.prototype.toString=function(){return d.encode(this.buf)},t.exports=d}).call(this,e("buffer").Buffer)},{bs58:123,buffer:126,lodash:204}],14:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./base58"),n=e("buffer"),i=e("../crypto/hash").sha256sha256,d=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t)){this.fromBuffer(t)}else if("string"==typeof t){this.fromString(t)}else t&&this.set(t)};d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},d.validChecksum=function(e,t){return a.isString(e)&&(e=new n.Buffer(o.decode(e))),a.isString(t)&&(t=new n.Buffer(o.decode(t))),t||(t=e.slice(-4),e=e.slice(0,-4)),d.checksum(e).toString("hex")===t.toString("hex")},d.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var t=new r(o.decode(e));if(4>t.length)throw new Error("Input string too short");var a=t.slice(0,-4),n=t.slice(-4),d=i(a),c=d.slice(0,4);if(n.toString("hex")!==c.toString("hex"))throw new Error("Checksum mismatch");return a},d.checksum=function(e){return i(e).slice(0,4)},d.encode=function(e){if(!r.isBuffer(e))throw new Error("Input must be a buffer");var t=new r(e.length+4),a=d.checksum(e);return e.copy(t),a.copy(t,e.length),o.encode(t)},d.prototype.fromBuffer=function(e){return this.buf=e,this},d.prototype.fromString=function(e){var t=d.decode(e);return this.buf=t,this},d.prototype.toBuffer=function(){return this.buf},d.prototype.toString=function(){return d.encode(this.buf)},t.exports=d}).call(this,e("buffer").Buffer)},{"../crypto/hash":9,"./base58":13,buffer:126,lodash:204}],15:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../util/preconditions"),n=e("../util/buffer"),i=e("../crypto/bn"),d=function e(t){if(!(this instanceof e))return new e(t);if(!a.isUndefined(t))if(r.isBuffer(t))this.set({buf:t});else if(a.isString(t)){var o=new r(t,"hex");if(2*o.length!=t.length)throw new TypeError("Invalid hex string");this.set({buf:o})}else if(a.isObject(t)){this.set(t)}else throw new TypeError("Unrecognized argument for BufferReader")};d.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},d.prototype.eof=function(){return this.pos>=this.buf.length},d.prototype.finished=d.prototype.eof,d.prototype.read=function(e){o.checkArgument(!a.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos+=e,t},d.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},d.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return++this.pos,e},d.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos+=2,e},d.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos+=2,e},d.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos+=4,e},d.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos+=4,e},d.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos+=4,e},d.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=i.fromBuffer(e);return this.pos+=8,t},d.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=4294967296*t+e,a;if(9007199254740991>=r)a=new i(r);else{var o=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);a=new i(o,10,"le")}return this.pos+=8,a},d.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(9007199254740992>=r)return r;throw new Error("number too large to retain precision - use readVarintBN");break;default:return e;}},d.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return o.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},d.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);return 253===e?this.read(3):254===e?this.read(5):255===e?this.read(9):this.read(1)},d.prototype.readVarintBN=function(){var e=this.readUInt8();return 253===e?new i(this.readUInt16LE()):254===e?new i(this.readUInt32LE()):255===e?this.readUInt64LEBN():new i(e)},d.prototype.reverse=function(){for(var e=new r(this.buf.length),t=0;te?(t=new r(1),t.writeUInt8(e,0)):65536>e?(t=new r(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):4294967296>e?(t=new r(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=new r(9),t.writeUInt8(255,0),t.writeInt32LE(-1&e,1),t.writeUInt32LE(h(e/4294967296),5)),t},i.varintBufBN=function(e){var t=e.toNumber(),a;if(253>t)a=new r(1),a.writeUInt8(t,0);else if(65536>t)a=new r(3),a.writeUInt8(253,0),a.writeUInt16LE(t,1);else if(4294967296>t)a=new r(5),a.writeUInt8(254,0),a.writeUInt32LE(t,1);else{var o=new i;o.writeUInt8(255),o.writeUInt64LEBN(e);var a=o.concat()}return a},t.exports=i}).call(this,e("buffer").Buffer)},{"../util/buffer":54,assert:72,buffer:126}],17:[function(e,t){(function(r){"use strict";var a=e("./bufferwriter"),o=e("./bufferreader"),n=e("../crypto/bn"),i=function e(t){if(!(this instanceof e))return new e(t);if(r.isBuffer(t))this.buf=t;else if("number"==typeof t){this.fromNumber(t)}else if(t instanceof n){this.fromBN(t)}else if(t){this.set(t)}};i.prototype.set=function(e){return this.buf=e.buf||this.buf,this},i.prototype.fromString=function(e){return this.set({buf:new r(e,"hex")}),this},i.prototype.toString=function(){return this.buf.toString("hex")},i.prototype.fromBuffer=function(e){return this.buf=e,this},i.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},i.prototype.fromBN=function(e){return this.buf=a().writeVarintBN(e).concat(),this},i.prototype.fromNumber=function(e){return this.buf=a().writeVarintNum(e).concat(),this},i.prototype.toBuffer=function(){return this.buf},i.prototype.toBN=function(){return o(this.buf).readVarintBN()},i.prototype.toNumber=function(){return o(this.buf).readVarintNum()},t.exports=i}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"./bufferreader":15,"./bufferwriter":16,buffer:126}],18:[function(e,t){"use strict";function r(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var a=e("lodash"),o=function(e,t){var o=function(){if(a.isString(t.message))this.message=r(t.message,arguments);else if(a.isFunction(t.message))this.message=t.message.apply(null,arguments);else throw new Error("Invalid error definition for "+t.name);this.stack=this.message+"\n"+new Error().stack};return o.prototype=Object.create(e.prototype),o.prototype.name=e.prototype.name+t.name,e[t.name]=o,t.errors&&n(o,t.errors),o},n=function(e,t){a.each(t,function(t){o(e,t)})},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+new Error().stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bitcore.Error";var d=e("./spec");(function(e,t){return n(e,t),e})(i.Error,d),t.exports=i.Error,t.exports.extend=function(e){return o(i.Error,e)}},{"./spec":19,lodash:204}],19:[function(e,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:"Invalid network: must be \"livenet\" or \"testnet\", got {0}"},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+"http://bitcore.io/"+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+r(arguments[0])}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:"Invalid entropy: more than 512 bits is non standard, got \"{0}\""},{name:"NotEnoughEntropy",message:"Invalid entropy: at least 128 bits needed, got \"{0}\""}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:"Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got \"{0}\""}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:"Invalid length for xpubkey: got \"{0}\""},{name:"InvalidPath",message:"Invalid derivation path, it should look like: \"m/1/100\", got \"{0}\""},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]},{name:"Mnemonic",message:"Internal Error on bitcore-mnemonic module {0}",errors:[{name:"InvalidEntropy",message:"Entropy length must be an even multiple of 11 bits: {0}"},{name:"UnknownWordlist",message:"Could not detect the used word list: {0}"},{name:"InvalidMnemonic",message:"Mnemonic string is invalid: {0}"}]}]},{}],20:[function(e,t){(function(r){"use strict";function a(e){if(e instanceof a)return e;if(!(this instanceof a))return new a(e);if(!e)return this._generateRandomly();if(u.get(e))return this._generateRandomly(e);if(i.isString(e)||y.isBuffer(e)){if(a.isValidSerialized(e))this._buildFromSerialized(e);else if(_.isValidJSON(e))this._buildFromJSON(e);else if(y.isBuffer(e)&&a.isValidSerialized(e.toString()))this._buildFromSerialized(e.toString());else throw a.getSerializedError(e);}else if(i.isObject(e))this._buildFromObject(e);else throw new m.UnrecognizedArgument(e)}var o=e("assert"),n=e("buffer"),i=e("lodash"),d=e("./util/preconditions"),s=e("./crypto/bn"),c=e("./encoding/base58"),f=e("./encoding/base58check"),p=e("./crypto/hash"),u=e("./networks"),l=e("./crypto/point"),b=e("./privatekey"),h=e("./crypto/random"),g=e("./errors"),m=g.HDPrivateKey,y=e("./util/buffer"),_=e("./util/js"),v=1/8;a.isValidPath=function(e,t){if(i.isString(e)){var r=a._getDerivationIndexes(e);return null!==r&&i.every(r,a.isValidPath)}return!!i.isNumber(e)&&(e=a.Hardened)||t,e512*v)throw new m.InvalidEntropyArgument.TooMuchEntropy(e);var o=p.sha512hmac(e,new n.Buffer("Bitcoin seed"));return new a({network:u.get(t)||u.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:o.slice(0,32),chainCode:o.slice(32,64)})},a.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var t=e("./hdpublickey");this._hdPublicKey=new t(this)}},a.prototype._buildFromBuffers=function(e){a._validateBufferArguments(e),_.defineImmutable(this,{_buffers:e});var t=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,y.emptyBuffer(1),e.privateKey],o=n.Buffer.concat(t);if(!e.checksum||!e.checksum.length)e.checksum=f.checksum(o);else if(e.checksum.toString()!==f.checksum(o).toString())throw new g.InvalidB58Checksum(o);var i=u.get(y.integerFromBuffer(e.version)),d;d=f.encode(n.Buffer.concat(t)),e.xprivkey=new r(d);var c=new b(s.fromBuffer(e.privateKey),i),l=c.toPublicKey(),h=a.ParentFingerPrintSize,m=p.sha256ripemd160(l.toBuffer()).slice(0,h);return _.defineImmutable(this,{xprivkey:d,network:i,depth:y.integerFromSingleByteBuffer(e.depth),privateKey:c,publicKey:l,fingerPrint:m}),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},a._validateBufferArguments=function(e){var t=function(t,r){var a=e[t];o(y.isBuffer(a),t+" argument is not a buffer"),o(a.length===r,t+" has not the expected size: found "+a.length+", expected "+r)};t("version",a.VersionSize),t("depth",a.DepthSize),t("parentFingerPrint",a.ParentFingerPrintSize),t("childIndex",a.ChildIndexSize),t("chainCode",a.ChainCodeSize),t("privateKey",a.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",a.CheckSumSize)},a.prototype.toString=function(){return this.xprivkey},a.prototype.inspect=function(){return""},a.prototype.toObject=a.prototype.toJSON=function(){return{network:u.get(y.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:y.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:y.integerFromBuffer(this.fingerPrint),parentFingerPrint:y.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:y.integerFromBuffer(this._buffers.childIndex),chainCode:y.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:y.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},a.fromBuffer=function(e){return new a(e.toString())},a.prototype.toBuffer=function(){return y.copy(this._buffers.xprivkey)},a.DefaultDepth=0,a.DefaultFingerprint=0,a.DefaultChildIndex=0,a.Hardened=2147483648,a.MaxIndex=2*a.Hardened,a.RootElementAlias=["m","M","m'","M'"],a.VersionSize=4,a.DepthSize=1,a.ParentFingerPrintSize=4,a.ChildIndexSize=4,a.ChainCodeSize=32,a.PrivateKeySize=32,a.CheckSumSize=4,a.DataLength=78,a.SerializedByteSize=82,a.VersionStart=0,a.VersionEnd=a.VersionStart+a.VersionSize,a.DepthStart=a.VersionEnd,a.DepthEnd=a.DepthStart+a.DepthSize,a.ParentFingerPrintStart=a.DepthEnd,a.ParentFingerPrintEnd=a.ParentFingerPrintStart+a.ParentFingerPrintSize,a.ChildIndexStart=a.ParentFingerPrintEnd,a.ChildIndexEnd=a.ChildIndexStart+a.ChildIndexSize,a.ChainCodeStart=a.ChildIndexEnd,a.ChainCodeEnd=a.ChainCodeStart+a.ChainCodeSize,a.PrivateKeyStart=a.ChainCodeEnd+1,a.PrivateKeyEnd=a.PrivateKeyStart+a.PrivateKeySize,a.ChecksumStart=a.PrivateKeyEnd,a.ChecksumEnd=a.ChecksumStart+a.CheckSumSize,o(a.ChecksumEnd===a.SerializedByteSize),t.exports=a}).call(this,e("buffer").Buffer)},{"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./crypto/random":11,"./encoding/base58":13,"./encoding/base58check":14,"./errors":18,"./hdpublickey":21,"./networks":33,"./privatekey":35,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,assert:72,buffer:126,lodash:204}],21:[function(e,t){(function(r){"use strict";function a(e){if(e instanceof a)return e;if(!(this instanceof a))return new a(e);if(!e)throw new m.MustSupplyArgument;else if(n.isString(e)||v.isBuffer(e)){var t=a.getSerializedError(e);if(!t)return this._buildFromSerialized(e);if(v.isBuffer(e)&&!a.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof m.ArgumentIsPrivateExtended)return new p(e).hdPublicKey;throw t}else{if(n.isObject(e))return e instanceof p?this._buildFromPrivate(e):this._buildFromObject(e);throw new m.UnrecognizedArgument(e)}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=e("lodash"),i=e("./util/preconditions"),d=e("./crypto/bn"),s=e("./encoding/base58"),c=e("./encoding/base58check"),f=e("./crypto/hash"),p=e("./hdprivatekey"),u=e("./networks"),l=e("./crypto/point"),b=e("./publickey"),h=e("./errors"),g=h,m=h.HDPublicKey,y=e("assert"),_=e("./util/js"),v=e("./util/buffer");a.isValidPath=function(e){if(n.isString(e)){var t=p._getDerivationIndexes(e);return null!==t&&n.every(t,a.isValidPath)}return!!n.isNumber(e)&&0<=e&&e=a.Hardened||t)throw new m.InvalidIndexCantDeriveHardened;if(0>e)throw new m.InvalidPath(e);var r=v.integerAsBuffer(e),o=v.concat([this.publicKey.toBuffer(),r]),n=f.sha512hmac(o,this._buffers.chainCode),i=d.fromBuffer(n.slice(0,32),{size:32}),s=n.slice(32,64),c;try{c=b.fromPoint(l.getG().mul(i).add(this.publicKey.point))}catch(t){return this._deriveWithNumber(e+1)}var p=new a({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:s,publicKey:c});return p},a.prototype._deriveFromString=function(e){if(n.includes(e,"'"))throw new m.InvalidIndexCantDeriveHardened;else if(!a.isValidPath(e))throw new m.InvalidPath(e);var t=p._getDerivationIndexes(e),r=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return r},a.isValidSerialized=function(e,t){return n.isNull(a.getSerializedError(e,t))},a.getSerializedError=function(e,t){if(!(n.isString(e)||v.isBuffer(e)))return new m.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new g.InvalidB58Char("(unknown)",e);try{e=c.decode(e)}catch(t){return new g.InvalidB58Checksum(e)}if(e.length!==a.DataSize)return new m.InvalidLength(e);if(!n.isUndefined(t)){var r=a._validateNetwork(e,t);if(r)return r}var o=v.integerFromBuffer(e.slice(0,4));return o===u.livenet.xprivkey||o===u.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},a._validateNetwork=function(e,t){var r=u.get(t);if(!r)return new g.InvalidNetworkArgument(t);var o=e.slice(a.VersionStart,a.VersionEnd);return v.integerFromBuffer(o)===r.xpubkey?null:new g.InvalidNetwork(o)},a.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=l.getG().mul(d.fromBuffer(t.privateKey));return t.publicKey=l.pointToCompressed(r),t.version=v.integerAsBuffer(u.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},a.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(u.get(e.network).xpubkey):e.version,depth:n.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:n.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:n.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:n.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:n.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:n.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},a.prototype._buildFromSerialized=function(e){var t=c.decode(e),r={version:t.slice(a.VersionStart,a.VersionEnd),depth:t.slice(a.DepthStart,a.DepthEnd),parentFingerPrint:t.slice(a.ParentFingerPrintStart,a.ParentFingerPrintEnd),childIndex:t.slice(a.ChildIndexStart,a.ChildIndexEnd),chainCode:t.slice(a.ChainCodeStart,a.ChainCodeEnd),publicKey:t.slice(a.PublicKeyStart,a.PublicKeyEnd),checksum:t.slice(a.ChecksumStart,a.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},a.prototype._buildFromBuffers=function(e){a._validateBufferArguments(e),_.defineImmutable(this,{_buffers:e});var t=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],o=v.concat(t),n=c.checksum(o);if(!e.checksum||!e.checksum.length)e.checksum=n;else if(e.checksum.toString("hex")!==n.toString("hex"))throw new g.InvalidB58Checksum(o,n);var i=u.get(v.integerFromBuffer(e.version)),d;d=c.encode(v.concat(t)),e.xpubkey=new r(d);var s=new b(e.publicKey,{network:i}),p=a.ParentFingerPrintSize,l=f.sha256ripemd160(s.toBuffer()).slice(0,p);return _.defineImmutable(this,{xpubkey:d,network:i,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:s,fingerPrint:l}),this},a._validateBufferArguments=function(e){var t=function(t,r){var a=e[t];y(v.isBuffer(a),t+" argument is not a buffer, it's "+("undefined"==typeof a?"undefined":o(a))),y(a.length===r,t+" has not the expected size: found "+a.length+", expected "+r)};t("version",a.VersionSize),t("depth",a.DepthSize),t("parentFingerPrint",a.ParentFingerPrintSize),t("childIndex",a.ChildIndexSize),t("chainCode",a.ChainCodeSize),t("publicKey",a.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",a.CheckSumSize)},a.fromString=function(e){return i.checkArgument(n.isString(e),"No valid string was provided"),new a(e)},a.fromObject=function(e){return i.checkArgument(n.isObject(e),"No valid argument was provided"),new a(e)},a.prototype.toString=function(){return this.xpubkey},a.prototype.inspect=function(){return""},a.prototype.toObject=a.prototype.toJSON=function(){return{network:u.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}},a.fromBuffer=function(e){return new a(e)},a.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},a.Hardened=2147483648,a.RootElementAlias=["m","M"],a.VersionSize=4,a.DepthSize=1,a.ParentFingerPrintSize=4,a.ChildIndexSize=4,a.ChainCodeSize=32,a.PublicKeySize=33,a.CheckSumSize=4,a.DataSize=78,a.SerializedByteSize=82,a.VersionStart=0,a.VersionEnd=a.VersionStart+a.VersionSize,a.DepthStart=a.VersionEnd,a.DepthEnd=a.DepthStart+a.DepthSize,a.ParentFingerPrintStart=a.DepthEnd,a.ParentFingerPrintEnd=a.ParentFingerPrintStart+a.ParentFingerPrintSize,a.ChildIndexStart=a.ParentFingerPrintEnd,a.ChildIndexEnd=a.ChildIndexStart+a.ChildIndexSize,a.ChainCodeStart=a.ChildIndexEnd,a.ChainCodeEnd=a.ChainCodeStart+a.ChainCodeSize,a.PublicKeyStart=a.ChainCodeEnd,a.PublicKeyEnd=a.PublicKeyStart+a.PublicKeySize,a.ChecksumStart=a.PublicKeyEnd,a.ChecksumEnd=a.ChecksumStart+a.CheckSumSize,y(a.PublicKeyEnd===a.DataSize),y(a.ChecksumEnd===a.SerializedByteSize),t.exports=a}).call(this,e("buffer").Buffer)},{"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./encoding/base58":13,"./encoding/base58check":14,"./errors":18,"./hdprivatekey":20,"./networks":33,"./publickey":36,"./util/buffer":54,"./util/js":55,"./util/preconditions":56,assert:72,buffer:126,lodash:204}],22:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./util/preconditions"),n=e("./address"),i=e("./publickey"),d=e("./privatekey"),s=e("./encoding/bufferwriter"),c=e("./crypto/ecdsa"),f=e("./crypto/signature"),p=e("./crypto/hash").sha256sha256,u=e("./util/js"),l=function e(t){return this instanceof e?(o.checkArgument(a.isString(t),"First argument should be a string"),this.message=t,this):new e(t)};l.MAGIC_BYTES=new r("Bitcoin Signed Message:\n"),l.prototype.magicHash=function(){var e=s.varintBufNum(l.MAGIC_BYTES.length),t=new r(this.message),a=s.varintBufNum(t.length),o=r.concat([e,l.MAGIC_BYTES,a,t]),n=p(o);return n},l.prototype._sign=function(e){console.log(e),o.checkArgument(e instanceof d,"First argument should be an instance of PrivateKey");var t=this.magicHash(),r=new c;return r.hashbuf=t,r.privkey=e,r.pubkey=e.toPublicKey(),r.signRandomK(),r.calci(),r.sig},l.prototype.sign=function(e){var t=this._sign(e);return t.toCompact().toString("base64")},l.prototype._verify=function(e,t){o.checkArgument(e instanceof i,"First argument should be an instance of PublicKey"),o.checkArgument(t instanceof f,"Second argument should be an instance of Signature");var r=this.magicHash(),a=c.verify(r,t,e);return a||(this.error="The signature was invalid"),a},l.prototype.verify=function(e,t){o.checkArgument(e),o.checkArgument(t&&a.isString(t)),a.isString(e)&&(e=n.fromString(e));var i=f.fromCompact(new r(t,"base64")),d=new c;d.hashbuf=this.magicHash(),d.sig=i;var s=d.toPublicKey(),p=n.fromPublicKey(s,e.network);return e.toString()===p.toString()?this._verify(s,i):(this.error="The signature did not match the message digest",!1)},l.fromString=function(e){return new l(e)},l.fromJSON=function(e){return u.isValidJSON(e)&&(e=JSON.parse(e)),new l(e.message)},l.prototype.toObject=function(){return{message:this.message}},l.prototype.toJSON=function(){return JSON.stringify(this.toObject())},l.prototype.toString=function(){return this.message},l.prototype.inspect=function(){return""},t.exports=l}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/ecdsa":8,"./crypto/hash":9,"./crypto/signature":12,"./encoding/bufferwriter":16,"./privatekey":35,"./publickey":36,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],23:[function(e,t){"use strict";t.exports=e("./mnemonic")},{"./mnemonic":24}],24:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("../util/preconditions"),n=e("../crypto/bn"),d=e("../errors"),i=e("../crypto/hash"),s=e("../hdprivatekey"),c=e("../crypto/random"),f=e("unorm"),p=function e(t,o){if(!(this instanceof e))return new e(t,o);a.isArray(t)&&(o=t,t=null);var n,i,s;if(r.isBuffer(t))s=t;else if(a.isString(t))i=f.nfkd(t);else if(a.isNumber(t))n=t;else if(t)throw new d.InvalidArgument("data","Must be a Buffer, a string or an integer");if(n=n||128,o=o||e._getDictionary(i),i&&!o)throw new d.UnknownWordlist(i);if(o=o||e.Words.ENGLISH,s&&(i=e._entropy2mnemonic(s,o)),i&&!e.isValid(i,o))throw new d.InvalidMnemonic(i);if(0!=n%32||128>n)throw new d.InvalidArgument("ENT","Values must be ENT > 128 and ENT % 32 == 0");i=i||e._mnemonic(n,o),Object.defineProperty(this,"wordlist",{configurable:!1,value:o}),Object.defineProperty(this,"phrase",{configurable:!1,value:i})};p.Words=e("./words"),p.isValid=function(e,t){if(e=f.nfkd(e),t=t||p._getDictionary(e),!t)return!1;for(var a=e.split(" "),o="",n=0,i;ni)return!1;o+=("00000000000"+i.toString(2)).slice(-11)}var d=o.length/33,s=o.slice(-d),c=o.slice(0,o.length-d),u=new r(c.length/8);for(n=0;no)return!1;return!0},p._getDictionary=function(e){if(!e)return null;for(var t=Object.keys(p.Words),r=0,a;r"},p._mnemonic=function(e,t){var r=c.getRandomBuffer(e/8);return p._entropy2mnemonic(r,t)},p._entropy2mnemonic=function(e,t){for(var r="",a=0;a4294967295*d)throw Error("Requested key length too long");if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError("key must a string or Buffer");if("string"!=typeof t&&!r.isBuffer(t))throw new TypeError("salt must a string or Buffer");"string"==typeof e&&(e=new r(e)),"string"==typeof t&&(t=new r(t));var s=new r(n),c=new r(d),f=new r(d),u=new r(t.length+4),b=p(n/d);t.copy(u,0,0,t.length);for(var l=1;l<=b;l++){u[t.length+0]=255&l>>24,u[t.length+1]=255&l>>16,u[t.length+2]=255&l>>8,u[t.length+3]=255&l>>0,c=a.createHmac("sha512",e).update(u).digest(),c.copy(f,0,0,d);for(var i=1;i=e,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.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},a.reverseMap=[],a.map)a.reverseMap[a.map[c]]=c;i.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./util/buffer":54,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],35:[function(e,t){(function(r){"use strict";function a(e,t){if(!(this instanceof a))return new a(e,t);if(e instanceof a)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new d(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(f.getN()))throw new TypeError("Number must be less than N");if("undefined"==typeof r.network)throw new TypeError("Must specify the network (\"livenet\" or \"testnet\")");return s.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 o=e("lodash"),n=e("./address"),i=e("./encoding/base58check"),d=e("./crypto/bn"),s=e("./util/js"),c=e("./networks"),f=e("./crypto/point"),p=e("./publickey"),u=e("./crypto/random"),l=e("./util/preconditions");a.prototype._classifyArguments=function(e,t){var n={compressed:!0,network:t?c.get(t):c.defaultNetwork};if(o.isUndefined(e)||o.isNull(e))n.bn=a._getRandomBN();else if(e instanceof d)n.bn=e;else if(e instanceof r||e instanceof Uint8Array)n=a._transformBuffer(e,t);else if(e.bn&&e.network)n=a._transformObject(e);else if(!t&&c.get(e))n.bn=a._getRandomBN(),n.network=c.get(e);else if("string"==typeof e)s.isHexa(e)?n.bn=new d(new r(e,"hex")):n=a._transformWIF(e,t);else throw new TypeError("First argument is an unrecognized data type.");return n},a._getRandomBN=function(){var e,t;do{var r=u.getRandomBuffer(32);t=d.fromBuffer(r),e=t.lt(f.getN())}while(!e);return t},a._transformBuffer=function(e,t){var r={};if(32===e.length)return a._transformBNBuffer(e,t);if(r.network=c.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==c.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else if(33===e.length)r.compressed=!1;else throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");return r.bn=d.fromBuffer(e.slice(1,33)),r},a._transformBNBuffer=function(e,t){var r={network:c.get(t)||c.defaultNetwork,bn:d.fromBuffer(e),compressed:!1};return r},a._transformWIF=function(e,t){return a._transformBuffer(i.decode(e),t)},a.fromBuffer=function(e,t){return new a(e,t)},a._transformObject=function(e){var t=new d(e.bn,"hex"),r=c.get(e.network);return{bn:t,network:r,compressed:e.compressed}},a.fromString=a.fromWIF=function(e){return l.checkArgument(o.isString(e),"First argument is expected to be a string."),new a(e)},a.fromObject=function(e){return l.checkArgument(o.isObject(e),"First argument is expected to be an object."),new a(e)},a.fromRandom=function(e){var t=a._getRandomBN();return new a(t,e)},a.getValidationError=function(e,t){var r;try{new a(e,t)}catch(t){r=t}return r},a.isValid=function(e,t){return!!e&&!a.getValidationError(e,t)},a.prototype.toString=function(){return this.toBuffer().toString("hex")},a.prototype.toWIF=function(){var e=this.network,t=this.compressed,a;return a=t?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})]),i.encode(a)},a.prototype.toBigNumber=function(){return this.bn},a.prototype.toBuffer=function(){return this.bn.toBuffer()},a.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},a.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=p.fromPrivateKey(this)),this._pubkey},a.prototype.toAddress=function(e){var t=this.toPublicKey();return n.fromPublicKey(t,e||this.network)},a.prototype.toObject=a.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},a.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/bn":7,"./crypto/point":10,"./crypto/random":11,"./encoding/base58check":14,"./networks":33,"./publickey":36,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],36:[function(e,t){(function(r){"use strict";function a(e,t){if(!(this instanceof a))return new a(e,t);if(f.checkArgument(e,"First argument is required, please include public key data."),e instanceof a)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),d.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||s.defaultNetwork}),this}var o=e("./crypto/bn"),n=e("./crypto/point"),i=e("./crypto/hash"),d=e("./util/js"),s=e("./networks"),c=e("lodash"),f=e("./util/preconditions");a.prototype._classifyArgs=function(e,t){var o={compressed:c.isUndefined(t.compressed)||t.compressed};if(e instanceof n)o.point=e;else if(e.x&&e.y)o=a._transformObject(e);else if("string"==typeof e)o=a._transformDER(new r(e,"hex"));else if(a._isBuffer(e))o=a._transformDER(e);else if(a._isPrivateKey(e))o=a._transformPrivateKey(e);else throw new TypeError("First argument is an unrecognized data format.");return o.network||(o.network=c.isUndefined(t.network)?void 0:s.get(t.network)),o},a._isPrivateKey=function(t){var r=e("./privatekey");return t instanceof r},a._isBuffer=function(e){return e instanceof r||e instanceof Uint8Array},a._transformPrivateKey=function(e){f.checkArgument(a._isPrivateKey(e),"Must be an instance of PrivateKey");var t={point:n.getG().mul(e.bn),compressed:e.compressed,network:e.network};return t},a._transformDER=function(e,t){f.checkArgument(a._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r={};t=!!c.isUndefined(t)||t;var i,d,s,p;if(4===e[0]||!t&&(6===e[0]||7===e[0])){if(s=e.slice(1,33),p=e.slice(33,65),32!==s.length||32!==p.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");i=new o(s),d=new o(p),r.point=new n(i,d),r.compressed=!1}else if(3===e[0])s=e.slice(1),i=new o(s),r=a._transformX(!0,i),r.compressed=!0;else if(2===e[0])s=e.slice(1),i=new o(s),r=a._transformX(!1,i),r.compressed=!0;else throw new TypeError("Invalid DER format public key");return r},a._transformX=function(e,t){f.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={point:n.fromX(e,t)};return r},a._transformObject=function(e){var t=new o(e.x,"hex"),r=new o(e.y,"hex"),i=new n(t,r);return new a(i,{compressed:e.compressed})},a.fromPrivateKey=function(e){f.checkArgument(a._isPrivateKey(e),"Must be an instance of PrivateKey");var t=a._transformPrivateKey(e);return new a(t.point,{compressed:t.compressed,network:t.network})},a.fromDER=a.fromBuffer=function(e,t){f.checkArgument(a._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r=a._transformDER(e,t);return new a(r.point,{compressed:r.compressed})},a.fromPoint=function(e,t){return f.checkArgument(e instanceof n,"First argument must be an instance of Point."),new a(e,{compressed:t})},a.fromString=function(e,t){var o=new r(e,t||"hex"),n=a._transformDER(o);return new a(n.point,{compressed:n.compressed})},a.fromX=function(e,t){var r=a._transformX(e,t);return new a(r.point,{compressed:r.compressed})},a.getValidationError=function(e){var t;try{new a(e)}catch(r){t=r}return t},a.isValid=function(e){return!a.getValidationError(e)},a.prototype.toObject=a.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},a.prototype.toBuffer=a.prototype.toDER=function(){var e=this.point.getX(),t=this.point.getY(),a=e.toBuffer({size:32}),o=t.toBuffer({size:32}),n;if(!this.compressed)return n=new r([4]),r.concat([n,a,o]);var i=o[o.length-1]%2;return n=i?new r([3]):new r([2]),r.concat([n,a])},a.prototype._getID=function(){return i.sha256ripemd160(this.toBuffer())},a.prototype.toAddress=function(t){var r=e("./address");return r.fromPublicKey(this,t||this.network)},a.prototype.toString=function(){return this.toDER().toString("hex")},a.prototype.inspect=function(){return""},t.exports=a}).call(this,e("buffer").Buffer)},{"./address":1,"./crypto/bn":7,"./crypto/hash":9,"./crypto/point":10,"./networks":33,"./privatekey":35,"./util/js":55,"./util/preconditions":56,buffer:126,lodash:204}],37:[function(e,t){"use strict";t.exports=e("./script"),t.exports.Interpreter=e("./interpreter")},{"./interpreter":38,"./script":39}],38:[function(e,t){(function(r){"use strict";var a=e("lodash"),o=e("./script"),d=e("../opcode"),s=e("../crypto/bn"),n=e("../crypto/hash"),i=e("../crypto/signature"),c=e("../publickey"),f=function e(t){return this instanceof e?void(t?(this.initialize(),this.set(t)):this.initialize()):new e(t)};f.prototype.verify=function(t,r,n,i,d){var s=e("../transaction");a.isUndefined(n)&&(n=new s),a.isUndefined(i)&&(i=0),a.isUndefined(d)&&(d=0),this.set({script:t,tx:n,nin:i,flags:d});var c;if(0!=(d&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;d&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var p=this.stack;if(this.initialize(),this.set({script:r,stack:p,tx:n,nin:i,flags:d}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var u=this.stack[this.stack.length-1];if(!f.castToBool(u))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(d&f.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var l=c[c.length-1],b=o.fromBuffer(l);return c.pop(),this.initialize(),this.set({script:b,stack:c,tx:n,nin:i,flags:d}),!!this.evaluate()&&(0===c.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!f.castToBool(c[c.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},t.exports=f,f.prototype.initialize=function(){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin="undefined"==typeof e.nin?this.nin:e.nin,this.stack=e.stack||this.stack,this.altstack=e.altack||this.altstack,this.pc="undefined"==typeof e.pc?this.pc:e.pc,this.pbegincodehash="undefined"==typeof e.pbegincodehash?this.pbegincodehash:e.pbegincodehash,this.nOpCount="undefined"==typeof e.nOpCount?this.nOpCount:e.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags="undefined"==typeof e.flags?this.flags:e.flags},f.true=new r([1]),f.false=new r([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.LOCKTIME_THRESHOLD=5e8,f.LOCKTIME_THRESHOLD_BN=new s(f.LOCKTIME_THRESHOLD),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.castToBool=function(e){for(var t=0;t=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&!e.gt(new s(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal()},f.prototype.step=function(){var e=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),t=-1===this.vfExec.indexOf(!1),r=this.script.chunks[this.pc],p,u,l,b,h,g,m,y,_,v,S,I,x,w,A,E,P;this.pc++;var B=r.opcodenum;if(a.isUndefined(B))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(r.buf&&r.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(B>d.OP_16&&201<++this.nOpCount)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(B===d.OP_CAT||B===d.OP_SUBSTR||B===d.OP_LEFT||B===d.OP_RIGHT||B===d.OP_INVERT||B===d.OP_AND||B===d.OP_OR||B===d.OP_XOR||B===d.OP_2MUL||B===d.OP_2DIV||B===d.OP_MUL||B===d.OP_DIV||B===d.OP_MOD||B===d.OP_LSHIFT||B===d.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(t&&0<=B&&B<=d.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(!r.buf)this.stack.push(f.false);else if(r.len!==r.buf.length)throw new Error("Length of push value not equal to length of data");else this.stack.push(r.buf)}else if(t||d.OP_IF<=B&&B<=d.OP_ENDIF)switch(B){case d.OP_1NEGATE:case d.OP_1:case d.OP_2:case d.OP_3:case d.OP_4:case d.OP_5:case d.OP_6:case d.OP_7:case d.OP_8:case d.OP_9:case d.OP_10:case d.OP_11:case d.OP_12:case d.OP_13:case d.OP_14:case d.OP_15:case d.OP_16:h=B-(d.OP_1-1),p=new s(h).toScriptNumBuffer(),this.stack.push(p);break;case d.OP_NOP:break;case d.OP_NOP2:case d.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var O=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e,5);if(O.lt(new s(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(O))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case d.OP_NOP1:case d.OP_NOP3:case d.OP_NOP4:case d.OP_NOP5:case d.OP_NOP6:case d.OP_NOP7:case d.OP_NOP8:case d.OP_NOP9:case d.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case d.OP_IF:case d.OP_NOTIF:{if(E=!1,t){if(1>this.stack.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;p=this.stack.pop(),E=f.castToBool(p),B===d.OP_NOTIF&&(E=!E)}this.vfExec.push(E)}break;case d.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 d.OP_ENDIF:{if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop()}break;case d.OP_VERIFY:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=this.stack[this.stack.length-1],E=f.castToBool(p),E)this.stack.pop();else return this.errstr="SCRIPT_ERR_VERIFY",!1}break;case d.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;break;case d.OP_TOALTSTACK:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop())}break;case d.OP_FROMALTSTACK:{if(1>this.altstack.length)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop())}break;case d.OP_2DROP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop()}break;case d.OP_2DUP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1],this.stack.push(u),this.stack.push(l)}break;case d.OP_3DUP:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-3],l=this.stack[this.stack.length-2];var R=this.stack[this.stack.length-1];this.stack.push(u),this.stack.push(l),this.stack.push(R)}break;case d.OP_2OVER:{if(4>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-4],l=this.stack[this.stack.length-3],this.stack.push(u),this.stack.push(l)}break;case d.OP_2ROT:{if(6>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack.splice(this.stack.length-6,2),this.stack.push(b[0]),this.stack.push(b[1])}break;case d.OP_2SWAP:{if(4>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack.splice(this.stack.length-4,2),this.stack.push(b[0]),this.stack.push(b[1])}break;case d.OP_IFDUP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1],E=f.castToBool(p),E&&this.stack.push(p)}break;case d.OP_DEPTH:p=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(p);break;case d.OP_DROP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop()}break;case d.OP_DUP:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1])}break;case d.OP_NIP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1)}break;case d.OP_OVER:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2])}break;case d.OP_PICK:case d.OP_ROLL:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=this.stack[this.stack.length-1],y=s.fromScriptNumBuffer(p,e),h=y.toNumber(),this.stack.pop(),0>h||h>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-h-1],B===d.OP_ROLL&&this.stack.splice(this.stack.length-h-1,1),this.stack.push(p)}break;case d.OP_ROT:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=this.stack[this.stack.length-3],m=this.stack[this.stack.length-2];var j=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=m,this.stack[this.stack.length-2]=j,this.stack[this.stack.length-1]=g}break;case d.OP_SWAP:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=this.stack[this.stack.length-2],m=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=m,this.stack[this.stack.length-1]=g}break;case d.OP_TUCK:{if(2>this.stack.length)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 d.OP_SIZE:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new s(this.stack[this.stack.length-1].length),this.stack.push(y.toScriptNumBuffer())}break;case d.OP_EQUAL:case d.OP_EQUALVERIFY:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;u=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1];var T=u.toString("hex")===l.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(T?f.true:f.false),B===d.OP_EQUALVERIFY)if(T)this.stack.pop();else return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1}break;case d.OP_1ADD:case d.OP_1SUB:case d.OP_NEGATE:case d.OP_ABS:case d.OP_NOT:case d.OP_0NOTEQUAL:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1],y=s.fromScriptNumBuffer(p,e),B===d.OP_1ADD?y=y.add(s.One):B===d.OP_1SUB?y=y.sub(s.One):B===d.OP_NEGATE?y=y.neg():B===d.OP_ABS?0>y.cmp(s.Zero)&&(y=y.neg()):B===d.OP_NOT?y=new s((0===y.cmp(s.Zero))+0):B===d.OP_0NOTEQUAL?y=new s((0!==y.cmp(s.Zero))+0):void 0,this.stack.pop(),this.stack.push(y.toScriptNumBuffer())}break;case d.OP_ADD:case d.OP_SUB:case d.OP_BOOLAND:case d.OP_BOOLOR:case d.OP_NUMEQUAL:case d.OP_NUMEQUALVERIFY:case d.OP_NUMNOTEQUAL:case d.OP_LESSTHAN:case d.OP_GREATERTHAN:case d.OP_LESSTHANOREQUAL:case d.OP_GREATERTHANOREQUAL:case d.OP_MIN:case d.OP_MAX:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(_=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e),y=new s(0),B===d.OP_ADD?y=_.add(v):B===d.OP_SUB?y=_.sub(v):B===d.OP_BOOLAND?y=new s((0!==_.cmp(s.Zero)&&0!==v.cmp(s.Zero))+0):B===d.OP_BOOLOR?y=new s((0!==_.cmp(s.Zero)||0!==v.cmp(s.Zero))+0):B===d.OP_NUMEQUAL?y=new s((0===_.cmp(v))+0):B===d.OP_NUMEQUALVERIFY?y=new s((0===_.cmp(v))+0):B===d.OP_NUMNOTEQUAL?y=new s((0!==_.cmp(v))+0):B===d.OP_LESSTHAN?y=new s((0>_.cmp(v))+0):B===d.OP_GREATERTHAN?y=new s((0<_.cmp(v))+0):B===d.OP_LESSTHANOREQUAL?y=new s((0>=_.cmp(v))+0):B===d.OP_GREATERTHANOREQUAL?y=new s((0<=_.cmp(v))+0):B===d.OP_MIN?y=0>_.cmp(v)?_:v:B===d.OP_MAX?y=0<_.cmp(v)?_:v:void 0,(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),B===d.OP_NUMEQUALVERIFY))if(f.castToBool(this.stack[this.stack.length-1]))this.stack.pop();else return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1}break;case d.OP_WITHIN:{if(3>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=s.fromScriptNumBuffer(this.stack[this.stack.length-3],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e);var N=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e);E=0>=v.cmp(_)&&0>_.cmp(N),this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(E?f.true:f.false)}break;case d.OP_RIPEMD160:case d.OP_SHA1:case d.OP_SHA256:case d.OP_HASH160:case d.OP_HASH256:{if(1>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-1];var C;B===d.OP_RIPEMD160?C=n.ripemd160(p):B===d.OP_SHA1?C=n.sha1(p):B===d.OP_SHA256?C=n.sha256(p):B===d.OP_HASH160?C=n.sha256ripemd160(p):B===d.OP_HASH256&&(C=n.sha256sha256(p)),this.stack.pop(),this.stack.push(C)}break;case d.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case d.OP_CHECKSIG:case d.OP_CHECKSIGVERIFY:{if(2>this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=this.stack[this.stack.length-2],I=this.stack[this.stack.length-1],x=new o().set({chunks:this.script.chunks.slice(this.pbegincodehash)});var z=new o().add(S);if(x.findAndDelete(z),!this.checkSignatureEncoding(S)||!this.checkPubkeyEncoding(I))return!1;try{w=i.fromTxFormat(S),A=c.fromBuffer(I,!1),P=this.tx.verifySignature(w,A,this.nin,x)}catch(t){P=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(P?f.true:f.false),B===d.OP_CHECKSIGVERIFY)if(P)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1}break;case d.OP_CHECKMULTISIG:case d.OP_CHECKMULTISIGVERIFY:{var M=1;if(this.stack.lengthU||20D||D>U)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var q=++M;if(M+=D,this.stack.lengthU&&(P=!1)}for(;1this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.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(P?f.true:f.false),B===d.OP_CHECKMULTISIGVERIFY)if(P)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1;}return!0}}).call(this,e("buffer").Buffer)},{"../crypto/bn":7,"../crypto/hash":9,"../crypto/signature":12,"../opcode":34,"../publickey":36,"../transaction":40,"./script":39,buffer:126,lodash:204}],39:[function(e,t){(function(r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=e("../address"),n=e("../encoding/bufferreader"),d=e("../encoding/bufferwriter"),i=e("../crypto/hash"),c=e("../opcode"),f=e("../publickey"),s=e("../crypto/signature"),p=e("../networks"),u=e("../util/preconditions"),l=e("lodash"),b=e("../errors"),h=e("buffer"),g=e("../util/buffer"),m=e("../util/js"),y=function e(t){return this instanceof e?(this.chunks=[],g.isBuffer(t))?e.fromBuffer(t):t instanceof o?e.fromAddress(t):t instanceof e?e.fromBuffer(t.toBuffer()):"string"==typeof t?e.fromString(t):void("undefined"!=typeof t&&this.set(t)):new e(t)};y.prototype.set=function(e){return this.chunks=e.chunks||this.chunks,this},y.fromBuffer=function(t){var e=new y;e.chunks=[];for(var r=new n(t);!r.finished();)try{var a=r.readUInt8(),o,i;0"},y.prototype.isPublicKeyHashOut=function(){return!!(5===this.chunks.length&&this.chunks[0].opcodenum===c.OP_DUP&&this.chunks[1].opcodenum===c.OP_HASH160&&this.chunks[2].buf&&20===this.chunks[2].buf.length&&this.chunks[3].opcodenum===c.OP_EQUALVERIFY&&this.chunks[4].opcodenum===c.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},y.prototype.getPublicKey=function(){return u.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return u.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===c.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4===t||6===t||7===t)&&65===e.length?r=!0:(3===t||2===t)&&33===e.length&&(r=!0),r)return f.isValid(e)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===c.OP_HASH160&&20===e[1]&&e[e.length-1]===c.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(1>=this.chunks.length)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf;if(!t)return!1;var r;try{r=y.fromBuffer(t)}catch(t){if(t instanceof b.Script.InvalidBuffer)return!1;throw t}var a=r.classify();return a!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return 3r)a=c.OP_PUSHDATA1;else if(65536>r)a=c.OP_PUSHDATA2;else if(4294967296>r)a=c.OP_PUSHDATA4;else throw new Error("You can't push that much data");return this._insertAtPosition({buf:e,len:r,opcodenum:a},t),this},y.prototype.removeCodeseparators=function(){for(var e=[],t=0;t=r[0]?a===c.OP_1+(r[0]-1):1===r.length&&129===r[0]?a===c.OP_1NEGATE:75>=r.length?a===r.length:255>=r.length?a===c.OP_PUSHDATA1:!(65535>=r.length)||a===c.OP_PUSHDATA2},y.prototype._decodeOP_N=function(e){if(e===c.OP_0)return 0;if(e>=c.OP_1&&e<=c.OP_16)return e-(c.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},y.prototype.getSignatureOperationsCount=function(e){e=!!l.isUndefined(e)||e;var t=this,r=0,a=c.OP_INVALIDOPCODE;return l.each(t.chunks,function(o){var n=o.opcodenum;n==c.OP_CHECKSIG||n==c.OP_CHECKSIGVERIFY?r++:(n==c.OP_CHECKMULTISIG||n==c.OP_CHECKMULTISIGVERIFY)&&(e&&a>=c.OP_1&&a<=c.OP_16?r+=t._decodeOP_N(a):r+=20),a=n}),r},t.exports=y}).call(this,e("buffer").Buffer)},{"../address":1,"../crypto/hash":9,"../crypto/signature":12,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../errors":18,"../networks":33,"../opcode":34,"../publickey":36,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],40:[function(e,t){"use strict";t.exports=e("./transaction"),t.exports.Input=e("./input"),t.exports.Output=e("./output"),t.exports.UnspentOutput=e("./unspentoutput"),t.exports.Signature=e("./signature"),t.exports.Sighash=e("./sighash")},{"./input":41,"./output":47,"./sighash":48,"./signature":49,"./transaction":50,"./unspentoutput":51}],41:[function(e,t){"use strict";t.exports=e("./input"),t.exports.PublicKey=e("./publickey"),t.exports.PublicKeyHash=e("./publickeyhash"),t.exports.MultiSig=e("./multisig.js"),t.exports.MultiSigScriptHash=e("./multisigscripthash.js")},{"./input":42,"./multisig.js":43,"./multisigscripthash.js":44,"./publickey":45,"./publickeyhash":46}],42:[function(e,t){"use strict";function r(e){return this instanceof r?e?this._fromObject(e):void 0:new r(e)}var a=e("lodash"),o=e("../../util/preconditions"),n=e("../../errors"),i=e("../../encoding/bufferwriter"),d=e("buffer"),s=e("../../util/buffer"),c=e("../../util/js"),f=e("../../script"),p=e("../sighash"),u=e("../output"),l=4294967295,b=l;r.MAXINT=l,r.DEFAULT_SEQNUMBER=b,r.DEFAULT_LOCKTIME_SEQNUMBER=l-1,r.DEFAULT_RBF_SEQNUMBER=l-2,Object.defineProperty(r.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new f(this._scriptBuffer),this._script._isInput=!0),this._script)}}),r.fromObject=function(e){o.checkArgument(a.isObject(e));var t=new r;return t._fromObject(e)},r.prototype._fromObject=function(e){var t;if(t=a.isString(e.prevTxId)&&c.isHexa(e.prevTxId)?new d.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof u?e.output:new u(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=a.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=a.isUndefined(e.sequenceNumber)?a.isUndefined(e.seqnum)?b:e.seqnum:e.sequenceNumber,a.isUndefined(e.script)&&a.isUndefined(e.scriptBuffer))throw new n.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},r.prototype.toObject=r.prototype.toJSON=function(){var e={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(e.scriptString=this.script.toString()),this.output&&(e.output=this.output.toObject()),e},r.fromBufferReader=function(e){var t=new r;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},r.prototype.toBufferWriter=function(e){e||(e=new i),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},r.prototype.setScript=function(e){if(this._script=null,e instanceof f)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(c.isHexa(e))this._scriptBuffer=new d.Buffer(e,"hex");else if(a.isString(e))this._script=new f(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(s.isBuffer(e))this._scriptBuffer=new d.Buffer(e);else throw new TypeError("Invalid argument type: script");return this},r.prototype.getSignatures=function(){throw new n.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},r.prototype.isFullySigned=function(){throw new n.AbstractMethodInvoked("Input#isFullySigned")},r.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},r.prototype.addSignature=function(){throw new n.AbstractMethodInvoked("Input#addSignature")},r.prototype.clearSignatures=function(){throw new n.AbstractMethodInvoked("Input#clearSignatures")},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,p.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},r.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},r.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},t.exports=r},{"../../encoding/bufferwriter":16,"../../errors":18,"../../script":37,"../../util/buffer":54,"../../util/js":55,"../../util/preconditions":56,"../output":47,"../sighash":48,buffer:126,lodash:204}],43:[function(e,t){"use strict";function r(e,t,r,o){i.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,o=o||e.signatures,this.publicKeys=a.sortBy(t,function(e){return e.toString("hex")}),s.checkState(c.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},a.each(this.publicKeys,function(e,t){n.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=o?this._deserializeSignatures(o):Array(this.publicKeys.length)}var a=e("lodash"),o=e("inherits"),n=e("../transaction"),i=e("./input"),d=e("../output"),s=e("../../util/preconditions"),c=e("../../script"),f=e("../../crypto/signature"),p=e("../sighash"),u=e("../../publickey"),l=e("../../util/buffer"),b=e("../signature");o(r,i),r.prototype.toObject=function(){var e=i.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=a.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},r.prototype._deserializeSignatures=function(e){return a.map(e,function(e){return e?new b(e):void 0})},r.prototype._serializeSignatures=function(){return a.map(this.signatures,function(e){return e?e.toObject():void 0})},r.prototype.getSignatures=function(e,t,r,o){s.checkState(this.output instanceof d),o=o||f.SIGHASH_ALL|f.SIGHASH_FORKID;var n=this,i=[];return a.each(this.publicKeys,function(a){a.toString()===t.publicKey.toString()&&i.push(new b({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:p.sign(e,t,o,r,n.output.script,n.output.satoshisBN),sigtype:o}))}),i},r.prototype.addSignature=function(e,t){return s.checkState(!this.isFullySigned(),"All needed signatures have already been added"),s.checkArgument(!a.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),s.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},r.prototype._updateScript=function(){return this.setScript(c.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},r.prototype._createSignatures=function(){return a.map(a.filter(this.signatures,function(e){return!a.isUndefined(e)}),function(e){return l.concat([e.signature.toDER(),l.integerAsSingleByteBuffer(e.sigtype)])})},r.prototype.clearSignatures=function(){this.signatures=Array(this.publicKeys.length),this._updateScript()},r.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},r.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},r.prototype.countSignatures=function(){return a.reduce(this.signatures,function(e,t){return e+!!t},0)},r.prototype.publicKeysWithoutSignature=function(){var e=this;return a.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,p.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},r.normalizeSignatures=function(e,t,r,a,o){return o.map(function(o){var n=null;return a=a.filter(function(a){if(n)return!0;var i=new b({signature:f.fromTxFormat(a),publicKey:o,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});i.signature.nhashtype=i.sigtype;var d=p.verify(e,i.signature,i.publicKey,i.inputIndex,t.output.script);return!d||(n=i,!1)}),n?n:null})},r.OPCODES_SIZE=1,r.SIGNATURE_SIZE=73,r.prototype._estimateSize=function(){return r.OPCODES_SIZE+this.threshold*r.SIGNATURE_SIZE},t.exports=r},{"../../crypto/signature":12,"../../publickey":36,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"../transaction":50,"./input":42,inherits:201,lodash:204}],44:[function(e,t){"use strict";function r(e,t,r,o){n.apply(this,arguments);var i=this;t=t||e.publicKeys,r=r||e.threshold,o=o||e.signatures,this.publicKeys=a.sortBy(t,function(e){return e.toString("hex")}),this.redeemScript=s.buildMultisigOut(this.publicKeys,r),d.checkState(s.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},a.each(this.publicKeys,function(e,t){i.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=o?this._deserializeSignatures(o):Array(this.publicKeys.length)}var a=e("lodash"),o=e("inherits"),n=e("./input"),i=e("../output"),d=e("../../util/preconditions"),s=e("../../script"),c=e("../../crypto/signature"),f=e("../sighash"),p=e("../../publickey"),u=e("../../util/buffer"),l=e("../signature");o(r,n),r.prototype.toObject=function(){var e=n.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=a.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},r.prototype._deserializeSignatures=function(e){return a.map(e,function(e){return e?new l(e):void 0})},r.prototype._serializeSignatures=function(){return a.map(this.signatures,function(e){return e?e.toObject():void 0})},r.prototype.getSignatures=function(e,t,r,o){d.checkState(this.output instanceof i),o=o||c.SIGHASH_ALL|c.SIGHASH_FORKID;var n=this,s=[];return a.each(this.publicKeys,function(a){a.toString()===t.publicKey.toString()&&s.push(new l({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:f.sign(e,t,o,r,n.redeemScript,n.output.satoshisBN),sigtype:o}))}),s},r.prototype.addSignature=function(e,t){return d.checkState(!this.isFullySigned(),"All needed signatures have already been added"),d.checkArgument(!a.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),d.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},r.prototype._updateScript=function(){return this.setScript(s.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},r.prototype._createSignatures=function(){return a.map(a.filter(this.signatures,function(e){return!a.isUndefined(e)}),function(e){return u.concat([e.signature.toDER(),u.integerAsSingleByteBuffer(e.sigtype)])})},r.prototype.clearSignatures=function(){this.signatures=Array(this.publicKeys.length),this._updateScript()},r.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},r.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},r.prototype.countSignatures=function(){return a.reduce(this.signatures,function(e,t){return e+!!t},0)},r.prototype.publicKeysWithoutSignature=function(){var e=this;return a.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},r.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript,this.output.satoshisBN)},r.OPCODES_SIZE=7,r.SIGNATURE_SIZE=74,r.PUBKEY_SIZE=34,r.prototype._estimateSize=function(){return r.OPCODES_SIZE+this.threshold*r.SIGNATURE_SIZE+this.publicKeys.length*r.PUBKEY_SIZE},t.exports=r},{"../../crypto/signature":12,"../../publickey":36,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201,lodash:204}],45:[function(e,t){"use strict";function r(){i.apply(this,arguments)}var a=e("inherits"),o=e("../../util/preconditions"),n=e("../../util/buffer"),i=e("./input"),d=e("../output"),s=e("../sighash"),c=e("../../script"),f=e("../../crypto/signature"),p=e("../signature");a(r,i),r.prototype.getSignatures=function(e,t,r,a){o.checkState(this.output instanceof d),a=a||f.SIGHASH_ALL|f.SIGHASH_FORKID;var n=t.toPublicKey();return n.toString()===this.output.script.getPublicKey().toString("hex")?[new p({publicKey:n,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:s.sign(e,t,a,r,this.output.script,this.output.satoshisBN),sigtype:a})]:[]},r.prototype.addSignature=function(e,t){return o.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(c.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},r.prototype.clearSignatures=function(){return this.setScript(c.empty()),this},r.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},r.SCRIPT_MAX_SIZE=73,r.prototype._estimateSize=function(){return r.SCRIPT_MAX_SIZE},t.exports=r},{"../../crypto/signature":12,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201}],46:[function(e,t){"use strict";function r(){d.apply(this,arguments)}var a=e("inherits"),o=e("../../util/preconditions"),n=e("../../util/buffer"),i=e("../../crypto/hash"),d=e("./input"),s=e("../output"),c=e("../sighash"),f=e("../../script"),p=e("../../crypto/signature"),u=e("../signature");a(r,d),r.prototype.getSignatures=function(e,t,r,a,d){return o.checkState(this.output instanceof s),d=d||i.sha256ripemd160(t.publicKey.toBuffer()),a=a||p.SIGHASH_ALL|p.SIGHASH_FORKID,n.equals(d,this.output.script.getPublicKeyHash())?[new u({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(e,t,a,r,this.output.script,this.output.satoshisBN),sigtype:a})]:[]},r.prototype.addSignature=function(e,t){return o.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this},r.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},r.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},r.SCRIPT_MAX_SIZE=107,r.prototype._estimateSize=function(){return r.SCRIPT_MAX_SIZE},t.exports=r},{"../../crypto/hash":9,"../../crypto/signature":12,"../../script":37,"../../util/buffer":54,"../../util/preconditions":56,"../output":47,"../sighash":48,"../signature":49,"./input":42,inherits:201}],47:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);if(!a.isObject(e))throw new TypeError("Unrecognized argument for Output");else if(this.satoshis=e.satoshis,i.isBuffer(e.script))this._scriptBuffer=e.script;else{var t;t=a.isString(e.script)&&d.isHexa(e.script)?new n.Buffer(e.script,"hex"):e.script,this.setScript(t)}}var a=e("lodash"),o=e("../crypto/bn"),n=e("buffer"),i=e("../util/buffer"),d=e("../util/js"),s=e("../encoding/bufferwriter"),c=e("../script"),f=e("../util/preconditions"),p=e("../errors");Object.defineProperty(r.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(r.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof o?(this._satoshisBN=e,this._satoshis=e.toNumber()):a.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=o.fromNumber(this._satoshis)):(f.checkArgument(d.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=o.fromNumber(e),this._satoshis=e),f.checkState(d.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),r.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis===this._satoshisBN.toNumber()?!!(0>this._satoshis)&&"transaction txout negative":"transaction txout satoshis has corrupted value"},Object.defineProperty(r.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),f.checkState(d.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),r.prototype.toObject=r.prototype.toJSON=function(){var e={satoshis:this.satoshis,script:this._scriptBuffer.toString("hex")};return e},r.fromObject=function(e){return new r(e)},r.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(t instanceof p.Script.InvalidBuffer)this._script=null;else throw t}},r.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(a.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else if(i.isBuffer(e))this.setScriptFromBuffer(e);else throw new TypeError("Invalid argument type: script");return this},r.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},r.fromBufferReader=function(e){var t={satoshis:e.readUInt64LEBN()},a=e.readVarintNum();return t.script=0===a?new n.Buffer([]):e.read(a),new r(t)},r.prototype.toBufferWriter=function(e){e||(e=new s),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},t.exports=r},{"../crypto/bn":7,"../encoding/bufferwriter":16,"../errors":18,"../script":37,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,buffer:126,lodash:204}],48:[function(e,t){(function(r){"use strict";var a=e("buffer"),o=e("../crypto/signature"),n=e("../script"),d=e("./output"),s=e("../encoding/bufferreader"),c=e("../encoding/bufferwriter"),f=e("../crypto/bn"),p=e("../crypto/hash"),i=e("../crypto/ecdsa"),u=e("../util/preconditions"),l=e("../util/buffer"),b=e("lodash"),h=function(e,t,r,a,n){function i(e,t){var r=new c;b.isUndefined(t)?b.each(e.outputs,function(e){e.toBufferWriter(r)}):e.outputs[t].toBufferWriter(r);var a=r.toBuffer(),o=p.sha256sha256(a);return o}var d=e.inputs[r];u.checkArgument(n instanceof f,"For ForkId=0 signatures, satoshis or complete input must be provided");var h=l.emptyBuffer(32),g=l.emptyBuffer(32),m=l.emptyBuffer(32);t&o.SIGHASH_ANYONECANPAY||(h=function(e){var t=new c;b.each(e.inputs,function(e){t.writeReverse(e.prevTxId),t.writeUInt32LE(e.outputIndex)});var r=t.toBuffer(),a=p.sha256sha256(r);return a}(e)),t&o.SIGHASH_ANYONECANPAY||(31&t)==o.SIGHASH_SINGLE||(31&t)==o.SIGHASH_NONE||(g=function(e){var t=new c;b.each(e.inputs,function(e){t.writeUInt32LE(e.sequenceNumber)});var r=t.toBuffer(),a=p.sha256sha256(r);return a}(e)),(31&t)!=o.SIGHASH_SINGLE&&(31&t)!=o.SIGHASH_NONE?m=i(e):(31&t)==o.SIGHASH_SINGLE&&r>>0);var v=y.toBuffer(),S=p.sha256sha256(v);return S=new s(S).readReverse(),S},g=function(t,u,l,b,g){var m=e("./transaction"),y=e("./input"),_=m.shallowCopy(t);if(b=new n(b),u&o.SIGHASH_FORKID&&!0)return h(_,u,l,b,g);b.removeCodeseparators();var v;for(v=0;v<_.inputs.length;v++)_.inputs[v]=new y(_.inputs[v]).setScript(n.empty());if(_.inputs[l]=new y(_.inputs[l]).setScript(b),(31&u)===o.SIGHASH_NONE||(31&u)===o.SIGHASH_SINGLE)for(v=0;v<_.inputs.length;v++)v!==l&&(_.inputs[v].sequenceNumber=0);if((31&u)===o.SIGHASH_NONE)_.outputs=[];else if((31&u)===o.SIGHASH_SINGLE){if(l>=_.outputs.length)return new r("0000000000000000000000000000000000000000000000000000000000000001","hex");for(_.outputs.length=l+1,v=0;vt?!e.disableMoreOutputThanInput&&(r=new s.Transaction.InvalidOutputAmountSum):r=this._hasFeeError(e,t),r||this._hasDustOutputs(e)||this._isMissingSignatures(e)},a.prototype._hasFeeError=function(e,t){if(!o.isUndefined(this._fee)&&this._fee!==t)return new s.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=h(a.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new s.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new s.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}if(!e.disableSmallFees){var n=p(this._estimateFee()/a.FEE_SECURITY_MARGIN);if(t"},a.prototype.toBuffer=function(){var e=new l;return this.toBufferWriter(e).toBuffer()},a.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),o.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),o.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),e},a.prototype.fromBuffer=function(e){var t=new u(e);return this.fromBufferReader(t)},a.prototype.fromBufferReader=function(e){n.checkArgument(!e.finished(),"No transaction data received");var t,r,a;for(this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t=a.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new s.Transaction.BlockHeightTooHigh;if(0>e)throw new s.Transaction.NLockTimeOutOfRange;for(var t=0;to&&(e+=a.CHANGE_OUTPUT_MAX_SIZE),p(e/1e3)*(r||a.FEE_PER_KB)},a.prototype._estimateSize=function(){var e=a.MAXIMUM_EXTRA_SIZE;return o.each(this.inputs,function(t){e+=t._estimateSize()}),o.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},a.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=o.without(this.outputs,t),this._outputAmount=void 0},a.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},a.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return d(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||d(e.script.toBuffer(),t.script.toBuffer())}),t}),this},a.prototype.shuffleOutputs=function(){return this.sortOutputs(o.shuffle)},a.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},a.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},a.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==o.difference(this.outputs,e).length;if(t)throw new s.Transaction.InvalidSorting;if(!o.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=o.findIndex(e,r)}return this.outputs=e,this},a.prototype.removeInput=function(e,t){var r;if(r=!t&&o.isNumber(e)?e:o.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t}),0>r||r>=this.inputs.length)throw new s.Transaction.InvalidIndex(r,this.inputs.length);var a=this.inputs[r];this.inputs=o.without(this.inputs,a),this._inputAmount=void 0,this._updateChangeOutput()},a.prototype.sign=function(e,t){n.checkState(this.hasAllUtxoInfo());var r=this;return o.isArray(e)?(o.each(e,function(e){r.sign(e,t)}),this):(o.each(this.getSignatures(e,t),function(e){r.applySignature(e)}),this)},a.prototype.getSignatures=function(e,t){e=new E(e),t=t||g.SIGHASH_ALL|g.SIGHASH_FORKID;var r=this,a=[],n=b.sha256ripemd160(e.publicKey.toBuffer());return o.each(this.inputs,function(i,d){o.each(i.getSignatures(r,e,d,t,n),function(e){a.push(e)})}),a},a.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},a.prototype.isFullySigned=function(){return o.each(this.inputs,function(e){if(e.isFullySigned===v.prototype.isFullySigned)throw new s.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),o.every(o.map(this.inputs,function(e){return e.isFullySigned()}))},a.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===v.prototype.isValidSignature)throw new s.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[e.inputIndex].isValidSignature(t,e)},a.prototype.verifySignature=function(e,t,r,a){return m.verify(this,e,t,r,a)},a.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new P(0),t=0,r;t1e6)return"transaction over the maximum block size";var n={};for(t=0;tc.length||100=v.MAXINT-1&&(t.sequenceNumber=v.DEFAULT_RBF_SEQNUMBER);return this},t.exports=a}).call(this,e("buffer").Buffer)},{"../address":1,"../crypto/bn":7,"../crypto/hash":9,"../crypto/signature":12,"../encoding/bufferreader":15,"../encoding/bufferwriter":16,"../errors":18,"../privatekey":35,"../script":37,"../util/buffer":54,"../util/js":55,"../util/preconditions":56,"./input":41,"./output":47,"./sighash":48,"./unspentoutput":51,buffer:126,"buffer-compare":124,lodash:204}],51:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);o.checkArgument(a.isObject(e),"Must provide an object from where to extract data");var t=e.address?new d(e.address):void 0,c=e.txid?e.txid:e.txId;if(!c||!n.isHexaString(c)||64"},r.prototype.toString=function(){return this.txId+":"+this.outputIndex},r.fromObject=function(e){return new r(e)},r.prototype.toObject=r.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:s.fromSatoshis(this.satoshis).toBTC()}},t.exports=r},{"../address":1,"../script":37,"../unit":52,"../util/js":55,"../util/preconditions":56,lodash:204}],52:[function(e,t){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);if(a.isNumber(t)){if(0>=t)throw new o.Unit.InvalidRate(t);e/=t,t=r.BTC}this._value=this._from(e,t);var n=this;Object.keys(i).forEach(function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})})}var a=e("lodash"),o=e("./errors"),n=e("./util/preconditions"),i={BTC:[100000000,8],mBTC:[100000,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(i).forEach(function(e){r[e]=e}),r.fromObject=function(e){return n.checkArgument(a.isObject(e),"Argument is expected to be an object"),new r(e.amount,e.code)},r.fromBTC=function(e){return new r(e,r.BTC)},r.fromMillis=r.fromMilis=function(e){return new r(e,r.mBTC)},r.fromMicros=r.fromBits=function(e){return new r(e,r.bits)},r.fromSatoshis=function(e){return new r(e,r.satoshis)},r.fromFiat=function(e,t){return new r(e,t)},r.prototype._from=function(e,t){if(!i[t])throw new o.Unit.UnknownCode(t);return parseInt((e*i[t][0]).toFixed())},r.prototype.to=function(e){if(a.isNumber(e)){if(0>=e)throw new o.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!i[e])throw new o.Unit.UnknownCode(e);var t=this._value/i[e][0];return parseFloat(t.toFixed(i[e][1]))},r.prototype.toBTC=function(){return this.to(r.BTC)},r.prototype.toMillis=r.prototype.toMilis=function(){return this.to(r.mBTC)},r.prototype.toMicros=r.prototype.toBits=function(){return this.to(r.bits)},r.prototype.toSatoshis=function(){return this.to(r.satoshis)},r.prototype.atRate=function(e){return this.to(e)},r.prototype.toString=function(){return this.satoshis+" satoshis"},r.prototype.toObject=r.prototype.toJSON=function(){return{amount:this.BTC,code:r.BTC}},r.prototype.inspect=function(){return""},t.exports=r},{"./errors":18,"./util/preconditions":56,lodash:204}],53:[function(e,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=e("lodash"),o=e("url"),n=e("./address"),i=e("./unit"),d=function e(t,a){if(!(this instanceof e))return new e(t,a);if(this.extras={},this.knownParams=a||[],this.address=this.network=this.amount=this.message=null,"string"==typeof t){var o=e.parse(t);o.amount&&(o.amount=this._parseAmount(o.amount)),this._fromObject(o)}else if("object"===("undefined"==typeof t?"undefined":r(t)))this._fromObject(t);else throw new TypeError("Unrecognized data format.")};d.fromString=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return new d(e)},d.fromObject=function(e){return new d(e)},d.isValid=function(e,t){try{new d(e,t)}catch(e){return!1}return!0},d.parse=function(e){var t=o.parse(e,!0);if("bitcoincash:"!==t.protocol)throw new TypeError("Invalid bitcoin cash URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(e);return t.query.address=r&&r[1]||void 0,t.query},d.Members=["address","amount","message","label","r"],d.prototype._fromObject=function(e){if(!n.isValid(e.address))throw new TypeError("Invalid bitcoin address");for(var t in this.address=new n(e.address),this.network=this.address.network,this.amount=e.amount,e)if("address"!=t&&"amount"!=t){if(/^req-/.exec(t)&&-1===this.knownParams.indexOf(t))throw Error("Unknown required argument "+t);var r=-1"},t.exports=d},{"./address":1,"./unit":52,lodash:204,url:263}],54:[function(e,t){(function(r){"use strict";function a(e,t){if(e.length!==t.length)return!1;for(var r=e.length,a=0;a>24,255&e>>16,255&e>>8,255&e])},integerFromBuffer:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e[0]<<24|e[1]<<16|e[2]<<8|e[3]},integerFromSingleByteBuffer:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e[0]},bufferToHex:function(e){return d.checkArgumentType(e,"Buffer","buffer"),e.toString("hex")},reverse:function(e){for(var t=new o.Buffer(e.length),r=0;r=e))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=d.byteLength(e);else if(d.isBuffer(e))this.value=e,this.length=e.length;else return t.error("Unsupported type: "+typeof e)}var n=e("inherits"),i=e("../base").Reporter,d=e("buffer").Buffer;n(a,i),r.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=o,o.prototype.join=function(e,t){return(e||(e=new d(this.length)),t||(t=0),0===this.length)?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):d.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":60,buffer:126,inherits:201}],60:[function(e,t,r){var a=r;a.Reporter=e("./reporter").Reporter,a.DecoderBuffer=e("./buffer").DecoderBuffer,a.EncoderBuffer=e("./buffer").EncoderBuffer,a.Node=e("./node")},{"./buffer":59,"./node":61,"./reporter":62}],61:[function(e,t){function r(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||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 a=e("../base").Reporter,o=e("../base").EncoderBuffer,n=e("../base").DecoderBuffer,i=e("minimalistic-assert"),d=["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"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(d);t.exports=r;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];r.prototype.clone=function(){var e=this._baseState,t={};c.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},r.prototype._wrap=function(){var e=this._baseState;s.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},r.prototype._init=function(e){var t=this._baseState;i(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),i.equal(t.children.length,1,"Root node can have only one child")},r.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(i(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(i(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var a=e[r];t[a]=r}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){r.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),d.forEach(function(e){r.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return i(null===t.tag),t.tag=e,this._useArgs(r),this}}),r.prototype.use=function(e){i(e);var t=this._baseState;return i(null===t.use),t.use=e,this},r.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},r.prototype.def=function(e){var t=this._baseState;return i(null===t["default"]),t["default"]=e,t.optional=!0,this},r.prototype.explicit=function(e){var t=this._baseState;return i(null===t.explicit&&null===t.implicit),t.explicit=e,this},r.prototype.implicit=function(e){var t=this._baseState;return i(null===t.explicit&&null===t.implicit),t.implicit=e,this},r.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},r.prototype.key=function(e){var t=this._baseState;return i(null===t.key),t.key=e,this},r.prototype.any=function(){var e=this._baseState;return e.any=!0,this},r.prototype.choice=function(e){var t=this._baseState;return i(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},r.prototype.contains=function(e){var t=this._baseState;return i(null===t.use),t.contains=e,this},r.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var a=r["default"],o=!0,i=null;if(null!==r.key&&(i=e.enterKey(r.key)),r.optional){var d=null;if(null===r.explicit?null===r.implicit?null!==r.tag&&(d=r.tag):d=r.implicit:d=r.explicit,null===d&&!r.any){var s=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(t){o=!1}e.restore(s)}else if(o=this._peekTag(e,d,r.any),e.isError(o))return o}var c;if(r.obj&&o&&(c=e.enterObject()),o){if(null!==r.explicit){var f=this._decodeTag(e,r.explicit);if(e.isError(f))return f;e=f}var p=e.offset;if(null===r.use&&null===r.choice){if(r.any)var s=e.save();var u=this._decodeTag(e,null===r.implicit?r.tag:r.implicit,r.any);if(e.isError(u))return u;r.any?a=e.raw(s):e=u}if(t&&t.track&&null!==r.tag&&t.track(e.path(),p,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),a=r.any?a:null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),e.isError(a))return a;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(e,t)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new n(a);a=this._getUse(r.contains,e._reporterState.obj)._decode(l,t)}}return r.obj&&o&&(a=e.leaveObject(c)),null!==r.key&&(null!==a||!0===o)?e.leaveKey(i,r.key,a):null!==i&&e.exitKey(i),a},r.prototype._decodeGeneric=function(e,t,r){var a=this._baseState;if("seq"===e||"set"===e)return null;return"seqof"===e||"setof"===e?this._decodeList(t,e,a.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&a.args?this._decodeObjid(t,a.args[0],a.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,a.args&&a.args[0],r):null===a.use?t.error("unknown tag: "+e):this._getUse(a.use,t._reporterState.obj)._decode(t,r)},r.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),i(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},r.prototype._decodeChoice=function(e,t){var r=this._baseState,a=null,o=!1;return Object.keys(r.choice).some(function(n){var i=e.save(),d=r.choice[n];try{var s=d._decode(e,t);if(e.isError(s))return!1;a={type:n,value:s},o=!0}catch(t){return e.restore(i),!1}return!0},this),o?a:e.error("Choice not matched")},r.prototype._createEncoderBuffer=function(e){return new o(e,this.reporter)},r.prototype._encode=function(e,t,r){var a=this._baseState;if(null===a["default"]||a["default"]!==e){var o=this._encodeValue(e,t,r);return void 0===o||this._skipDefault(o,t,r)?void 0:o}},r.prototype._encodeValue=function(e,t,r){var o=this._baseState;if(null===o.parent)return o.children[0]._encode(e,t||new a);var n=null;if(this.reporter=t,o.optional&&void 0===e)if(null!==o["default"])e=o["default"];else return;var i=null,d=!1;if(o.any)n=this._createEncoderBuffer(e);else if(o.choice)n=this._encodeChoice(e,t);else if(o.contains)i=this._getUse(o.contains,r)._encode(e,t),d=!0;else if(o.children)i=o.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var a=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var o=r._encode(e[r._baseState.key],t,e);return t.leaveKey(a),o},this).filter(function(e){return e}),i=this._createEncoderBuffer(i);else if("seqof"===o.tag||"setof"===o.tag){if(!(o.args&&1===o.args.length))return t.error("Too many args for : "+o.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var s=this.clone();s._baseState.implicit=null,i=this._createEncoderBuffer(e.map(function(r){var a=this._baseState;return this._getUse(a.args[0],e)._encode(r,t)},s))}else null===o.use?(i=this._encodePrimitive(o.tag,e),d=!0):n=this._getUse(o.use,r)._encode(e,t);var n;if(!o.any&&null===o.choice){var c=null===o.implicit?o.tag:o.implicit,f=null===o.implicit?"universal":"context";null===c?null===o.use&&t.error("Tag could be omitted only for .use()"):null===o.use&&(n=this._encodeComposite(c,d,f,i))}return null!==o.explicit&&(n=this._encodeComposite(o.explicit,!1,"context",n)),n},r.prototype._encodeChoice=function(e,t){var r=this._baseState,a=r.choice[e.type];return a||i(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),a._encode(e.value,t)},r.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},r.prototype._isNumstr=function(e){return /^[0-9 ]*$/.test(e)},r.prototype._isPrintstr=function(e){return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":60,"minimalistic-assert":209}],62:[function(e,t,r){function a(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}var n=e("inherits");r.Reporter=a,a.prototype.isError=function(e){return e instanceof o},a.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},a.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},a.prototype.enterKey=function(e){return this._reporterState.path.push(e)},a.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},a.prototype.leaveKey=function(e,t,r){var a=this._reporterState;this.exitKey(e),null!==a.obj&&(a.obj[t]=r)},a.prototype.path=function(){return this._reporterState.path.join("/")},a.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},a.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},a.prototype.error=function(e){var t=this._reporterState,r=e instanceof o,a;if(a=r?e:new o(t.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!t.options.partial)throw a;return r||t.errors.push(a),a},a.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e};n(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{inherits:201}],63:[function(e,t,r){var a=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=a._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=a._reverse(r.tag)},{"../constants":64}],64:[function(e,t,r){var a=r;a._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var a=e[r];t[a]=r}),t},a.der=e("./der")},{"./der":63}],65:[function(e,t){function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new o,this.tree._init(e.body)}function o(e){c.Node.call(this,"der",e)}function n(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var a=p.tagClass[r>>6],o=0==(32&r);if(31==(31&r)){var n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;var i=p.tag[r];return{cls:a,primitive:o,tag:r,tagStr:i}}function i(e,t,r){var a=e.readUInt8(r);if(e.isError(a))return a;if(!t&&128===a)return null;if(0==(128&a))return a;var o=127&a;if(4a?2e3+a:1900+a}else return e.error("Decoding "+t+" time is not supported yet");return Date.UTC(a,o-1,n,i,d,s,0)},o.prototype._decodeNull=function(){return null},o.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},o.prototype._decodeInt=function(e,t){var r=e.raw(),a=new f(r);return t&&(a=t[a.toString(10)]||a),a},o.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":57,inherits:201}],66:[function(e,t,r){var a=r;a.der=e("./der"),a.pem=e("./pem")},{"./der":65,"./pem":67}],67:[function(e,t){function r(e){n.call(this,e),this.enc="pem"}var a=e("inherits"),o=e("buffer").Buffer,n=e("./der");a(r,n),t.exports=r,r.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),a=t.label.toUpperCase(),d=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,f=0,i;fe?"0"+e:e}function n(e,t,r,a){var o;if("seqof"===e?e="seq":"setof"===e&&(e="set"),f.tagByName.hasOwnProperty(e))o=f.tagByName[e];else if("number"==typeof e&&(0|e)===e)o=e;else return a.error("Unknown tag: "+e);return 31<=o?a.error("Multi-octet tag encoding unsupported"):(t||(o|=32),o|=f.tagClassByName[r||"universal"]<<6,o)}var i=e("inherits"),d=e("buffer").Buffer,s=e("../../asn1"),c=s.base,f=s.constants.der;t.exports=r,r.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(a,c.Node),a.prototype._encodeComposite=function(e,t,r,a){var o=n(e,t,r,this.reporter);if(128>a.length){var s=new d(2);return s[0]=o,s[1]=a.length,this._createEncoderBuffer([s,a])}for(var c=1,f=a.length;256<=f;f>>=8)c++;var s=new d(2+c);s[0]=o,s[1]=128|c;for(var f=1+c,i=a.length;0>=8)s[f]=255&i;return this._createEncoderBuffer([s,a])},a.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new d(2*e.length),a=0;a>=7)o++;for(var i=new d(o),s=i.length-1,a=e.length-1,n;0<=a;a--)for(n=e[a],i[s--]=127&n;0<(n>>=7);)i[s--]=128|127&n;return this._createEncoderBuffer(i)},a.prototype._encodeTime=function(e,t){var r=new Date(e),a;return"gentime"===t?a=[o(r.getFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?a=[o(r.getFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(a,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!d.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new d(r)}if(d.isBuffer(e)){var a=e.length;0===e.length&&a++;var o=new d(a);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var a=1,n=e;256<=n;n>>=8)a++;for(var o=Array(a),n=o.length-1;0<=n;n--)o[n]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new d(o))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},a.prototype._skipDefault=function(e,t,r){var a=this._baseState,o;if(null===a["default"])return!1;var n=e.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a["default"],t,r).join()),n.length!==a.defaultBuffer.length)return!1;for(o=0;o=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return o}function c(e,t,a,o){for(var n=0,r=u(e.length,a),d=t,i;d>>o}return t}function b(e,t,o){o.negative=t.negative^e.negative;var n=0|e.length+t.length;o.length=n,n=0|n-1;var d=0|e.words[0],a=0|t.words[0],s=d*a,r=67108863&s,c=0|s/67108864;o.words[0]=r;for(var p=1;p>>26,b=67108863&c,h=u(p,t.length-1),g=f(0,p-e.length+1),m;g<=h;g++)m=0|p-g,d=0|e.words[m],a=0|t.words[g],s=d*a+b,l+=0|s/67108864,b=67108863&s;o.words[p]=0|b,c=0|l}return 0==c?o.length--:o.words[p]=0|c,o.strip()}function h(e,t,o){o.negative=t.negative^e.negative,o.length=e.length+t.length;for(var n=0,d=0,s=0,c;s>>26),d+=c>>>26,c&=67108863}o.words[s]=p,n=c,c=d}return 0==n?o.length--:o.words[s]=n,o.strip()}function g(e,t,r){var a=new m;return a.mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}function y(e,t){this.name=e,this.p=new d(t,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=d._prime(e);this.m=t.p,this.prime=t}else o(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){I.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new d(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)}var w=Math.imul;"object"==typeof r?r.exports=d:a.BN=d,d.BN=d,d.wordSize=26;var A;try{A=t("buffer").Buffer}catch(t){}d.isBN=function(e){return!!(e instanceof d)||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,t){return 0e.cmp(t)?e:t},d.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),o(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,"");var a=0;"-"===e[0]&&a++,16===t?this._parseHex(e,a):this._parseBase(e,t,a),"-"===e[0]&&(this.negative=1),this.strip();"le"!==r||this._initArray(this.toArray(),t,r)},d.prototype._initNumber=function(e,t,r){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(o(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3);"le"!==r||this._initArray(this.toArray(),t,r)},d.prototype._initArray=function(e,t,r){if(o("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=p(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);return this.strip()},d.prototype._parseHex=function(e,t){this.length=p((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)n=s(e,r,r+6),this.words[o]|=67108863&n<>>26-a,a+=24,26<=a&&(a-=26,o++);r+6!==t&&(n=s(e,t,r+6),this.words[o]|=67108863&n<>>26-a),this.strip()},d.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var a=0,o=1;67108863>=o;o*=t)a++;a--,o=0|o/t;for(var n=e.length-r,d=n%a,s=u(n,n-d)+r,f=0,p=r;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f);if(0!=d){var i=1;for(f=c(e,p,e.length,t),p=0;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f)}},d.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t"};var E=["","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"],P=[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],B=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,10000000,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];d.prototype.toString=function(e,t){e=e||10,t=0|t||1;var a;if(16===e||"hex"===e){a="";for(var n=0,d=0,s=0;s>>24-n,a=0!=d||s!==this.length-1?E[6-f.length]+f+a:f+a,n+=2,26<=n&&(n-=26,s--)}for(0!=d&&(a=d.toString(16)+a);0!=a.length%t;)a="0"+a;return 0!==this.negative&&(a="-"+a),a}if(e===(0|e)&&2<=e&&36>=e){var p=P[e],u=B[e];a="";var l=this.clone();for(l.negative=0;!l.isZero();){var c=l.modn(u).toString(e);l=l.idivn(u),a=l.isZero()?c+a:E[p-c.length]+c+a}for(this.isZero()&&(a="0"+a);0!=a.length%t;)a="0"+a;return 0!==this.negative&&(a="-"+a),a}o(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=a&&(t+=7,a>>>=7),8<=a&&(t+=4,a>>>=4),2<=a&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 0==(8191&a)&&(t+=13,a>>>=13),0==(127&a)&&(t+=7,a>>>=7),0==(15&a)&&(t+=4,a>>>=4),0==(3&a)&&(t+=2,a>>>=2),0==(1&a)&&t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){o("number"==typeof e&&0<=e);var t=0|p(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,t){o("number"==typeof e&&0<=e);var r=0|e/26,a=e%26;return this._expand(r+1),t?this.words[r]|=1<e.length?(r=this,a=e):(r=e,a=this);for(var o=0,n=0;n>>26;for(;0!=o&&n>>26;if(this.length=r.length,0!=o)this.words[this.length]=o,this.length++;else if(r!==this)for(;ne.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var o,a;0>26,this.words[d]=67108863&t;for(;0!=n&&d>26,this.words[d]=67108863&t;if(0==n&&d>>13,f=0|n[1],p=8191&f,u=f>>>13,l=0|n[2],b=8191&l,h=l>>>13,g=0|n[3],m=8191&g,y=g>>>13,_=0|n[4],v=8191&_,S=_>>>13,k=0|n[5],I=8191&k,x=k>>>13,A=0|n[6],E=8191&A,P=A>>>13,B=0|n[7],O=8191&B,R=B>>>13,j=0|n[8],T=8191&j,N=j>>>13,C=0|n[9],z=8191&C,M=C>>>13,U=0|a[0],L=8191&U,D=U>>>13,q=0|a[1],H=8191&q,F=q>>>13,K=0|a[2],V=8191&K,G=K>>>13,W=0|a[3],Y=8191&W,X=W>>>13,Z=0|a[4],J=8191&Z,Q=Z>>>13,$=0|a[5],ee=8191&$,te=$>>>13,re=0|a[6],ae=8191&re,oe=re>>>13,ne=0|a[7],ie=8191&ne,de=ne>>>13,se=0|a[8],ce=8191&se,fe=se>>>13,pe=0|a[9],ue=8191&pe,le=pe>>>13,be,he,ge;r.negative=e.negative^t.negative,r.length=19,be=w(s,L),he=w(s,D),he=0|he+w(c,L),ge=w(c,D);var me=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(me>>>26),me&=67108863,be=w(p,L),he=w(p,D),he=0|he+w(u,L),ge=w(u,D),be=0|be+w(s,H),he=0|he+w(s,F),he=0|he+w(c,H),ge=0|ge+w(c,F);var ye=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ye>>>26),ye&=67108863,be=w(b,L),he=w(b,D),he=0|he+w(h,L),ge=w(h,D),be=0|be+w(p,H),he=0|he+w(p,F),he=0|he+w(u,H),ge=0|ge+w(u,F),be=0|be+w(s,V),he=0|he+w(s,G),he=0|he+w(c,V),ge=0|ge+w(c,G);var _e=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(_e>>>26),_e&=67108863,be=w(m,L),he=w(m,D),he=0|he+w(y,L),ge=w(y,D),be=0|be+w(b,H),he=0|he+w(b,F),he=0|he+w(h,H),ge=0|ge+w(h,F),be=0|be+w(p,V),he=0|he+w(p,G),he=0|he+w(u,V),ge=0|ge+w(u,G),be=0|be+w(s,Y),he=0|he+w(s,X),he=0|he+w(c,Y),ge=0|ge+w(c,X);var ve=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ve>>>26),ve&=67108863,be=w(v,L),he=w(v,D),he=0|he+w(S,L),ge=w(S,D),be=0|be+w(m,H),he=0|he+w(m,F),he=0|he+w(y,H),ge=0|ge+w(y,F),be=0|be+w(b,V),he=0|he+w(b,G),he=0|he+w(h,V),ge=0|ge+w(h,G),be=0|be+w(p,Y),he=0|he+w(p,X),he=0|he+w(u,Y),ge=0|ge+w(u,X),be=0|be+w(s,J),he=0|he+w(s,Q),he=0|he+w(c,J),ge=0|ge+w(c,Q);var Se=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Se>>>26),Se&=67108863,be=w(I,L),he=w(I,D),he=0|he+w(x,L),ge=w(x,D),be=0|be+w(v,H),he=0|he+w(v,F),he=0|he+w(S,H),ge=0|ge+w(S,F),be=0|be+w(m,V),he=0|he+w(m,G),he=0|he+w(y,V),ge=0|ge+w(y,G),be=0|be+w(b,Y),he=0|he+w(b,X),he=0|he+w(h,Y),ge=0|ge+w(h,X),be=0|be+w(p,J),he=0|he+w(p,Q),he=0|he+w(u,J),ge=0|ge+w(u,Q),be=0|be+w(s,ee),he=0|he+w(s,te),he=0|he+w(c,ee),ge=0|ge+w(c,te);var ke=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(ke>>>26),ke&=67108863,be=w(E,L),he=w(E,D),he=0|he+w(P,L),ge=w(P,D),be=0|be+w(I,H),he=0|he+w(I,F),he=0|he+w(x,H),ge=0|ge+w(x,F),be=0|be+w(v,V),he=0|he+w(v,G),he=0|he+w(S,V),ge=0|ge+w(S,G),be=0|be+w(m,Y),he=0|he+w(m,X),he=0|he+w(y,Y),ge=0|ge+w(y,X),be=0|be+w(b,J),he=0|he+w(b,Q),he=0|he+w(h,J),ge=0|ge+w(h,Q),be=0|be+w(p,ee),he=0|he+w(p,te),he=0|he+w(u,ee),ge=0|ge+w(u,te),be=0|be+w(s,ae),he=0|he+w(s,oe),he=0|he+w(c,ae),ge=0|ge+w(c,oe);var Ie=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ie>>>26),Ie&=67108863,be=w(O,L),he=w(O,D),he=0|he+w(R,L),ge=w(R,D),be=0|be+w(E,H),he=0|he+w(E,F),he=0|he+w(P,H),ge=0|ge+w(P,F),be=0|be+w(I,V),he=0|he+w(I,G),he=0|he+w(x,V),ge=0|ge+w(x,G),be=0|be+w(v,Y),he=0|he+w(v,X),he=0|he+w(S,Y),ge=0|ge+w(S,X),be=0|be+w(m,J),he=0|he+w(m,Q),he=0|he+w(y,J),ge=0|ge+w(y,Q),be=0|be+w(b,ee),he=0|he+w(b,te),he=0|he+w(h,ee),ge=0|ge+w(h,te),be=0|be+w(p,ae),he=0|he+w(p,oe),he=0|he+w(u,ae),ge=0|ge+w(u,oe),be=0|be+w(s,ie),he=0|he+w(s,de),he=0|he+w(c,ie),ge=0|ge+w(c,de);var xe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(xe>>>26),xe&=67108863,be=w(T,L),he=w(T,D),he=0|he+w(N,L),ge=w(N,D),be=0|be+w(O,H),he=0|he+w(O,F),he=0|he+w(R,H),ge=0|ge+w(R,F),be=0|be+w(E,V),he=0|he+w(E,G),he=0|he+w(P,V),ge=0|ge+w(P,G),be=0|be+w(I,Y),he=0|he+w(I,X),he=0|he+w(x,Y),ge=0|ge+w(x,X),be=0|be+w(v,J),he=0|he+w(v,Q),he=0|he+w(S,J),ge=0|ge+w(S,Q),be=0|be+w(m,ee),he=0|he+w(m,te),he=0|he+w(y,ee),ge=0|ge+w(y,te),be=0|be+w(b,ae),he=0|he+w(b,oe),he=0|he+w(h,ae),ge=0|ge+w(h,oe),be=0|be+w(p,ie),he=0|he+w(p,de),he=0|he+w(u,ie),ge=0|ge+w(u,de),be=0|be+w(s,ce),he=0|he+w(s,fe),he=0|he+w(c,ce),ge=0|ge+w(c,fe);var we=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(we>>>26),we&=67108863,be=w(z,L),he=w(z,D),he=0|he+w(M,L),ge=w(M,D),be=0|be+w(T,H),he=0|he+w(T,F),he=0|he+w(N,H),ge=0|ge+w(N,F),be=0|be+w(O,V),he=0|he+w(O,G),he=0|he+w(R,V),ge=0|ge+w(R,G),be=0|be+w(E,Y),he=0|he+w(E,X),he=0|he+w(P,Y),ge=0|ge+w(P,X),be=0|be+w(I,J),he=0|he+w(I,Q),he=0|he+w(x,J),ge=0|ge+w(x,Q),be=0|be+w(v,ee),he=0|he+w(v,te),he=0|he+w(S,ee),ge=0|ge+w(S,te),be=0|be+w(m,ae),he=0|he+w(m,oe),he=0|he+w(y,ae),ge=0|ge+w(y,oe),be=0|be+w(b,ie),he=0|he+w(b,de),he=0|he+w(h,ie),ge=0|ge+w(h,de),be=0|be+w(p,ce),he=0|he+w(p,fe),he=0|he+w(u,ce),ge=0|ge+w(u,fe),be=0|be+w(s,ue),he=0|he+w(s,le),he=0|he+w(c,ue),ge=0|ge+w(c,le);var Ae=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ae>>>26),Ae&=67108863,be=w(z,H),he=w(z,F),he=0|he+w(M,H),ge=w(M,F),be=0|be+w(T,V),he=0|he+w(T,G),he=0|he+w(N,V),ge=0|ge+w(N,G),be=0|be+w(O,Y),he=0|he+w(O,X),he=0|he+w(R,Y),ge=0|ge+w(R,X),be=0|be+w(E,J),he=0|he+w(E,Q),he=0|he+w(P,J),ge=0|ge+w(P,Q),be=0|be+w(I,ee),he=0|he+w(I,te),he=0|he+w(x,ee),ge=0|ge+w(x,te),be=0|be+w(v,ae),he=0|he+w(v,oe),he=0|he+w(S,ae),ge=0|ge+w(S,oe),be=0|be+w(m,ie),he=0|he+w(m,de),he=0|he+w(y,ie),ge=0|ge+w(y,de),be=0|be+w(b,ce),he=0|he+w(b,fe),he=0|he+w(h,ce),ge=0|ge+w(h,fe),be=0|be+w(p,ue),he=0|he+w(p,le),he=0|he+w(u,ue),ge=0|ge+w(u,le);var Ee=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ee>>>26),Ee&=67108863,be=w(z,V),he=w(z,G),he=0|he+w(M,V),ge=w(M,G),be=0|be+w(T,Y),he=0|he+w(T,X),he=0|he+w(N,Y),ge=0|ge+w(N,X),be=0|be+w(O,J),he=0|he+w(O,Q),he=0|he+w(R,J),ge=0|ge+w(R,Q),be=0|be+w(E,ee),he=0|he+w(E,te),he=0|he+w(P,ee),ge=0|ge+w(P,te),be=0|be+w(I,ae),he=0|he+w(I,oe),he=0|he+w(x,ae),ge=0|ge+w(x,oe),be=0|be+w(v,ie),he=0|he+w(v,de),he=0|he+w(S,ie),ge=0|ge+w(S,de),be=0|be+w(m,ce),he=0|he+w(m,fe),he=0|he+w(y,ce),ge=0|ge+w(y,fe),be=0|be+w(b,ue),he=0|he+w(b,le),he=0|he+w(h,ue),ge=0|ge+w(h,le);var Pe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Pe>>>26),Pe&=67108863,be=w(z,Y),he=w(z,X),he=0|he+w(M,Y),ge=w(M,X),be=0|be+w(T,J),he=0|he+w(T,Q),he=0|he+w(N,J),ge=0|ge+w(N,Q),be=0|be+w(O,ee),he=0|he+w(O,te),he=0|he+w(R,ee),ge=0|ge+w(R,te),be=0|be+w(E,ae),he=0|he+w(E,oe),he=0|he+w(P,ae),ge=0|ge+w(P,oe),be=0|be+w(I,ie),he=0|he+w(I,de),he=0|he+w(x,ie),ge=0|ge+w(x,de),be=0|be+w(v,ce),he=0|he+w(v,fe),he=0|he+w(S,ce),ge=0|ge+w(S,fe),be=0|be+w(m,ue),he=0|he+w(m,le),he=0|he+w(y,ue),ge=0|ge+w(y,le);var Be=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Be>>>26),Be&=67108863,be=w(z,J),he=w(z,Q),he=0|he+w(M,J),ge=w(M,Q),be=0|be+w(T,ee),he=0|he+w(T,te),he=0|he+w(N,ee),ge=0|ge+w(N,te),be=0|be+w(O,ae),he=0|he+w(O,oe),he=0|he+w(R,ae),ge=0|ge+w(R,oe),be=0|be+w(E,ie),he=0|he+w(E,de),he=0|he+w(P,ie),ge=0|ge+w(P,de),be=0|be+w(I,ce),he=0|he+w(I,fe),he=0|he+w(x,ce),ge=0|ge+w(x,fe),be=0|be+w(v,ue),he=0|he+w(v,le),he=0|he+w(S,ue),ge=0|ge+w(S,le);var Oe=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Oe>>>26),Oe&=67108863,be=w(z,ee),he=w(z,te),he=0|he+w(M,ee),ge=w(M,te),be=0|be+w(T,ae),he=0|he+w(T,oe),he=0|he+w(N,ae),ge=0|ge+w(N,oe),be=0|be+w(O,ie),he=0|he+w(O,de),he=0|he+w(R,ie),ge=0|ge+w(R,de),be=0|be+w(E,ce),he=0|he+w(E,fe),he=0|he+w(P,ce),ge=0|ge+w(P,fe),be=0|be+w(I,ue),he=0|he+w(I,le),he=0|he+w(x,ue),ge=0|ge+w(x,le);var Re=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Re>>>26),Re&=67108863,be=w(z,ae),he=w(z,oe),he=0|he+w(M,ae),ge=w(M,oe),be=0|be+w(T,ie),he=0|he+w(T,de),he=0|he+w(N,ie),ge=0|ge+w(N,de),be=0|be+w(O,ce),he=0|he+w(O,fe),he=0|he+w(R,ce),ge=0|ge+w(R,fe),be=0|be+w(E,ue),he=0|he+w(E,le),he=0|he+w(P,ue),ge=0|ge+w(P,le);var je=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(je>>>26),je&=67108863,be=w(z,ie),he=w(z,de),he=0|he+w(M,ie),ge=w(M,de),be=0|be+w(T,ce),he=0|he+w(T,fe),he=0|he+w(N,ce),ge=0|ge+w(N,fe),be=0|be+w(O,ue),he=0|he+w(O,le),he=0|he+w(R,ue),ge=0|ge+w(R,le);var Te=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Te>>>26),Te&=67108863,be=w(z,ce),he=w(z,fe),he=0|he+w(M,ce),ge=w(M,fe),be=0|be+w(T,ue),he=0|he+w(T,le),he=0|he+w(N,ue),ge=0|ge+w(N,le);var Ne=0|(0|o+be)+((8191&he)<<13);o=0|(0|ge+(he>>>13))+(Ne>>>26),Ne&=67108863,be=w(z,ue),he=w(z,le),he=0|he+w(M,ue),ge=w(M,le);var Ce=0|(0|o+be)+((8191&he)<<13);return o=0|(0|ge+(he>>>13))+(Ce>>>26),Ce&=67108863,i[0]=me,i[1]=ye,i[2]=_e,i[3]=ve,i[4]=Se,i[5]=ke,i[6]=Ie,i[7]=xe,i[8]=we,i[9]=Ae,i[10]=Ee,i[11]=Pe,i[12]=Be,i[13]=Oe,i[14]=Re,i[15]=je,i[16]=Te,i[17]=Ne,i[18]=Ce,0!=o&&(i[19]=o,r.length++),r};w||(O=b),d.prototype.mulTo=function(e,t){var r=this.length+e.length,a;return a=10===this.length&&10===e.length?O(this,e,t):63>r?b(this,e,t):1024>r?h(this,e,t):g(this,e,t),a},m.prototype.makeRBT=function(e){for(var r=Array(e),t=d.prototype._countBits(e)-1,a=0;a>=1;return a},m.prototype.permute=function(e,t,r,a,o,n){for(var d=0;d>>=1)o++;return 1<=a))for(var o=0,n;oo?0:0|o/67108864;return e},m.prototype.convert13b=function(e,t,r,a){for(var n=0,d=0;d>>=13,r[2*d+1]=8191&n,n>>>=13;for(d=2*t;de);for(var t=0,r=0;r>=26,t+=0|a/67108864,t+=n>>>26,this.words[r]=67108863&n}return 0!=t&&(this.words[r]=t,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var t=l(e);if(0===t.length)return new d(1);for(var r=this,a=0;a>>26-t<<26-t,d=(0|this.words[a])-i<>>26-t}n&&(this.words[a]=n,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;ar)for(this.length-=r,c=0;c=n);c--){var p=0|this.words[c];this.words[c]=i<<26-d|p>>>d,i=p&(67108863^67108863>>>d<>>t<e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},d.prototype.addn=function(e){return this.clone().iaddn(e)},d.prototype.subn=function(e){return this.clone().isubn(e)},d.prototype.iabs=function(){return this.negative=0,this},d.prototype.abs=function(){return this.clone().iabs()},d.prototype._ishlnsubmul=function(e,t,r){var a=e.length+r,n;this._expand(a);var i=0,d;for(n=0;n>26)-(0|s/67108864),this.words[n+r]=67108863&d}for(;n>26,this.words[n+r]=67108863&d;if(0==i)return this.strip();for(o(-1==i),i=0,n=0;n>26,this.words[n]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,t){var r=this.length-e.length,o=this.clone(),n=e,s=0|n.words[n.length-1],c=this._countBits(s);r=26-c,0!=r&&(n=n.ushln(r),o.iushln(r),s=0|n.words[n.length-1]);var f=o.length-n.length,p;if("mod"!==t){p=new d(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new d(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,t):(i=this.neg().divmod(e.neg(),t),"div"!==t&&(n=i.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:i.div,mod:n})},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0===t.div.negative?t.mod:t.mod.isub(e),a=e.ushrn(1),o=e.andln(1),n=r.cmp(a);return 0>n||1===o&&0===n?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},d.prototype.modn=function(e){o(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+(0|this.words[r]))%e;return t},d.prototype.idivn=function(e){o(67108863>=e);for(var t=0,r=this.length-1,a;0<=r;r--)a=(0|this.words[r])+67108864*t,this.words[r]=0|a/e,t=a%e;return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){o(0===e.negative),o(!e.isZero());var t=this,r=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var a=new d(1),n=new d(0),s=new d(0),c=new d(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var p=r.clone(),u=t.clone();!t.isZero();){for(var l=0,i=1;0==(t.words[0]&i)&&26>l;++l,i<<=1);if(0b;++b,h<<=1);if(0c;++c,i<<=1);if(0f;++f,p<<=1);if(0u.cmpn(0)&&u.iadd(e),u},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var o=this.clone(),a=e.clone();o.negative=0,a.negative=0;for(var n=0;o.isEven()&&a.isEven();n++)o.iushrn(1),a.iushrn(1);do{for(;o.isEven();)o.iushrn(1);for(;a.isEven();)a.iushrn(1);var i=o.cmp(a);if(0>i){var r=o;o=a,a=r}else if(0===i||0===a.cmpn(1))break;o.isub(a)}while(!0);return a.iushln(n)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return 0==(1&this.words[0])},d.prototype.isOdd=function(){return 1==(1&this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){o("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,i&=67108863,this.words[d]=i;return 0!=n&&(this.words[d]=n,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var t=0>e;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(1=e,"Number is too big");var a=0|this.words[0];r=a===e?0:ae.length)return 1;if(this.lengtha&&(t=1);break}}return t},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return 0<=this.cmpn(e)},d.prototype.gte=function(e){return 0<=this.cmp(e)},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return 0>=this.cmpn(e)},d.prototype.lte=function(e){return 0>=this.cmp(e)},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new I(e)},d.prototype.toRed=function(e){return o(!this.red,"Already a number in reduction context"),o(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return o(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return o(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return o(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return o(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return o(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return o(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return o(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return o(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return o(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return o(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return o(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return o(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return o(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var R={k256:null,p224:null,p192:null,p25519:null};y.prototype._tmp=function(){var e=new d(null);return e.words=Array(p(this.n/13)),e},y.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var a=r=e.length)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=n&r,o=10;o>>22,n=i}n>>>=22,e.words[o-10]=n,e.length-=0===n&&10>>=26,e.words[r]=o,t=a}return 0!=t&&(e.words[e.length++]=t),e},d._prime=function(e){if(R[e])return R[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new v;else if("p192"===e)t=new S;else if("p25519"===e)t=new k;else throw new Error("Unknown prime "+e);return R[e]=t,t},I.prototype._verify1=function(e){o(0===e.negative,"red works only with positives"),o(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){o(0==(e.negative|t.negative),"red works only with positives"),o(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(o(1==a%2),3===a){var n=this.m.add(new d(1)).iushrn(2);return this.pow(e,n)}for(var f=this.m.subn(1),p=0;!f.isZero()&&0===f.andln(1);)p++,f.iushrn(1);o(!f.isZero());var s=new d(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new d(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var g=this.pow(h,f),c=this.pow(e,f.addn(1).iushrn(1)),r=this.pow(e,f),t=p;0!==r.cmp(s);){for(var m=r,y=0;0!==m.cmp(s);y++)m=m.redSqr();o(y>p,n!==a[0]&&(n=this.sqr(n)),0==u&&0==i){s=0;continue}i<<=1,i|=u,s++,s!=r&&(0!==o||0!==p)||(n=this.mul(n,a[i]),s=0,i=0)}c=26}return n},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},d.mont=function(e){return new x(e)},i(x,I),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var a=e.imul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).iushrn(this.shift),n=o;return 0<=o.cmp(this.m)?n=o.isub(this.m):0>o.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},x.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new d(0)._forceRed(this);var a=e.mul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).iushrn(this.shift),n=o;return 0<=o.cmp(this.m)?n=o.isub(this.m):0>o.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},x.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})("undefined"==typeof r||r,this)},{buffer:77}],72:[function(e,t){(function(r){"use strict";function a(e,t){if(e===t)return 0;for(var r=e.length,a=t.length,o=0,n=u(r,a);o>18]+d[63&e>>12]+d[63&e>>6]+d[63&e]}function n(e,t,r){for(var a=[],n=t,i;n>16,d[f++]=255&n>>8,d[f++]=255&n;return 2===i?(n=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,d[f++]=255&n):1===i&&(n=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,d[f++]=255&n>>8,d[f++]=255&n),d},r.fromByteArray=function(e){for(var t=e.length,r=t%3,a="",o=[],s=16383,c=0,i=t-r,f;ci?i:c+s));return 1==r?(f=e[t-1],a+=d[f>>2],a+=d[63&f<<4],a+="=="):2==r&&(f=(e[t-2]<<8)+e[t-1],a+=d[f>>10],a+=d[63&f>>4],a+=d[63&f<<2],a+="="),o.push(a),o.join("")};for(var d=[],s=[],c="undefined"==typeof Uint8Array?Array:Uint8Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,i=f.length;pe,this.isSmall=!0}function g(e){return-Je?[e]:1e14>e?[e%1e7,h(e/1e7)]:[e%1e7,h(e/1e7)%1e7,h(e/1e14)]}function m(e){_(e);var t=e.length;return 4>t&&0>C(e,Q)?0===t?0:1===t?e[0]:2===t?e[0]+e[1]*X:e[0]+(e[1]+e[2]*X)*X:e}function _(e){for(var t=e.length;0===e[--t];);e.length=t+1}function n(e){for(var t=Array(e),r=-1;++r=d?1:0,n[c]=s-r*d;for(;c=t.length?y(e,t):y(t,e)}function I(e,t){var a=e.length,o=Array(a),r=X,n,d;for(d=0;di?(i+=d,r=1):r=0,n[s]=i;for(s=o;si)i+=d;else{n[s++]=i;break}n[s]=i}for(;si?i+f:i;return s=m(s),"number"==typeof s?(o&&(s=-s),new d(s)):new t(s,o)}function A(e,t){var a=e.length,o=t.length,d=n(a+o),r=X,s,c,f,i,p;for(f=0;f=r)return A(e,t);r=p(r/2);var o=e.slice(r),n=e.slice(0,r),a=t.slice(r),i=t.slice(0,r),d=B(n,i),s=B(o,a),c=B(k(n,o),k(i,a)),u=k(k(d,P(v(v(c,d),s),r)),P(s,2*r));return _(u),u}function O(e,t){return 0<-0.012*e-0.012*t+1.5e-5*e*t}function b(e,r,a){return e_?(f[g+v]=_+o,_=-1):(f[g+v]=_,_=0);for(;0!==_;){for(b-=1,y=0,v=0;vy?(f[g+v]=y+o,y=0):(f[g+v]=y,y=1);_+=y}d[g]=b}return f=T(f,c)[0],[m(d),m(f)]}function j(e,t){for(var r=e.length,a=t.length,o=[],n=[],i=X,d,s,c,f,u;r;){if(n.unshift(e[--r]),_(n),0>C(n,t)){o.push(0);continue}s=n.length,c=n[s-1]*i+n[s-2],f=t[a-1]*i+t[a-2],s>a&&(c=(c+1)*i),d=p(c/f);do{if(u=E(t,d),0>=C(u,n))break;d--}while(d);o.push(d),n=v(n,u)}return o.reverse(),[m(o),m(n)]}function T(e,t){var r=e.length,a=n(r),o,i,d,s;for(d=0,o=r-1;0<=o;--o)s=d*X+e[o],i=S(s/t),d=s-i*t,a[o]=0|i;return[a,0|d]}function N(r,o){var i=Y(o),n=r.value,a=i.value,c,f;if(0===a)throw new Error("Cannot divide by zero");if(r.isSmall)return i.isSmall?[new d(S(n/a)),new d(n%a)]:[e[0],r];if(i.isSmall){if(1===a)return[r,e[0]];if(-1==a)return[r.negate(),e[0]];var p=s(a);if(p=n.length+a.length?R(n,a):j(n,a),f=c[0];var h=r.sign!==i.sign,g=c[1],y=r.sign;return"number"==typeof f?(h&&(f=-f),f=new d(f)):f=new t(f,h),"number"==typeof g?(y&&(g=-g),g=new d(g)):g=new t(g,y),[f,g]}function C(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var r=e.length-1;0<=r;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function z(e){var t=e.abs();return!t.isUnit()&&(t.equals(2)||t.equals(3)||t.equals(5)||(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5)?!1:!!t.lesser(25)||void 0))}function M(e){return("number"==typeof e||"string"==typeof e)&&+s(e)<=X||e instanceof t&&1>=e.value.length}function U(e,t,r){t=Y(t);for(var a=e.isNegative(),o=t.isNegative(),n=a?e.not():e,d=o?t.not():t,s=0,f=0,p=null,u=null,l=[];!n.isZero()||!d.isZero();)p=N(n,te),s=p[1].toJSNumber(),a&&(s=te-1-s),u=N(d,te),f=u[1].toJSNumber(),o&&(f=te-1-f),n=p[0],d=u[0],l.push(r(s,f));for(var b=0===r(a?1:0,o?1:0)?c(0):c(-1),h=l.length-1;0<=h;h-=1)b=b.multiply(te).add(c(l[h]));return b}function L(e){var t=e.value,r="number"==typeof t?t|re:t[0]+t[1]*X|ae;return r&-r}function D(e,t){return e=Y(e),t=Y(t),e.greater(t)?e:t}function q(e,t){return e=Y(e),t=Y(t),e.lesser(t)?e:t}function H(r,a){if(r=Y(r).abs(),a=Y(a).abs(),r.equals(a))return r;if(r.isZero())return a;if(a.isZero())return r;for(var o=e[1],n,i;r.isEven()&&a.isEven();)n=u(L(r),L(a)),r=r.divide(n),a=a.divide(n),o=o.multiply(n);for(;r.isEven();)r=r.divide(L(r));do{for(;a.isEven();)a=a.divide(L(a));r.greater(a)&&(i=a,a=r,r=i),a=a.subtract(r)}while(!a.isZero());return o.isUnit()?r:r.multiply(o)}function F(t,r,a){var o=e[0],n=e[1],d;for(d=t.length-1;0<=d;d--)o=o.add(t[d].times(n)),n=n.times(r);return a?o.negate():o}function K(e){var t=e.value;return"number"==typeof t&&(t=[t]),1===t.length&&35>=t[0]?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t[0]):"<"+t+">"}function V(e,t){if(t=c(t),t.isZero()){if(e.isZero())return"0";throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1))return e.isZero()?"0":e.isNegative()?Array(1-e).join("10"):"1"+Array(+e).join("01");var r="";if(e.isNegative()&&t.isPositive()&&(r="-",e=e.abs()),t.equals(1))return e.isZero()?"0":r+Array(+e+1).join(1);for(var a=[],o=e,i;o.isNegative()||0<=o.compareAbs(t);){i=o.divmod(t),o=i.quotient;var d=i.remainder;d.isNegative()&&(d=t.minus(d).abs(),o=o.next()),a.push(K(d))}return a.push(K(o)),r+a.reverse().join("")}function G(e){if(g(+e)){var a=+e;if(a===S(a))return new d(a);throw"Invalid integer: "+e}var o="-"===e[0];o&&(e=e.slice(1));var n=e.split(/e/i);if(2i)throw new Error("Cannot include negative exponent part for integers");s+=Array(i+1).join("0"),e=s}var f=/^([0-9][0-9]*)$/.test(e);if(!f)throw new Error("Invalid integer: "+e);for(var p=[],r=e.length,u=Z,l=r-u;0l&&(l=0),r-=u;return _(p),new t(p,o)}function W(e){if(g(e)){if(e!==S(e))throw new Error(e+" is not an integer.");return new d(e)}return G(e.toString())}function Y(e){return"number"==typeof e?W(e):"string"==typeof e?G(e):e}var X=1e7,Z=7,J=9007199254740992,Q=l(J);t.prototype=Object.create(e.prototype),d.prototype=Object.create(e.prototype),t.prototype.add=function(e){var r=Y(e);if(this.sign!==r.sign)return this.subtract(r.negate());var o=this.value,a=r.value;return r.isSmall?new t(I(o,s(a)),this.sign):new t(k(o,a),this.sign)},t.prototype.plus=t.prototype.add,d.prototype.add=function(e){var r=Y(e),o=this.value;if(0>o!==r.sign)return this.subtract(r.negate());var a=r.value;if(r.isSmall){if(g(o+a))return new d(o+a);a=l(s(a))}return new t(I(a,s(o)),0>o)},d.prototype.plus=d.prototype.add,t.prototype.subtract=function(e){var t=Y(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,a=t.value;return t.isSmall?w(r,s(a),this.sign):x(r,a,this.sign)},t.prototype.minus=t.prototype.subtract,d.prototype.subtract=function(e){var t=Y(e),r=this.value;if(0>r!==t.sign)return this.add(t.negate());var a=t.value;return t.isSmall?new d(r-a):w(a,s(r),0<=r)},d.prototype.minus=d.prototype.subtract,t.prototype.negate=function(){return new t(this.value,!this.sign)},d.prototype.negate=function(){var e=this.sign,t=new d(-this.value);return t.sign=!e,t},t.prototype.abs=function(){return new t(this.value,!1)},d.prototype.abs=function(){return new d(s(this.value))},t.prototype.multiply=function(r){var o=Y(r),n=this.value,a=o.value,i=this.sign!==o.sign,d;if(o.isSmall){if(0===a)return e[0];if(1===a)return this;if(-1===a)return this.negate();if(d=s(a),da?1:-1):-1},t.prototype.compare=function(e){if(e===Infinity)return-1;if(e===-Infinity)return 1;var t=Y(e),r=this.value,a=t.value;return this.sign===t.sign?t.isSmall?this.sign?-1:1:C(r,a)*(this.sign?-1:1):t.sign?1:-1},t.prototype.compareTo=t.prototype.compare,d.prototype.compare=function(e){if(e===Infinity)return-1;if(e===-Infinity)return 1;var t=Y(e),r=this.value,a=t.value;return t.isSmall?r==a?0:r>a?1:-1:0>r===t.sign?0>r?1:-1:0>r?-1:1},d.prototype.compareTo=d.prototype.compare,t.prototype.equals=function(e){return 0===this.compare(e)},d.prototype.eq=d.prototype.equals=t.prototype.eq=t.prototype.equals,t.prototype.notEquals=function(e){return 0!==this.compare(e)},d.prototype.neq=d.prototype.notEquals=t.prototype.neq=t.prototype.notEquals,t.prototype.greater=function(e){return 0this.compare(e)},d.prototype.lt=d.prototype.lesser=t.prototype.lt=t.prototype.lesser,t.prototype.greaterOrEquals=function(e){return 0<=this.compare(e)},d.prototype.geq=d.prototype.greaterOrEquals=t.prototype.geq=t.prototype.greaterOrEquals,t.prototype.lesserOrEquals=function(e){return 0>=this.compare(e)},d.prototype.leq=d.prototype.lesserOrEquals=t.prototype.leq=t.prototype.lesserOrEquals,t.prototype.isEven=function(){return 0==(1&this.value[0])},d.prototype.isEven=function(){return 0==(1&this.value)},t.prototype.isOdd=function(){return 1==(1&this.value[0])},d.prototype.isOdd=function(){return 1==(1&this.value)},t.prototype.isPositive=function(){return!this.sign},d.prototype.isPositive=function(){return 0this.value},t.prototype.isUnit=function(){return!1},d.prototype.isUnit=function(){return 1===s(this.value)},t.prototype.isZero=function(){return!1},d.prototype.isZero=function(){return 0===this.value},t.prototype.isDivisibleBy=function(t){var r=Y(t),a=r.value;return 0!==a&&(1===a||(2===a?this.isEven():this.mod(r).equals(e[0])))},d.prototype.isDivisibleBy=t.prototype.isDivisibleBy,t.prototype.isPrime=function(){var r=z(this);if(void 0!==r)return r;for(var o=this.abs(),n=o.prev(),s=[2,3,5,7,11,13,17,19],a=n,f,d,t,i;a.isEven();)a=a.divide(2);for(t=0;t-J?new d(e-1):new t(Q,!0)};for(var $=[1];2*$[$.length-1]<=X;)$.push(2*$[$.length-1]);var ee=$.length,te=$[ee-1];t.prototype.shiftLeft=function(e){if(!M(e))throw new Error(e+" is too large for shifting.");if(e=+e,0>e)return this.shiftRight(-e);for(var t=this;e>=ee;)t=t.multiply(te),e-=ee-1;return t.multiply($[e])},d.prototype.shiftLeft=t.prototype.shiftLeft,t.prototype.shiftRight=function(e){var t;if(!M(e))throw new Error(e+" is too large for shifting.");if(e=+e,0>e)return this.shiftLeft(-e);for(var r=this;e>=ee;){if(r.isZero())return r;t=N(r,te),r=t[1].isNegative()?t[0].prev():t[0],e-=ee-1}return t=N(r,$[e]),t[1].isNegative()?t[0].prev():t[0]},d.prototype.shiftRight=t.prototype.shiftRight,t.prototype.not=function(){return this.negate().prev()},d.prototype.not=t.prototype.not,t.prototype.and=function(e){return U(this,e,function(e,t){return e&t})},d.prototype.and=t.prototype.and,t.prototype.or=function(e){return U(this,e,function(e,t){return e|t})},d.prototype.or=t.prototype.or,t.prototype.xor=function(e){return U(this,e,function(e,t){return e^t})},d.prototype.xor=t.prototype.xor;var re=1073741824,ae=(X&-X)*(X&-X)|re,oe=function(e,t){for(var a=e.length,o=s(t),n=0,n,i;n=o){if("1"===i&&1===o)continue;throw new Error(i+" is not a valid digit in base "+t+".")}else if(i.charCodeAt(0)-87>=o)throw new Error(i+" is not a valid digit in base "+t+".");if(2<=t&&36>=t&&a<=36.7368005696771/r(t)){var f=parseInt(e,t);if(isNaN(f))throw new Error(i+" is not a valid digit in base "+t+".");return new d(parseInt(e,t))}t=Y(t);var p=[],u="-"===e[0];for(n=u?1:0;n=l)p.push(Y(i));else if(97<=l&&122>=l)p.push(Y(i.charCodeAt(0)-87));else if("<"===i){var b=n;do n++;while(">"!==e[n]);p.push(Y(e.slice(b+1,n)))}else throw new Error(i+" is not a valid character")}return F(p,t,u)};t.prototype.toString=function(e){if(void 0===e&&(e=10),10!==e)return V(this,e);for(var t=this.value,r=t.length,a=t[--r]+"",o;0<=--r;)o=t[r]+"",a+="0000000".slice(o.length)+o;var n=this.sign?"-":"";return n+a},d.prototype.toString=function(e){return void 0===e&&(e=10),10==e?this.value+"":V(this,e)},t.prototype.toJSON=d.prototype.toJSON=function(){return this.toString()},t.prototype.valueOf=function(){return+this.toString()},t.prototype.toJSNumber=t.prototype.valueOf,d.prototype.valueOf=function(){return this.value},d.prototype.toJSNumber=d.prototype.valueOf;for(var ne=0;1e3>ne;ne++)e[ne]=new d(ne),0=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return o}function s(e,t,a,o){for(var n=0,r=u(e.length,a),d=t,i;de&&(this.sign=!0,e=-e),void(67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(o(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3));if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),o(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,"");var a=0;"-"===e[0]&&a++,16===t?this._parseHex(e,a):this._parseBase(e,t,a),"-"===e[0]&&(this.sign=!0),this.strip()},n.prototype._initArray=function(e,t,r){if(o("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=p(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-n,n+=24,26<=n&&(n-=26,i++);else if("le"===r)for(var a=0,i=0,d;a>>26-n,n+=24,26<=n&&(n-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t){this.length=p((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)n=d(e,r,r+6),this.words[o]|=67108863&n<>>26-a,a+=24,26<=a&&(a-=26,o++);if(r+6!==t){var n=d(e,t,r+6);this.words[o]|=67108863&n<>>26-a}this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var a=0,o=1;67108863>=o;o*=t)a++;a--,o=0|o/t;for(var n=e.length-r,d=n%a,c=u(n,n-d)+r,f=0,p=r;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f);if(0!=d){for(var i=1,f=s(e,p,e.length,t),p=0;pthis.words[0]+f?this.words[0]+=f:this._iaddn(f)}},n.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t"};var y=["","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"],_=[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],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,10000000,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(e,t){if(e=e||10,16===e||"hex"===e){for(var a="",n=0,t=0|t||1,d=0,s=0;s>>24-n,a=0!=d||s!==this.length-1?y[6-f.length]+f+a:f+a,n+=2,26<=n&&(n-=26,s--)}for(0!=d&&(a=d.toString(16)+a);0!=a.length%t;)a="0"+a;return this.sign&&(a="-"+a),a}if(e===(0|e)&&2<=e&&36>=e){var p=_[e],u=v[e],a="",l=this.clone();for(l.sign=!1;0!==l.cmpn(0);){var c=l.modn(u).toString(e);l=l.idivn(u),a=0===l.cmpn(0)?c+a:y[p-c.length]+c+a}return 0===this.cmpn(0)&&(a="0"+a),this.sign&&(a="-"+a),a}o(!1,"Base should be between 2 and 36")},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toArray=function(){this.strip();var e=Array(this.byteLength());e[0]=0;for(var t=this.clone(),r=0,a;0!==t.cmpn(0);r++)a=t.andln(255),t.ishrn(8),e[e.length-r-1]=a;return e},n.prototype._countBits=e?function(t){return 32-e(t)}:function(e){var a=e,t=0;return 4096<=a&&(t+=13,a>>>=13),64<=a&&(t+=7,a>>>=7),8<=a&&(t+=4,a>>>=4),2<=a&&(t+=2,a>>>=2),t+a},n.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 0==(8191&a)&&(t+=13,a>>>=13),0==(127&a)&&(t+=7,a>>>=7),0==(15&a)&&(t+=4,a>>>=4),0==(3&a)&&(t+=2,a>>>=2),0==(1&a)&&t++,t},n.prototype.bitLength=function(){var e=0,t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.iand=function(e){this.sign=this.sign&&e.sign;var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.ixor=function(e){this.sign=this.sign||e.sign;var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.setn=function(e,t){o("number"==typeof e&&0<=e);for(var r=0|e/26,a=e%26;this.length<=r;)this.words[this.length++]=0;return t?this.words[r]|=1<e.length?(r=this,a=e):(r=e,a=this);for(var o=0,n=0,t;n>>26;for(;0!=o&&n>>26}if(this.length=r.length,0!=o)this.words[this.length]=o,this.length++;else if(r!==this)for(;ne.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(e.sign){e.sign=!1;var t=this.iadd(e);return e.sign=!0,t._normSign()}if(this.sign)return this.sign=!1,this.iadd(e),this.sign=!0,this._normSign();var r=this.cmp(e);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var o,a;0>26,this.words[d]=67108863&t;for(;0!=n&&d>26,this.words[d]=67108863&t}if(0==n&&d>>26,s=67108863&o,c=u(n,e.length-1),p=f(0,n-this.length+1);p<=c;p++){var l=n-p,i=0|this.words[l],a=0|e.words[p],b=i*a,r=67108863&b;d=0|d+(0|b/67108864),r=0|r+s,s=67108863&r,d=0|d+(r>>>26)}t.words[n]=s,o=d}return 0==o?t.length--:t.words[n]=o,t.strip()},n.prototype._bigMulTo=function(e,t){t.sign=e.sign!==this.sign,t.length=this.length+e.length;for(var o=0,n=0,d=0,s;d>>26),n+=s>>>26,s&=67108863}t.words[d]=c,o=s,s=n}return 0==o?t.length--:t.words[d]=o,t.strip()},n.prototype.mulTo=function(e,t){var r;return r=63>this.length+e.length?this._smallMulTo(e,t):this._bigMulTo(e,t),r},n.prototype.mul=function(e){var t=new n(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},n.prototype.imul=function(e){if(0===this.cmpn(0)||0===e.cmpn(0))return this.words[0]=0,this.length=1,this;var t=this.length,o=e.length;this.sign=e.sign!==this.sign,this.length+=e.length,this.words[this.length-1]=0;for(var n=this.length-2;0<=n;n--){for(var d=0,s=0,c=u(n,o-1),p=f(0,n-t+1);p<=c;p++){var l=n-p,i=this.words[l],a=e.words[p],b=i*a,r=67108863&b;d+=0|b/67108864,r+=s,s=67108863&r,d+=r>>>26}this.words[n]=s,this.words[n+1]+=d,d=0}for(var d=0,l=1,h;l>>26;return this.strip()},n.prototype.imuln=function(e){o("number"==typeof e);for(var t=0,r=0;r>=26,t+=0|a/67108864,t+=n>>>26,this.words[r]=67108863&n}return 0!=t&&(this.words[r]=t,this.length++),this},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.mul(this)},n.prototype.ishln=function(e){o("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26;if(0!=t){for(var a=0,n=0;n>>26-t<<26-t,d=this.words[n]-i<>>26-t}a&&(this.words[n]=a,this.length++)}if(0!=r){for(var n=this.length-1;0<=n;n--)this.words[n+r]=this.words[n];for(var n=0;nr){this.length-=r;for(var c=0;c=n);c--)p=this.words[c],this.words[c]=i<<26-d|p>>>d,i=p&(67108863^67108863>>>d<>>t<e?this.isubn(-e):this.sign?1===this.length&&this.words[0]e)return this.iaddn(-e);if(this.sign)return this.sign=!1,this.iaddn(e),this.sign=!0,this;this.words[0]-=e;for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.sign=!1,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,r,a){var n=e.length+a,d;if(this.words.length>26)-(0|c/67108864),this.words[d+a]=67108863&s}for(;d>26,this.words[d+a]=67108863&s}if(0==t)return this.strip();o(-1==t),t=0;for(var d=0,s;d>26,this.words[d]=67108863&s;return this.sign=!0,this.strip()},n.prototype._wordDiv=function(e,t){var r=this.length-e.length,o=this.clone(),d=e,s=d.words[d.length-1],c=this._countBits(s);r=26-c,0!=r&&(d=d.shln(r),o.ishln(r),s=d.words[d.length-1]);var f=o.length-d.length,p;if("mod"!==t){p=new n(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t)},n.prototype.div=function(e){return this.divmod(e,"div").div},n.prototype.mod=function(e){return this.divmod(e,"mod").mod},n.prototype.divRound=function(e){var t=this.divmod(e);if(0===t.mod.cmpn(0))return t.div;var r=t.div.sign?t.mod.isub(e):t.mod,a=e.shrn(1),o=e.andln(1),n=r.cmp(a);return 0>n||1===o&&0===n?t.div:t.div.sign?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){o(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+this.words[r])%e;return t},n.prototype.idivn=function(e){o(67108863>=e);for(var t=0,r=this.length-1,a;0<=r;r--)a=this.words[r]+67108864*t,this.words[r]=0|a/e,t=a%e;return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){o(!e.sign),o(0!==e.cmpn(0));var t=this,r=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),i=new n(0),d=new n(0),s=new n(1),c=0;t.isEven()&&r.isEven();)t.ishrn(1),r.ishrn(1),++c;for(var f=r.clone(),p=t.clone();0!==t.cmpn(0);){for(;t.isEven();)t.ishrn(1),a.isEven()&&i.isEven()?(a.ishrn(1),i.ishrn(1)):(a.iadd(f).ishrn(1),i.isub(p).ishrn(1));for(;r.isEven();)r.ishrn(1),d.isEven()&&s.isEven()?(d.ishrn(1),s.ishrn(1)):(d.iadd(f).ishrn(1),s.isub(p).ishrn(1));0<=t.cmp(r)?(t.isub(r),a.isub(d),i.isub(s)):(r.isub(t),d.isub(a),s.isub(i))}return{a:d,b:s,gcd:r.ishln(c)}},n.prototype._invmp=function(e){o(!e.sign),o(0!==e.cmpn(0));var t=this,r=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),i=new n(0),d=r.clone();0i){var r=o;o=a,a=r}else if(0===i||0===a.cmpn(1))break;o.isub(a)}while(!0);return a.ishln(n)},n.prototype.invm=function(e){return this.egcd(e).a.mod(e)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){o("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,d&=67108863,this.words[n]=d;return 0!=i&&(this.words[n]=i,this.length++),this},n.prototype.cmpn=function(e){var t=0>e;if(t&&(e=-e),this.sign&&!t)return-1;if(!this.sign&&t)return 1;e&=67108863,this.strip();var r;if(1e.length)return 1;if(this.lengtha&&(t=1);break}}return t},n.red=function(e){return new g(e)},n.prototype.toRed=function(e){return o(!this.red,"Already a number in reduction context"),o(!this.sign,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return o(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return o(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return o(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return o(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return o(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return o(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return o(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return o(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return o(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return o(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return o(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return o(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return o(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};i.prototype._tmp=function(){var e=new n(null);return e.words=Array(p(this.n/13)),e},i.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var a=r=e.length)return e.words[0]=0,void(e.length=1);var n=e.words[9];t.words[t.length++]=n&r;for(var o=10,i;o>>22,n=i;e.words[o-10]=n>>>22,e.length-=9},c.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0,a,o;r>>=26,e.words[r]=o,t=a}return 0!=t&&(e.words[e.length++]=t),e},n._prime=function(e){if(S[e])return S[e];var t;if("k256"===e)t=new c;else if("p224"===e)t=new l;else if("p192"===e)t=new b;else if("p25519"===e)t=new h;else throw new Error("Unknown prime "+e);return S[e]=t,t},g.prototype._verify1=function(e){o(!e.sign,"red works only with positives"),o(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){o(!e.sign&&!t.sign,"red works only with positives"),o(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.mod(this.m)._forceRed(this)},g.prototype.neg=function(e){var t=e.clone();return t.sign=!t.sign,t.iadd(this.m)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},g.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.shln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e)},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(0===e.cmpn(0))return e.clone();var a=this.m.andln(3);if(o(1==a%2),3===a){var d=this.m.add(new n(1)).ishrn(2),f=this.pow(e,d);return f}for(var r=this.m.subn(1),p=0;0!==r.cmpn(0)&&0===r.andln(1);)p++,r.ishrn(1);o(0!==r.cmpn(0));var s=new n(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new n(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var g=this.pow(h,r),f=this.pow(e,r.addn(1).ishrn(1)),c=this.pow(e,r),t=p;0!==c.cmp(s);){for(var m=c,y=0;0!==m.cmp(s);y++)m=m.redSqr();o(yo.cmpn(0)&&(n=o.iadd(this.m)),n._forceRed(this)},m.prototype.mul=function(e,r){if(0===e.cmpn(0)||0===r.cmpn(0))return new n(0)._forceRed(this);var a=e.mul(r),t=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=a.isub(t).ishrn(this.shift),i=o;return 0<=o.cmp(this.m)?i=o.isub(this.m):0>o.cmpn(0)&&(i=o.iadd(this.m)),i._forceRed(this)},m.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})("undefined"==typeof r||r,this)},{}],76:[function(e,t){function a(e){this.rand=e}var o;if(t.exports=function(e){return o||(o=new a(null)),o.generate(e)},t.exports.Rand=a,a.prototype.generate=function(e){return this._rand(e)},a.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^i[255&f>>>16]^d[255&p>>>8]^s[255&u]^t[l++],g=n[f>>>24]^i[255&p>>>16]^d[255&u>>>8]^s[255&c]^t[l++],m=n[p>>>24]^i[255&u>>>16]^d[255&c>>>8]^s[255&f]^t[l++],y=n[u>>>24]^i[255&c>>>16]^d[255&f>>>8]^s[255&p]^t[l++],c=h,f=g,p=m,u=y;return h=(a[c>>>24]<<24|a[255&f>>>16]<<16|a[255&p>>>8]<<8|a[255&u])^t[l++],g=(a[f>>>24]<<24|a[255&p>>>16]<<16|a[255&u>>>8]<<8|a[255&c])^t[l++],m=(a[p>>>24]<<24|a[255&u>>>16]<<16|a[255&c>>>8]<<8|a[255&f])^t[l++],y=(a[u>>>24]<<24|a[255&c>>>16]<<16|a[255&f>>>8]<<8|a[255&p])^t[l++],h>>>=0,g>>>=0,m>>>=0,y>>>=0,[h,g,m,y]}function n(e){this._key=r(e),this._reset()}var d=e("safe-buffer").Buffer,i=[0,1,2,4,8,16,32,64,128,27,54],s=function(){for(var e=Array(256),r=0;256>r;r++)e[r]=128>r?r<<1:283^r<<1;for(var a=[],o=[],n=[[],[],[],[]],d=[[],[],[],[]],s=0,c=0,f=0,i;256>f;++f){i=c^c<<1^c<<2^c<<3^c<<4,i=99^(i>>>8^255&i),a[s]=i,o[i]=s;var p=e[s],u=e[p],l=e[u],b=257*e[i]^16843008*i;n[0][s]=b<<24|b>>>8,n[1][s]=b<<16|b>>>16,n[2][s]=b<<8|b>>>24,n[3][s]=b,b=16843009*l^65537*u^257*p^16843008*s,d[0][i]=b<<24|b>>>8,d[1][i]=b<<16|b>>>16,d[2][i]=b<<8|b>>>24,d[3][i]=b,0==s?s=c=1:(s=p^e[e[e[l^p]]],c^=e[e[c]])}return{SBOX:a,INV_SBOX:o,SUB_MIX:n,INV_SUB_MIX:d}}();n.blockSize=16,n.keySize=32,n.prototype.blockSize=n.blockSize,n.prototype.keySize=n.keySize,n.prototype._reset=function(){for(var e=this._key,r=e.length,a=r+6,o=4*(a+1),n=[],d=0;d>>24,c=s.SBOX[c>>>24]<<24|s.SBOX[255&c>>>16]<<16|s.SBOX[255&c>>>8]<<8|s.SBOX[255&c],c^=i[0|d/r]<<24):6>>24]<<24|s.SBOX[255&c>>>16]<<16|s.SBOX[255&c>>>8]<<8|s.SBOX[255&c]),n[d]=n[d-r]^c}for(var t=[],f=0;ff||4>=p?u:s.INV_SUB_MIX[0][s.SBOX[u>>>24]]^s.INV_SUB_MIX[1][s.SBOX[255&u>>>16]]^s.INV_SUB_MIX[2][s.SBOX[255&u>>>8]]^s.INV_SUB_MIX[3][s.SBOX[255&u]]}this._nRounds=a,this._keySchedule=n,this._invKeySchedule=t},n.prototype.encryptBlockRaw=function(e){return e=r(e),o(e,this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},n.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=d.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},n.prototype.decryptBlock=function(e){e=r(e);var t=e[1];e[1]=e[3],e[3]=t;var a=o(e,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),n=d.allocUnsafe(16);return n.writeUInt32BE(a[0],0),n.writeUInt32BE(a[3],4),n.writeUInt32BE(a[2],8),n.writeUInt32BE(a[1],12),n},n.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=n},{"safe-buffer":251}],79:[function(e,t){function r(e,t){var r=0;e.length!==t.length&&r++;for(var a=u(e.length,t.length),o=0;ot&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=f(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&r(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},o.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},o.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},t.exports=o},{"./aes":78,"./ghash":83,"./incr32":84,"buffer-xor":125,"cipher-base":131,inherits:201,"safe-buffer":251}],80:[function(e,t,r){var a=e("./encrypter"),o=e("./decrypter"),n=e("./modes/list.json");r.createCipher=r.Cipher=a.createCipher,r.createCipheriv=r.Cipheriv=a.createCipheriv,r.createDecipher=r.Decipher=o.createDecipher,r.createDecipheriv=r.Decipheriv=o.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(n)}},{"./decrypter":81,"./encrypter":82,"./modes/list.json":92}],81:[function(e,t,r){function a(e,t,r){p.call(this),this._cache=new o,this._last=void 0,this._cipher=new u.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}function o(){this.cache=s.allocUnsafe(0)}function n(e){for(var t=e[15],r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}var n=e("safe-buffer").Buffer,i=n.alloc(16,0);o.prototype.ghash=function(e){for(var t=-1;++t++o;){for(i=0!=(this.state[~~(o/8)]&1<<7-o%8),i&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),d=0!=(1&e[3]),n=3;0>>1|(1&e[n-1])<<31;e[0]>>>=1,d&&(e[0]^=-520093696)}this.state=a(t)},o.prototype.update=function(e){this.cache=n.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":251}],84:[function(e,t){t.exports=function(e){for(var t=e.length,r;t--;)if(r=e.readUInt8(t),255===r)e.writeUInt8(0,t);else{r++,e.writeUInt8(r,t);break}}},{}],85:[function(e,t,r){var a=e("buffer-xor");r.encrypt=function(e,t){var r=a(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var o=e._cipher.decryptBlock(t);return a(o,r)}},{"buffer-xor":125}],86:[function(e,t,r){function a(e,t,r){var a=t.length,i=n(t,e._cache);return e._cache=e._cache.slice(a),e._prev=o.concat([e._prev,r?t:i]),i}var o=e("safe-buffer").Buffer,n=e("buffer-xor");r.encrypt=function(e,t,r){for(var n=o.allocUnsafe(0),i;t.length;)if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),e._cache.length<=t.length)i=e._cache.length,n=o.concat([n,a(e,t.slice(0,i),r)]),t=t.slice(i);else{n=o.concat([n,a(e,t,r)]);break}return n}},{"buffer-xor":125,"safe-buffer":251}],87:[function(e,t,r){function a(e,t,r){for(var a=-1,n=0,i,d,s;++a<8;)i=e._cipher.encryptBlock(e._prev),d=t&1<<7-a?128:0,s=i[0]^d,n+=(128&s)>>a%8,e._prev=o(e._prev,r?d:s);return n}function o(e,t){var r=e.length,a=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++a>7;return o}var n=e("safe-buffer").Buffer;r.encrypt=function(e,t,r){for(var o=t.length,d=n.allocUnsafe(o),s=-1;++s=e.cmpn(0))throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}var d=e("bn.js"),i=e("elliptic").ec,c=e("parse-asn1"),s=e("./curves.json");t.exports=function(e,t,n,s,f){var p=c(n);if("ec"===p.type){if("ecdsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");return a(e,t,p)}if("dsa"===p.type){if("dsa"!==s)throw new Error("wrong public key type");return o(e,t,p)}if("rsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");t=r.concat([f,t]);for(var l=p.modulus.byteLength(),b=[1],h=0;t.length+b.length+2h?1:0;for(l=u(e.length,b.length),e.length!==b.length&&(m=1),g=-1;++g=f;t--)p=(p<<1)+o[t];s.push(p)}for(var u=this.jpoint(null,null,null),a=this.jpoint(null,null,null),l=n;0f)break;var i=n[f];c(0!==i),s="affine"===e.type?0>1]):s.mixedAdd(o[-i-1>>1].neg()):0>1]):s.add(o[-i-1>>1].neg())}return"affine"===e.type?s.toP():s},r.prototype._wnafMulAdd=function(e,t,r,o,n){for(var c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,h=0,g=0;gg)break;for(var v=0;v>1]:0>E&&(i=u[v][-E-1>>1].neg());x="affine"===i.type?x.mixedAdd(i):x.add(i)}}for(var g=0;g=p((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,o=0;o":""},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),a=this.z.redSqr();a=a.redIAdd(a);var o=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=o.redAdd(r),i=e.redSub(a),d=o.redSub(r),s=n.redMul(i),c=e.redMul(d),f=n.redMul(d),p=i.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),a=this.y.redSqr(),o,n,i;if(this.curve.twisted){var d=this.curve._mulA(r),e=d.redAdd(a);if(this.zOne)o=t.redSub(r).redSub(a).redMul(e.redSub(this.curve.two)),n=e.redMul(d.redSub(a)),i=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);o=t.redSub(r).redISub(a).redMul(c),n=e.redMul(d.redSub(a)),i=e.redMul(c)}}else{var d=r.redAdd(a),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=d.redSub(s).redSub(s);o=this.curve._mulC(t.redISub(d)).redMul(c),n=this.curve._mulC(d).redMul(r.redISub(a)),i=d.redMul(c)}return this.curve.point(o,n,i)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),a=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),o=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),i=a.redSub(r),e=n.redSub(o),d=n.redAdd(o),s=a.redAdd(r),c=i.redMul(e),f=d.redMul(s),p=i.redMul(s),u=e.redMul(d);return this.curve.point(c,f,u,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),a=r.redSqr(),o=this.x.redMul(t.x),n=this.y.redMul(t.y),i=this.curve.d.redMul(o).redMul(n),e=a.redSub(i),d=a.redAdd(i),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(n),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(d).redMul(n.redSub(this.curve._mulA(o))),p=e.redMul(d)):(f=r.redMul(d).redMul(n.redSub(o)),p=this.curve._mulC(e).redMul(d)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},a.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},a.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var a=e.clone(),o=this.curve.redN.redMul(this.z);;){if(a.iadd(this.curve.n),0<=a.cmp(this.curve.p))return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}return!1},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],110:[function(e,t,r){"use strict";var a=r;a.base=e("./base"),a.short=e("./short"),a.mont=e("./mont"),a.edwards=e("./edwards")},{"./base":108,"./edwards":109,"./mont":111,"./short":112}],111:[function(e,t){"use strict";function r(e){d.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){d.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),n=e("bn.js"),i=e("inherits"),d=o.base,s=e("../../elliptic"),c=s.utils;i(r,d),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),a=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),o=a.redSqrt();return 0===o.redSqr().cmp(a)},i(a,d.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(c.toArray(e,t),1)},r.prototype.point=function(e,t){return new a(this,e,t)},r.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),a=r.redSqr(),o=t.redSub(a),n=t.redMul(a),i=o.redMul(a.redAdd(this.curve.a24.redMul(o)));return this.curve.point(n,i)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),a=this.x.redSub(this.z),o=e.x.redAdd(e.z),n=e.x.redSub(e.z),i=n.redMul(r),d=o.redMul(a),s=t.z.redMul(i.redAdd(d).redSqr()),c=t.x.redMul(i.redISub(d).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,a=this.curve.point(null,null),o=this,n=[];0!==r.cmpn(0);r.iushrn(1))n.push(r.andln(1));for(var d=n.length-1;0<=d;d--)0===n[d]?(t=t.diffAdd(a,o),a=a.dbl()):(a=t.diffAdd(a,o),t=t.dbl());return a},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],112:[function(e,t){"use strict";function r(e){c.call(this,"short",e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function a(e,t,r,a){c.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(t,16),this.y=new d(r,16),a&&(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 o(e,t,r,a){c.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===a?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(t,16),this.y=new d(r,16),this.z=new d(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var n=e("../curve"),i=e("../../elliptic"),d=e("bn.js"),s=e("inherits"),c=n.base,f=i.utils.assert;s(r,c),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new d(e.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=0>a[0].cmp(a[1])?a[0]:a[1],t=t.toRed(this.red)}if(e.lambda)r=new d(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var n;return n=e.basis?e.basis.map(function(e){return{a:new d(e.a,16),b:new d(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:n}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:d.mont(e),r=new d(2).toRed(t).redInvm(),a=r.redNeg(),o=new d(3).toRed(t).redNeg().redSqrt().redMul(r),n=a.redAdd(o).fromRed(),i=a.redSub(o).fromRed();return[n,i]},r.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(h(this.n.bitLength()/2)),a=e,o=this.n.clone(),n=new d(1),s=new d(0),c=new d(0),f=new d(1),p=0,i,u,l,b,g,m,_,v,r,S;0!==a.cmpn(0);){S=o.div(a),v=o.sub(S.mul(a)),r=c.sub(S.mul(n));var k=f.sub(S.mul(s));if(!l&&0>v.cmp(t))i=_.neg(),u=n,l=v.neg(),b=r;else if(l&&2==++p)break;_=v,o=a,a=v,c=n,n=r,f=s,s=k}g=v.neg(),m=r;var y=l.sqr().add(b.sqr()),I=g.sqr().add(m.sqr());return 0<=I.cmp(y)&&(g=i,m=u),l.negative&&(l=l.neg(),b=b.neg()),g.negative&&(g=g.neg(),m=m.neg()),[{a:l,b:b},{a:g,b:m}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],a=t[1],o=a.b.mul(e).divRound(this.n),n=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),d=n.mul(a.a),s=o.mul(r.b),c=n.mul(a.b),f=e.sub(i).sub(d),p=s.add(c).neg();return{k1:f,k2:p}},r.prototype.pointFromX=function(e,t){e=new d(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),a=r.redSqrt();if(0!==a.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=a.fromRed().isOdd();return(t&&!o||!t&&o)&&(a=a.redNeg()),this.point(e,a)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,a=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,r){for(var a=this._endoWnafT1,o=this._endoWnafT2,n=0;n":""},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),a=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,a)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),a=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(a),n=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new d(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o):this.curve._wnafMulAdd(1,a,o,2)},a.prototype.jmulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o,!0):this.curve._wnafMulAdd(1,a,o,2,!0)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,a=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(a)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(a)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,c.BasePoint),r.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),a=this.y.redMul(t).redMul(e);return this.curve.point(r,a)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),a=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(a),i=this.y.redMul(t.redMul(e.z)),d=e.y.redMul(a.redMul(this.z)),s=o.redSub(n),c=i.redSub(d);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=o.redMul(r),u=c.redSqr().redIAdd(f).redISub(p).redISub(p),l=c.redMul(p.redISub(u)).redISub(i.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),a=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),d=a.redSub(o),s=n.redSub(i);if(0===d.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=d.redSqr(),c=r.redMul(d),f=a.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),u=s.redMul(f.redISub(p)).redISub(n.redMul(c)),l=this.z.redMul(d);return this.curve.jpoint(p,u,l)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":107,"../curve":110,"bn.js":106,inherits:201}],113:[function(e,t,r){"use strict";function a(e){this.curve="short"===e.type?new d.curve.short(e):"edwards"===e.type?new d.curve.edwards(e):new d.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}var n=r,i=e("hash.js"),d=e("../elliptic"),s=d.utils.assert;n.PresetCurve=a,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:i.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"]}),o("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:i.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=e("./precomputed/secp256k1")}catch(t){c=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})},{"../elliptic":107,"./precomputed/secp256k1":120,"hash.js":185}],114:[function(e,t){"use strict";function r(e){return this instanceof r?void("string"==typeof e&&(d(n.curves.hasOwnProperty(e),"Unknown curve "+e),e=n.curves[e]),e instanceof n.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash):new r(e)}var a=e("bn.js"),o=e("hmac-drbg"),n=e("../../elliptic"),i=n.utils,d=i.assert,s=e("./key"),c=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new s(this,e)},r.prototype.keyFromPrivate=function(e,t){return s.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return s.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||n.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new a(2));do{var d=new a(t.generate(r));if(0=h.cmpn(1)||0<=h.cmp(l))){var g=this.g.mul(h);if(!g.isInfinity()){var m=g.getX(),y=m.umod(this.n);if(0!==y.cmpn(0)){var _=h.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),0!==_.cmpn(0)){var v=(g.getY().isOdd()?1:0)|(0===m.cmp(y)?0:2);return i.canonical&&0<_.cmp(this.nh)&&(_=this.n.sub(_),v^=1),new c({r:y,s:_,recoveryParam:v})}}}}},r.prototype.verify=function(e,t,o,n){e=this._truncateToN(new a(e,16)),o=this.keyFromPublic(o,n),t=new c(t,"hex");var i=t.r,r=t.s;if(0>i.cmpn(1)||0<=i.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var d=r.invm(this.n),s=d.mul(e).umod(this.n),f=d.mul(i).umod(this.n);if(!this.curve._maxwellTrick){var u=this.g.mulAdd(s,o.getPublic(),f);return!u.isInfinity()&&0===u.getX().umod(this.n).cmp(i)}var u=this.g.jmulAdd(s,o.getPublic(),f);return!u.isInfinity()&&u.eqXToP(i)},r.prototype.recoverPubKey=function(t,o,i,f){d((3&i)===i,"The recovery param is more than two bits"),o=new c(o,f);var p=this.n,n=new a(t),e=o.r,r=o.s,s=1&i,u=i>>1;if(0<=e.cmp(this.curve.p.umod(this.curve.n))&&u)throw new Error("Unable to find sencond key candinate");e=u?this.curve.pointFromX(e.add(this.curve.n),s):this.curve.pointFromX(e,s);var l=o.r.invm(p),b=p.sub(n).mul(l).umod(p),h=r.mul(l).umod(p);return this.g.mulAdd(b,e,h)},r.prototype.getKeyRecoveryParam=function(t,e,r,a){if(e=new c(e,a),null!==e.recoveryParam)return e.recoveryParam;for(var o=0;4>o;o++){var n;try{n=this.recoverPubKey(t,e,o)}catch(t){continue}if(n.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":107,"./key":115,"./signature":116,"bn.js":106,"hmac-drbg":198}],115:[function(e,t){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.fromPublic=function(e,t,a){return t instanceof r?t:new r(e,{pub:t,pubEnc:a})},r.fromPrivate=function(e,t,a){return t instanceof r?t:new r(e,{priv:t,privEnc:a})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new a(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?("mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y))):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return""}},{"../../elliptic":107,"bn.js":106}],116:[function(e,a){"use strict";function o(e,t){return e instanceof o?e:void(this._importDER(e,t)||(p(e.r&&e.s,"Signature without r or s"),this.r=new f(e.r,16),this.s=new f(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function n(){this.place=0}function i(e,t){var r=e[t.place++];if(!(128&r))return r;for(var a=0,o=0,n=t.place;o<(15&r);o++,n++)a<<=8,a|=e[n];return t.place=n,a}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&ta)return void e.push(a);var o=1+(r(a)/t>>>3);for(e.push(128|o);--o;)e.push(255&a>>>(o<<3));e.push(a)}var f=e("bn.js"),s=e("../../elliptic"),u=s.utils,p=u.assert;a.exports=o,o.prototype._importDER=function(e,t){e=u.toArray(e,t);var a=new n;if(48!==e[a.place++])return!1;var o=i(e,a);if(o+a.place!==e.length)return!1;if(2!==e[a.place++])return!1;var d=i(e,a),c=e.slice(a.place,d+a.place);if(a.place+=d,2!==e[a.place++])return!1;var r=i(e,a);if(e.length!==r+a.place)return!1;var p=e.slice(a.place,r+a.place);return 0===c[0]&&128&c[1]&&(c=c.slice(1)),0===p[0]&&128&p[1]&&(p=p.slice(1)),this.r=new f(c),this.s=new f(p),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var a=[2];c(a,t.length),a=a.concat(t),a.push(2),c(a,r.length);var o=a.concat(r),n=[48];return c(n,o.length),n=n.concat(o),u.encode(n,e)}},{"../../elliptic":107,"bn.js":106}],117:[function(e,t){"use strict";function r(e){if(i("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);var e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=p(e.n.bitLength()/8),this.hash=a.sha512}var a=e("hash.js"),o=e("../../elliptic"),n=o.utils,i=n.assert,d=n.parseBytes,s=e("./key"),c=e("./signature");t.exports=r,r.prototype.sign=function(e,t){e=d(e);var a=this.keyFromSecret(t),o=this.hashInt(a.messagePrefix(),e),r=this.g.mul(o),n=this.encodePoint(r),i=this.hashInt(n,a.pubBytes(),e).mul(a.priv()),s=o.add(i).umod(this.curve.n);return this.makeSignature({R:r,S:s,Rencoded:n})},r.prototype.verify=function(e,t,r){e=d(e),t=this.makeSignature(t);var a=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),a.pubBytes(),e),n=this.g.mul(t.S()),i=t.R().add(a.pub().mul(o));return i.eq(n)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(a>>1)-1?(a>>1)-d:d,o.isubn(n)}else n=0;r.push(n);for(var s=0!==o.cmpn(0)&&0===o.andln(a-1)?t+1:1,c=1;c>8,t[o]&=255;for(;d;)t.push(255&d),d>>=8}for(r=0;"1"===e[r]&&rt[a]?1:0,0==r);++a);return 0==r&&(t.length>e.length?r=-1:e.length>t.length&&(r=1)),r}},{}],125:[function(e,t){(function(e){t.exports=function(t,r){for(var a=u(t.length,r.length),o=new e(a),n=0;nQ)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=d.prototype,t}function d(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(e)}return i(e,t,r)}function i(e,t,r){if("number"==typeof e)throw new TypeError("\"value\" argument must not be a number");return W(e)?b(e,t,r):"string"==typeof e?p(e,t):h(e)}function s(e){if("number"!=typeof e)throw new TypeError("\"size\" argument must be a number");else if(0>e)throw new RangeError("\"size\" argument must not be negative")}function c(e,t,r){return s(e),0>=e?n(e):void 0===t?n(e):"string"==typeof r?n(e).fill(t,r):n(e).fill(t)}function f(e){return s(e),n(0>e?0:0|g(e))}function p(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!d.isEncoding(t))throw new TypeError("\"encoding\" must be a valid string encoding");var r=0|m(e,t),a=n(r),o=a.write(e,t);return o!==r&&(a=a.slice(0,o)),a}function l(e){for(var t=0>e.length?0:0|g(e.length),r=n(t),a=0;at||e.byteLength=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return 0|e}function m(e,t){if(d.isBuffer(e))return e.length;if(Y(e)||W(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(a)return H(e).length;t=(""+t).toLowerCase(),a=!0;}}function y(e,t,r){var a=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0;}}function _(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function v(e,t,r,a,o){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):2147483647r&&(r=-2147483648),r=+r,X(r)&&(r=o?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(0>r)if(o)r=0;else return-1;if("string"==typeof t&&(t=d.from(t,a)),d.isBuffer(t))return 0===t.length?-1:S(e,t,r,a,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):S(e,[t],r,a,o);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,a,o){function n(e,t){return 1==d?e[t]:e.readUInt16BE(t*d)}var d=1,s=e.length,c=t.length;if(void 0!==a&&(a=(a+"").toLowerCase(),"ucs2"===a||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(2>e.length||2>t.length)return-1;d=2,s/=2,c/=2,r/=2}var f;if(o){var i=-1;for(f=r;fs&&(r=s-c),f=r;0<=f;f--){for(var p=!0,u=0;uo&&(a=o)):a=o;var n=t.length;if(0!=n%2)throw new TypeError("Invalid hex string");a>n/2&&(a=n/2);for(var d=0,i;dn&&(i=n):2==d?(s=e[o+1],128==(192&s)&&(p=(31&n)<<6|63&s,127p||57343p&&(i=p))):void 0}null===i?(i=65533,d=1):65535>>10),i=56320|1023&i),a.push(i),o+=d}return O(a)}function O(e){var t=e.length;if(t<=$)return a.apply(String,e);for(var r="",o=0;ot)&&(t=0),(!r||0>r||r>a)&&(r=a);for(var o="",n=t;ne)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function z(e,t,r,a,o,n){if(!d.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,r,a){if(r+a>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function U(e,t,r,a,o){return t=+t,r>>>=0,o||M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,r,a,23,4),r+4}function L(e,t,r,a,o){return t=+t,r>>>=0,o||M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,r,a,52,8),r+8}function D(e){if(e=e.trim().replace(ee,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function H(e,t){t=t||Infinity;for(var r=e.length,a=null,o=[],n=0,i;ni){if(!a){if(56319i){-1<(t-=3)&&o.push(239,191,189),a=i;continue}i=(a-55296<<10|i-56320)+65536}else a&&-1<(t-=3)&&o.push(239,191,189);if(a=null,128>i){if(0>(t-=1))break;o.push(i)}else if(2048>i){if(0>(t-=2))break;o.push(192|i>>6,128|63&i)}else if(65536>i){if(0>(t-=3))break;o.push(224|i>>12,128|63&i>>6,128|63&i)}else if(1114112>i){if(0>(t-=4))break;o.push(240|i>>18,128|63&i>>12,128|63&i>>6,128|63&i)}else throw new Error("Invalid code point")}return o}function F(e){for(var t=[],r=0;r(t-=2));++a)o=e.charCodeAt(a),n=o>>8,i=o%256,r.push(i),r.push(n);return r}function V(e){return Z.toByteArray(D(e))}function G(e,t,r,a){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function W(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function Y(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function X(e){return e!==e}var Z=e("base64-js"),J=e("ieee754");r.Buffer=d,r.SlowBuffer=function(e){return+e!=e&&(e=0),d.alloc(+e)},r.INSPECT_MAX_BYTES=50;var Q=2147483647;r.kMaxLength=Q,d.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(e,t,r){return i(e,t,r)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(e,t,r){return c(e,t,r)},d.allocUnsafe=function(e){return f(e)},d.allocUnsafeSlow=function(e){return f(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer},d.compare=function(e,t){if(!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,a=t.length,o=0,n=u(r,a);ot&&(e+=" ... ")),""},d.prototype.compare=function(e,t,r,a,o){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===o&&(o=this.length),0>t||r>e.length||0>a||o>this.length)throw new RangeError("out of range index");if(a>=o&&t>=r)return 0;if(a>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,o>>>=0,this===e)return 0;for(var n=o-a,s=r-t,c=u(n,s),f=this.slice(a,o),p=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((void 0===r||r>o)&&(r=o),0r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var n=!1;;)switch(a){case"hex":return k(this,e,t,r);case"utf8":case"utf-8":return I(this,e,t,r);case"ascii":return x(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(n)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),n=!0;}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;d.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e],o=1,n=0;++n>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e+--t],o=1;0>>=0,t||C(e,1,this.length),this[e]},d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var a=this[e],n=1,d=0;++d=n&&(a-=o(2,8*t)),a},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var a=t,n=1,i=this[e+--a];0=n&&(i-=o(2,8*t)),i},d.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),J.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),J.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),J.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),J.read(this,e,!1,52,8)},d.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var n=o(2,8*r)-1;z(this,e,t,r,n,0)}var d=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!a){var n=o(2,8*r)-1;z(this,e,t,r,n,0)}var d=r-1,i=1;for(this[t+d]=255&e;0<=--d&&(i*=256);)this[t+d]=255&e/i;return t+r},d.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var n=o(2,8*r-1);z(this,e,t,r,n-1,-n)}var d=0,i=1,s=0;for(this[t]=255&e;++de&&0==s&&0!==this[t+d-1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},d.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var n=o(2,8*r-1);z(this,e,t,r,n-1,-n)}var d=r-1,i=1,s=0;for(this[t+d]=255&e;0<=--d&&(i*=256);)0>e&&0==s&&0!==this[t+d+1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},d.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||z(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},d.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},d.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},d.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},d.prototype.copy=function(e,t,r,a){if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>a)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-to)for(n=0;no&&(e=o)}if(void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!d.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else"number"==typeof e&&(e&=255);if(0>t||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var n;if("number"==typeof e)for(n=t;na,`Invalid value: ${a}.`),t+="qpzry9x8gf2tvdw0s3jn54khce6mua7l"[a];return t},decode:function(e){r("string"==typeof e,`Invalid base32-encoded string: ${e}.`);let t=[];for(const o of e)r(o in a,`Invalid value: ${o}.`),t.push(a[o]);return t}}},{"./ensure":130}],128:[function(e,t){function r(e){let t=!1,r=!1;for(const a of e)if(t=t||a!==a.toUpperCase(),r=r||a!==a.toLowerCase(),t&&r)return!1;return!0}function a(e){switch(e){case"P2PKH":return 0;case"P2SH":return 8;default:throw new Error(`Invalid type: ${e}.`);}}function o(e){switch(120&e){case 0:return"P2PKH";case 8:return"P2SH";default:throw new Error(`Invalid address type in version byte: ${e}.`);}}function n(e){switch(8*e.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: ${e.length}.`);}}function i(e){switch(7&e){case 0:return 160;case 1:return 192;case 2:return 224;case 3:return 256;case 4:return 320;case 5:return 384;case 6:return 448;case 7:return 512;}}function d(e){const t=[];for(const r of e)t.push(31&r.charCodeAt(0));return t}function s(e){const t=[];for(let r=0;8>r;++r)t.push(e.and(31).toJSNumber()),e=e.shiftRight(5);return t.reverse()}function c(e,t){const r=d(e).concat([0]);return f(r.concat(t)).equals(0)}function f(e){const t=[656907472481,522768456162,1044723512260,748107326120,130178868336];let r=p(1);for(let a of e){let e=r.shiftRight(35);r=r.and(34359738367).shiftLeft(5).xor(a);for(let a=0;a{let o=0,n=0,i=[];const d=(1<s||0!=s>>t)throw new Error(`Invalid value: ${s}.`);for(o=o<=r;)n-=r,i.push(o>>n&d)}if(!a)0=t||o<{if(!e)throw new Error(t)}},{}],131:[function(e,t){function r(e){o.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var a=e("safe-buffer").Buffer,o=e("stream").Transform,n=e("string_decoder").StringDecoder,i=e("inherits");i(r,o),r.prototype.update=function(e,t,r){"string"==typeof e&&(e=a.from(e,t));var o=this._update(e);return this.hashMode?this:(r&&(o=this._toString(o,r)),o)},r.prototype.setAutoPadding=function(){},r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},r.prototype._transform=function(e,t,r){var a;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(t){a=t}finally{r(a)}},r.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)},r.prototype._finalOrDigest=function(e){var t=this.__final()||a.alloc(0);return e&&(t=this._toString(t,e,!0)),t},r.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new n(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var a=this._decoder.write(e);return r&&(a+=this._decoder.end()),a},t.exports=r},{inherits:201,"safe-buffer":251,stream:260,string_decoder:261}],132:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(r){return"[object Error]"===t(r)||r instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":202}],133:[function(e,t){(function(r){function a(e){this.curveType=d[e],this.curveType||(this.curveType={name:e}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function o(e,t,a){Array.isArray(e)||(e=e.toArray());var o=new r(e);if(a&&o.length>>2),d=0,i=0;d>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,a=-271733879,o=-1732584194,c=271733878,d=0;d>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t){return e<>>32-t}var a=e("./make-hash");t.exports=function(e){return a(e,r)}},{"./make-hash":152}],154:[function(e,t){"use strict";function r(e,t){n.call(this,"digest"),"string"==typeof t&&(t=d.from(t));var r="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>r){var a="rmd160"===e?new s:c(e);t=a.update(t).digest()}else t.lengths?t=e(t):t.length>>1],r=d.r28shl(r,i),a=d.r28shl(a,i),d.pc2(r,a,e.keys,n)},a.prototype._update=function(e,t,a,o){var n=this._desState,i=d.readUInt32BE(e,t),s=d.readUInt32BE(e,t+4);d.ip(i,s,n.tmp,0),i=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,i,s,n.tmp,0):this._decrypt(n,i,s,n.tmp,0),i=n.tmp[0],s=n.tmp[1],d.writeUInt32BE(a,i,o),d.writeUInt32BE(a,s,o+4)},a.prototype._pad=function(e,t){for(var r=e.length-t,a=t;a>>0,p=f}d.rip(u,p,n,c)},a.prototype._decrypt=function(e,a,o,n,c){for(var p=o,u=a,r=e.keys.length-2;0<=r;r-=2){var i=e.keys[r],l=e.keys[r+1];d.expand(p,e.tmp,0),i^=e.tmp[0],l^=e.tmp[1];var b=d.substitute(i,l),s=d.permute(b),f=p;p=(u^s)>>>0,u=f}d.rip(p,u,n,c)}},{"../des":157,inherits:201,"minimalistic-assert":209}],161:[function(e,t){"use strict";function r(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),a=t.slice(8,16),n=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:a}),s.create({type:"encrypt",key:n})]:[s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:a}),s.create({type:"decrypt",key:r})]}function a(e){d.call(this,e);var t=new r(this.type,this.options.key);this._edeState=t}var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),d=i.Cipher,s=i.DES;n(a,d),t.exports=a,a.create=function(e){return new a(e)},a.prototype._update=function(e,t,r,a){var o=this._edeState;o.ciphers[0]._update(e,t,r,a),o.ciphers[1]._update(r,a,r,a),o.ciphers[2]._update(r,a,r,a)},a.prototype._pad=s.prototype._pad,a.prototype._unpad=s.prototype._unpad},{"../des":157,inherits:201,"minimalistic-assert":209}],162:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){var r=e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t];return r>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=255&t>>>16,e[2+r]=255&t>>>8,e[3+r]=255&t},r.ip=function(e,t,r,a){for(var o=0,n=0,d=6;0<=d;d-=2){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>>i+d}for(var d=6;0<=d;d-=2){for(var i=1;25>=i;i+=8)n<<=1,n|=1&t>>>i+d;for(var i=1;25>=i;i+=8)n<<=1,n|=1&e>>>i+d}r[a+0]=o>>>0,r[a+1]=n>>>0},r.rip=function(e,t,r,a){for(var o=0,n=0,d=0;4>d;d++)for(var i=24;0<=i;i-=8)o<<=1,o|=1&t>>>i+d,o<<=1,o|=1&e>>>i+d;for(var d=4;8>d;d++)for(var i=24;0<=i;i-=8)n<<=1,n|=1&t>>>i+d,n<<=1,n|=1&e>>>i+d;r[a+0]=o>>>0,r[a+1]=n>>>0},r.pc1=function(e,t,r,a){for(var o=0,n=0,d=7;5<=d;d--){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d}for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var d=1;3>=d;d++){for(var i=0;24>=i;i+=8)n<<=1,n|=1&t>>i+d;for(var i=0;24>=i;i+=8)n<<=1,n|=1&e>>i+d}for(var i=0;24>=i;i+=8)n<<=1,n|=1&e>>i+d;r[a+0]=o>>>0,r[a+1]=n>>>0},r.r28shl=function(e,t){return 268435455&e<>>28-t};var a=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,o){for(var n=0,d=0,s=a.length>>>1,c=0;c>>a[c];for(var c=s;c>>a[c];r[o+0]=n>>>0,r[o+1]=d>>>0},r.expand=function(e,t,r){var a=0,o=0;a=(1&e)<<5|e>>>27;for(var n=23;15<=n;n-=4)a<<=6,a|=63&e>>>n;for(var n=11;3<=n;n-=4)o|=63&e>>>n,o<<=6;o|=(31&e)<<1|e>>>31,t[r+0]=a>>>0,t[r+1]=o>>>0};var o=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,a=0;4>a;a++){var n=63&e>>>18-6*a,i=o[64*a+n];r<<=4,r|=i}for(var a=0;4>a;a++){var n=63&t>>>18-6*a,i=o[256+64*a+n];r<<=4,r|=i}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r];return t>>>0},r.padSplit=function(e,t,r){for(var a=e.toString(2);a.lengthe)return 2===t||5===t?new d([140,123]):new d([140,39]);t=new d(t);for(var r,n;;){for(r=new d(i(p(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(l),!t.cmp(l))for(;r.mod(s).cmp(v);)r.iadd(S);else if(!t.cmp(b))for(;r.mod(m).cmp(y);)r.iadd(S);if(n=r.shrn(1),a(n)&&a(r)&&o(n)&&o(r)&&f.test(n)&&f.test(r))return r}}var i=e("randombytes");t.exports=n,n.simpleSieve=a,n.fermatTest=o;var d=e("bn.js"),s=new d(24),c=e("miller-rabin"),f=new c,u=new d(1),l=new d(2),b=new d(5),h=new d(16),g=new d(8),m=new d(10),y=new d(3),_=new d(7),v=new d(11),S=new d(4),k=new d(12),I=null},{"bn.js":167,"miller-rabin":207,randombytes:234}],166:[function(e,t){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],167:[function(e,t,r){arguments[4][71][0].apply(r,arguments)},{buffer:77,dup:71}],168:[function(e,t,r){"use strict";var a=r;a.version=e("../package.json").version,a.utils=e("./elliptic/utils"),a.rand=e("brorand"),a.hmacDRBG=e("./elliptic/hmac-drbg"),a.curve=e("./elliptic/curve"),a.curves=e("./elliptic/curves"),a.ec=e("./elliptic/ec")},{"../package.json":181,"./elliptic/curve":171,"./elliptic/curves":174,"./elliptic/ec":175,"./elliptic/hmac-drbg":178,"./elliptic/utils":180,brorand:76}],169:[function(e,t){"use strict";function r(e,t){this.type=e,this.p=new o(t.p,16),this.red=t.prime?o.red(t.prime):o.mont(this.p),this.zero=new o(0).toRed(this.red),this.one=new o(1).toRed(this.red),this.two=new o(2).toRed(this.red),this.n=t.n&&new o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,]}function a(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=e("bn.js"),n=e("../../elliptic"),d=n.utils.getNAF,s=n.utils.getJSF,c=n.utils.assert;t.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){var r=e._getDoubles(),o=d(t,1),n=(1<=c;t--)f=(f<<1)+o[t];s.push(f)}for(var p=this.jpoint(null,null,null),a=this.jpoint(null,null,null),u=n;0f)break;var i=n[f];c(0!==i),s="affine"===e.type?0>1]):s.mixedAdd(o[-i-1>>1].neg()):0>1]):s.add(o[-i-1>>1].neg())}return"affine"===e.type?s.toP():s},r.prototype._wnafMulAdd=function(e,t,r,o){for(var n=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0,h=0;hh)break;for(var _=0;_>1]:0>A&&(i=c[_][-A-1>>1].neg());I="affine"===i.type?I.mixedAdd(i):I.add(i)}}for(var h=0;h":""},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),a=this.z.redSqr();a=a.redIAdd(a);var o=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=o.redAdd(r),i=e.redSub(a),d=o.redSub(r),s=n.redMul(i),c=e.redMul(d),f=n.redMul(d),p=i.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),a=this.y.redSqr(),o,n,i;if(this.curve.twisted){var d=this.curve._mulA(r),e=d.redAdd(a);if(this.zOne)o=t.redSub(r).redSub(a).redMul(e.redSub(this.curve.two)),n=e.redMul(d.redSub(a)),i=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);o=t.redSub(r).redISub(a).redMul(c),n=e.redMul(d.redSub(a)),i=e.redMul(c)}}else{var d=r.redAdd(a),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=d.redSub(s).redSub(s);o=this.curve._mulC(t.redISub(d)).redMul(c),n=this.curve._mulC(d).redMul(r.redISub(a)),i=d.redMul(c)}return this.curve.point(o,n,i)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),a=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),o=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),i=a.redSub(r),e=n.redSub(o),d=n.redAdd(o),s=a.redAdd(r),c=i.redMul(e),f=d.redMul(s),p=i.redMul(s),u=e.redMul(d);return this.curve.point(c,f,u,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),a=r.redSqr(),o=this.x.redMul(t.x),n=this.y.redMul(t.y),i=this.curve.d.redMul(o).redMul(n),e=a.redSub(i),d=a.redAdd(i),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(n),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(d).redMul(n.redSub(this.curve._mulA(o))),p=e.redMul(d)):(f=r.redMul(d).redMul(n.redSub(o)),p=this.curve._mulC(e).redMul(d)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},{"../../elliptic":168,"../curve":171,"bn.js":75,inherits:201}],171:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{"./base":169,"./edwards":170,"./mont":172,"./short":173,dup:110}],172:[function(e,t){"use strict";function r(e){d.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){d.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),n=e("bn.js"),i=e("inherits"),d=o.base;i(r,d),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),a=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),o=a.redSqrt();return 0===o.redSqr().cmp(a)},i(a,d.BasePoint),r.prototype.point=function(e,t){return new a(this,e,t)},r.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),a=r.redSqr(),o=t.redSub(a),n=t.redMul(a),i=o.redMul(a.redAdd(this.curve.a24.redMul(o)));return this.curve.point(n,i)},a.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),a=this.x.redSub(this.z),o=e.x.redAdd(e.z),n=e.x.redSub(e.z),i=n.redMul(r),d=o.redMul(a),s=t.z.redMul(i.redAdd(d).redSqr()),c=t.x.redMul(i.redISub(d).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,a=this.curve.point(null,null),o=this,n=[];0!==r.cmpn(0);r.ishrn(1))n.push(r.andln(1));for(var d=n.length-1;0<=d;d--)0===n[d]?(t=t.diffAdd(a,o),a=a.dbl()):(a=t.diffAdd(a,o),t=t.dbl());return a},a.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":171,"bn.js":75,inherits:201}],173:[function(e,t){"use strict";function r(e){c.call(this,"short",e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function a(e,t,r,a){c.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(t,16),this.y=new d(r,16),a&&(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 o(e,t,r,a){c.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===a?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(t,16),this.y=new d(r,16),this.z=new d(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var n=e("../curve"),i=e("../../elliptic"),d=e("bn.js"),s=e("inherits"),c=n.base,f=i.utils.assert;s(r,c),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new d(e.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=0>a[0].cmp(a[1])?a[0]:a[1],t=t.toRed(this.red)}if(e.lambda)r=new d(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var n;return n=e.basis?e.basis.map(function(e){return{a:new d(e.a,16),b:new d(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:n}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:d.mont(e),r=new d(2).toRed(t).redInvm(),a=r.redNeg(),o=new d(3).toRed(t).redNeg().redSqrt().redMul(r),n=a.redAdd(o).fromRed(),i=a.redSub(o).fromRed();return[n,i]},r.prototype._getEndoBasis=function(e){for(var t=this.n.shrn(h(this.n.bitLength()/2)),a=e,o=this.n.clone(),n=new d(1),s=new d(0),c=new d(0),f=new d(1),p=0,i,u,l,b,g,m,_,v,r,S;0!==a.cmpn(0);){S=o.div(a),v=o.sub(S.mul(a)),r=c.sub(S.mul(n));var k=f.sub(S.mul(s));if(!l&&0>v.cmp(t))i=_.neg(),u=n,l=v.neg(),b=r;else if(l&&2==++p)break;_=v,o=a,a=v,c=n,n=r,f=s,s=k}g=v.neg(),m=r;var y=l.sqr().add(b.sqr()),I=g.sqr().add(m.sqr());return 0<=I.cmp(y)&&(g=i,m=u),l.sign&&(l=l.neg(),b=b.neg()),g.sign&&(g=g.neg(),m=m.neg()),[{a:l,b:b},{a:g,b:m}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],a=t[1],o=a.b.mul(e).divRound(this.n),n=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),d=n.mul(a.a),s=o.mul(r.b),c=n.mul(a.b),f=e.sub(i).sub(d),p=s.add(c).neg();return{k1:f,k2:p}},r.prototype.pointFromX=function(e,t){t=new d(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),a=r.redSqrt(),o=a.fromRed().isOdd();return(e&&!o||!e&&o)&&(a=a.redNeg()),this.point(t,a)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,a=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t){for(var r=this._endoWnafT1,a=this._endoWnafT2,o=0;o":""},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),a=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,a)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),a=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(a),n=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new d(e,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var a=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,o):this.curve._wnafMulAdd(1,a,o,2)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,a=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(a)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(a)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,c.BasePoint),r.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),a=this.y.redMul(t).redMul(e);return this.curve.point(r,a)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),a=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(a),i=this.y.redMul(t.redMul(e.z)),d=e.y.redMul(a.redMul(this.z)),s=o.redSub(n),c=i.redSub(d);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=o.redMul(r),u=c.redSqr().redIAdd(f).redISub(p).redISub(p),l=c.redMul(p.redISub(u)).redISub(i.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(u,l,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),a=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),d=a.redSub(o),s=n.redSub(i);if(0===d.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=d.redSqr(),c=r.redMul(d),f=a.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),u=s.redMul(f.redISub(p)).redISub(n.redMul(c)),l=this.z.redMul(d);return this.curve.jpoint(p,u,l)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":168,"../curve":171,"bn.js":75,inherits:201}],174:[function(e,t,r){"use strict";function a(e){this.curve="short"===e.type?new d.curve.short(e):"edwards"===e.type?new d.curve.edwards(e):new d.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}var n=r,i=e("hash.js"),d=e("../elliptic"),s=d.utils.assert;n.PresetCurve=a,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=e("./precomputed/secp256k1")}catch(t){c=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})},{"../elliptic":168,"./precomputed/secp256k1":179,"hash.js":185}],175:[function(e,t){"use strict";function r(e){return this instanceof r?void("string"==typeof e&&(i(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash):new r(e)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert,d=e("./key"),c=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new d(this,e)},r.prototype.keyFromPrivate=function(e,t){return d.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return d.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});var t=new o.hmacDRBG({hash:this.hash,pers:e.pers,entropy:e.entropy||o.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new a(2));do{var i=new a(t.generate(r));if(0u;u++)p.unshift(0);for(var i=e.toArray(),u=i.length;u=h.cmpn(1)||0<=h.cmp(b))continue;var g=this.g.mul(h);if(g.isInfinity())continue;var m=g.getX().mod(this.n);if(0===m.cmpn(0))continue;var y=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e)).mod(this.n);if(0===y.cmpn(0))continue;return d.canonical&&0i.cmpn(1)||0<=i.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var d=r.invm(this.n),s=d.mul(e).mod(this.n),f=d.mul(i).mod(this.n),u=this.g.mulAdd(s,o.getPublic(),f);return!u.isInfinity()&&0===u.getX().mod(this.n).cmp(i)}},{"../../elliptic":168,"./key":176,"./signature":177,"bn.js":75}],176:[function(e,t){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils;t.exports=r,r.fromPublic=function(e,t,a){return t instanceof r?t:new r(e,{pub:t,pubEnc:a})},r.fromPrivate=function(e,t,a){return t instanceof r?t:new r(e,{priv:t,privEnc:a})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof e&&(t=e,e=null),!t)return this.pub;for(var r=this.ec.curve.p.byteLength(),a=this.pub.getX().toArray(),o=a.length;o"}},{"../../elliptic":168,"bn.js":75}],177:[function(e,t){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(i(e.r&&e.s,"Signature without r or s"),this.r=new a(e.r,16),this.s=new a(e.s,16)))}var a=e("bn.js"),o=e("../../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.prototype._importDER=function(e,t){if(e=n.toArray(e,t),6>e.length||48!==e[0]||2!==e[2])return!1;var r=e[1];if(1+r>e.length)return!1;var o=e[3];if(128<=o)return!1;if(4+o+2>=e.length)return!1;if(2!==e[4+o])return!1;var i=e[5+o];return!(128<=i)&&!(4+o+2+i>e.length)&&(this.r=new a(e.slice(4,4+o)),this.s=new a(e.slice(4+o+2,4+o+2+i)),!0)},r.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r));var a=t.length+r.length+4,o=[48,a,2,t.length];return o=o.concat(t,[2,r.length],r),n.encode(o,e)}},{"../../elliptic":168,"bn.js":75}],178:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc),a=n.toArray(e.nonce,e.nonceEnc),o=n.toArray(e.pers,e.persEnc);i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,a,o)}var a=e("hash.js"),o=e("../elliptic"),n=o.utils,i=n.assert;t.exports=r,r.prototype._init=function(e,t,r){var a=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this.reseed=1},r.prototype.generate=function(e,t,r,a){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(a=r,r=t,t=null),r&&(r=n.toArray(r,a),this._update(r));for(var o=[];o.length>8,i=255&o;n?r.push(n,i):r.push(i)}else if("hex"===t){e=e.replace(/[^a-z0-9]+/ig,""),0!=e.length%2&&(e="0"+e);for(var a=0;a(a>>1)-1?(a>>1)-d:d,o.isubn(n)}else n=0;r.push(n);for(var s=0!==o.cmpn(0)&&0===o.andln(a-1)?t+1:1,c=1;ce||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,o,s,c,i;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var f=new Error("Uncaught, unspecified \"error\" event. ("+t+")");throw f.context=t,f}if(r=this._events[e],d(r))return!1;if(a(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(n(r))for(s=Array.prototype.slice.call(arguments,1),i=r.slice(),o=i.length,c=0;co&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),o||(o=!0,t.apply(this,arguments))}if(!a(t))throw TypeError("listener must be a function");var o=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,o,d,s;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],d=r.length,o=-1,r===t||a(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(r)){for(s=d;0o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],183:[function(e,t){var r=e("safe-buffer").Buffer,a=e("md5.js");t.exports=function(e,t,o,n){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=o/8,d=r.alloc(i),s=r.alloc(n||0),c=r.alloc(0),f;0=this._blockSize;){for(var n=this._blockOffset;n=this._delta8){e=this.pending;var a=e.length%this._delta8;this.pending=e.slice(e.length-a,e.length),0===this.pending.length&&(this.pending=null),e=o.join32(e,0,e.length-a,this.endian);for(var r=0;r>>24,o[n++]=255&e>>>16,o[n++]=255&e>>>8,o[n++]=255&e}else for(o[n++]=255&e,o[n++]=255&e>>>8,o[n++]=255&e>>>16,o[n++]=255&e>>>24,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,i=8;ithis.blockSize&&(e=new this.Hash().update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=e?t^r^a:31>=e?t&r|~t&a:47>=e?(t|~r)^a:63>=e?t&a|r&~a:t^(r|~a)}function i(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function d(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var c=e("./utils"),f=e("./common"),p=c.rotl32,u=c.sum32,l=c.sum32_3,b=c.sum32_4,h=f.BlockHash;c.inherits(o,h),a.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(e,t){for(var a=this.h[0],o=this.h[1],c=this.h[2],f=this.h[3],h=this.h[4],y=a,_=o,v=c,S=f,k=h,I=0,x;80>I;I++)x=u(p(b(a,n(I,o,c,f),e[g[I]+t],i(I)),m[I]),h),a=h,h=f,f=p(c,10),c=o,o=x,x=u(p(b(y,n(79-I,_,v,S),e[r[I]+t],d(I)),s[I]),k),y=k,k=S,S=p(v,10),v=_,_=x;x=l(this.h[1],c,S),this.h[1]=l(this.h[2],f,k),this.h[2]=l(this.h[3],h,y),this.h[3]=l(this.h[4],a,_),this.h[4]=l(this.h[0],o,v),this.h[0]=x},o.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var g=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],r=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],s=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":186,"./utils":196}],189:[function(e,t,r){"use strict";r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":190,"./sha/224":191,"./sha/256":192,"./sha/384":193,"./sha/512":194}],190:[function(e,t){"use strict";function r(){return this instanceof r?void(i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)):new r}var a=e("../utils"),o=e("../common"),n=e("./common"),f=a.rotl32,p=a.sum32,u=a.sum32_5,l=n.ft_1,i=o.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];a.inherits(r,i),t.exports=r,r.blockSize=512,r.outSize=160,r.hmacStrength=80,r.padLength=64,r.prototype._update=function(r,o){for(var n=this.W,g=0;16>g;g++)n[g]=r[o+g];for(;gn;n++)o[n]=t[r+n];for(;ni&&(i+=4294967296),i}function o(e,t,a,o,n,i){var d=t&o^~t&i;return 0>d&&(d+=4294967296),d}function n(e,t,a,o,n){var i=e&a^e&n^a&n;return 0>i&&(i+=4294967296),i}function d(e,t,a,o,n,i){var d=t&o^t&i^o&i;return 0>d&&(d+=4294967296),d}function s(e,t){var a=y(e,t,28),o=y(t,e,2),n=y(t,e,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function c(e,t){var a=_(e,t,28),o=_(t,e,2),n=_(t,e,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function f(e,t){var a=y(e,t,14),o=y(e,t,18),n=y(t,e,9),i=a^o^n;return 0>i&&(i+=4294967296),i}function p(e,t){var a=_(e,t,14),o=_(e,t,18),n=_(t,e,9),i=a^o^n;return 0>i&&(i+=4294967296),i}function u(e,t){var a=y(e,t,1),o=y(e,t,8),n=v(e,t,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function l(e,t){var a=_(e,t,1),o=_(e,t,8),n=S(e,t,7),i=a^o^n;return 0>i&&(i+=4294967296),i}function b(e,t){var a=y(e,t,19),o=y(t,e,29),n=v(e,t,6),i=a^o^n;return 0>i&&(i+=4294967296),i}function h(e,t){var a=_(e,t,19),o=_(t,e,29),n=S(e,t,6),i=a^o^n;return 0>i&&(i+=4294967296),i}var i=e("../utils"),g=e("../common"),m=e("minimalistic-assert"),y=i.rotr64_hi,_=i.rotr64_lo,v=i.shr64_hi,S=i.shr64_lo,k=i.sum64,I=i.sum64_hi,x=i.sum64_lo,w=i.sum64_4_hi,A=i.sum64_4_lo,E=i.sum64_5_hi,P=i.sum64_5_lo,B=g.BlockHash,O=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];i.inherits(r,B),t.exports=r,r.blockSize=1024,r.outSize=512,r.hmacStrength=192,r.padLength=128,r.prototype._prepareBlock=function(e,t){for(var r=this.W,a=0;32>a;a++)r[a]=e[t+a];for(;a>>3},r.g1_256=function(e){return d(e,17)^d(e,19)^e>>>10}},{"../utils":196}],196:[function(e,t,r){"use strict";function a(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function n(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var d=e("minimalistic-assert"),i=e("inherits");r.inherits=i,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(!("string"==typeof e))for(a=0;a>8,i=255&o;n?r.push(n,i):r.push(i)}else if("hex"===t)for(e=e.replace(/[^a-z0-9]+/ig,""),0!=e.length%2&&(e="0"+e),a=0;a>>0}return n},r.split32=function(e,t){for(var r=Array(4*e.length),a=0,o=0,n;a>>24,r[o+1]=255&n>>>16,r[o+2]=255&n>>>8,r[o+3]=255&n):(r[o+3]=n>>>24,r[o+2]=255&n>>>16,r[o+1]=255&n>>>8,r[o]=255&n);return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,a){return e+t+r+a>>>0},r.sum32_5=function(t,r,a,o,n){return t+r+a+o+n>>>0},r.sum64=function(e,t,r,a){var o=e[t],n=e[t+1],i=a+n>>>0,d=(i>>0,e[t+1]=i},r.sum64_hi=function(e,t,r,a){var o=(t+a>>>0>>0},r.sum64_lo=function(e,t,r,a){return t+a>>>0},r.sum64_4_hi=function(e,t,r,a,o,n,i,d){var s=0,c=t;c=c+a>>>0,s+=c>>0,s+=c>>0,s+=c>>0},r.sum64_4_lo=function(e,t,r,a,o,n,i,d){return t+a+n+d>>>0},r.sum64_5_hi=function(e,t,r,a,o,n,i,d,s,c){var f=0,p=t;p=p+a>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0},r.sum64_5_lo=function(e,t,r,a,o,n,i,d,s,c){return t+a+n+d+c>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:197,"minimalistic-assert":209}],197:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],198:[function(e,t){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),a=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");n(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,a,i)}var a=e("hash.js"),o=e("minimalistic-crypto-utils"),n=e("minimalistic-assert");t.exports=r,r.prototype._init=function(e,t,r){var a=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},r.prototype.generate=function(e,t,r,a){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(a=r,r=t,t=null),r&&(r=o.toArray(r,a||"hex"),this._update(r));for(var n=[];n.length>1,l=-7,b=a?c-1:0,i=a?-1:1,d=t[r+b],s,e;for(b+=i,s=d&(1<<-l)-1,d>>=-l,l+=f;0>=-l,l+=n;0>1,_=23===u?5.960464477539063e-8-6.617444900424222e-24:0,v=p?0:l-1,i=p?1:-1,d=0>n||0===n&&0>1/n?1:0,S,k,m;for(n=s(n),isNaN(n)||n===Infinity?(k=isNaN(n)?1:0,S=g):(S=h(r(n)/t),1>n*(m=o(2,-S))&&(S--,m*=2),n+=1<=S+y?_/m:_*o(2,1-y),2<=n*m&&(S++,m/=2),S+y>=g?(k=0,S=g):1<=S+y?(k=(n*m-1)*o(2,u),S+=y):(k=n*o(2,y-1)*o(2,u),S=0));8<=u;a[f+v]=255&k,v+=i,k/=256,u-=8);for(S=S<"']/g,pt=RegExp(ct.source),ut=RegExp(ft.source),bt=/<%-([\s\S]+?)%>/g,ht=/<%([\s\S]+?)%>/g,mt=/<%=([\s\S]+?)%>/g,lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gt=/^\w*$/,yt=/^\./,_t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/[\\^$.*+?()[\]{}|]/g,St=RegExp(vt.source),kt=/^\s+|\s+$/g,It=/^\s+/,xt=/\s+$/,wt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,At=/\{\n\/\* \[wrapped with (.+)\] \*/,Et=/,? & /,Pt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Bt=/\\(\\)?/g,Ot=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rt=/\w*$/,jt=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Ct=/^0o[0-7]+$/i,zt=/^(?:0|[1-9]\d*)$/,Mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ut=/($^)/,Lt=/['\n\r\u2028\u2029\\]/g,Dt="\\ud800-\\udfff",qt="\\u2700-\\u27bf",Ht="a-z\\xdf-\\xf6\\xf8-\\xff",Ft="A-Z\\xc0-\\xd6\\xd8-\\xde",Kt="\\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",Vt="['\u2019]",Gt="["+Kt+"]",Wt="["+("\\u0300-\\u036f"+"\\ufe20-\\ufe2f"+"\\u20d0-\\u20ff")+"]",Yt="\\d+",Xt="["+Ht+"]",Zt="[^"+Dt+Kt+Yt+qt+Ht+Ft+"]",Jt="\\ud83c[\\udffb-\\udfff]",Qt="[^"+Dt+"]",$t="(?:\\ud83c[\\udde6-\\uddff]){2}",er="[\\ud800-\\udbff][\\udc00-\\udfff]",tr="["+Ft+"]",rr="(?:"+Xt+"|"+Zt+")",ar="(?:"+Vt+"(?:d|ll|m|re|s|t|ve))?",or="(?:"+Vt+"(?:D|LL|M|RE|S|T|VE))?",nr="(?:"+Wt+"|"+Jt+")"+"?",ir="["+"\\ufe0e\\ufe0f"+"]?",dr="(?:"+"\\u200d"+"(?:"+[Qt,$t,er].join("|")+")"+ir+nr+")*",sr=ir+nr+dr,cr="(?:"+["["+qt+"]",$t,er].join("|")+")"+sr,fr="(?:"+[Qt+Wt+"?",Wt,$t,er,"["+Dt+"]"].join("|")+")",pr=/['’]/g,ur=/[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]/g,lr=RegExp(Jt+"(?="+Jt+")|"+fr+sr,"g"),br=RegExp([tr+"?"+Xt+"+"+ar+"(?="+[Gt,tr,"$"].join("|")+")","(?:"+tr+"|"+Zt+")"+"+"+or+"(?="+[Gt,tr+rr,"$"].join("|")+")",tr+"?"+rr+"+"+ar,tr+"+"+or,"\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)",Yt,cr].join("|"),"g"),hr=/[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/,gr=/[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"],yr=-1,_r={};_r[Je]=_r[Qe]=_r[$e]=_r[et]=_r[tt]=_r[rt]=_r[at]=_r[ot]=_r[nt]=!0,_r[Te]=_r[Ne]=_r[Xe]=_r[Ce]=_r[Ze]=_r[ze]=_r[Me]=_r[Ue]=_r[De]=_r[qe]=_r[He]=_r[Ke]=_r[Ve]=_r[Ge]=_r[Ye]=!1;var vr={};vr[Te]=vr[Ne]=vr[Xe]=vr[Ze]=vr[Ce]=vr[ze]=vr[Je]=vr[Qe]=vr[$e]=vr[et]=vr[tt]=vr[De]=vr[qe]=vr[He]=vr[Ke]=vr[Ve]=vr[Ge]=vr[We]=vr[rt]=vr[at]=vr[ot]=vr[nt]=!0,vr[Me]=vr[Ue]=vr[Ye]=!1;var Sr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kr=parseFloat,Ir=parseInt,xr="object"==typeof e&&e&&e.Object===Object&&e,wr="object"==typeof self&&self&&self.Object===Object&&self,Ar=xr||wr||Function("return this")(),Er="object"==typeof r&&r&&!r.nodeType&&r,Pr=Er&&"object"==typeof t&&t&&!t.nodeType&&t,Br=Pr&&Pr.exports===Er,Or=Br&&xr.process,Rr=function(){try{return Or&&Or.binding&&Or.binding("util")}catch(t){}}(),jr=Rr&&Rr.isArrayBuffer,Tr=Rr&&Rr.isDate,Nr=Rr&&Rr.isMap,Cr=Rr&&Rr.isRegExp,zr=Rr&&Rr.isSet,Mr=Rr&&Rr.isTypedArray,Ur=j("length"),Lr=T({À:"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"}),Dr=T({"&":"&","<":"<",">":">",'"':""","'":"'"}),qr=T({"&":"&","<":"<",">":">",""":"\"","'":"'"}),Hr=function e(t){function r(e){if(Fn(e)&&!js(e)&&!(e instanceof x)){if(e instanceof _)return e;if(Ti.call(e,"__wrapped__"))return ln(e)}return new _(e)}function d(){}function _(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function x(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Re,this.__views__=[]}function T(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function $t(e,t,r,a,o,n){var i=t&ue,d=t&le,c;if(r&&(c=o?r(e,a,o,n):r(e)),void 0!==c)return c;if(!Hn(e))return e;var f=js(e);if(!f){var p=Hd(e),u=p==Ue||p==Le;if(Ns(e))return Ca(e,i);if(p!=He&&p!=Te&&(!u||o)){if(!vr[p])return o?e:{};c=Ho(e,p,$t,i)}else if(c=d||u?{}:qo(e),!i)return d?Za(e,Xt(c,e)):Xa(e,Yt(c,e))}else if(c=Do(e),!i)return Wa(e,c);n||(n=new Pt);var l=n.get(e);if(l)return l;n.set(e,c);var b=t&be?d?Bo:Po:d?oi:ai,h=f?void 0:b(e);return s(h||e,function(a,o){h&&(o=a,a=e[o]),Vt(c,o,$t(a,t,r,o,e,n))}),c}function er(e){var t=ai(e);return function(r){return tr(r,e,t)}}function tr(e,t,r){var a=r.length;if(null==e)return!a;for(e=xi(e);a--;){var o=r[a],n=t[o],i=e[o];if(void 0===i&&!(o in e)||!n(i))return!1}return!0}function rr(e,t,r){if("function"!=typeof e)throw new Ei(ce);return Vd(function(){e.apply(void 0,r)},t)}function ar(e,t,r,a){var o=-1,n=g,i=!0,d=e.length,s=[],c=t.length;if(!d)return s;r&&(t=y(t,L(r))),a?(n=m,i=!1):t.length>=se&&(n=q,i=!1,t=new ie(t));outer:for(;++or&&(r=-r>o?0:o+r),a=void 0===a||a>o?o:Zn(a),0>a&&(a+=o),a=r>a?0:Jn(a);rt}function xr(e,t){return null!=e&&Ti.call(e,t)}function wr(e,t){return null!=e&&t in xi(e)}function Er(e,t,r){return e>=cd(t,r)&&et?r:0,Vo(t,r)?e[t]:void 0}function aa(e,t,r){var a=-1;t=y(t.length?t:[ui],L(jo()));var o=Jr(e,function(e){var r=y(t,function(t){return t(e)});return{criteria:r,index:++a,value:e}});return C(o,function(e,t){return Ka(e,t,r)})}function oa(e,t){return na(e,t,function(t,r){return ri(e,r)})}function na(e,t,r){for(var a=-1,o=t.length,n={};++at||t>Be)return r;do t%2&&(r+=e),t=rd(t/2),t&&(e+=e);while(t);return r}function ua(e,t){return Gd(an(e,t,ui),e+"")}function la(e){return qt(di(e))}function ba(e,t){var r=di(e);return cn(r,Qt(t,0,r.length))}function ha(e,t,r,a){if(!Hn(e))return e;t=Ta(t,e);for(var o=-1,n=t.length,i=e;null!=i&&++ot&&(t=-t>o?0:o+t),r=r>o?o:r,0>r&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var n=_i(o);++a>>1){for(;a>>1,i=e[n];null!==i&&!Wn(i)&&(r?i<=t:i=se){var c=t?null:Ud(e);if(c)return $(c);i=!1,o=q,s=new ie}else s=t?[]:d;outer:for(;++aa)return a?xa(e[0]):[];for(var o=-1,n=_i(a);++o=a?e:ma(e,t,r)}function Ca(e,t){if(t)return e.slice();var r=e.length,a=Fi?Fi(r):new e.constructor(r);return e.copy(a),a}function za(e){var t=new e.constructor(e.byteLength);return new Hi(t).set(new Hi(e)),t}function Ma(e,t){var r=t?za(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Ua(e,t,r){var o=t?r(Z(e),ue):Z(e);return S(o,a,new e.constructor)}function La(e){var t=new e.constructor(e.source,Rt.exec(e));return t.lastIndex=e.lastIndex,t}function Da(e,t,r){var a=t?r($(e),ue):$(e);return S(a,o,new e.constructor)}function qa(e){return Pd?xi(Pd.call(e)):{}}function Ha(e,t){var r=t?za(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Fa(e,t){if(e!==t){var r=void 0!==e,a=null===e,o=e===e,n=Wn(e),i=void 0!==t,d=null===t,s=t===t,c=Wn(t);if(!d&&!c&&!n&&e>t||n&&i&&s&&!d&&!c||a&&i&&s||!r&&s||!o)return 1;if(!a&&!n&&!c&&e=d)return s;var c=r[a];return s*("desc"==c?-1:1)}return e.index-t.index}function Va(e,t,r,a){for(var o=-1,n=e.length,i=r.length,d=-1,s=t.length,c=sd(n-i,0),f=_i(s+c),p=!a;++do?void 0:n,o=1),t=xi(t);++ai&&d[0]!==c&&d[i-1]!==c?[]:Q(d,c);if(i-=f.length,ir)return r?pa(t,e):t;var a=pa(t,td(e/ae(t)));return W(t)?Na(oe(a),0,e).join(""):a.slice(0,e)}function bo(e,t,r,a){function o(){for(var t=-1,s=arguments.length,c=-1,f=a.length,p=_i(f+s),u=this&&this!==Ar&&this instanceof o?d:e;++cd))return!1;var c=n.get(e);if(c&&n.get(t))return c==t;var f=-1,p=!0,u=r&ge?new ie:void 0;for(n.set(e,t),n.set(t,e);++ft.length?e:br(e,ma(t,0,-1))}function nn(e,t){for(var r=e.length,a=cd(t.length,r),o=Wa(e),n;a--;)n=t[a],e[a]=Vo(n,r)?o[n]:void 0;return e}function dn(e,t,r){var a=t+"";return Gd(e,Fo(a,un(Uo(a),r)))}function sn(e){var t=0,r=0;return function(){var a=fd(),o=16-(a-r);if(r=a,!(0=800)return arguments[0];return e.apply(void 0,arguments)}}function cn(e,t){var r=-1,a=e.length;for(t=void 0===t?a:t;++ro&&(o=sd(a+o,0)),E(e,jo(t,3),o)}function hn(e,t,r){var a=null==e?0:e.length;if(!a)return-1;var o=a-1;return void 0!==r&&(o=Zn(r),o=0>r?sd(a+o,0):cd(o,a-1)),E(e,jo(t,3),o,!0)}function gn(e){var t=null==e?0:e.length;return t?sr(e,1):[]}function mn(e){return e&&e.length?e[0]:void 0}function yn(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}function _n(e,t){return e&&e.length&&t&&t.length?da(e,t):e}function vn(e){return null==e?e:ld.call(e)}function Sn(e){if(!(e&&e.length))return[];var t=0;return e=b(e,function(e){if(Mn(e))return t=sd(e.length,t),!0}),M(t,function(t){return y(e,j(t))})}function kn(e,t){if(!(e&&e.length))return[];var r=Sn(e);return null==t?r:y(r,function(e){return n(t,void 0,e)})}function In(e){var t=r(e);return t.__chain__=!0,t}function xn(e,t){return t(e)}function wn(e,t){var r=js(e)?s:Rd;return r(e,jo(t,3))}function An(e,t){var r=js(e)?c:jd;return r(e,jo(t,3))}function En(e,t){var r=js(e)?y:Jr;return r(e,jo(t,3))}function Pn(e,t,r){return t=r?void 0:t,t=e&&null==t?e.length:t,vo(e,xe,void 0,void 0,void 0,void 0,t)}function Bn(e,t){var r;if("function"!=typeof t)throw new Ei(ce);return e=Zn(e),function(){return 0<--e&&(r=t.apply(this,arguments)),1>=e&&(t=void 0),r}}function On(e,t,r){t=r?void 0:t;var a=vo(e,ve,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=On.placeholder,a}function Rn(e,t,r){t=r?void 0:t;var a=vo(e,Se,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=Rn.placeholder,a}function jn(e,t,r){function a(t){var r=b,a=h;return b=h=void 0,f=t,m=e.apply(a,r),m}function o(e){return f=e,y=Vd(d,t),p?a(e):m}function n(e){var r=e-_,a=e-f,o=t-r;return u?cd(o,g-a):o}function i(e){var r=e-_,a=e-f;return void 0==_||r>=t||0>r||u&&a>=g}function d(){var e=vs();return i(e)?s(e):void(y=Vd(d,n(e)))}function s(e){return(y=void 0,l&&b)?a(e):(b=h=void 0,m)}function c(){var e=vs(),r=i(e);if(b=arguments,h=this,_=e,r){if(void 0===y)return o(_);if(u)return y=Vd(d,t),a(_)}return void 0===y&&(y=Vd(d,t)),m}var f=0,p=!1,u=!1,l=!0,b,h,g,m,y,_;if("function"!=typeof e)throw new Ei(ce);return t=Qn(t)||0,Hn(r)&&(p=!!r.leading,u="maxWait"in r,g=u?sd(Qn(r.maxWait)||0,t):g,l="trailing"in r?!!r.trailing:l),c.cancel=function(){void 0!==y&&Md(y),f=0,b=_=h=y=void 0},c.flush=function(){return void 0===y?m:s(vs())},c}function Tn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ei(ce);var r=function(){var a=arguments,o=t?t.apply(this,a):a[0],n=r.cache;if(n.has(o))return n.get(o);var i=e.apply(this,a);return r.cache=n.set(o,i)||n,i};return r.cache=new(Tn.Cache||ne),r}function Nn(e){if("function"!=typeof e)throw new Ei(ce);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2]);}return!e.apply(this,t)}}function Cn(e,t){return e===t||e!==e&&t!==t}function zn(e){return null!=e&&qn(e.length)&&!Ln(e)}function Mn(e){return Fn(e)&&zn(e)}function Un(e){if(!Fn(e))return!1;var t=gr(e);return t==Me||t=="[object DOMException]"||"string"==typeof e.message&&"string"==typeof e.name&&!Vn(e)}function Ln(e){if(!Hn(e))return!1;var t=gr(e);return t==Ue||t==Le||t=="[object AsyncFunction]"||t=="[object Proxy]"}function Dn(e){return"number"==typeof e&&e==Zn(e)}function qn(e){return"number"==typeof e&&-1e?-1:1;return t*1.7976931348623157e308}return e===e?e:0}function Zn(e){var t=Xn(e),r=t%1;return t===t?r?t-r:t:0}function Jn(e){return e?Qt(Zn(e),0,Re):0}function Qn(e){if("number"==typeof e)return e;if(Wn(e))return Oe;if(Hn(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Hn(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(kt,"");var r=Tt.test(e);return r||Ct.test(e)?Ir(e.slice(2),r?2:8):jt.test(e)?Oe:+e}function $n(e){return Ya(e,oi(e))}function ei(e){return null==e?"":Ia(e)}function ti(e,t,r){var a=null==e?void 0:br(e,t);return void 0===a?r:a}function ri(e,t){return null!=e&&Lo(e,t,wr)}function ai(e){return zn(e)?Dt(e):Yr(e)}function oi(e){return zn(e)?Dt(e,!0):Xr(e)}function ni(e,t){if(null==e)return{};var r=y(Bo(e),function(e){return[e]});return t=jo(t),na(e,r,function(e,r){return t(e,r[0])})}function ii(e,t,r){t=Ta(t,e);var a=-1,o=t.length;for(o||(o=1,e=void 0);++ar)return!1;var a=t.length-1;return r==a?t.pop():Wi.call(t,r,1),--this.size,!0},te.prototype.get=function(e){var t=this.__data__,r=Gt(t,e);return 0>r?void 0:t[r][1]},te.prototype.has=function(e){return-1a?(++this.size,r.push([e,t])):r[a][1]=t,this},ne.prototype.clear=function(){this.size=0,this.__data__={hash:new T,map:new(hd||te),string:new T}},ne.prototype["delete"]=function(e){var t=To(this,e)["delete"](e);return this.size-=t?1:0,t},ne.prototype.get=function(e){return To(this,e).get(e)},ne.prototype.has=function(e){return To(this,e).has(e)},ne.prototype.set=function(e,t){var r=To(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this},ie.prototype.add=ie.prototype.push=function(e){return this.__data__.set(e,fe),this},ie.prototype.has=function(e){return this.__data__.has(e)},Pt.prototype.clear=function(){this.__data__=new te,this.size=0},Pt.prototype["delete"]=function(e){var t=this.__data__,r=t["delete"](e);return this.size=t.size,r},Pt.prototype.get=function(e){return this.__data__.get(e)},Pt.prototype.has=function(e){return this.__data__.has(e)},Pt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof te){var a=r.__data__;if(!hd||a.length=t}),Rs=Ur(function(){return arguments}())?Ur:function(e){return Fn(e)&&Ti.call(e,"callee")&&!Gi.call(e,"callee")},js=_i.isArray,Ts=jr?L(jr):function(e){return Fn(e)&&gr(e)==Xe},Ns=od||yi,Cs=Tr?L(Tr):function(e){return Fn(e)&&gr(e)==ze},zs=Nr?L(Nr):function(e){return Fn(e)&&Hd(e)==De},Ms=Cr?L(Cr):function(e){return Fn(e)&&gr(e)==Ke},Us=zr?L(zr):function(e){return Fn(e)&&Hd(e)==Ve},Ls=Mr?L(Mr):function(e){return Fn(e)&&qn(e.length)&&!!_r[gr(e)]},Ds=go(Zr),qs=go(function(e,t){return e<=t}),Hs=Qa(function(e,t){if(Jo(t)||zn(t))return void Ya(t,ai(t),e);for(var r in t)Ti.call(t,r)&&Vt(e,r,t[r])}),Fs=Qa(function(e,t){Ya(t,oi(t),e)}),Ks=Qa(function(e,t,r,a){Ya(t,oi(t),e,a)}),Vs=Qa(function(e,t,r,a){Ya(t,ai(t),e,a)}),Gs=Eo(Jt),Ws=ua(function(e){return e.push(void 0,So),n(Ks,void 0,e)}),Ys=ua(function(e){return e.push(void 0,ko),n($s,void 0,e)}),Xs=fo(function(e,t,r){e[t]=r},pi(ui)),Zs=fo(function(e,t,r){Ti.call(e,t)?e[t].push(r):e[t]=[r]},jo),Js=ua(Rr),Qs=Qa(function(e,t,r){ea(e,t,r)}),$s=Qa(function(e,t,r,a){ea(e,t,r,a)}),ec=Eo(function(e,t){var r={};if(null==e)return r;var a=!1;t=y(t,function(t){return t=Ta(t,e),a||(a=1--e)return t.apply(this,arguments)}},r.ary=Pn,r.assign=Hs,r.assignIn=Fs,r.assignInWith=Ks,r.assignWith=Vs,r.at=Gs,r.before=Bn,r.bind=Ss,r.bindAll=lc,r.bindKey=ks,r.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},r.chain=In,r.chunk=function(e,t,r){t=(r?Go(e,t,r):void 0===t)?1:sd(Zn(t),0);var a=null==e?0:e.length;if(!a||1>t)return[];for(var o=0,n=0,i=_i(td(a/t));ot?0:t,a)):[]},r.dropRight=function(e,t,r){var a=null==e?0:e.length;return a?(t=r||void 0===t?1:Zn(t),t=a-t,ma(e,0,0>t?0:t)):[]},r.dropRightWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!0,!0):[]},r.dropWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!0):[]},r.fill=function(e,t,r,a){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&Go(e,t,r)&&(r=0,a=o),ir(e,t,r,a)):[]},r.filter=function(e,t){var r=js(e)?b:dr;return r(e,jo(t,3))},r.flatMap=function(e,t){return sr(En(e,t),1)},r.flatMapDeep=function(e,t){return sr(En(e,t),Pe)},r.flatMapDepth=function(e,t,r){return r=void 0===r?1:Zn(r),sr(En(e,t),r)},r.flatten=gn,r.flattenDeep=function(e){var t=null==e?0:e.length;return t?sr(e,Pe):[]},r.flattenDepth=function(e,t){var r=null==e?0:e.length;return r?(t=void 0===t?1:Zn(t),sr(e,t)):[]},r.flip=function(e){return vo(e,Ae)},r.flow=bc,r.flowRight=hc,r.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,a={},o;++t>>0,!r)?[]:(e=ei(e),e&&("string"==typeof t||null!=t&&!Ms(t))&&(t=Ia(t),!t&&W(e))?Na(oe(e),0,r):e.split(t,r))},r.spread=function(e,t){if("function"!=typeof e)throw new Ei(ce);return t=null==t?0:sd(Zn(t),0),ua(function(r){var a=r[t],o=Na(r,0,t);return a&&v(o,a),n(e,this,o)})},r.tail=function(e){var t=null==e?0:e.length;return t?ma(e,1,t):[]},r.take=function(e,t,r){return e&&e.length?(t=r||void 0===t?1:Zn(t),ma(e,0,0>t?0:t)):[]},r.takeRight=function(e,t,r){var a=null==e?0:e.length;return a?(t=r||void 0===t?1:Zn(t),t=a-t,ma(e,0>t?0:t,a)):[]},r.takeRightWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3),!1,!0):[]},r.takeWhile=function(e,t){return e&&e.length?Ea(e,jo(t,3)):[]},r.tap=function(e,t){return t(e),e},r.throttle=function(e,t,r){var a=!0,o=!0;if("function"!=typeof e)throw new Ei(ce);return Hn(r)&&(a="leading"in r?!!r.leading:a,o="trailing"in r?!!r.trailing:o),jn(e,t,{leading:a,maxWait:t,trailing:o})},r.thru=xn,r.toArray=Yn,r.toPairs=rc,r.toPairsIn=ac,r.toPath=function(e){return js(e)?y(e,fn):Wn(e)?[e]:Wa(Wd(ei(e)))},r.toPlainObject=$n,r.transform=function(e,t,r){var a=js(e),o=a||Ns(e)||Ls(e);if(t=jo(t,4),null==r){var n=e&&e.constructor;r=o?a?new n:[]:Hn(e)?Ln(n)?Od(Ki(e)):{}:{}}return(o?s:cr)(e,function(e,a,o){return t(r,e,a,o)}),r},r.unary=function(e){return Pn(e,1)},r.union=rs,r.unionBy=as,r.unionWith=os,r.uniq=function(e){return e&&e.length?xa(e):[]},r.uniqBy=function(e,t){return e&&e.length?xa(e,jo(t,2)):[]},r.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?xa(e,void 0,t):[]},r.unset=function(e,t){return null==e||wa(e,t)},r.unzip=Sn,r.unzipWith=kn,r.update=function(e,t,r){return null==e?e:Aa(e,t,ja(r))},r.updateWith=function(e,t,r,a){return a="function"==typeof a?a:void 0,null==e?e:Aa(e,t,ja(r),a)},r.values=di,r.valuesIn=function(e){return null==e?[]:D(e,oi(e))},r.without=ns,r.words=fi,r.wrap=function(e,t){return As(ja(t),e)},r.xor=is,r.xorBy=ds,r.xorWith=ss,r.zip=cs,r.zipObject=function(e,t){return Oa(e||[],t||[],Vt)},r.zipObjectDeep=function(e,t){return Oa(e||[],t||[],ha)},r.zipWith=fs,r.entries=rc,r.entriesIn=ac,r.extend=Fs,r.extendWith=Ks,bi(r,r),r.add=Ic,r.attempt=uc,r.camelCase=oc,r.capitalize=si,r.ceil=xc,r.clamp=function(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=Qn(r),r=r===r?r:0),void 0!==t&&(t=Qn(t),t=t===t?t:0),Qt(Qn(e),t,r)},r.clone=function(e){return $t(e,be)},r.cloneDeep=function(e){return $t(e,ue|be)},r.cloneDeepWith=function(e,t){return t="function"==typeof t?t:void 0,$t(e,ue|be,t)},r.cloneWith=function(e,t){return t="function"==typeof t?t:void 0,$t(e,be,t)},r.conformsTo=function(e,t){return null==t||tr(e,t,ai(t))},r.deburr=ci,r.defaultTo=function(e,t){return null==e||e!==e?t:e},r.divide=wc,r.endsWith=function(e,t,r){e=ei(e),t=Ia(t);var a=e.length;r=void 0===r?a:Qt(Zn(r),0,a);var o=r;return r-=t.length,0<=r&&e.slice(r,o)==t},r.eq=Cn,r.escape=function(e){return e=ei(e),e&&ut.test(e)?e.replace(ft,Dr):e},r.escapeRegExp=function(e){return e=ei(e),e&&St.test(e)?e.replace(vt,"\\$&"):e},r.every=function(e,t,r){var a=js(e)?l:or;return r&&Go(e,t,r)&&(t=void 0),a(e,jo(t,3))},r.find=ls,r.findIndex=bn,r.findKey=function(e,t){return A(e,jo(t,3),cr)},r.findLast=bs,r.findLastIndex=hn,r.findLastKey=function(e,t){return A(e,jo(t,3),fr)},r.floor=Ac,r.forEach=wn,r.forEachRight=An,r.forIn=function(e,t){return null==e?e:Td(e,jo(t,3),oi)},r.forInRight=function(e,t){return null==e?e:Nd(e,jo(t,3),oi)},r.forOwn=function(e,t){return e&&cr(e,jo(t,3))},r.forOwnRight=function(e,t){return e&&fr(e,jo(t,3))},r.get=ti,r.gt=Bs,r.gte=Os,r.has=function(e,t){return null!=e&&Lo(e,t,xr)},r.hasIn=ri,r.head=mn,r.identity=ui,r.includes=function(e,t,r,a){e=zn(e)?e:di(e),r=r&&!a?Zn(r):0;var o=e.length;return 0>r&&(r=sd(o+r,0)),Gn(e)?r<=o&&-1o&&(o=sd(a+o,0)),P(e,t,o)},r.inRange=function(e,t,r){return t=Xn(t),void 0===r?(r=t,t=0):r=Xn(r),e=Qn(e),Er(e,t,r)},r.invoke=Js,r.isArguments=Rs,r.isArray=js,r.isArrayBuffer=Ts,r.isArrayLike=zn,r.isArrayLikeObject=Mn,r.isBoolean=function(e){return!0===e||!1===e||Fn(e)&&gr(e)==Ce},r.isBuffer=Ns,r.isDate=Cs,r.isElement=function(e){return Fn(e)&&1===e.nodeType&&!Vn(e)},r.isEmpty=function(e){if(null==e)return!0;if(zn(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Ns(e)||Ls(e)||Rs(e)))return!e.length;var t=Hd(e);if(t==De||t==Ve)return!e.size;if(Jo(e))return!Yr(e).length;for(var r in e)if(Ti.call(e,r))return!1;return!0},r.isEqual=function(e,t){return Fr(e,t)},r.isEqualWith=function(e,t,r){r="function"==typeof r?r:void 0;var a=r?r(e,t):void 0;return void 0===a?Fr(e,t,void 0,r):!!a},r.isError=Un,r.isFinite=function(e){return"number"==typeof e&&nd(e)},r.isFunction=Ln,r.isInteger=Dn,r.isLength=qn,r.isMap=zs,r.isMatch=function(e,t){return e===t||Vr(e,t,No(t))},r.isMatchWith=function(e,t,r){return r="function"==typeof r?r:void 0,Vr(e,t,No(t),r)},r.isNaN=function(e){return Kn(e)&&e!=+e},r.isNative=function(e){if(Fd(e))throw new Si("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Gr(e)},r.isNil=function(e){return null==e},r.isNull=function(e){return null===e},r.isNumber=Kn,r.isObject=Hn,r.isObjectLike=Fn,r.isPlainObject=Vn,r.isRegExp=Ms,r.isSafeInteger=function(e){return Dn(e)&&e>=-Be&&e<=Be},r.isSet=Us,r.isString=Gn,r.isSymbol=Wn,r.isTypedArray=Ls,r.isUndefined=function(e){return void 0===e},r.isWeakMap=function(e){return Fn(e)&&Hd(e)==Ye},r.isWeakSet=function(e){return Fn(e)&&gr(e)=="[object WeakSet]"},r.join=function(e,t){return null==e?"":id.call(e,t)},r.kebabCase=nc,r.last=yn,r.lastIndexOf=function(e,t,r){var a=null==e?0:e.length;if(!a)return-1;var o=a;return void 0!==r&&(o=Zn(r),o=0>o?sd(a+o,0):cd(o,a-1)),t===t?re(e,t,o):E(e,O,o,!0)},r.lowerCase=ic,r.lowerFirst=dc,r.lt=Ds,r.lte=qs,r.max=function(e){return e&&e.length?nr(e,ui,Sr):void 0},r.maxBy=function(e,t){return e&&e.length?nr(e,jo(t,2),Sr):void 0},r.mean=function(e){return R(e,ui)},r.meanBy=function(e,t){return R(e,jo(t,2))},r.min=function(e){return e&&e.length?nr(e,ui,Zr):void 0},r.minBy=function(e,t){return e&&e.length?nr(e,jo(t,2),Zr):void 0},r.stubArray=mi,r.stubFalse=yi,r.stubObject=function(){return{}},r.stubString=function(){return""},r.stubTrue=function(){return!0},r.multiply=Ec,r.nth=function(e,t){return e&&e.length?ra(e,Zn(t)):void 0},r.noConflict=function(){return Ar._===this&&(Ar._=Ui),this},r.noop=hi,r.now=vs,r.pad=function(e,t,r){e=ei(e),t=Zn(t);var a=t?ae(e):0;if(!t||a>=t)return e;var o=(t-a)/2;return lo(rd(o),r)+e+lo(td(o),r)},r.padEnd=function(e,t,r){e=ei(e),t=Zn(t);var a=t?ae(e):0;return t&&at){var a=e;e=t,t=a}if(r||e%1||t%1){var o=ud();return cd(e+o*(t-e+kr("1e-"+((o+"").length-1))),t)}return ca(e,t)},r.reduce=function(e,t,r){var a=js(e)?S:N,o=3>arguments.length;return a(e,jo(t,4),r,o,Rd)},r.reduceRight=function(e,t,r){var a=js(e)?k:N,o=3>arguments.length;return a(e,jo(t,4),r,o,jd)},r.repeat=function(e,t,r){return t=(r?Go(e,t,r):void 0===t)?1:Zn(t),pa(ei(e),t)},r.replace=function(){var e=arguments,t=ei(e[0]);return 3>e.length?t:t.replace(e[1],e[2])},r.result=ii,r.round=Pc,r.runInContext=e,r.sample=function(e){var t=js(e)?qt:la;return t(e)},r.size=function(e){if(null==e)return 0;if(zn(e))return Gn(e)?ae(e):e.length;var t=Hd(e);return t==De||t==Ve?e.size:Yr(e).length},r.snakeCase=sc,r.some=function(e,t,r){var a=js(e)?I:ya;return r&&Go(e,t,r)&&(t=void 0),a(e,jo(t,3))},r.sortedIndex=function(e,t){return _a(e,t)},r.sortedIndexBy=function(e,t,r){return va(e,t,jo(r,2))},r.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var a=_a(e,t);if(ae||e>Be)return[];var r=Re,a=cd(e,Re);t=jo(t),e-=Re;for(var o=M(a,t);++r=n)return e;var d=r-ae(a);if(1>d)return a;var s=i?Na(i,0,d).join(""):e.slice(0,d);if(void 0===o)return s+a;if(i&&(d+=s.length-d),Ms(o)){if(e.slice(d).search(o)){var c=s,f;for(o.global||(o=wi(o.source,ei(Rt.exec(o))+"g")),o.lastIndex=0;f=o.exec(c);)var p=f.index;s=s.slice(0,void 0===p?d:p)}}else if(e.indexOf(Ia(o),d)!=d){var u=s.lastIndexOf(o);-1a.__dir__?"Right":"")}),a},x.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),s(["filter","map","takeWhile"],function(e,t){var r=t+1;x.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:jo(e,3),type:r}),t.__filtered__=t.__filtered__||r==Ee||r==3,t}}),s(["head","last"],function(e,t){var r="take"+(t?"Right":"");x.prototype[e]=function(){return this[r](1).value()[0]}}),s(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");x.prototype[e]=function(){return this.__filtered__?new x(this):this[r](1)}}),x.prototype.compact=function(){return this.filter(ui)},x.prototype.find=function(e){return this.filter(e).head()},x.prototype.findLast=function(e){return this.reverse().find(e)},x.prototype.invokeMap=ua(function(e,t){return"function"==typeof e?new x(this):this.map(function(r){return Rr(r,e,t)})}),x.prototype.reject=function(e){return this.filter(Nn(jo(e)))},x.prototype.slice=function(e,t){e=Zn(e);var r=this;return r.__filtered__&&(0t)?new x(r):(0>e?r=r.takeRight(-e):e&&(r=r.drop(e)),void 0!==t&&(t=Zn(t),r=0>t?r.dropRight(-t):r.take(t-e)),r)},x.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},x.prototype.toArray=function(){return this.take(Re)},cr(x.prototype,function(e,t){var a=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),n=r[o?"take"+("last"==t?"Right":""):t],i=o||/^find/.test(t);n&&(r.prototype[t]=function(){var t=this.__wrapped__,d=o?[1]:arguments,s=t instanceof x,c=d[0],f=s||js(t),p=function(e){var t=n.apply(r,v([e],d));return o&&u?t[0]:t};f&&a&&"function"==typeof c&&1!=c.length&&(s=f=!1);var u=this.__chain__,l=!!this.__actions__.length,b=i&&!u,h=s&&!l;if(!i&&f){t=h?t:new x(this);var g=e.apply(t,d);return g.__actions__.push({func:xn,args:[p],thisArg:void 0}),new _(g,u)}return b&&h?e.apply(this,d):(g=this.thru(p),b?o?g.value()[0]:g.value():g)})}),s(["pop","push","shift","sort","splice","unshift"],function(e){var t=Pi[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);r.prototype[e]=function(){var e=arguments;if(o&&!this.__chain__){var r=this.value();return t.apply(js(r)?r:[],e)}return this[a](function(r){return t.apply(js(r)?r:[],e)})}}),cr(x.prototype,function(e,t){var a=r[t];if(a){var o=a.name+"",n=Sd[o]||(Sd[o]=[]);n.push({name:t,func:a})}}),Sd[co(void 0,ye).name]=[{name:"wrapper",func:void 0}],x.prototype.clone=function(){var e=new x(this.__wrapped__);return e.__actions__=Wa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Wa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Wa(this.__views__),e},x.prototype.reverse=function(){if(this.__filtered__){var e=new x(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},x.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=js(e),a=0>t,o=r?e.length:0,n=Mo(0,o,this.__views__),i=n.start,d=n.end,s=d-i,c=a?d:i-1,f=this.__iteratees__,p=f.length,u=0,l=cd(s,this.__takeCount__);if(!r||!a&&o==s&&l==s)return Pa(e,this.__actions__);var b=[];outer:for(;s--&&u=this.__values__.length,t=e?void 0:this.__values__[this.__index__++];return{done:e,value:t}},r.prototype.plant=function(e){for(var t=this,r,a;t instanceof d;){a=ln(t),a.__index__=0,a.__values__=void 0,r?o.__wrapped__=a:r=a;var o=a;t=t.__wrapped__}return o.__wrapped__=e,r},r.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof x){var t=e;return this.__actions__.length&&(t=new x(this)),t=t.reverse(),t.__actions__.push({func:xn,args:[vn],thisArg:void 0}),new _(t,this.__chain__)}return this.thru(vn)},r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=function(){return Pa(this.__wrapped__,this.__actions__)},r.prototype.first=r.prototype.head,Xi&&(r.prototype[Xi]=function(){return this}),r}();"function"==typeof d&&"object"==typeof d.amd&&d.amd?(Ar._=Hr,d(function(){return Hr})):Pr?((Pr.exports=Hr)._=Hr,Er._=Hr):Ar._=Hr}).call(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],205:[function(e,t){(function(r){"use strict";function a(){d.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function o(e,t){return e<>>32-t}function n(e,t,r,a,n,i,d){return 0|o(0|e+(t&r|~t&a)+n+i,d)+t}function s(e,t,r,a,n,i,c){return 0|o(0|e+(t&a|r&~a)+n+i,c)+t}function f(e,t,r,a,n,i,d){return 0|o(0|e+(t^r^a)+n+i,d)+t}function p(e,t,r,a,n,i,c){return 0|o(0|e+(r^(t|~a))+n+i,c)+t}var i=e("inherits"),d=e("hash-base"),c=Array(16);i(a,d),a.prototype._update=function(){for(var e=c,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,o=this._c,i=this._d;r=n(r,a,o,i,e[0],3614090360,7),i=n(i,r,a,o,e[1],3905402710,12),o=n(o,i,r,a,e[2],606105819,17),a=n(a,o,i,r,e[3],3250441966,22),r=n(r,a,o,i,e[4],4118548399,7),i=n(i,r,a,o,e[5],1200080426,12),o=n(o,i,r,a,e[6],2821735955,17),a=n(a,o,i,r,e[7],4249261313,22),r=n(r,a,o,i,e[8],1770035416,7),i=n(i,r,a,o,e[9],2336552879,12),o=n(o,i,r,a,e[10],4294925233,17),a=n(a,o,i,r,e[11],2304563134,22),r=n(r,a,o,i,e[12],1804603682,7),i=n(i,r,a,o,e[13],4254626195,12),o=n(o,i,r,a,e[14],2792965006,17),a=n(a,o,i,r,e[15],1236535329,22),r=s(r,a,o,i,e[1],4129170786,5),i=s(i,r,a,o,e[6],3225465664,9),o=s(o,i,r,a,e[11],643717713,14),a=s(a,o,i,r,e[0],3921069994,20),r=s(r,a,o,i,e[5],3593408605,5),i=s(i,r,a,o,e[10],38016083,9),o=s(o,i,r,a,e[15],3634488961,14),a=s(a,o,i,r,e[4],3889429448,20),r=s(r,a,o,i,e[9],568446438,5),i=s(i,r,a,o,e[14],3275163606,9),o=s(o,i,r,a,e[3],4107603335,14),a=s(a,o,i,r,e[8],1163531501,20),r=s(r,a,o,i,e[13],2850285829,5),i=s(i,r,a,o,e[2],4243563512,9),o=s(o,i,r,a,e[7],1735328473,14),a=s(a,o,i,r,e[12],2368359562,20),r=f(r,a,o,i,e[5],4294588738,4),i=f(i,r,a,o,e[8],2272392833,11),o=f(o,i,r,a,e[11],1839030562,16),a=f(a,o,i,r,e[14],4259657740,23),r=f(r,a,o,i,e[1],2763975236,4),i=f(i,r,a,o,e[4],1272893353,11),o=f(o,i,r,a,e[7],4139469664,16),a=f(a,o,i,r,e[10],3200236656,23),r=f(r,a,o,i,e[13],681279174,4),i=f(i,r,a,o,e[0],3936430074,11),o=f(o,i,r,a,e[3],3572445317,16),a=f(a,o,i,r,e[6],76029189,23),r=f(r,a,o,i,e[9],3654602809,4),i=f(i,r,a,o,e[12],3873151461,11),o=f(o,i,r,a,e[15],530742520,16),a=f(a,o,i,r,e[2],3299628645,23),r=p(r,a,o,i,e[0],4096336452,6),i=p(i,r,a,o,e[7],1126891415,10),o=p(o,i,r,a,e[14],2878612391,15),a=p(a,o,i,r,e[5],4237533241,21),r=p(r,a,o,i,e[12],1700485571,6),i=p(i,r,a,o,e[3],2399980690,10),o=p(o,i,r,a,e[10],4293915773,15),a=p(a,o,i,r,e[1],2240044497,21),r=p(r,a,o,i,e[8],1873313359,6),i=p(i,r,a,o,e[15],4264355552,10),o=p(o,i,r,a,e[6],2734768916,15),a=p(a,o,i,r,e[13],1309151649,21),r=p(r,a,o,i,e[4],4149444226,6),i=p(i,r,a,o,e[11],3174756917,10),o=p(o,i,r,a,e[2],718787259,15),a=p(a,o,i,r,e[9],3951481745,21),this._a=0|this._a+r,this._b=0|this._b+a,this._c=0|this._c+o,this._d=0|this._d+i},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},{inherits:201,"safe-buffer":251,stream:260}],207:[function(e,t){function r(e){this.rand=e||new a.Rand}var o=e("bn.js"),a=e("brorand");t.exports=r,r.create=function(e){return new r(e)},r.prototype._randbelow=function(e){var t=e.bitLength(),r=p(t/8);do var n=new o(this.rand.generate(r));while(0<=n.cmp(e));return n},r.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},r.prototype.test=function(e,t,r){var n=e.bitLength(),c=o.mont(e),p=new o(1).toRed(c);t||(t=f(1,0|n/48));for(var u=e.subn(1),l=0;!u.testn(l);l++);for(var s=e.shrn(l),d=u.toRed(c),b=!0;0>8,i=255&o;n?r.push(n,i):r.push(i)}return r},n.zero2=a,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],211:[function(e,t){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],212:[function(e,t,r){"use strict";var a=e("asn1.js");r.certificate=e("./certificate");var o=a.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=o;var n=a.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=n;var i=a.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(d),this.key("subjectPublicKey").bitstr())});r.PublicKey=i;var d=a.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),s=a.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(d),this.key("subjectPrivateKey").octstr())});r.PrivateKey=s;var c=a.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=c;var f=a.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=f,r.DSAparam=a.define("DSAparam",function(){this.int()});var p=a.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(u),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=p;var u=a.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=a.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":213,"asn1.js":57}],213:[function(e,t){"use strict";var r=e("asn1.js"),a=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),n=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),i=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())}),d=r.define("RelativeDistinguishedName",function(){this.setof(o)}),s=r.define("RDNSequence",function(){this.seqof(d)}),c=r.define("Name",function(){this.choice({rdnSequence:this.use(s)})}),f=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(a),this.key("notAfter").use(a))}),p=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),u=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(n),this.key("issuer").use(c),this.key("validity").use(f),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(i),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(p).optional())}),l=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(u),this.key("signatureAlgorithm").use(n),this.key("signatureValue").bitstr())});t.exports=l},{"asn1.js":57}],214:[function(e,t){(function(r){var a=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,n=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,i=e("evp_bytestokey"),d=e("browserify-aes");t.exports=function(e,t){var s=e.toString(),c=s.match(a),f;if(!c){var p=s.match(n);f=new r(p[2].replace(/\r?\n/g,""),"base64")}else{var u="aes"+c[1],l=new r(c[2],"hex"),b=new r(c[3].replace(/\r?\n/g,""),"base64"),h=i(t,l.slice(0,8),parseInt(c[1],10)).key,g=[],m=d.createDecipheriv(u,h,l);g.push(m.update(b)),g.push(m.final()),f=r.concat(g)}var y=s.match(o)[1];return{tag:y,data:f}}}).call(this,e("buffer").Buffer)},{"browserify-aes":80,buffer:126,evp_bytestokey:183}],215:[function(e,t){(function(r){function a(e){var t;"object"!=typeof e||r.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new r(e));var a=d(e,t),i=a.tag,s=a.data,c,f;switch(i){case"CERTIFICATE":f=n.certificate.decode(s,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=n.PublicKey.decode(s,"der")),c=f.algorithm.algorithm.join("."),c){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(f.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return f.subjectPrivateKey=f.subjectPublicKey,{type:"ec",data:f};case"1.2.840.10040.4.1":return f.algorithm.params.pub_key=n.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+c);}throw new Error("unknown key type "+i);case"ENCRYPTED PRIVATE KEY":s=n.EncryptedPrivateKey.decode(s,"der"),s=o(s,t);case"PRIVATE KEY":switch(f=n.PrivateKey.decode(s,"der"),c=f.algorithm.algorithm.join("."),c){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:n.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=n.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+c);}throw new Error("unknown key type "+i);case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(s,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(s,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(s,"der")};case"EC PRIVATE KEY":return s=n.ECPrivateKey.decode(s,"der"),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error("unknown key type "+i);}}function o(e,t){var a=e.algorithm.decrypt.kde.kdeparams.salt,o=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=i[e.algorithm.decrypt.cipher.algo.join(".")],d=e.algorithm.decrypt.cipher.iv,f=e.subjectPrivateKey,p=parseInt(n.split("-")[1],10)/8,u=c.pbkdf2Sync(t,a,o,p),l=s.createDecipheriv(n,u,d),b=[];return b.push(l.update(f)),b.push(l.final()),r.concat(b)}var n=e("./asn1"),i=e("./aesid.json"),d=e("./fixProc"),s=e("browserify-aes"),c=e("pbkdf2");t.exports=a,a.signature=n.signature}).call(this,e("buffer").Buffer)},{"./aesid.json":211,"./asn1":212,"./fixProc":214,"browserify-aes":80,buffer:126,pbkdf2:216}],216:[function(e,t,r){r.pbkdf2=e("./lib/async"),r.pbkdf2Sync=e("./lib/sync")},{"./lib/async":217,"./lib/sync":220}],217:[function(e,t){(function(r,a){function o(e){if(a.process&&!a.process.browser)return Promise.resolve(!1);if(!p||!p.importKey||!p.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];b=b||f.alloc(8);var t=n(b,b,10,128,e).then(function(){return!0}).catch(function(){return!1});return l[e]=t,t}function n(e,t,r,a,o){return p.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return p.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:o}},e,a<<3)}).then(function(e){return f.from(e)})}function i(e,t){e.then(function(e){r.nextTick(function(){t(null,e)})},function(a){r.nextTick(function(){t(a)})})}var d=e("./precondition"),s=e("./default-encoding"),c=e("./sync"),f=e("safe-buffer").Buffer,p=a.crypto&&a.crypto.subtle,u={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[],b;t.exports=function(e,t,p,l,b,h){if(f.isBuffer(e)||(e=f.from(e,s)),f.isBuffer(t)||(t=f.from(t,s)),d(p,l),"function"==typeof b&&(h=b,b=void 0),"function"!=typeof h)throw new Error("No callback provided to pbkdf2");b=b||"sha1";var g=u[b.toLowerCase()];return g&&"function"==typeof a.Promise?void i(o(g).then(function(r){return r?n(e,t,p,l,g):c(e,t,p,l,b)}),h):r.nextTick(function(){var r;try{r=c(e,t,p,l,b)}catch(t){return h(t)}h(null,r)})}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./default-encoding":218,"./precondition":219,"./sync":220,_process:222,"safe-buffer":251}],218:[function(e,t){(function(e){var r;if(e.browser)r="utf-8";else{var a=parseInt(e.version.split(".")[0].slice(1),10);r=6<=a?"utf-8":"binary"}t.exports=r}).call(this,e("_process"))},{_process:222}],219:[function(e,t){t.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(0>e)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(0>t||t>1073741823||t!==t)throw new TypeError("Bad key length")}},{}],220:[function(e,t){function r(e,t,r){var o=a(e),n="sha512"===e||"sha384"===e?128:64;t.length>n?t=o(t):t.length=t.length){n++;break}var i=t.slice(2,o-1),d=t.slice(o-1,o);if(("0002"!==a.toString("hex")&&!r||"0001"!==a.toString("hex")&&r)&&n++,8>i.length&&n++,n)throw new Error("decryption error");return t.slice(o)}function d(e,t){e=new r(e),t=new r(t);var a=0,o=e.length;e.length!==t.length&&(a++,o=u(e.length,t.length));for(var n=-1;++np||0<=new i(t).cmp(c.modulus))throw new Error("decryption error");var u=d?l(new i(t),c):f(t,c);var b=new r(p-u.length);if(b.fill(0),u=r.concat([b,u],p),4===s)return a(c,u);if(1===s)return o(c,u,d);if(3===s)return u;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":224,"./withPublic":228,"./xor":229,"bn.js":225,"browserify-rsa":98,buffer:126,"create-hash":151,"parse-asn1":215}],227:[function(e,t){(function(r){function a(e,t){var a=e.modulus.byteLength(),o=t.length,n=s("sha1").update(new r("")).digest(),i=n.length,u=2*i;if(o>a-u-2)throw new Error("message too long");var l=new r(a-o-u-2);l.fill(0);var b=a-i-1,h=d(i),g=f(r.concat([n,l,new r([1]),t],b),c(h,b)),m=f(h,c(g,i));return new p(r.concat([new r([0]),m,g],a))}function o(e,t,a){var o=t.length,i=e.modulus.byteLength();if(o>i-11)throw new Error("message too long");var d;return a?(d=new r(i-o-3),d.fill(255)):d=n(i-o-3),new p(r.concat([new r([0,a?1:2]),d,new r([0]),t],i))}function n(e){for(var t=new r(e),a=0,o=d(2*e),n=0,i;a=o&&r>>10),e=56320|1023&e),t+=C(e),t}).join("")}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:S}function u(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function l(e,t,r){var a=0;for(e=r?N(e/A):e>>1,e+=N(e/t);e>T*x>>1;a+=S)e=N(e/T);return N(a+(T+1)*e/(e+w))}function b(e){var r=[],a=e.length,o=0,i=P,n=E,d,c,u,b,h,g,m,y,_,t;for(c=e.lastIndexOf(B),0>c&&(c=0),u=0;u=a&&s("invalid-input"),y=p(e.charCodeAt(b++)),(y>=S||y>N((v-o)/g))&&s("overflow"),o+=y*g,_=m<=n?I:m>=n+x?x:m-n,y<_)break;t=S-_,g>N(v/t)&&s("overflow"),g*=t}d=r.length+1,n=l(o-h,d,0==h),N(o/d)>v-i&&s("overflow"),i+=N(o/d),o%=d,r.splice(o++,0,i)}return f(r)}function g(e){var r=[],a,o,n,i,d,f,p,b,h,g,t,m,y,_,k;for(e=c(e),m=e.length,a=P,o=0,d=E,f=0;ft&&r.push(C(t));for(n=i=r.length,i&&r.push(B);n=a&&tN((v-o)/y)&&s("overflow"),o+=(p-a)*y,a=p,f=0;fv&&s("overflow"),t==a){for(b=o,h=S;;h+=S){if(g=h<=d?I:h>=d+x?x:h-d,b= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=S-I,N=h,C=a,z,M;if(z={version:"1.4.1",ucs2:{decode:c,encode:f},decode:b,encode:g,toASCII:function(e){return i(e,function(e){return O.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return i(e,function(e){return k.test(e)?b(e.slice(4).toLowerCase()):e})}},"function"==typeof d&&"object"==typeof d.amd&&d.amd)d("punycode",function(){return z});else if(!(m&&y))o.punycode=z;else if(t.exports==m)y.exports=z;else for(M in z)z.hasOwnProperty(M)&&(m[M]=z[M])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],231:[function(e,t){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,n){t=t||"&",o=o||"=";var d={};if("string"!=typeof e||0===e.length)return d;var s=/\+/g;e=e.split(t);var c=1e3;n&&"number"==typeof n.maxKeys&&(c=n.maxKeys);var f=e.length;0c&&(f=c);for(var p=0;pl||0>e)throw new TypeError("offset must be a uint32");if(e>p||e>t)throw new RangeError("offset out of range")}function i(e,t,r){if("number"!=typeof e||e!==e)throw new TypeError("size must be a number");if(e>l||0>e)throw new TypeError("size must be a uint32");if(e+t>r||e>p)throw new RangeError("buffer too small")}function d(e,r,a,o){if(t.browser){var n=e.buffer,i=new Uint8Array(n,r,a);return u.getRandomValues(i),o?void t.nextTick(function(){o(null,e)}):e}if(o)return void c(a,function(t,a){return t?o(t):void(a.copy(e,r),o(null,e))});var d=c(a);return d.copy(e,r),e}var s=e("safe-buffer"),c=e("randombytes"),f=s.Buffer,p=s.kMaxLength,u=a.crypto||a.msCrypto,l=4294967295;u&&u.getRandomValues||!t.browser?(r.randomFill=function(e,t,r,o){if(!f.isBuffer(e)&&!(e instanceof a.Uint8Array))throw new TypeError("\"buf\" argument must be a Buffer or Uint8Array");if("function"==typeof t)o=t,t=0,r=e.length;else if("function"==typeof r)o=r,r=e.length-t;else if("function"!=typeof o)throw new TypeError("\"cb\" argument must be a function");return n(t,e.length),i(r,t,e.length),d(e,t,r,o)},r.randomFillSync=function(e,t,r){if("undefined"==typeof t&&(t=0),!f.isBuffer(e)&&!(e instanceof a.Uint8Array))throw new TypeError("\"buf\" argument must be a Buffer or Uint8Array");return n(t,e.length),void 0===r&&(r=e.length-t),i(r,t,e.length),d(e,t,r)}):(r.randomFill=o,r.randomFillSync=o)}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{_process:222,randombytes:234,"safe-buffer":251}],236:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":237}],237:[function(e,t){"use strict";function r(e){return this instanceof r?void(s.call(this,e),c.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",a)):new r(e)}function a(){this.allowHalfOpen||this._writableState.ended||n(o,this)}function o(e){e.end()}var n=e("process-nextick-args"),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=r;var d=e("core-util-is");d.inherits=e("inherits");var s=e("./_stream_readable"),c=e("./_stream_writable");d.inherits(r,s);for(var f=i(c.prototype),p=0,u;p=Y?e=Y:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function b(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=l(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function g(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(F("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?T(y,e):y(e))}function y(e){F("emit readable"),e.emit("readable"),w(e)}function _(e,t){t.readingMore||(t.readingMore=!0,T(v,e,t))}function v(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=E(e,t.buffer,t.decoder),r}function E(e,t,r){var a;return en.length?n.length:e;if(o+=i===n.length?n:n.slice(0,e),e-=i,0===e){i===n.length?(++a,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=n.slice(i));break}++a}return t.length-=a,o}function B(e,t){var r=L.allocUnsafe(e),a=t.head,o=1;for(a.data.copy(r),e-=a.data.length;a=a.next;){var n=a.data,i=e>n.length?n.length:e;if(n.copy(r,r.length-e,0,i),e-=i,0===e){i===n.length?(++o,t.head=a.next?a.next:t.tail=null):(t.head=a,a.data=n.slice(i));break}++o}return t.length-=o,r}function O(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return F("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):m(this),null;if(e=b(e,t),0===e&&t.ended)return 0===t.length&&O(this),null;var a=t.needReadable;F("need readable",a),(0===t.length||t.length-e>>0),r=this.head,n=0;r;)a(r.data,t,n),n+=r.data.length,r=r.next;return t},e}()},{"safe-buffer":251}],243:[function(e,t){"use strict";function r(e,t){e.emit("error",t)}var a=e("process-nextick-args");t.exports={destroy:function(e,t){var o=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?void(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&a(r,this,e)):void(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(a(r,o,e),o._writableState&&(o._writableState.errorEmitted=!0)):t&&t(e)}))},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":221}],244:[function(e,t){t.exports=e("events").EventEmitter},{events:182}],245:[function(e,t,r){arguments[4][197][0].apply(r,arguments)},{dup:197}],246:[function(e,t){t.exports=e("./readable").PassThrough},{"./readable":247}],247:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":237,"./lib/_stream_passthrough.js":238,"./lib/_stream_readable.js":239,"./lib/_stream_transform.js":240,"./lib/_stream_writable.js":241}],248:[function(e,t){t.exports=e("./readable").Transform},{"./readable":247}],249:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":241}],250:[function(e,t){(function(r){"use strict";function a(){p.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function o(e,t){return e<>>32-t}function n(t,r,a,n,i,e,d,c){return 0|o(0|t+(r^a^n)+e+d,c)+i}function d(t,r,a,n,i,e,d,c){return 0|o(0|t+(r&a|~r&n)+e+d,c)+i}function s(t,r,a,n,i,e,d,f){return 0|o(0|t+((r|~a)^n)+e+d,f)+i}function c(t,r,a,n,i,e,c,f){return 0|o(0|t+(r&n|a&~n)+e+c,f)+i}function f(t,r,a,n,i,e,c,f){return 0|o(0|t+(r^(a|~n))+e+c,f)+i}var i=e("inherits"),p=e("hash-base");i(a,p),a.prototype._update=function(){for(var e=Array(16),r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);var a=this._a,i=this._b,p=this._c,u=this._d,l=this._e;a=n(a,i,p,u,l,e[0],0,11),p=o(p,10),l=n(l,a,i,p,u,e[1],0,14),i=o(i,10),u=n(u,l,a,i,p,e[2],0,15),a=o(a,10),p=n(p,u,l,a,i,e[3],0,12),l=o(l,10),i=n(i,p,u,l,a,e[4],0,5),u=o(u,10),a=n(a,i,p,u,l,e[5],0,8),p=o(p,10),l=n(l,a,i,p,u,e[6],0,7),i=o(i,10),u=n(u,l,a,i,p,e[7],0,9),a=o(a,10),p=n(p,u,l,a,i,e[8],0,11),l=o(l,10),i=n(i,p,u,l,a,e[9],0,13),u=o(u,10),a=n(a,i,p,u,l,e[10],0,14),p=o(p,10),l=n(l,a,i,p,u,e[11],0,15),i=o(i,10),u=n(u,l,a,i,p,e[12],0,6),a=o(a,10),p=n(p,u,l,a,i,e[13],0,7),l=o(l,10),i=n(i,p,u,l,a,e[14],0,9),u=o(u,10),a=n(a,i,p,u,l,e[15],0,8),p=o(p,10),l=d(l,a,i,p,u,e[7],1518500249,7),i=o(i,10),u=d(u,l,a,i,p,e[4],1518500249,6),a=o(a,10),p=d(p,u,l,a,i,e[13],1518500249,8),l=o(l,10),i=d(i,p,u,l,a,e[1],1518500249,13),u=o(u,10),a=d(a,i,p,u,l,e[10],1518500249,11),p=o(p,10),l=d(l,a,i,p,u,e[6],1518500249,9),i=o(i,10),u=d(u,l,a,i,p,e[15],1518500249,7),a=o(a,10),p=d(p,u,l,a,i,e[3],1518500249,15),l=o(l,10),i=d(i,p,u,l,a,e[12],1518500249,7),u=o(u,10),a=d(a,i,p,u,l,e[0],1518500249,12),p=o(p,10),l=d(l,a,i,p,u,e[9],1518500249,15),i=o(i,10),u=d(u,l,a,i,p,e[5],1518500249,9),a=o(a,10),p=d(p,u,l,a,i,e[2],1518500249,11),l=o(l,10),i=d(i,p,u,l,a,e[14],1518500249,7),u=o(u,10),a=d(a,i,p,u,l,e[11],1518500249,13),p=o(p,10),l=d(l,a,i,p,u,e[8],1518500249,12),i=o(i,10),u=s(u,l,a,i,p,e[3],1859775393,11),a=o(a,10),p=s(p,u,l,a,i,e[10],1859775393,13),l=o(l,10),i=s(i,p,u,l,a,e[14],1859775393,6),u=o(u,10),a=s(a,i,p,u,l,e[4],1859775393,7),p=o(p,10),l=s(l,a,i,p,u,e[9],1859775393,14),i=o(i,10),u=s(u,l,a,i,p,e[15],1859775393,9),a=o(a,10),p=s(p,u,l,a,i,e[8],1859775393,13),l=o(l,10),i=s(i,p,u,l,a,e[1],1859775393,15),u=o(u,10),a=s(a,i,p,u,l,e[2],1859775393,14),p=o(p,10),l=s(l,a,i,p,u,e[7],1859775393,8),i=o(i,10),u=s(u,l,a,i,p,e[0],1859775393,13),a=o(a,10),p=s(p,u,l,a,i,e[6],1859775393,6),l=o(l,10),i=s(i,p,u,l,a,e[13],1859775393,5),u=o(u,10),a=s(a,i,p,u,l,e[11],1859775393,12),p=o(p,10),l=s(l,a,i,p,u,e[5],1859775393,7),i=o(i,10),u=s(u,l,a,i,p,e[12],1859775393,5),a=o(a,10),p=c(p,u,l,a,i,e[1],2400959708,11),l=o(l,10),i=c(i,p,u,l,a,e[9],2400959708,12),u=o(u,10),a=c(a,i,p,u,l,e[11],2400959708,14),p=o(p,10),l=c(l,a,i,p,u,e[10],2400959708,15),i=o(i,10),u=c(u,l,a,i,p,e[0],2400959708,14),a=o(a,10),p=c(p,u,l,a,i,e[8],2400959708,15),l=o(l,10),i=c(i,p,u,l,a,e[12],2400959708,9),u=o(u,10),a=c(a,i,p,u,l,e[4],2400959708,8),p=o(p,10),l=c(l,a,i,p,u,e[13],2400959708,9),i=o(i,10),u=c(u,l,a,i,p,e[3],2400959708,14),a=o(a,10),p=c(p,u,l,a,i,e[7],2400959708,5),l=o(l,10),i=c(i,p,u,l,a,e[15],2400959708,6),u=o(u,10),a=c(a,i,p,u,l,e[14],2400959708,8),p=o(p,10),l=c(l,a,i,p,u,e[5],2400959708,6),i=o(i,10),u=c(u,l,a,i,p,e[6],2400959708,5),a=o(a,10),p=c(p,u,l,a,i,e[2],2400959708,12),l=o(l,10),i=f(i,p,u,l,a,e[4],2840853838,9),u=o(u,10),a=f(a,i,p,u,l,e[0],2840853838,15),p=o(p,10),l=f(l,a,i,p,u,e[5],2840853838,5),i=o(i,10),u=f(u,l,a,i,p,e[9],2840853838,11),a=o(a,10),p=f(p,u,l,a,i,e[7],2840853838,6),l=o(l,10),i=f(i,p,u,l,a,e[12],2840853838,8),u=o(u,10),a=f(a,i,p,u,l,e[2],2840853838,13),p=o(p,10),l=f(l,a,i,p,u,e[10],2840853838,12),i=o(i,10),u=f(u,l,a,i,p,e[14],2840853838,5),a=o(a,10),p=f(p,u,l,a,i,e[1],2840853838,12),l=o(l,10),i=f(i,p,u,l,a,e[3],2840853838,13),u=o(u,10),a=f(a,i,p,u,l,e[8],2840853838,14),p=o(p,10),l=f(l,a,i,p,u,e[11],2840853838,11),i=o(i,10),u=f(u,l,a,i,p,e[6],2840853838,8),a=o(a,10),p=f(p,u,l,a,i,e[15],2840853838,5),l=o(l,10),i=f(i,p,u,l,a,e[13],2840853838,6),u=o(u,10);var b=this._a,h=this._b,g=this._c,m=this._d,y=this._e;b=f(b,h,g,m,y,e[5],1352829926,8),g=o(g,10),y=f(y,b,h,g,m,e[14],1352829926,9),h=o(h,10),m=f(m,y,b,h,g,e[7],1352829926,9),b=o(b,10),g=f(g,m,y,b,h,e[0],1352829926,11),y=o(y,10),h=f(h,g,m,y,b,e[9],1352829926,13),m=o(m,10),b=f(b,h,g,m,y,e[2],1352829926,15),g=o(g,10),y=f(y,b,h,g,m,e[11],1352829926,15),h=o(h,10),m=f(m,y,b,h,g,e[4],1352829926,5),b=o(b,10),g=f(g,m,y,b,h,e[13],1352829926,7),y=o(y,10),h=f(h,g,m,y,b,e[6],1352829926,7),m=o(m,10),b=f(b,h,g,m,y,e[15],1352829926,8),g=o(g,10),y=f(y,b,h,g,m,e[8],1352829926,11),h=o(h,10),m=f(m,y,b,h,g,e[1],1352829926,14),b=o(b,10),g=f(g,m,y,b,h,e[10],1352829926,14),y=o(y,10),h=f(h,g,m,y,b,e[3],1352829926,12),m=o(m,10),b=f(b,h,g,m,y,e[12],1352829926,6),g=o(g,10),y=c(y,b,h,g,m,e[6],1548603684,9),h=o(h,10),m=c(m,y,b,h,g,e[11],1548603684,13),b=o(b,10),g=c(g,m,y,b,h,e[3],1548603684,15),y=o(y,10),h=c(h,g,m,y,b,e[7],1548603684,7),m=o(m,10),b=c(b,h,g,m,y,e[0],1548603684,12),g=o(g,10),y=c(y,b,h,g,m,e[13],1548603684,8),h=o(h,10),m=c(m,y,b,h,g,e[5],1548603684,9),b=o(b,10),g=c(g,m,y,b,h,e[10],1548603684,11),y=o(y,10),h=c(h,g,m,y,b,e[14],1548603684,7),m=o(m,10),b=c(b,h,g,m,y,e[15],1548603684,7),g=o(g,10),y=c(y,b,h,g,m,e[8],1548603684,12),h=o(h,10),m=c(m,y,b,h,g,e[12],1548603684,7),b=o(b,10),g=c(g,m,y,b,h,e[4],1548603684,6),y=o(y,10),h=c(h,g,m,y,b,e[9],1548603684,15),m=o(m,10),b=c(b,h,g,m,y,e[1],1548603684,13),g=o(g,10),y=c(y,b,h,g,m,e[2],1548603684,11),h=o(h,10),m=s(m,y,b,h,g,e[15],1836072691,9),b=o(b,10),g=s(g,m,y,b,h,e[5],1836072691,7),y=o(y,10),h=s(h,g,m,y,b,e[1],1836072691,15),m=o(m,10),b=s(b,h,g,m,y,e[3],1836072691,11),g=o(g,10),y=s(y,b,h,g,m,e[7],1836072691,8),h=o(h,10),m=s(m,y,b,h,g,e[14],1836072691,6),b=o(b,10),g=s(g,m,y,b,h,e[6],1836072691,6),y=o(y,10),h=s(h,g,m,y,b,e[9],1836072691,14),m=o(m,10),b=s(b,h,g,m,y,e[11],1836072691,12),g=o(g,10),y=s(y,b,h,g,m,e[8],1836072691,13),h=o(h,10),m=s(m,y,b,h,g,e[12],1836072691,5),b=o(b,10),g=s(g,m,y,b,h,e[2],1836072691,14),y=o(y,10),h=s(h,g,m,y,b,e[10],1836072691,13),m=o(m,10),b=s(b,h,g,m,y,e[0],1836072691,13),g=o(g,10),y=s(y,b,h,g,m,e[4],1836072691,7),h=o(h,10),m=s(m,y,b,h,g,e[13],1836072691,5),b=o(b,10),g=d(g,m,y,b,h,e[8],2053994217,15),y=o(y,10),h=d(h,g,m,y,b,e[6],2053994217,5),m=o(m,10),b=d(b,h,g,m,y,e[4],2053994217,8),g=o(g,10),y=d(y,b,h,g,m,e[1],2053994217,11),h=o(h,10),m=d(m,y,b,h,g,e[3],2053994217,14),b=o(b,10),g=d(g,m,y,b,h,e[11],2053994217,14),y=o(y,10),h=d(h,g,m,y,b,e[15],2053994217,6),m=o(m,10),b=d(b,h,g,m,y,e[0],2053994217,14),g=o(g,10),y=d(y,b,h,g,m,e[5],2053994217,6),h=o(h,10),m=d(m,y,b,h,g,e[12],2053994217,9),b=o(b,10),g=d(g,m,y,b,h,e[2],2053994217,12),y=o(y,10),h=d(h,g,m,y,b,e[13],2053994217,9),m=o(m,10),b=d(b,h,g,m,y,e[9],2053994217,12),g=o(g,10),y=d(y,b,h,g,m,e[7],2053994217,5),h=o(h,10),m=d(m,y,b,h,g,e[10],2053994217,15),b=o(b,10),g=d(g,m,y,b,h,e[14],2053994217,8),y=o(y,10),h=n(h,g,m,y,b,e[12],0,8),m=o(m,10),b=n(b,h,g,m,y,e[15],0,5),g=o(g,10),y=n(y,b,h,g,m,e[10],0,12),h=o(h,10),m=n(m,y,b,h,g,e[4],0,9),b=o(b,10),g=n(g,m,y,b,h,e[1],0,12),y=o(y,10),h=n(h,g,m,y,b,e[5],0,5),m=o(m,10),b=n(b,h,g,m,y,e[8],0,14),g=o(g,10),y=n(y,b,h,g,m,e[7],0,6),h=o(h,10),m=n(m,y,b,h,g,e[6],0,8),b=o(b,10),g=n(g,m,y,b,h,e[2],0,13),y=o(y,10),h=n(h,g,m,y,b,e[13],0,6),m=o(m,10),b=n(b,h,g,m,y,e[14],0,5),g=o(g,10),y=n(y,b,h,g,m,e[0],0,15),h=o(h,10),m=n(m,y,b,h,g,e[3],0,13),b=o(b,10),g=n(g,m,y,b,h,e[9],0,11),y=o(y,10),h=n(h,g,m,y,b,e[11],0,11),m=o(m,10);var _=0|this._b+p+m;this._b=0|this._c+u+y,this._c=0|this._d+l+b,this._d=0|this._e+a+h,this._e=0|this._a+i+g,this._a=_},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(4294967295>=r)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=4294967295&r;this._block.writeUInt32BE((r-a)/4294967296,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":251}],253:[function(e,t,r){var r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};r.sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":254,"./sha1":255,"./sha224":256,"./sha256":257,"./sha384":258,"./sha512":259}],254:[function(e,t){function r(){this.init(),this._w=c,d.call(this,64,56)}function o(e){return e<<5|e>>>27}function n(e){return e<<30|e>>>2}function i(e,t,r,a){return 0===e?t&r|~t&a:2===e?t&r|t&a|r&a:t^r^a}var a=e("inherits"),d=e("./hash"),s=e("safe-buffer").Buffer,f=[1518500249,1859775393,-1894007588,-899497514],c=Array(80);a(r,d),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(r){for(var p=this._w,u=0|this._a,a=0|this._b,l=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)p[e]=r.readInt32BE(4*e);for(;80>e;++e)p[e]=p[e-3]^p[e-8]^p[e-14]^p[e-16];for(var b=0;80>b;++b){var h=~~(b/20),s=0|o(u)+i(h,a,l,c)+d+p[b]+f[h];d=c,c=l,l=n(a),a=u,u=s}this._a=0|u+this._a,this._b=0|a+this._b,this._c=0|l+this._c,this._d=0|c+this._d,this._e=0|d+this._e},r.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],255:[function(e,t){function r(){this.init(),this._w=p,s.call(this,64,56)}function a(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function n(e){return e<<30|e>>>2}function i(e,t,r,a){return 0===e?t&r|~t&a:2===e?t&r|t&a|r&a:t^r^a}var d=e("inherits"),s=e("./hash"),c=e("safe-buffer").Buffer,f=[1518500249,1859775393,-1894007588,-899497514],p=Array(80);d(r,s),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(r){for(var p=this._w,u=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)p[e]=r.readInt32BE(4*e);for(;80>e;++e)p[e]=a(p[e-3]^p[e-8]^p[e-14]^p[e-16]);for(var h=0;80>h;++h){var g=~~(h/20),s=0|o(u)+i(g,l,b,c)+d+p[h]+f[g];d=c,c=b,b=n(l),l=u,u=s}this._a=0|u+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|d+this._e},r.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],256:[function(e,t){function r(){this.init(),this._w=d,n.call(this,64,56)}var a=e("inherits"),o=e("./sha256"),n=e("./hash"),i=e("safe-buffer").Buffer,d=Array(64);a(r,o),r.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},r.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=r},{"./hash":252,"./sha256":257,inherits:201,"safe-buffer":251}],257:[function(e,t){function r(){this.init(),this._w=l,f.call(this,64,56)}function o(e,t,r){return r^e&(t^r)}function n(e,t,r){return e&t|r&(e|t)}function i(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function s(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function a(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=e("inherits"),f=e("./hash"),p=e("safe-buffer").Buffer,u=[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],l=Array(64);c(r,f),r.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},r.prototype._update=function(t){for(var r=this._w,p=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,m=0|this._e,e=0|this._f,f=0|this._g,g=0|this._h,h=0;16>h;++h)r[h]=t.readInt32BE(4*h);for(;64>h;++h)r[h]=0|d(r[h-2])+r[h-7]+a(r[h-15])+r[h-16];for(var y=0;64>y;++y){var _=0|g+s(m)+o(m,e,f)+u[y]+r[y],v=0|i(p)+n(p,l,b);g=f,f=e,e=m,m=0|c+_,c=b,b=l,l=p,p=0|_+v}this._a=0|p+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|m+this._e,this._f=0|e+this._f,this._g=0|f+this._g,this._h=0|g+this._h},r.prototype._hash=function(){var e=p.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],258:[function(e,t){function r(){this.init(),this._w=d,n.call(this,128,112)}var a=e("inherits"),o=e("./sha512"),n=e("./hash"),i=e("safe-buffer").Buffer,d=Array(160);a(r,o),r.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},r.prototype._hash=function(){function e(e,r,a){t.writeInt32BE(e,a),t.writeInt32BE(r,a+4)}var t=i.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=r},{"./hash":252,"./sha512":259,inherits:201,"safe-buffer":251}],259:[function(e,t){function r(){this.init(),this._w=g,l.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function o(e,t,r){return e&t|r&(e|t)}function n(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function i(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function s(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function c(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function p(e,t){return e>>>0>>0?1:0}var u=e("inherits"),l=e("./hash"),b=e("safe-buffer").Buffer,h=[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],g=Array(160);u(r,l),r.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},r.prototype._update=function(e){for(var t=this._w,r=0|this._ah,u=0|this._bh,l=0|this._ch,b=0|this._dh,g=0|this._eh,m=0|this._fh,y=0|this._gh,_=0|this._hh,v=0|this._al,S=0|this._bl,k=0|this._cl,I=0|this._dl,x=0|this._el,w=0|this._fl,A=0|this._gl,E=0|this._hl,P=0;32>P;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;160>P;P+=2){var B=t[P-30],O=t[P-30+1],R=d(B,O),T=s(O,B);B=t[P-4],O=t[P-4+1];var N=c(B,O),C=f(O,B),z=t[P-14],M=t[P-14+1],U=t[P-32],L=t[P-32+1],D=0|T+M,q=0|R+z+p(D,T);D=0|D+C,q=0|q+N+p(D,C),D=0|D+L,q=0|q+U+p(D,L),t[P]=q,t[P+1]=D}for(var H=0;160>H;H+=2){q=t[H],D=t[H+1];var j=o(r,u,l),F=o(v,S,k),K=n(r,v),V=n(v,r),G=i(g,x),W=i(x,g),Y=h[H],X=h[H+1],Z=a(g,m,y),J=a(x,w,A),Q=0|E+W,$=0|_+G+p(Q,E);Q=0|Q+J,$=0|$+Z+p(Q,J),Q=0|Q+X,$=0|$+Y+p(Q,X),Q=0|Q+D,$=0|$+q+p(Q,D);var ee=0|V+F,te=0|K+j+p(ee,V);_=y,E=A,y=m,A=w,m=g,w=x,x=0|I+Q,g=0|b+$+p(x,I),b=l,I=k,l=u,k=S,u=r,S=v,v=0|Q+ee,r=0|$+te+p(v,Q)}this._al=0|this._al+v,this._bl=0|this._bl+S,this._cl=0|this._cl+k,this._dl=0|this._dl+I,this._el=0|this._el+x,this._fl=0|this._fl+w,this._gl=0|this._gl+A,this._hl=0|this._hl+E,this._ah=0|this._ah+r+p(this._al,v),this._bh=0|this._bh+u+p(this._bl,S),this._ch=0|this._ch+l+p(this._cl,k),this._dh=0|this._dh+b+p(this._dl,I),this._eh=0|this._eh+g+p(this._el,x),this._fh=0|this._fh+m+p(this._fl,w),this._gh=0|this._gh+y+p(this._gl,A),this._hh=0|this._hh+_+p(this._hl,E)},r.prototype._hash=function(){function e(e,r,a){t.writeInt32BE(e,a),t.writeInt32BE(r,a+4)}var t=b.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=r},{"./hash":252,inherits:201,"safe-buffer":251}],260:[function(e,t){function r(){a.call(this)}t.exports=r;var a=e("events").EventEmitter,o=e("inherits");o(r,a),r.Readable=e("readable-stream/readable.js"),r.Writable=e("readable-stream/writable.js"),r.Duplex=e("readable-stream/duplex.js"),r.Transform=e("readable-stream/transform.js"),r.PassThrough=e("readable-stream/passthrough.js"),r.Stream=r,r.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function o(){c.readable&&c.resume&&c.resume()}function n(){f||(f=!0,e.end())}function i(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){if(s(),0===a.listenerCount(this,"error"))throw e}function s(){c.removeListener("data",r),e.removeListener("drain",o),c.removeListener("end",n),c.removeListener("close",i),c.removeListener("error",d),e.removeListener("error",d),c.removeListener("end",s),c.removeListener("close",s),e.removeListener("close",s)}var c=this;c.on("data",r),e.on("drain",o),e._isStdio||t&&!1===t.end||(c.on("end",n),c.on("close",i));var f=!1;return c.on("error",d),e.on("error",d),c.on("end",s),c.on("close",s),e.on("close",s),e.emit("pipe",c),e}},{events:182,inherits:201,"readable-stream/duplex.js":236,"readable-stream/passthrough.js":246,"readable-stream/readable.js":247,"readable-stream/transform.js":248,"readable-stream/writable.js":249}],261:[function(e,t,r){"use strict";function a(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function o(e){var t=a(e);if("string"!=typeof t&&(g.isEncoding===m||!m(e)))throw new Error("Unknown encoding: "+e);return t||e}function n(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=f,this.end=p,t=4;break;case"utf8":this.fillLast=c,t=4;break;case"base64":this.text=u,this.end=l,t=3;break;default:return this.write=b,void(this.end=h);}this.lastNeed=0,this.lastTotal=0,this.lastChar=g.allocUnsafe(t)}function d(e){if(127>=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:-1}function s(e,t,r){var a=t.length-1;if(a=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],a.slice(0,-1)}return a}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0==r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}var g=e("safe-buffer").Buffer,m=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1;}};r.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=S;++S)v[S]=0;y.fromCharCode=[function(e,t,r){return 60>t||13311t?new y(t,o):e(t,r)},function(e,t,r){var a=_[t];return a||(a=e(t,r),!!a.feature&&++v[255&t>>8]>n&&(_[t]=a)),a},function(e,t,r){return!r?new y(t,null):e(t,r)},function(e,t,r){var a;if(t=e},y.isLowSurrogate=function(e){return 56320<=e&&57343>=e},y.prototype.prepFeature=function(){this.feature||(this.feature=y.fromCharCode(this.codepoint,!0).feature)},y.prototype.toString=function(){if(65536>this.codepoint)return a(this.codepoint);var e=this.codepoint-65536;return a(h(e/1024)+55296,e%1024+56320)},y.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},y.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},y.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},y.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},y.prototype.getComposite=function(e){if(this.prepFeature(),!this.feature[2])return null;var t=this.feature[2][e.codepoint];return t?y.fromCharCode(t):null};var i=function(e){this.str=e,this.cursor=0};i.prototype.next=function(){if(!!this.str&&this.cursor","\"","`"," ","\r","\n","\t"]),p=["'"].concat(f),u=["%","/","?",";","#"].concat(p),l=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=e("querystring");a.prototype.parse=function(e,t,r){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),o=-1!==a&&a255?"":this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==S[0]&&(S="/"+S))}if(!g[w])for(var P=0,N=p.length,H;P_.length&&_.unshift(""),r.pathname=_.join("/")}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var v=r.pathname||"",p=r.search||"";r.path=v+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var s=r.pathname&&"/"===r.pathname.charAt(0),S=e.host||e.pathname&&"/"===e.pathname.charAt(0),k=S||s||r.host&&e.pathname,I=k,x=r.pathname&&r.pathname.split("/")||[],_=e.pathname&&e.pathname.split("/")||[],w=r.protocol&&!y[r.protocol];if(w&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===_[0]?_[0]=e.host:_.unshift(e.host)),e.host=null),k=k&&(""===_[0]||""===x[0])),S)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,x=_;else if(_.length)x||(x=[]),x.pop(),x=x.concat(_),r.search=e.search,r.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(w){r.hostname=r.host=x.shift();var A=r.host&&0a)return v(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var n;return n=S?p(e,t,a,g,h):h.map(function(r){return u(e,t,a,g,r,S)}),e.seen.pop(),l(n,_,w)}function c(e,t){if(_(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\"")+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,a,o){for(var n=[],d=0,i=t.length;de.seen.indexOf(c.value)?(d=g(r)?s(e,c.value,null):s(e,c.value,r-1),-1e?"0"+e.toString(10):e.toString(10)}function E(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),j[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;r.format=function(e){if(!y(e)){for(var t=[],r=0;r=n)return e;switch(e){case"%s":return a[r++]+"";case"%d":return+a[r++];case"%j":try{return JSON.stringify(a[r++])}catch(e){return"[Circular]"}default:return e;}}),d=a[r];r",main:"lib/bitcoincash.js",files:["lib/","dist/"],scripts:{build:"npm install && npx gulp build","build:node":"npm install && npx gulp build:node","build:browser":"npm install && npx gulp build:browser","build:test":"npm install && npx gulp build:test",test:"npm install && npx gulp test","test:all":"npm install && npx gulp test:all","test:node":"npm install && npx gulp test:node","test:browser":"npm install && npx gulp test:browser",lint:"npm install && npx gulp lint",coveralls:"npm install && npx gulp coveralls",preversion:"npm install && npm test",version:"npm install && npx gulp version",postversion:"npm install && npx gulp postversion",bump:"npm version patch -m 'Bump version to %s.'"},keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],repository:{type:"git",url:"https://github.com/bitcoincashjs/bitcoincashjs.git"},browser:{request:"browser-request"},dependencies:{"big-integer":"^1.6.26","bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",cashaddrjs:"^0.1.4",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"^4.17.4",unorm:"^1.4.1"},devDependencies:{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-minify":"^0.2.0","babel-preset-env":"^1.6.1",babelify:"^8.0.0",brfs:"^1.4.3",browserify:"^14.5.0",chai:"^1.10.0",coveralls:"^3.0.0",gulp:"^3.8.10","gulp-shell":"^0.6.5",jsdoc:"^3.5.5",jshint:"^2.9.5",karma:"^2.0.0","karma-chrome-launcher":"^2.2.0","karma-detect-browsers":"^2.2.6","karma-firefox-launcher":"^1.1.0","karma-mocha":"^1.3.0",mocha:"^4.1.0",mustache:"^2.3.0",nyc:"^11.4.1","run-sequence":"^2.2.0",sinon:"^1.13.0","uglify-js":"^3.3.4"},license:"MIT"}},{}]},{},[2])(2)}); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 45a537e..274d73b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -101,7 +101,7 @@ gulp.task( ['build'], shell.task([[ 'npx mustache package.json README.tpl.md > README.md', '&&', - 'git add -A lib dist README.md', + 'git add -A dist README.md', ].join(' ')]) ); diff --git a/package-lock.json b/package-lock.json index 214d8a1..b5cba2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bitcoincashjs", - "version": "0.1.7", + "version": "0.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a16f7c6..2dc502a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitcoincashjs", - "version": "0.1.7", + "version": "0.1.8", "description": "A simple, safe, and powerful JavaScript Bitcoin Cash library.", "author": "Emilio Almansi ", "main": "lib/bitcoincash.js",