function t(t,e,r,n){Object.defineProperty(t,e,{get:r,set:n,enumerable:!0,configurable:!0})}var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function r(t){return t&&t.__esModule?t.default:t}var n={},i={},s=e.parcelRequire7c15;null==s&&((s=function(t){if(t in n)return n[t].exports;if(t in i){var e=i[t];delete i[t];var r={id:t,exports:{}};return n[t]=r,e.call(r.exports,r,r.exports),r.exports}var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(t,e){i[t]=e},e.parcelRequire7c15=s),s.register("kVFKx",(function(e,r){t(e.exports,"Address",(()=>i)),t(e.exports,"Bip32",(()=>s)),t(e.exports,"Bip39",(()=>o)),t(e.exports,"Bn",(()=>a)),t(e.exports,"Br",(()=>u)),t(e.exports,"Bsm",(()=>f)),t(e.exports,"Bw",(()=>h)),t(e.exports,"Base58",(()=>c)),t(e.exports,"Base58Check",(()=>d)),t(e.exports,"Block",(()=>l)),t(e.exports,"BlockHeader",(()=>p)),t(e.exports,"Constants",(()=>b)),t(e.exports,"getConstants",(()=>m)),t(e.exports,"Ecdsa",(()=>g)),t(e.exports,"Hash",(()=>y)),t(e.exports,"Interp",(()=>v)),t(e.exports,"KeyPair",(()=>w)),t(e.exports,"OpCode",(()=>_)),t(e.exports,"Point",(()=>S)),t(e.exports,"PrivKey",(()=>O)),t(e.exports,"PubKey",(()=>E)),t(e.exports,"Random",(()=>I)),t(e.exports,"Script",(()=>P)),t(e.exports,"Sig",(()=>M)),t(e.exports,"SigOperations",(()=>A)),t(e.exports,"Struct",(()=>k)),t(e.exports,"Tx",(()=>x)),t(e.exports,"TxBuilder",(()=>R)),t(e.exports,"TxIn",(()=>T)),t(e.exports,"TxOut",(()=>B)),t(e.exports,"TxOutMap",(()=>N)),t(e.exports,"TxVerifier",(()=>C)),t(e.exports,"VarInt",(()=>L)),t(e.exports,"Workers",(()=>U)),t(e.exports,"WorkersResult",(()=>D)),t(e.exports,"cmp",(()=>H)),t(e.exports,"Ach",(()=>j)),t(e.exports,"Aes",(()=>F)),t(e.exports,"Aescbc",(()=>K)),t(e.exports,"Cbc",(()=>V)),t(e.exports,"Ecies",(()=>q)),t(e.exports,"deps",(()=>G));var n=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=87)}([function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n,i=r(4);!function(t){t[t.OP_FALSE=0]="OP_FALSE",t[t.OP_0=0]="OP_0",t[t.OP_PUSHDATA1=76]="OP_PUSHDATA1",t[t.OP_PUSHDATA2=77]="OP_PUSHDATA2",t[t.OP_PUSHDATA4=78]="OP_PUSHDATA4",t[t.OP_1NEGATE=79]="OP_1NEGATE",t[t.OP_RESERVED=80]="OP_RESERVED",t[t.OP_TRUE=81]="OP_TRUE",t[t.OP_1=81]="OP_1",t[t.OP_2=82]="OP_2",t[t.OP_3=83]="OP_3",t[t.OP_4=84]="OP_4",t[t.OP_5=85]="OP_5",t[t.OP_6=86]="OP_6",t[t.OP_7=87]="OP_7",t[t.OP_8=88]="OP_8",t[t.OP_9=89]="OP_9",t[t.OP_10=90]="OP_10",t[t.OP_11=91]="OP_11",t[t.OP_12=92]="OP_12",t[t.OP_13=93]="OP_13",t[t.OP_14=94]="OP_14",t[t.OP_15=95]="OP_15",t[t.OP_16=96]="OP_16",t[t.OP_NOP=97]="OP_NOP",t[t.OP_VER=98]="OP_VER",t[t.OP_IF=99]="OP_IF",t[t.OP_NOTIF=100]="OP_NOTIF",t[t.OP_VERIF=101]="OP_VERIF",t[t.OP_VERNOTIF=102]="OP_VERNOTIF",t[t.OP_ELSE=103]="OP_ELSE",t[t.OP_ENDIF=104]="OP_ENDIF",t[t.OP_VERIFY=105]="OP_VERIFY",t[t.OP_RETURN=106]="OP_RETURN",t[t.OP_TOALTSTACK=107]="OP_TOALTSTACK",t[t.OP_FROMALTSTACK=108]="OP_FROMALTSTACK",t[t.OP_2DROP=109]="OP_2DROP",t[t.OP_2DUP=110]="OP_2DUP",t[t.OP_3DUP=111]="OP_3DUP",t[t.OP_2OVER=112]="OP_2OVER",t[t.OP_2ROT=113]="OP_2ROT",t[t.OP_2SWAP=114]="OP_2SWAP",t[t.OP_IFDUP=115]="OP_IFDUP",t[t.OP_DEPTH=116]="OP_DEPTH",t[t.OP_DROP=117]="OP_DROP",t[t.OP_DUP=118]="OP_DUP",t[t.OP_NIP=119]="OP_NIP",t[t.OP_OVER=120]="OP_OVER",t[t.OP_PICK=121]="OP_PICK",t[t.OP_ROLL=122]="OP_ROLL",t[t.OP_ROT=123]="OP_ROT",t[t.OP_SWAP=124]="OP_SWAP",t[t.OP_TUCK=125]="OP_TUCK",t[t.OP_CAT=126]="OP_CAT",t[t.OP_SUBSTR=127]="OP_SUBSTR",t[t.OP_SPLIT=127]="OP_SPLIT",t[t.OP_LEFT=128]="OP_LEFT",t[t.OP_NUM2BIN=128]="OP_NUM2BIN",t[t.OP_RIGHT=129]="OP_RIGHT",t[t.OP_BIN2NUM=129]="OP_BIN2NUM",t[t.OP_SIZE=130]="OP_SIZE",t[t.OP_INVERT=131]="OP_INVERT",t[t.OP_AND=132]="OP_AND",t[t.OP_OR=133]="OP_OR",t[t.OP_XOR=134]="OP_XOR",t[t.OP_EQUAL=135]="OP_EQUAL",t[t.OP_EQUALVERIFY=136]="OP_EQUALVERIFY",t[t.OP_RESERVED1=137]="OP_RESERVED1",t[t.OP_RESERVED2=138]="OP_RESERVED2",t[t.OP_1ADD=139]="OP_1ADD",t[t.OP_1SUB=140]="OP_1SUB",t[t.OP_2MUL=141]="OP_2MUL",t[t.OP_2DIV=142]="OP_2DIV",t[t.OP_NEGATE=143]="OP_NEGATE",t[t.OP_ABS=144]="OP_ABS",t[t.OP_NOT=145]="OP_NOT",t[t.OP_0NOTEQUAL=146]="OP_0NOTEQUAL",t[t.OP_ADD=147]="OP_ADD",t[t.OP_SUB=148]="OP_SUB",t[t.OP_MUL=149]="OP_MUL",t[t.OP_DIV=150]="OP_DIV",t[t.OP_MOD=151]="OP_MOD",t[t.OP_LSHIFT=152]="OP_LSHIFT",t[t.OP_RSHIFT=153]="OP_RSHIFT",t[t.OP_BOOLAND=154]="OP_BOOLAND",t[t.OP_BOOLOR=155]="OP_BOOLOR",t[t.OP_NUMEQUAL=156]="OP_NUMEQUAL",t[t.OP_NUMEQUALVERIFY=157]="OP_NUMEQUALVERIFY",t[t.OP_NUMNOTEQUAL=158]="OP_NUMNOTEQUAL",t[t.OP_LESSTHAN=159]="OP_LESSTHAN",t[t.OP_GREATERTHAN=160]="OP_GREATERTHAN",t[t.OP_LESSTHANOREQUAL=161]="OP_LESSTHANOREQUAL",t[t.OP_GREATERTHANOREQUAL=162]="OP_GREATERTHANOREQUAL",t[t.OP_MIN=163]="OP_MIN",t[t.OP_MAX=164]="OP_MAX",t[t.OP_WITHIN=165]="OP_WITHIN",t[t.OP_RIPEMD160=166]="OP_RIPEMD160",t[t.OP_SHA1=167]="OP_SHA1",t[t.OP_SHA256=168]="OP_SHA256",t[t.OP_HASH160=169]="OP_HASH160",t[t.OP_HASH256=170]="OP_HASH256",t[t.OP_CODESEPARATOR=171]="OP_CODESEPARATOR",t[t.OP_CHECKSIG=172]="OP_CHECKSIG",t[t.OP_CHECKSIGVERIFY=173]="OP_CHECKSIGVERIFY",t[t.OP_CHECKMULTISIG=174]="OP_CHECKMULTISIG",t[t.OP_CHECKMULTISIGVERIFY=175]="OP_CHECKMULTISIGVERIFY",t[t.OP_NOP1=176]="OP_NOP1",t[t.OP_NOP2=177]="OP_NOP2",t[t.OP_CHECKLOCKTIMEVERIFY=177]="OP_CHECKLOCKTIMEVERIFY",t[t.OP_NOP3=178]="OP_NOP3",t[t.OP_CHECKSEQUENCEVERIFY=178]="OP_CHECKSEQUENCEVERIFY",t[t.OP_NOP4=179]="OP_NOP4",t[t.OP_NOP5=180]="OP_NOP5",t[t.OP_NOP6=181]="OP_NOP6",t[t.OP_NOP7=182]="OP_NOP7",t[t.OP_NOP8=183]="OP_NOP8",t[t.OP_NOP9=184]="OP_NOP9",t[t.OP_NOP10=185]="OP_NOP10",t[t.OP_SMALLDATA=249]="OP_SMALLDATA",t[t.OP_SMALLINTEGER=250]="OP_SMALLINTEGER",t[t.OP_PUBKEYS=251]="OP_PUBKEYS",t[t.OP_PUBKEYHASH=253]="OP_PUBKEYHASH",t[t.OP_PUBKEY=254]="OP_PUBKEY",t[t.OP_INVALIDOPCODE=255]="OP_INVALIDOPCODE"}(n||(n={}));class s extends i.a{constructor(t){super({num:t})}fromNumber(t){return this.num=t,this}static fromNumber(t){return(new this).fromNumber(t)}toNumber(){return this.num}fromString(t){const e=n[t];if(void 0===e)throw new Error("Invalid opCodeStr");return this.num=e,this}toString(){const t=s.str[this.num];if(void 0===t){if(this.num>0&&this.nume.size)r=r.slice(i-r.length,r.length);else if(i>24,o=8388607&e;if(n=t.alloc(4),n.writeInt32BE(o),s<=3)n=n.slice(1,s+1);else{const e=t.alloc(s-3);e.fill(0),n=t.concat([n,e])}return this.fromBuffer(n),8388608&e&&i(0).sub(this).copy(this),this},i.prototype.toBits=function(){let e;e=this.lt(0)?this.neg().toBuffer():this.toBuffer();let r,n=e.length;if(n>3)r=t.concat([t.from([0]),e.slice(0,3)]).readUInt32BE(0);else if(n<=3){const i=t.alloc(3-n+1);i.fill(0),r=t.concat([i,e.slice(0,n)]).readUInt32BE(0)}8388608&r&&(r>>=8,n++),this.lt(0)&&(r|=8388608);const i=n<<24|r;return e=t.alloc(4),e.writeInt32BE(i,0),e.readUInt32BE(0)},i.prototype.fromScriptNumBuffer=function(t,e,r){if(void 0===r&&(r=4),t.length>r)throw new Error("script number overflow");if(e&&t.length>0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return this.fromSm(t,{endian:"little"})},i.prototype.toScriptNumBuffer=function(){return this.toSm({endian:"little"})},i.prototype.neg=function(){const t=n.prototype.neg.call(this),e=Object.create(i.prototype);return t.copy(e),e},i.prototype.add=function(t){const e=n.prototype.add.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.sub=function(t){const e=n.prototype.sub.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.mul=function(t){const e=n.prototype.mul.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.mod=function(t){const e=n.prototype.mod.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.umod=function(t){const e=n.prototype.umod.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.invm=function(t){const e=n.prototype.invm.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.div=function(t){const e=n.prototype.div.call(this,t);return t=Object.create(i.prototype),e.copy(t),t},i.prototype.ushln=function(t){const e=n.prototype.ushln.call(this,t),r=Object.create(i.prototype);return e.copy(r),r},i.prototype.ushrn=function(t){const e=n.prototype.ushrn.call(this,t),r=Object.create(i.prototype);return e.copy(r),r},i.prototype.cmp=function(t){return n.prototype.cmp.call(this,t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.prototype.neq=function(t){return 0!==this.cmp(t)},i.prototype.gt=function(t){return this.cmp(t)>0},i.prototype.geq=function(t){return this.cmp(t)>=0},i.prototype.lt=function(t){return this.cmp(t)<0},i.prototype.leq=function(t){return this.cmp(t)<=0},o("add"),o("sub"),o("mul"),o("mod"),o("invm"),o("div"),o("cmp"),o("gt"),o("geq"),o("lt"),o("leq");const a=i}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var n=r(45);let i;class s{constructor(t=[],e=0,r=[],n=new Map){this.nativeWorkers=t,this.lastid=e,this.incompconsteRes=r,this.promisemap=n}asyncObjectMethod(t,e,r,i=this.lastid+1){if(!r)throw new Error("must specify args");const s=t[e](...r);return(new n.a).fromResult(s,i)}static async asyncObjectMethod(t,e,r,n){return i||(i=new s),i.asyncObjectMethod(t,e,r,n)}asyncClassMethod(t,e,r,i=this.lastid+1){if(!r)throw new Error("must specify args");const s=t[e](...r);return(new n.a).fromResult(s,i)}static async asyncClassMethod(t,e,r,n){return i||(i=new s),i.asyncClassMethod(t,e,r,n)}static endGlobalWorkers(){i&&!t.browser&&(i=void 0)}}}).call(this,r(26))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var n=r(32),i=r(2);class s{static sha1(e){if(!t.isBuffer(e))throw new Error("sha1 hash must be of a buffer");const r=Object(n.sha1)().update(e).digest();return t.from(r)}static async asyncSha1(t){const e=[t];return(await i.a.asyncClassMethod(s,"sha1",e)).resbuf}static sha256(e){if(!t.isBuffer(e))throw new Error("sha256 hash must be of a buffer");const r=Object(n.sha256)().update(e).digest();return t.from(r)}static async asyncSha256(t){const e=[t];return(await i.a.asyncClassMethod(s,"sha256",e)).resbuf}static sha256Sha256(t){try{return s.sha256(s.sha256(t))}catch(t){throw new Error("sha256Sha256 hash must be of a buffer: "+t)}}static async asyncSha256Sha256(t){const e=[t];return(await i.a.asyncClassMethod(s,"sha256Sha256",e)).resbuf}static ripemd160(e){if(!t.isBuffer(e))throw new Error("ripemd160 hash must be of a buffer");const r=Object(n.ripemd160)().update(e).digest();return t.from(r)}static async asyncRipemd160(t){const e=[t];return(await i.a.asyncClassMethod(s,"ripemd160",e)).resbuf}static sha256Ripemd160(t){try{return s.ripemd160(s.sha256(t))}catch(t){throw new Error("sha256Ripemd160 hash must be of a buffer: "+t)}}static async asyncSha256Ripemd160(t){const e=[t];return(await i.a.asyncClassMethod(s,"sha256Ripemd160",e)).resbuf}static sha512(e){if(!t.isBuffer(e))throw new Error("sha512 hash must be of a buffer");const r=Object(n.sha512)().update(e).digest();return t.from(r)}static async asyncSha512(t){const e=[t];return(await i.a.asyncClassMethod(s,"sha512",e)).resbuf}static hmac(e,r,n){if("sha1"!==e&&"sha256"!==e&&"sha512"!==e)throw new Error("invalid choice of hash function");const i=s[e];if(!t.isBuffer(r)||!t.isBuffer(n))throw new Error("data and key must be buffers");const o=s.blockSize[e]/8;if(n.length>o&&(n=i(n)),n.lengtht.toBuffer()))}toFastBuffer(){return 0===Object.keys(this).length?t.alloc(0):this.toBuffer()}fromHex(e,...r){if(!n(e))throw new Error("invalid hex string");const i=t.from(e,"hex");return this.fromBuffer(i,...r)}static fromHex(t,...e){return(new this).fromHex(t,...e)}asyncFromHex(e,...r){if(!n(e))throw new Error("invalid hex string");const i=t.from(e,"hex");return this.asyncFromBuffer(i,...r)}static asyncFromHex(t,...e){return(new this).asyncFromHex(t,...e)}fromFastHex(e,...r){if(!n(e))throw new Error("invalid hex string");const i=t.from(e,"hex");return this.fromFastBuffer(i,...r)}static fromFastHex(t,...e){return(new this).fromFastHex(t,...e)}toHex(){return this.toBuffer().toString("hex")}asyncToHex(){return this.asyncToBuffer().then((t=>t.toString("hex")))}toFastHex(){return this.toFastBuffer().toString("hex")}fromString(t,...e){if("string"!=typeof t)throw new Error("str must be a string");return this.fromHex(t,...e)}static fromString(t,...e){return(new this).fromString(t,...e)}asyncFromString(t,...e){if("string"!=typeof t)throw new Error("str must be a string");return this.asyncFromHex(t,...e)}static asyncFromString(t,...e){return(new this).asyncFromString(t,...e)}toString(){return this.toHex()}asyncToString(){return this.asyncToHex()}fromJSON(t){throw new Error("not implemented")}static fromJSON(t){return(new this).fromJSON(t)}asyncFromJSON(t,...e){throw new Error("not implemented")}static asyncFromJSON(t,...e){return(new this).asyncFromJSON(t,...e)}toJSON(){const e={};for(const r in this)if(Array.isArray(this[r])){const t=[];for(const e in this[r])"function"==typeof this[r][e].toJSON?t.push(this[r][e].toJSON()):t.push(JSON.stringify(this[r][e]));e[r]=t}else if(null===this[r])e[r]=this[r];else if("object"==typeof this[r]&&"function"==typeof this[r].toJSON)e[r]=this[r].toJSON();else if("boolean"==typeof this[r]||"number"==typeof this[r]||"string"==typeof this[r])e[r]=this[r];else if(t.isBuffer(this[r]))e[r]=this[r].toString("hex");else if(this[r]instanceof Map)e[r]=JSON.stringify(this[r]);else if("object"==typeof this[r])throw new Error("not implemented");return e}asyncToJSON(){throw new Error("not implemented")}clone(){return this.cloneByJSON()}cloneByBuffer(){return(new this.constructor).fromBuffer(this.toBuffer())}cloneByFastBuffer(){return(new this.constructor).fromFastBuffer(this.toFastBuffer())}cloneByHex(){return(new this.constructor).fromHex(this.toHex())}cloneByString(){return(new this.constructor).fromString(this.toString())}cloneByJSON(){return(new this.constructor).fromJSON(this.toJSON())}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var n=r(1),i=r(4);class s extends i.a{constructor(t,e,r,n,i){super({r:t,s:e,nHashType:r,recovery:n,compressed:i})}fromBuffer(t){try{return this.fromDer(t,!0)}catch(t){}try{return this.fromCompact(t)}catch(t){}return this.fromTxFormat(t)}toBuffer(){return void 0!==this.nHashType?this.toTxFormat():void 0!==this.recovery?this.toCompact():this.toDer()}fromCompact(t){let e=!0,r=t.slice(0,1)[0]-27-4;if(r<0&&(e=!1,r+=4),0!==r&&1!==r&&2!==r&&3!==r)throw new Error("i must be 0, 1, 2, or 3");this.compressed=e,this.recovery=r;const n=t.slice(1);return this.fromRS(n),this}static fromCompact(t){return(new this).fromCompact(t)}fromRS(t){const e=t.slice(0,32),r=t.slice(32,64);if(32!==e.length)throw new Error("r must be 32 bytes");if(32!==r.length||t.length>64)throw new Error("s must be 32 bytes");return this.r=(new n.a).fromBuffer(e),this.s=(new n.a).fromBuffer(r),this}static fromRS(t){return(new this).fromRS(t)}fromDer(t,e){const r=s.parseDer(t,e);return this.r=r.r,this.s=r.s,this}static fromDer(t,e){return(new this).fromDer(t,e)}fromTxFormat(t){if(0===t.length)return this.r=new n.a(1),this.s=new n.a(1),this.nHashType=1,this;const e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1);return this.fromDer(r,!1),this.nHashType=e,this}static fromTxFormat(t){return(new this).fromTxFormat(t)}fromString(t){return this.fromHex(t)}static parseDer(e,r){if(void 0===r&&(r=!0),!t.isBuffer(e))throw new Error("DER formatted signature should be a buffer");const i=e[0];if(48!==i)throw new Error("Header byte should be 0x30");let s=e[1];const o=e.slice(2).length;if(r&&s!==o)throw new Error("LEngth byte should length of what follows");s=s73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;const e=t[3];if(5+e>=t.length)return!1;const r=t[5+e];if(e+r+7!==t.length)return!1;const n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;const i=t.slice(6+e);return!(2!==t[6+e-2]||0===r||128&i[0]||r>1&&0===i[0]&&!(128&i[1]))}hasLowS(){return!this.s.lt(1)&&!this.s.gt(n.a.fromBuffer(t.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))}hasDefinedHashType(){return!(this.nHashTypes.SIGHASH_SINGLE)}toCompact(e,r){if(e="number"==typeof e?e:this.recovery,r="boolean"==typeof r?r:this.compressed,0!==e&&1!==e&&2!==e&&3!==e)throw new Error("recovery must be equal to 0, 1, 2, or 3");let n=e+27+4;!1===r&&(n-=4);const i=t.from([n]),s=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return t.concat([i,s,o])}toRS(){return t.concat([this.r.toBuffer({size:32}),this.s.toBuffer({size:32})])}toDer(){const e=this.r.toBuffer(),r=this.s.toBuffer(),n=128&e[0],i=128&r[0],s=n?t.concat([t.from([0]),e]):e,o=i?t.concat([t.from([0]),r]):r,a=2+s.length+2+o.length,u=s.length,f=o.length;return t.concat([t.from([48,a,2,u]),s,t.from([2,f]),o])}toTxFormat(){const e=this.toDer(),r=t.alloc(1);return r.writeUInt8(this.nHashType,0),t.concat([e,r])}toString(){return this.toHex()}}s.SIGHASH_ALL=1,s.SIGHASH_NONE=2,s.SIGHASH_SINGLE=3,s.SIGHASH_FORKID=64,s.SIGHASH_ANYONECANPAY=128}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return n}));class n{constructor(t){this.fromObject({bufs:t})}fromObject(t){return this.bufs=t.bufs||this.bufs||[],this}getLength(){let t=0;for(const e in this.bufs)t+=this.bufs[e].length;return t}toBuffer(){return t.concat(this.bufs)}write(t){return this.bufs.push(t),this}writeReverse(e){const r=t.alloc(e.length);for(let t=0;t * @license MIT */ var n=r(88),i=r(89),s=r(90);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function f(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var h=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var c=!0,d=0;di&&(n=i):n=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&f)<<6|63&s)>127&&(h=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&f)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&f)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,r,n,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function N(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function C(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,s){return s||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,s){return s||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=o(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return c(null,t)},u.allocUnsafeSlow=function(t){return c(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),f=this.slice(n,i),h=t.slice(e,r),c=0;ci)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return O(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||T(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);T(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);T(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(33))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return u}));var n=r(1),i=r(6),s=r(11),o=r(4),a=r(2);class u extends o.a{constructor(t,e){super({point:t,compressed:e})}fromJSON(t){return this.fromFastHex(t),this}toJSON(){return this.toFastHex()}fromPrivKey(t){return this.fromObject({point:s.a.getG().mul(t.bn),compressed:t.compressed}),this}static fromPrivKey(t){return(new this).fromPrivKey(t)}async asyncFromPrivKey(t){const e=await a.a.asyncObjectMethod(this,"fromPrivKey",[t]);return this.fromFastBuffer(e.resbuf)}static asyncFromPrivKey(t){return(new this).asyncFromPrivKey(t)}fromBuffer(t,e){return this.fromDer(t,e)}async asyncFromBuffer(t,e){const r=[t,e],n=await a.a.asyncObjectMethod(this,"fromBuffer",r);return this.fromFastBuffer(n.resbuf)}fromFastBuffer(t){if(0===t.length)return this;const e=Boolean(t[0]);return t=t.slice(1),this.fromDer(t),this.compressed=e,this}fromDer(t,e){if(e=void 0===e,4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0]){const e=t.slice(1),r=new n.a(e);this.fromX(!0,r),this.compressed=!0}else{if(2!==t[0])throw new Error("Invalid DER format pubKey");{const e=t.slice(1),r=new n.a(e);this.fromX(!1,r),this.compressed=!0}}else{const e=t.slice(1,33),r=t.slice(33,65);if(32!==e.length||32!==r.length||65!==t.length)throw new Error("LEngth of x and y must be 32 bytes");const i=new n.a(e),o=new n.a(r);this.point=new s.a(i,o),this.compressed=!1}return this}static fromDer(t,e){return(new this).fromDer(t,e)}fromString(e){return this.fromDer(t.from(e,"hex")),this}fromX(t,e){if("boolean"!=typeof t)throw new Error("Must specify whether x is odd or not (true or false)");return this.point=s.a.fromX(t,e),this}static fromX(t,e){return(new this).fromX(t,e)}toBuffer(){const t=void 0===this.compressed||this.compressed;return this.toDer(t)}toFastBuffer(){if(!this.point)return t.alloc(0);const e=new i.a,r=void 0===this.compressed||Boolean(this.compressed);return e.writeUInt8(Number(r)),e.write(this.toDer(!1)),e.toBuffer()}toDer(e){if("boolean"!=typeof(e=void 0===e?this.compressed:e))throw new Error("Must specify whether the public key is compressed or not (true or false)");const r=this.point.getX(),n=this.point.getY(),i=r.toBuffer({size:32}),s=n.toBuffer({size:32});let o;return e?(o=s[s.length-1]%2?t.from([3]):t.from([2]),t.concat([o,i])):(o=t.from([4]),t.concat([o,i,s]))}toString(){const t=void 0===this.compressed||this.compressed;return this.toDer(t).toString("hex")}static isCompressedOrUncompressed(t){if(t.length<33)return!1;if(4===t[0]){if(65!==t.length)return!1}else{if(2!==t[0]&&3!==t[0])return!1;if(33!==t.length)return!1}return!0}validate(){if(this.point.isInfinity())throw new Error("point: Point cannot be equal to Infinity");if(this.point.eq(new s.a(new n.a(0),new n.a(0))))throw new Error("point: Point cannot be equal to 0, 0");return this.point.validate(),this}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return c}));var n=r(1),i=r(12),s=r(6),o=r(18),a=r(0),u=r(8),f=r(5),h=r(4);class c extends h.a{constructor(t=[]){super({chunks:t})}fromJSON(t){return this.fromString(t)}toJSON(){return this.toString()}fromBuffer(e){this.chunks=[];const r=new i.a(e);for(;!r.eof();){const e=r.readUInt8();let n=0,i=t.from([]);if(e>0&&e0&&i=0&&o0&&(r=r+" "+t.buf.toString("hex"));else if(void 0!==a.a.str[e])0===e?r+=" 0":79===e?r+=" -1":r=r+" "+new a.a(e).toString();else{let t=e.toString(16);t.length%2!=0&&(t="0"+t),r=r+" "+t}return r}fromOpReturnData(t){return this.writeOpCode(a.a.OP_RETURN),this.writeBuffer(t),this}static fromOpReturnData(t){return(new this).fromOpReturnData(t)}fromSafeData(t){return this.writeOpCode(a.a.OP_FALSE),this.writeOpCode(a.a.OP_RETURN),this.writeBuffer(t),this}static fromSafeData(t){return(new this).fromSafeData(t)}fromSafeDataArray(t){this.writeOpCode(a.a.OP_FALSE),this.writeOpCode(a.a.OP_RETURN);for(const e in t){const r=t[e];this.writeBuffer(r)}return this}static fromSafeDataArray(t){return(new this).fromSafeDataArray(t)}getData(){if(this.isSafeDataOut())return this.chunks.slice(2).map((t=>t.buf));if(this.isOpReturn())return this.chunks.slice(1).map((t=>t.buf));throw new Error("Unrecognized script type to get data from")}fromPubKeyHash(t){if(20!==t.length)throw new Error("hashBuf must be a 20 byte buffer");return this.writeOpCode(a.a.OP_DUP),this.writeOpCode(a.a.OP_HASH160),this.writeBuffer(t),this.writeOpCode(a.a.OP_EQUALVERIFY),this.writeOpCode(a.a.OP_CHECKSIG),this}static fromPubKeyHash(t){return(new this).fromPubKeyHash(t)}static sortPubKeys(t){return t.slice().sort(((t,e)=>{const r=t.toBuffer(),n=e.toBuffer(),i=Math.max(r.length,n.length);for(let t=0;t<=i;t++){if(void 0===r[t])return-1;if(void 0===n[t])return 1;if(r[t]n[t])return 1}}))}fromPubKeys(t,e,r=!0){if("number"!=typeof t)throw new Error("m must be a number");r&&(e=c.sortPubKeys(e)),this.writeOpCode(t+a.a.OP_1-1);for(const t in e)this.writeBuffer(e[t].toBuffer());return this.writeOpCode(e.length+a.a.OP_1-1),this.writeOpCode(a.a.OP_CHECKMULTISIG),this}static fromPubKeys(t,e,r=!0){return(new this).fromPubKeys(t,e,r)}removeCodeseparators(){const t=[];for(let e=0;ea.a.OP_16)return!1;return!0}isNonSpendable(){const t=this.chunks[0].opCodeNum===a.a.OP_FALSE,e=this.chunks[1]&&this.chunks[1].opCodeNum===a.a.OP_RETURN;return!!t&&!!e}isOpReturn(){return this.chunks[0].opCodeNum===a.a.OP_RETURN&&this.chunks.filter((e=>t.isBuffer(e.buf))).length===this.chunks.slice(1).length}isSafeDataOut(){if(this.chunks.length<2)return!1;if(this.chunks[0].opCodeNum!==a.a.OP_FALSE)return!1;const t=this.chunks.slice(1);return new c(t).isOpReturn()}isPubKeyHashOut(){return!!(this.chunks[0]&&this.chunks[0].opCodeNum===a.a.OP_DUP&&this.chunks[1]&&this.chunks[1].opCodeNum===a.a.OP_HASH160&&this.chunks[2].buf&&this.chunks[3]&&this.chunks[3].opCodeNum===a.a.OP_EQUALVERIFY&&this.chunks[4]&&this.chunks[4].opCodeNum===a.a.OP_CHECKSIG)}isPubKeyHashIn(){return!(2!==this.chunks.length||!this.chunks[0].buf&&this.chunks[0].opCodeNum!==a.a.OP_0||!this.chunks[1].buf&&this.chunks[0].opCodeNum!==a.a.OP_0)}isScriptHashOut(){const t=this.toBuffer();return 23===t.length&&t[0]===a.a.OP_HASH160&&20===t[1]&&t[22]===a.a.OP_EQUAL}isScriptHashIn(){if(!this.isPushOnly())return!1;try{(new c).fromBuffer(this.chunks[this.chunks.length-1].buf)}catch(t){return!1}return!0}isMultiSigOut(){const t=this.chunks[0].opCodeNum-a.a.OP_1+1;if(!(t>=1&&t<=16))return!1;if(!this.chunks.slice(1,this.chunks.length-2).every((t=>{try{const e=t.buf;return(new u.a).fromDer(e).validate(),!0}catch(t){return!1}})))return!1;const e=this.chunks[this.chunks.length-2].opCodeNum-a.a.OP_1+1;return e>=t&&e<=16&&this.chunks[1+e+1].opCodeNum===a.a.OP_CHECKMULTISIG}isMultiSigIn(){if(this.chunks[0].opCodeNum!==a.a.OP_0)return!1;const e=this.chunks.slice(1);return!(e.length<1)&&e.every((e=>t.isBuffer(e.buf)&&f.a.IsTxDer(e.buf)))}findAndDelete(t){const e=t.toBuffer();for(let t=0;t=0&&t.cmp(16)<=0)this.chunks.push({opCodeNum:t.toNumber()+a.a.OP_1-1});else{const e=t.toSm({endian:"little"});this.writeBuffer(e)}return this}static writeBn(t){return(new this).writeBn(t)}writeNumber(t){return this.writeBn((new n.a).fromNumber(t)),this}static writeNumber(t){return(new this).writeNumber(t)}setChunkBn(t,e){return this.chunks[t]=(new c).writeBn(e).chunks[0],this}writeBuffer(t){let e;const r=t.length;if(t.length>0&&t.length=1&&r[0]<=16?n!==a.a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n!==a.a.OP_1NEGATE:r.length<=75?n!==r.length:r.length<=255?n!==a.a.OP_PUSHDATA1:r.length<=65535&&n!==a.a.OP_PUSHDATA2))}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return o}));var n=r(12),i=r(6),s=r(4);class o extends s.a{constructor(t){super({buf:t})}fromJSON(e){return this.fromObject({buf:t.from(e,"hex")}),this}toJSON(){return this.buf.toString("hex")}fromBuffer(t){return this.buf=t,this}fromBr(t){return this.buf=t.readVarIntBuf(),this}fromBn(t){return this.buf=(new i.a).writeVarIntBn(t).toBuffer(),this}static fromBn(t){return(new this).fromBn(t)}fromNumber(t){return this.buf=(new i.a).writeVarIntNum(t).toBuffer(),this}static fromNumber(t){return(new this).fromNumber(t)}toBuffer(){return this.buf}toBn(){return new n.a(this.buf).readVarIntBn()}toNumber(){return new n.a(this.buf).readVarIntNum()}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(82),i=r(1);const s=n.curves.secp256k1,o=s.curve.point().constructor;class a extends o{constructor(t,e,r){super(s.curve,t,e,r)}static fromX(t,e){const r=s.curve.pointFromX(e,t);return Object.create(a.prototype).copyFrom(r)}copyFrom(t){if(!(t instanceof o))throw new Error("point should be an external point");for(const e of Object.keys(t))this[e]=t[e];return this}add(t){return t=o.prototype.add.call(this,t),Object.create(a.prototype).copyFrom(t)}mul(t){if(!t.lt(a.getN()))throw new Error("point mul out of range");const e=o.prototype.mul.call(this,t);return Object.create(a.prototype).copyFrom(e)}mulAdd(t,e,r){const n=o.prototype.mulAdd.call(this,t,e,r);return(e=Object.create(a.prototype)).copyFrom(n)}getX(){const t=o.prototype.getX.call(this),e=Object.create(i.a.prototype);return t.copy(e),e}getY(){const t=o.prototype.getY.call(this),e=Object.create(i.a.prototype);return t.copy(e),e}fromX(t,e){const r=a.fromX(t,e);return this.copyFrom(r)}toJSON(){return{x:this.getX().toString(),y:this.getY().toString()}}fromJSON(t){const e=(new i.a).fromString(t.x),r=(new i.a).fromString(t.y),n=new a(e,r);return this.copyFrom(n)}toString(){return JSON.stringify(this.toJSON())}fromString(t){const e=JSON.parse(t),r=(new a).fromJSON(e);return this.copyFrom(r)}static getG(){const t=s.curve.g;return Object.create(a.prototype).copyFrom(t)}static getN(){return new i.a(s.curve.n.toArray())}validate(){if(0!==a.fromX(this.getY().isOdd(),this.getX()).getY().cmp(this.getY()))throw new Error("Invalid y value of public key");if(!(this.getX().gt(-1)&&this.getX().lt(a.getN())&&this.getY().gt(-1)&&this.getY().lt(a.getN())))throw new Error("Point does not lie on the curve");return this}}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));var n=r(1);class i{constructor(t){this.fromObject({buf:t})}fromObject(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this}eof(){return this.pos>=this.buf.length}read(t=this.buf.length){const e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e}readReverse(e=this.buf.length){const r=this.buf.slice(this.pos,this.pos+e);this.pos=this.pos+e;const n=t.alloc(r.length);for(let t=0;t=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,i){for(var s=0,o=0,a=Math.min(t.length,r),u=e;u=49?f-49+10:f>=17?f-17+10:f,n(f>=0&&o0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){s.prototype.inspect=c}else s.prototype.inspect=c;function c(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f>>26,c=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;h+=(o=(i=0|t.words[p])*(s=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,s=0,o=0;o>>24-i&16777215)||o!==this.length-1?d[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var b=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?b+r:d[f-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,i),o},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,s=0;i>8&255),r>16&255),6===s?(r>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],g=8191&m,y=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,S=0|o[4],O=8191&S,E=S>>>13,I=0|o[5],P=8191&I,M=I>>>13,A=0|o[6],k=8191&A,x=A>>>13,R=0|o[7],T=8191&R,B=R>>>13,N=0|o[8],C=8191&N,L=N>>>13,U=0|o[9],D=8191&U,H=U>>>13,j=0|a[0],F=8191&j,K=j>>>13,V=0|a[1],q=8191&V,G=V>>>13,Y=0|a[2],z=8191&Y,W=Y>>>13,J=0|a[3],Z=8191&J,X=J>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,K))+Math.imul(d,F)|0))<<13)|0;f=((s=Math.imul(d,K))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,K))+Math.imul(b,F)|0,s=Math.imul(b,K);var gt=(f+(n=n+Math.imul(c,q)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,q)|0))<<13)|0;f=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,K))+Math.imul(y,F)|0,s=Math.imul(y,K),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,q)|0,s=s+Math.imul(b,G)|0;var yt=(f+(n=n+Math.imul(c,z)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,z)|0))<<13)|0;f=((s=s+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,K))+Math.imul(_,F)|0,s=Math.imul(_,K),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(y,q)|0,s=s+Math.imul(y,G)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,z)|0,s=s+Math.imul(b,W)|0;var vt=(f+(n=n+Math.imul(c,Z)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,Z)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,K))+Math.imul(E,F)|0,s=Math.imul(E,K),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,q)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,z)|0,s=s+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,X)|0;var wt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,K))+Math.imul(M,F)|0,s=Math.imul(M,K),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(E,q)|0,s=s+Math.imul(E,G)|0,n=n+Math.imul(w,z)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,z)|0,s=s+Math.imul(_,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,K))+Math.imul(x,F)|0,s=Math.imul(x,K),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(M,q)|0,s=s+Math.imul(M,G)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(E,z)|0,s=s+Math.imul(E,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0;var St=(f+(n=n+Math.imul(c,st)|0)|0)+((8191&(i=(i=i+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,K))+Math.imul(B,F)|0,s=Math.imul(B,K),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,q)|0,s=s+Math.imul(x,G)|0,n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(M,z)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,nt)|0,n=n+Math.imul(p,st)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0;var Ot=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,K))+Math.imul(L,F)|0,s=Math.imul(L,K),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,q)|0,s=s+Math.imul(B,G)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(x,z)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,nt)|0,n=n+Math.imul(g,st)|0,i=(i=i+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,s=s+Math.imul(b,ft)|0;var Et=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,K))+Math.imul(H,F)|0,s=Math.imul(H,K),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,q)|0,s=s+Math.imul(L,G)|0,n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,z)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(w,st)|0,i=(i=i+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,s=s+Math.imul(b,dt)|0;var It=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((s=s+Math.imul(d,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(H,q)|0,s=Math.imul(H,G),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(L,z)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(O,st)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,s=s+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((s=s+Math.imul(b,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,W))+Math.imul(H,z)|0,s=Math.imul(H,W),n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,X)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(P,st)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,dt)|0;var Mt=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((s=s+Math.imul(y,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,X))+Math.imul(H,Z)|0,s=Math.imul(H,X),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,s=s+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(k,st)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(M,ut)|0,s=s+Math.imul(M,ft)|0,n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var At=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((s=s+Math.imul(_,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,tt))+Math.imul(H,$)|0,s=Math.imul(H,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,s=s+Math.imul(L,nt)|0,n=n+Math.imul(T,st)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ft)|0)+Math.imul(x,ut)|0,s=s+Math.imul(x,ft)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(M,ct)|0,s=s+Math.imul(M,dt)|0;var kt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(E,pt)|0))<<13)|0;f=((s=s+Math.imul(E,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(H,rt)|0,s=Math.imul(H,nt),n=n+Math.imul(C,st)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,st)|0,s=s+Math.imul(L,ot)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(B,ut)|0,s=s+Math.imul(B,ft)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(x,ct)|0,s=s+Math.imul(x,dt)|0;var xt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((s=s+Math.imul(M,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,st),i=(i=Math.imul(D,ot))+Math.imul(H,st)|0,s=Math.imul(H,ot),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(L,ut)|0,s=s+Math.imul(L,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,s=s+Math.imul(B,dt)|0;var Rt=(f+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,bt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((s=s+Math.imul(x,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ft))+Math.imul(H,ut)|0,s=Math.imul(H,ft),n=n+Math.imul(C,ct)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(L,ct)|0,s=s+Math.imul(L,dt)|0;var Tt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((s=s+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,dt))+Math.imul(H,ct)|0,s=Math.imul(H,dt);var Bt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((s=s+Math.imul(L,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Nt=(f+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(H,pt)|0))<<13)|0;return f=((s=Math.imul(H,bt))+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Ot,u[8]=Et,u[9]=It,u[10]=Pt,u[11]=Mt,u[12]=At,u[13]=kt,u[14]=xt,u[15]=Rt,u[16]=Tt,u[17]=Bt,u[18]=Nt,0!==f&&(u[19]=f,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=b),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?b(this,t,e):r<1024?g(this,t,e):y(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,r+=s/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,f=0;f=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&s}for(;i>26,this.words[i+r]=67108863&s;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f=0;c--){var d=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(i,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=d)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(t,e,r){var i,o,a;return n(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=67108864%t,i=0,s=this.length-1;s>=0;s--)i=(r*i+(0|this.words[s]))%t;return e?-i:i},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*r;this.words[i]=s/t|0,r=s%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=new s(0),u=new s(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(c)),i.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(u)):(r.isub(e),a.isub(i),u.isub(o))}return{a:a,b:u,gcd:r.iushln(f)}},s.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new s(1),a=new s(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new P(t)},s.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function O(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){P.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(S,_),S.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=s}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new O;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return w[t]=e,e},P.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},P.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},P.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},P.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},P.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},P.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},P.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},P.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},P.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},P.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},P.prototype.isqr=function(t){return this.imul(t,t.clone())},P.prototype.sqr=function(t){return this.mul(t,t)},P.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new s(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=o;0!==l.cmp(a);){for(var b=l,m=0;0!==b.cmp(a);m++)b=b.redSqr();n(m=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==o?(o<<=1,o|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}u=26}return i},P.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},P.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new M(t)},i(M,P),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(92)(t))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return m}));var n=r(1),i=r(12),s=r(6),o=r(29),a=r(3),u=r(41),f=r(9),h=r(5),c=r(4),d=r(13),l=r(20),p=r(10),b=r(2);class m extends c.a{constructor(t=1,e=p.a.fromNumber(0),r=[],n=p.a.fromNumber(0),i=[],s=0){super({versionBytesNum:t,txInsVi:e,txIns:r,txOutsVi:n,txOuts:i,nLockTime:s})}fromJSON(t){const e=[];for(const r of t.txIns)e.push((new d.a).fromJSON(r));const r=[];for(const e of t.txOuts)r.push((new l.a).fromJSON(e));return this.fromObject({versionBytesNum:t.versionBytesNum,txInsVi:(new p.a).fromJSON(t.txInsVi),txIns:e,txOutsVi:(new p.a).fromJSON(t.txOutsVi),txOuts:r,nLockTime:t.nLockTime}),this}toJSON(){const t=[];for(const e of this.txIns)t.push(e.toJSON());const e=[];for(const t of this.txOuts)e.push(t.toJSON());return{versionBytesNum:this.versionBytesNum,txInsVi:this.txInsVi.toJSON(),txIns:t,txOutsVi:this.txOutsVi.toJSON(),txOuts:e,nLockTime:this.nLockTime}}fromBr(t){this.versionBytesNum=t.readUInt32LE(),this.txInsVi=new p.a(t.readVarIntBuf());const e=this.txInsVi.toNumber();this.txIns=[];for(let r=0;r>>0),c.toBuffer()}const g=this.cloneByBuffer();(i=(new f.a).fromBuffer(i.toBuffer())).removeCodeseparators();for(let t=0;tg.txOuts.length-1)return t.from("0000000000000000000000000000000000000000000000000000000000000001","hex");g.txOuts.length=r+1,g.txOutsVi=p.a.fromNumber(r+1);for(let e=0;enew i.a(t.txHashBuf).readReverse().compare(new i.a(e.txHashBuf).readReverse())||t.txOutNum-e.txOutNum)),this.txOuts.sort(((t,e)=>t.valueBn.sub(e.valueBn).toNumber()||t.script.toBuffer().compare(e.script.toBuffer()))),this}}m.MAX_MONEY=21e14,m.SCRIPT_ENABLE_SIGHASH_FORKID=65536}).call(this,r(7).Buffer)},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(83);class i{static getRandomBuffer(t){return n(t)}}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";(function(t){function n(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new Error("buf1 and buf2 must be buffers");if(e.length!==r.length)return!1;let n=0;for(let t=0;ti.Mainnet.Msg.magicNum===t?i.Mainnet:i.Testnet.Msg.magicNum===t?i.Testnet:i.Regtest.Msg.magicNum===t?i.Regtest:i.STN.Msg.magicNum===t?i.STN:i.Default},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(1),i=r(6),s=r(9),o=r(4),a=r(10);class u extends o.a{constructor(t,e,r){super({valueBn:t,scriptVi:e,script:r})}setScript(t){return this.scriptVi=a.a.fromNumber(t.toBuffer().length),this.script=t,this}fromProperties(t,e){return this.fromObject({valueBn:t}),this.setScript(e),this}static fromProperties(t,e){return(new this).fromProperties(t,e)}fromJSON(t){return this.fromObject({valueBn:(new n.a).fromJSON(t.valueBn),scriptVi:(new a.a).fromJSON(t.scriptVi),script:(new s.a).fromJSON(t.script)}),this}toJSON(){return{valueBn:this.valueBn.toJSON(),scriptVi:this.scriptVi.toJSON(),script:this.script.toJSON()}}fromBr(t){return this.valueBn=t.readUInt64LEBn(),this.scriptVi=a.a.fromNumber(t.readVarIntNum()),this.script=(new s.a).fromBuffer(t.read(this.scriptVi.toNumber())),this}toBw(t){return t||(t=new i.a),t.writeUInt64LEBn(this.valueBn),t.write(this.scriptVi.buf),t.write(this.script.toBuffer()),t}}},function(t,e,r){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */var n=r(7),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(s(n,e),e.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(6),i=r(23),s=r(8),o=r(4);class a extends o.a{constructor(t,e,r=i.a){super({privKey:t,pubKey:e}),this.PrivKey=r}fromJSON(t){return t.privKey&&(this.privKey=this.PrivKey.fromJSON(t.privKey)),t.pubKey&&(this.pubKey=s.a.fromJSON(t.pubKey)),this}fromBr(t){const e=t.readUInt8();e>0&&(this.privKey=(new this.PrivKey).fromFastBuffer(t.read(e)));const r=t.readUInt8();return r>0&&(this.pubKey=(new s.a).fromFastBuffer(t.read(r))),this}toBw(t){if(t||(t=new n.a),this.privKey){const e=this.privKey.toFastBuffer();t.writeUInt8(e.length),t.write(e)}else t.writeUInt8(0);if(this.pubKey){const e=this.pubKey.toFastBuffer();t.writeUInt8(e.length),t.write(e)}else t.writeUInt8(0);return t}fromString(t){return this.fromJSON(JSON.parse(t))}toString(){return JSON.stringify(this.toJSON())}toPublic(){const t=(new a).fromObject(this);return t.privKey=void 0,t}fromPrivKey(t){return this.privKey=t,this.pubKey=(new s.a).fromPrivKey(t),this}static fromPrivKey(t){return(new this).fromPrivKey(t)}async asyncFromPrivKey(t){return this.privKey=t,this.pubKey=await(new s.a).asyncFromPrivKey(t),this}static asyncFromPrivKey(t){return(new this).asyncFromPrivKey(t)}fromRandom(){return this.privKey=(new this.PrivKey).fromRandom(),this.pubKey=(new s.a).fromPrivKey(this.privKey),this}static fromRandom(){return(new this).fromRandom()}async asyncFromRandom(){return this.privKey=(new this.PrivKey).fromRandom(),this.asyncFromPrivKey(this.privKey)}static asyncFromRandom(){return(new this).asyncFromRandom()}}a.Mainnet=class extends a{constructor(t,e){super(t,e,i.a.Mainnet)}},a.Testnet=class extends a{constructor(t,e){super(t,e,i.a.Testnet)}}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return f}));var n=r(24),i=r(1),s=r(19),o=r(11),a=r(16),u=r(4);class f extends u.a{constructor(t,e,r){super({bn:t,compressed:e}),r=r||s.a.Default.PrivKey,this.Constants=r}fromJSON(t){return this.fromHex(t),this}toJSON(){return this.toHex()}fromRandom(){let t,e,r;do{t=a.a.getRandomBuffer(32),e=(new i.a).fromBuffer(t),r=e.lt(o.a.getN())}while(!r);return this.fromObject({bn:e,compressed:!0}),this}static fromRandom(){return(new this).fromRandom()}toBuffer(){let e=this.compressed;void 0===e&&(e=!0);const r=this.bn.toBuffer({size:32});let n;return n=e?t.concat([t.from([this.Constants.versionByteNum]),r,t.from([1])]):t.concat([t.from([this.Constants.versionByteNum]),r]),n}fromBuffer(t){if(34===t.length&&1===t[33])this.compressed=!0;else{if(33!==t.length)throw new Error("Length of privKey buffer must be 33 (uncompressed pubKey) or 34 (compressed pubKey)");this.compressed=!1}if(t[0]!==this.Constants.versionByteNum)throw new Error("Invalid versionByteNum byte");return this.fromBn((new i.a).fromBuffer(t.slice(1,33)))}toBn(){return this.bn}fromBn(t){return this.bn=t,this}static fromBn(t){return(new this).fromBn(t)}validate(){if(!this.bn.lt(o.a.getN()))throw new Error("Number must be less than N");if("boolean"!=typeof this.compressed)throw new Error("Must specify whether the corresponding public key is compressed or not (true or false)");return this}toWif(){return n.a.encode(this.toBuffer())}fromWif(t){return this.fromBuffer(n.a.decode(t))}static fromWif(t){return(new this).fromWif(t)}toString(){return this.toWif()}fromString(t){return this.fromWif(t)}}f.Mainnet=class extends f{constructor(t,e){super(t,e,s.a.Mainnet.PrivKey)}},f.Testnet=class extends f{constructor(t,e){super(t,e,s.a.Testnet.PrivKey)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return a}));var n=r(44),i=r(18),s=r(3),o=r(4);class a extends o.a{constructor(t){super({buf:t})}fromHex(e){return this.fromBuffer(t.from(e,"hex"))}toHex(){return this.toBuffer().toString("hex")}static decode(t){if("string"!=typeof t)throw new Error("Input must be a string");const e=n.a.decode(t);if(e.length<4)throw new Error("Input string too short");const r=e.slice(0,-4),o=e.slice(-4),a=s.a.sha256Sha256(r).slice(0,4);if(!Object(i.a)(o,a))throw new Error("Checksum mismatch");return r}static encode(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");const r=t.alloc(e.length+4),i=s.a.sha256Sha256(e);return e.copy(r),i.copy(r,e.length),n.a.encode(r)}fromBuffer(t){return this.buf=t,this}fromString(t){const e=a.decode(t);return this.buf=e,this}toBuffer(){return this.buf}toString(){return a.encode(this.buf)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";var n=r(30),i=r(17);function s(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&o|128):s(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],s=n+t[e+1]>>>0,o=(s>>0,t[e+1]=s},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,s,o,a){var u=0,f=e;return u+=(f=f+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,s,o,a){return e+n+s+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,s,o,a,u,f){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,s,o,a,u,f){return e+n+s+a+f>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e){var r,n,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var u,f=[],h=!1,c=-1;function d(){h&&u&&(h=!1,u.length?f=u.concat(f):c=-1,f.length&&l())}function l(){if(!h){var t=a(d);h=!0;for(var e=f.length;e;){for(u=f,f=[];++c1)for(var r=1;r>1,f=a.a.getN(),h=a.a.getG(),c=o?r.add(f):r,d=a.a.fromX(s,c);let l="";try{d.mul(f)}catch(t){l=t.message}if("point mul out of range"!==l)throw new Error("nR is not a valid curve point");const p=e.neg().umod(f),b=r.invm(f),m=d.mul(i).add(h.mul(p)).mul(b),g=new u.a(m);return g.compressed=this.sig.compressed,g.validate(),g}async asyncSig2PubKey(){const t=await d.a.asyncObjectMethod(this,"sig2PubKey",[]);return u.a.fromFastBuffer(t.resbuf)}static sig2PubKey(t,e){return(new l).fromObject({sig:t,hashBuf:e}).sig2PubKey()}static async asyncSig2PubKey(t,e){const r=(new l).fromObject({sig:t,hashBuf:e});return await r.asyncSig2PubKey()}verifyStr(e=!0){if(!t.isBuffer(this.hashBuf)||32!==this.hashBuf.length)return"hashBuf must be a 32 byte buffer";try{this.keyPair.pubKey.validate()}catch(t){return"Invalid pubKey: "+t}const r=this.sig.r,i=this.sig.s;if(!(r.gt(0)&&r.lt(a.a.getN())&&i.gt(0)&&i.lt(a.a.getN())))return"r and s not in range";if(e&&!this.sig.hasLowS())return"s is too high and does not satisfy low s contraint - see bip 62";const s=(new n.a).fromBuffer(this.hashBuf,this.endian?{endian:this.endian}:void 0),o=a.a.getN(),u=i.invm(o),f=u.mul(s).mod(o),h=u.mul(r).mod(o),c=a.a.getG().mulAdd(f,this.keyPair.pubKey.point,h);return c.isInfinity()?"p is infinity":0!==c.getX().mod(o).cmp(r)&&"Invalid signature"}sign(){const e="little"===this.endian?new i.a(this.hashBuf).readReverse():this.hashBuf,r=this.keyPair.privKey,s=r.bn;if(!e||!r||!s)throw new Error("invalid parameters");if(!t.isBuffer(e)||32!==e.length)throw new Error("hashBuf must be a 32 byte buffer");const o=a.a.getN(),u=a.a.getG(),f=(new n.a).fromBuffer(e);let c,d,l,p,b=0;do{(!this.k||b>0)&&this.deterministicK(b),b++,c=this.k,d=u.mul(c),l=d.getX().mod(o),p=c.invm(o).mul(f.add(s.mul(l))).mod(o)}while(l.cmp(0)<=0||p.cmp(0)<=0);return p.gt((new n.a).fromBuffer(t.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(p=a.a.getN().sub(p)),this.sig=h.a.fromObject({r:l,s:p,compressed:this.keyPair.pubKey.compressed}),this}async asyncSign(){const t=await d.a.asyncObjectMethod(this,"sign",[]);return this.fromFastBuffer(t.resbuf)}signRandomK(){return this.randomK(),this.sign()}toString(){const t={};return this.hashBuf&&(t.hashBuf=this.hashBuf.toString("hex")),this.keyPair&&(t.keyPair=this.keyPair.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)}verify(t=!0){return this.verifyStr(t)?this.verified=!1:this.verified=!0,this}async asyncVerify(t=!0){const e=await d.a.asyncObjectMethod(this,"verify",[t]);return this.fromFastBuffer(e.resbuf)}static sign(t,e,r){return(new l).fromObject({hashBuf:t,endian:r,keyPair:e}).sign().sig}static async asyncSign(t,e,r){const n=(new l).fromObject({hashBuf:t,endian:r,keyPair:e});return await n.asyncSign(),n.sig}static verify(t,e,r,n,i=!0){return(new l).fromObject({hashBuf:t,endian:n,sig:e,keyPair:(new o.a).fromObject({pubKey:r})}).verify(i).verified}static async asyncVerify(t,e,r,n,i=!0){const s=(new l).fromObject({hashBuf:t,endian:n,sig:e,keyPair:(new o.a).fromObject({pubKey:r})});return await s.asyncVerify(i),s.verified}}}).call(this,r(7).Buffer)},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(14),s=r(30),o=r(55);n.assert=s,n.toArray=o.toArray,n.zero2=o.zero2,n.toHex=o.toHex,n.encode=o.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s,o,a,u=t.andln(3)+n&3,f=e.andln(3)+i&3;3===u&&(u=-1),3===f&&(f=-1),s=0==(1&u)?0:3!=(a=t.andln(7)+n&7)&&5!==a||2!==f?u:-u,r[0].push(s),o=0==(1&f)?0:3!=(a=e.andln(7)+i&7)&&5!==a||2!==u?f:-f,r[1].push(o),2*n===s+1&&(n=1-n),2*i===o+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){var n=e;n.utils=r(25),n.common=r(43),n.sha=r(94),n.ripemd=r(98),n.hmac=r(99),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function s(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,o;if("string"==typeof e&&(i="not ",e.substr(0,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))o="The ".concat(t," ").concat(n," ").concat(s(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";o='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(s(e,"type"))}return o+". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var i=r(66),s=r(71);r(17)(f,i);for(var o=n(s.prototype),a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var n=r(6),i=r(4);class s extends i.a{constructor(t,e,r,n,i,s){super({versionBytesNum:t,prevBlockHashBuf:e,merkleRootBuf:r,time:n,bits:i,nonce:s})}fromJSON(e){return this.fromObject({versionBytesNum:e.versionBytesNum,prevBlockHashBuf:t.from(e.prevBlockHashBuf,"hex"),merkleRootBuf:t.from(e.merkleRootBuf,"hex"),time:e.time,bits:e.bits,nonce:e.nonce}),this}toJSON(){return{versionBytesNum:this.versionBytesNum,prevBlockHashBuf:this.prevBlockHashBuf.toString("hex"),merkleRootBuf:this.merkleRootBuf.toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}}fromBr(t){return this.versionBytesNum=t.readUInt32LE(),this.prevBlockHashBuf=t.read(32),this.merkleRootBuf=t.read(32),this.time=t.readUInt32LE(),this.bits=t.readUInt32LE(),this.nonce=t.readUInt32LE(),this}toBw(t){return t||(t=new n.a),t.writeUInt32LE(this.versionBytesNum),t.write(this.prevBlockHashBuf),t.write(this.merkleRootBuf),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return p}));var n=r(1),i=r(6),s=r(18),o=r(3),a=r(0),u=r(8),f=r(9),h=r(5),c=r(4),d=r(15),l=r(13);class p extends c.a{constructor(t,e,r,i=[],s=[],o=0,a=0,u=0,f=[],h="",c=p.defaultFlags,d=new n.a(0)){super({script:t,tx:e,nIn:r,stack:i,altStack:s,pc:o,pBeginCodeHash:a,nOpCount:u,ifStack:f,errStr:h,flags:c,valueBn:d})}initialize(){return this.script=new f.a,this.stack=[],this.altStack=[],this.pc=0,this.pBeginCodeHash=0,this.nOpCount=0,this.ifStack=[],this.errStr="",this.flags=p.defaultFlags,this}fromJSON(t){return this.fromJSONNoTx(t),this.tx=t.tx?(new d.a).fromJSON(t.tx):void 0,this}fromJSONNoTx(e){this.fromObject({script:void 0!==e.script?(new f.a).fromJSON(e.script):void 0,nIn:e.nIn}),this.stack=[];for(const r of e.stack)this.stack.push(t.from(r,"hex"));this.altStack=[];for(const r of e.altStack)this.altStack.push(t.from(r,"hex"));return this.fromObject({pc:e.pc,pBeginCodeHash:e.pBeginCodeHash,nOpCount:e.nOpCount,ifStack:e.ifStack,errStr:e.errStr,flags:e.flags}),this}fromBr(t){const e=t.readVarIntNum(),r=t.read(e);this.fromJSONNoTx(JSON.parse(r.toString()));const n=t.readVarIntNum();if(n>0){const e=t.read(n);this.tx=(new d.a).fromFastBuffer(e)}return this}toJSON(){const t=this.toJSONNoTx();return t.tx=this.tx?this.tx.toJSON():void 0,t}toJSONNoTx(){const t=[];for(const e of this.stack)t.push(e.toString("hex"));const e=[];for(const t of this.altStack)e.push(t.toString("hex"));return{script:this.script?this.script.toJSON():void 0,nIn:this.nIn,stack:t,altStack:e,pc:this.pc,pBeginCodeHash:this.pBeginCodeHash,nOpCount:this.nOpCount,ifStack:this.ifStack,errStr:this.errStr,flags:this.flags}}toBw(e){e||(e=new i.a);const r=t.from(JSON.stringify(this.toJSONNoTx()));if(e.writeVarIntNum(r.length),e.write(r),this.tx){const t=this.tx.toFastBuffer();e.writeVarIntNum(t.length),e.write(t)}else e.writeVarIntNum(0);return e}static getFlags(t){let e=0;return-1!==t.indexOf("NONE")&&(e|=p.SCRIPT_VERIFY_NONE),-1!==t.indexOf("P2SH")&&(e|=p.SCRIPT_VERIFY_P2SH),-1!==t.indexOf("STRICTENC")&&(e|=p.SCRIPT_VERIFY_STRICTENC),-1!==t.indexOf("DERSIG")&&(e|=p.SCRIPT_VERIFY_DERSIG),-1!==t.indexOf("LOW_S")&&(e|=p.SCRIPT_VERIFY_LOW_S),-1!==t.indexOf("NULLDUMMY")&&(e|=p.SCRIPT_VERIFY_NULLDUMMY),-1!==t.indexOf("SIGPUSHONLY")&&(e|=p.SCRIPT_VERIFY_SIGPUSHONLY),-1!==t.indexOf("MINIMALDATA")&&(e|=p.SCRIPT_VERIFY_MINIMALDATA),-1!==t.indexOf("DISCOURAGE_UPGRADABLE_NOPS")&&(e|=p.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS),-1!==t.indexOf("CLEANSTACK")&&(e|=p.SCRIPT_VERIFY_CLEANSTACK),-1!==t.indexOf("CHECKLOCKTIMEVERIFY")&&(e|=p.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY),-1!==t.indexOf("CHECKSEQUENCEVERIFY")&&(e|=p.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY),-1!==t.indexOf("SIGHASH_FORKID")&&(e|=p.SCRIPT_ENABLE_SIGHASH_FORKID),e}static castToBool(t){for(let e=0;e=p.LOCKTIME_THRESHOLD&&t>=p.LOCKTIME_THRESHOLD)&&!(t>this.tx.nLockTime)&&l.a.SEQUENCE_FINAL!==this.tx.txIns[this.nIn].nSequence}checkSequence(t){const e=this.tx.txIns[this.nIn].nSequence;if(this.tx.versionBytesNum<2)return!1;if(e&l.a.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;const r=l.a.SEQUENCE_LOCKTIME_TYPE_FLAG|l.a.SEQUENCE_LOCKTIME_MASK,n=e&r,i=t&r;return(n=l.a.SEQUENCE_LOCKTIME_TYPE_FLAG&&i>=l.a.SEQUENCE_LOCKTIME_TYPE_FLAG)&&!(i>n)}*eval(){this.script.toBuffer().length>1e4&&(this.errStr="SCRIPT_ERR_SCRIPT_SIZE",yield!1);try{for(;this.pc1e3&&(this.errStr="SCRIPT_ERR_STACK_SIZE",yield!1)}catch(t){this.errStr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,yield!1}this.ifStack.length>0&&(this.errStr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",yield!1),yield!0}step(){const e=0!=(this.flags&p.SCRIPT_VERIFY_MINIMALDATA),r=!(this.ifStack.indexOf(!1)+1),i=this.script.chunks[this.pc];this.pc++;const c=i.opCodeNum;if(void 0===c)return this.errStr="SCRIPT_ERR_BAD_OPCODE",!1;if(i.buf&&i.buf.length>p.MAX_SCRIPT_ELEMENT_SIZE)return this.errStr="SCRIPT_ERR_PUSH_SIZE",!1;if(c>a.a.OP_16&&++this.nOpCount>201)return this.errStr="SCRIPT_ERR_OP_COUNT",!1;if(c===a.a.OP_LEFT||c===a.a.OP_RIGHT||c===a.a.OP_2MUL||c===a.a.OP_2DIV)return this.errStr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(r&&c>=0&&c<=a.a.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errStr="SCRIPT_ERR_MINIMALDATA",!1;if(i.buf){if(i.len!==i.buf.length)throw new Error("LEngth of push value not equal to length of data");this.stack.push(i.buf)}else this.stack.push(p.false)}else if(r||a.a.OP_IF<=c&&c<=a.a.OP_ENDIF)switch(c){case a.a.OP_1NEGATE:case a.a.OP_1:case a.a.OP_2:case a.a.OP_3:case a.a.OP_4:case a.a.OP_5:case a.a.OP_6:case a.a.OP_7:case a.a.OP_8:case a.a.OP_9:case a.a.OP_10:case a.a.OP_11:case a.a.OP_12:case a.a.OP_13:case a.a.OP_14:case a.a.OP_15:case a.a.OP_16:{const t=c-(a.a.OP_1-1),e=new n.a(t).toScriptNumBuffer();this.stack.push(e)}break;case a.a.OP_NOP:break;case a.a.OP_CHECKLOCKTIMEVERIFY:{if(!(this.flags&p.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&p.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errStr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-1],r=(new n.a).fromScriptNumBuffer(t,e,5).toNumber();if(r<0)return this.errStr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(r))return this.errStr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1}break;case a.a.OP_CHECKSEQUENCEVERIFY:{if(!(this.flags&p.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&p.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errStr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-1],r=(new n.a).fromScriptNumBuffer(t,e,5).toNumber();if(r<0)return this.errStr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(r&l.a.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(r))return this.errStr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1}break;case a.a.OP_NOP1:case a.a.OP_NOP3:case a.a.OP_NOP4:case a.a.OP_NOP5:case a.a.OP_NOP6:case a.a.OP_NOP7:case a.a.OP_NOP8:case a.a.OP_NOP9:case a.a.OP_NOP10:if(this.flags&p.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errStr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case a.a.OP_IF:case a.a.OP_NOTIF:{let t=!1;if(r){if(this.stack.length<1)return this.errStr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;const e=this.stack.pop();t=p.castToBool(e),c===a.a.OP_NOTIF&&(t=!t)}this.ifStack.push(t)}break;case a.a.OP_ELSE:if(0===this.ifStack.length)return this.errStr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.ifStack[this.ifStack.length-1]=!this.ifStack[this.ifStack.length-1];break;case a.a.OP_ENDIF:if(0===this.ifStack.length)return this.errStr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.ifStack.pop();break;case a.a.OP_VERIFY:{if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-1];if(!p.castToBool(t))return this.errStr="SCRIPT_ERR_VERIFY",!1;this.stack.pop()}break;case a.a.OP_RETURN:return this.errStr="SCRIPT_ERR_OP_RETURN",!1;case a.a.OP_TOALTSTACK:if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altStack.push(this.stack.pop());break;case a.a.OP_FROMALTSTACK:if(this.altStack.length<1)return this.errStr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altStack.pop());break;case a.a.OP_2DROP:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case a.a.OP_2DUP:{if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-2],e=this.stack[this.stack.length-1];this.stack.push(t),this.stack.push(e)}break;case a.a.OP_3DUP:{if(this.stack.length<3)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-3],e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];this.stack.push(t),this.stack.push(e),this.stack.push(r)}break;case a.a.OP_2OVER:{if(this.stack.length<4)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-4],e=this.stack[this.stack.length-3];this.stack.push(t),this.stack.push(e)}break;case a.a.OP_2ROT:{if(this.stack.length<6)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack.splice(this.stack.length-6,2);this.stack.push(t[0]),this.stack.push(t[1])}break;case a.a.OP_2SWAP:{if(this.stack.length<4)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack.splice(this.stack.length-4,2);this.stack.push(t[0]),this.stack.push(t[1])}break;case a.a.OP_IFDUP:{if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-1];p.castToBool(t)&&this.stack.push(t)}break;case a.a.OP_DEPTH:{const t=new n.a(this.stack.length).toScriptNumBuffer();this.stack.push(t)}break;case a.a.OP_DROP:if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case a.a.OP_DUP:if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case a.a.OP_NIP:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case a.a.OP_OVER:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case a.a.OP_PICK:case a.a.OP_ROLL:{if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;let t=this.stack[this.stack.length-1];const r=(new n.a).fromScriptNumBuffer(t,e).toNumber();if(this.stack.pop(),r<0||r>=this.stack.length)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-r-1],c===a.a.OP_ROLL&&this.stack.splice(this.stack.length-r-1,1),this.stack.push(t)}break;case a.a.OP_ROT:{if(this.stack.length<3)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-3],e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=e,this.stack[this.stack.length-2]=r,this.stack[this.stack.length-1]=t}break;case a.a.OP_SWAP:{if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=this.stack[this.stack.length-2],e=this.stack[this.stack.length-1];this.stack[this.stack.length-2]=e,this.stack[this.stack.length-1]=t}break;case a.a.OP_TUCK:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case a.a.OP_SIZE:{if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const t=new n.a(this.stack[this.stack.length-1].length);this.stack.push(t.toScriptNumBuffer())}break;case a.a.OP_OR:case a.a.OP_AND:case a.a.OP_XOR:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const i=this.stack[this.stack.length-2],d=this.stack[this.stack.length-1];if(i.length!==d.length)return this.errStr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(c){case a.a.OP_AND:for(let t=0;t0?t.readUInt8(t.length-1):0)&h.a.SIGHASH_FORKID){if(!(this.flags&p.SCRIPT_ENABLE_SIGHASH_FORKID))return this.errStr="SCRIPT_ERR_ILLEGAL_FORKID",!1}else r.findAndDelete((new f.a).writeBuffer(t));if(!this.checkSigEncoding(t)||!this.checkPubKeyEncoding(e))return!1;let n;try{const i=(new h.a).fromTxFormat(t),s=(new u.a).fromBuffer(e,!1);n=this.tx.verify(i,s,this.nIn,r,Boolean(this.flags&p.SCRIPT_VERIFY_LOW_S),this.valueBn,this.flags)}catch(t){n=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(n?p.true:p.false),c===a.a.OP_CHECKSIGVERIFY){if(!n)return this.errStr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}}break;case a.a.OP_CHECKMULTISIG:case a.a.OP_CHECKMULTISIGVERIFY:{let t=1;if(this.stack.length20)return this.errStr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=r,this.nOpCount>201)return this.errStr="SCRIPT_ERR_OP_COUNT",!1;let i=++t;if(t+=r,this.stack.lengthr)return this.errStr="SCRIPT_ERR_SIG_COUNT",!1;let o=++t;if(t+=s,this.stack.length0?e.readUInt8(e.length-1):0)&h.a.SIGHASH_FORKID){if(!(this.flags&p.SCRIPT_ENABLE_SIGHASH_FORKID))return this.errStr="SCRIPT_ERR_ILLEGAL_FORKID",!1}else d.findAndDelete((new f.a).writeBuffer(e))}let l=!0;for(;l&&s>0;){const t=this.stack[this.stack.length-o],e=this.stack[this.stack.length-i];if(!this.checkSigEncoding(t)||!this.checkPubKeyEncoding(e))return!1;let n;try{const r=(new h.a).fromTxFormat(t),i=(new u.a).fromBuffer(e,!1);n=this.tx.verify(r,i,this.nIn,d,Boolean(this.flags&p.SCRIPT_VERIFY_LOW_S),this.valueBn,this.flags)}catch(t){n=!1}n&&(o++,s--),i++,r--,s>r&&(l=!1)}for(;t-- >1;)this.stack.pop();if(this.stack.length<1)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&p.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(l?p.true:p.false),c===a.a.OP_CHECKMULTISIGVERIFY){if(!l)return this.errStr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}}break;case a.a.OP_CAT:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const m=this.stack[this.stack.length-2],g=this.stack[this.stack.length-1];this.stack[this.stack.length-2]=t.concat([m,g]),this.stack.pop();break;case a.a.OP_SPLIT:if(this.stack.length<2)return this.errStr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;const y=this.stack[this.stack.length-2],v=(new n.a).fromScriptNumBuffer(this.stack[this.stack.length-1],e);if(v.lt(0)||v.gt(y.length))return this.errStr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;const w=y.slice(0,v.toNumber()),_=y.slice(v.toNumber());this.stack.pop(),this.stack.pop(),this.stack.push(w),this.stack.push(_);break;default:return this.errStr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}verify(t,e,r,n,i,s){const o=this.results(t,e,r,n,i,s);for(const t of o)if(!t)return!1;return!0}*results(t,e,r,n,i,s){let o;this.fromObject({script:t,tx:r,nIn:n,flags:i,valueBn:s}),0==(i&p.SCRIPT_VERIFY_SIGPUSHONLY)||t.isPushOnly()||(this.errStr=this.errStr||"SCRIPT_ERR_SIG_PUSHONLY",yield!1),yield*this.eval(),i&p.SCRIPT_VERIFY_P2SH&&(o=this.stack.slice());let a=this.stack;this.initialize(),this.fromObject({script:e,stack:a,tx:r,nIn:n,flags:i,valueBn:s}),yield*this.eval(),0===this.stack.length&&(this.errStr=this.errStr||"SCRIPT_ERR_EVAL_FALSE",yield!1);const u=this.stack[this.stack.length-1];if(p.castToBool(u)||(this.errStr=this.errStr||"SCRIPT_ERR_EVAL_FALSE",yield!1),i&p.SCRIPT_VERIFY_P2SH&&e.isScriptHashOut()){t.isPushOnly()||(this.errStr=this.errStr||"SCRIPT_ERR_SIG_PUSHONLY",yield!1);const e=a;if(a=o,o=e,0===a.length)throw new Error("internal error - stack copy empty");const u=a[a.length-1],h=(new f.a).fromBuffer(u);a.pop(),this.initialize(),this.fromObject({script:h,stack:a,tx:r,nIn:n,flags:i,valueBn:s}),yield*this.eval(),0===a.length&&(this.errStr=this.errStr||"SCRIPT_ERR_EVAL_FALSE",yield!1),p.castToBool(a[a.length-1])?yield!0:(this.errStr=this.errStr||"SCRIPT_ERR_EVAL_FALSE",yield!1)}if(0!=(i&p.SCRIPT_VERIFY_CLEANSTACK)){if(!(i&p.SCRIPT_VERIFY_P2SH))throw new Error("cannot use CLEANSTACK without P2SH");1!==a.length&&(this.errStr=this.errStr||"SCRIPT_ERR_CLEANSTACK",yield!1)}yield!0}getDebugObject(){const t=this.pc-1;return{errStr:this.errStr,scriptStr:this.script?this.script.toString():"no script found",pc:t,stack:this.stack.map((t=>t.toString("hex"))),altStack:this.altStack.map((t=>t.toString("hex"))),opCodeStr:this.script?a.a.fromNumber(this.script.chunks[t].opCodeNum).toString():"no script found"}}getDebugString(){return JSON.stringify(this.getDebugObject(),null,2)}}p.true=t.from([1]),p.false=t.from([]),p.MAX_SCRIPT_ELEMENT_SIZE=520,p.LOCKTIME_THRESHOLD=5e8,p.SCRIPT_VERIFY_NONE=0,p.SCRIPT_VERIFY_P2SH=1,p.SCRIPT_VERIFY_STRICTENC=2,p.SCRIPT_VERIFY_DERSIG=4,p.SCRIPT_VERIFY_LOW_S=8,p.SCRIPT_VERIFY_NULLDUMMY=16,p.SCRIPT_VERIFY_SIGPUSHONLY=32,p.SCRIPT_VERIFY_MINIMALDATA=64,p.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,p.SCRIPT_VERIFY_CLEANSTACK=256,p.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,p.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,p.SCRIPT_ENABLE_SIGHASH_FORKID=65536,p.defaultFlags=p.SCRIPT_VERIFY_P2SH|p.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));const n=r(126);class i{static encrypt(t,e){const r=i.buf2Words(e),s=i.buf2Words(t),o=new n(r).encrypt(s);return i.words2Buf(o)}static decrypt(t,e){const r=i.buf2Words(t),s=i.buf2Words(e),o=new n(s).decrypt(r);return i.words2Buf(o)}static buf2Words(t){if(t.length%4)throw new Error("buf length must be a multiple of 4");const e=[];for(let r=0;r=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s({nScriptChunk:t.nScriptChunk,type:t.type,addressStr:t.addressStr,nHashType:t.nHashType,log:t.log})));return t}fromJSON(t){for(const e of Object.keys(t))this.map.set(e,t[e].map((t=>({nScriptChunk:t.nScriptChunk,type:t.type,addressStr:t.addressStr,nHashType:t.nHashType,log:t.log}))));return this}setOne(t,e,r,i="sig",s,o=n.a.SIGHASH_ALL|n.a.SIGHASH_FORKID){const a=t.toString("hex")+":"+e,u={nScriptChunk:r,type:i,addressStr:s,nHashType:o};return this.map.set(a,[u]),this}setMany(t,e,r){const i=t.toString("hex")+":"+e;return r=r.map((t=>({type:t.type||"sig",nHashType:t.nHashType||n.a.SIGHASH_ALL|n.a.SIGHASH_FORKID,...t}))),this.map.set(i,r),this}addOne(t,e,r,i="sig",s,o=n.a.SIGHASH_ALL|n.a.SIGHASH_FORKID){const a=this.get(t,e)||[];return a.push({nScriptChunk:r,type:i,addressStr:s,nHashType:o}),this.setMany(t,e,a),this}get(t,e){const r=t.toString("hex")+":"+e;return this.map.get(r)||[]}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(4),i=r(20);class s extends n.a{constructor(t=new Map){super({map:t})}toJSON(){const t={};for(const[e,r]of this.map.entries())t[e]=r.toHex();return t}fromJSON(t){for(const e of Object.keys(t))this.map.set(e,i.a.fromHex(t[e]));return this}set(t,e,r){const n=t.toString("hex")+":"+e;return this.map.set(n,r),this}get(t,e){const r=t.toString("hex")+":"+e;return this.map.get(r)}setTx(t){const e=t.hash().toString("hex");for(const[r,n]of t.txOuts.entries()){const t=e+":"+r;this.map.set(t,n)}return this}}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return d}));var n=r(37),i=r(12),s=r(6),o=r(3),a=r(86),u=r(4),f=r(15),h=r(10),c=r(2);class d extends u.a{constructor(t,e,r){super({blockHeader:t,txsVi:e,txs:r})}fromJSON(t){const e=[];for(const r of t.txs)e.push((new f.a).fromJSON(r));return this.fromObject({blockHeader:(new n.a).fromJSON(t.blockHeader),txsVi:(new h.a).fromJSON(t.txsVi),txs:e}),this}toJSON(){const t=[];for(const e of t)t.push(e.toJSON());return{blockHeader:this.blockHeader.toJSON(),txsVi:this.txsVi.toJSON(),txs:t}}fromBr(t){this.blockHeader=(new n.a).fromBr(t),this.txsVi=new h.a(t.readVarIntBuf());const e=this.txsVi.toNumber();this.txs=[];for(let r=0;rt.toBuffer())),r=a.a.fromBuffers(e).hash();return t.compare(r,this.blockHeader.merkleRootBuf)}static iterateTxs(t){const e=new i.a(t),r=(new n.a).fromBr(e),s=new h.a(e.readVarIntBuf()),o=s.toNumber();return{blockHeader:r,txsVi:s,txsNum:o,*[Symbol.iterator](){for(let t=0;t>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){"use strict";var n=r(25),i=r(43),s=r(52),o=r(30),a=n.sum32,u=n.sum32_4,f=n.sum32_5,h=s.ch32,c=s.maj32,d=s.s0_256,l=s.s1_256,p=s.g0_256,b=s.g1_256,m=i.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(y,m),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n>8,o=255&i;s?r.push(s,o):r.push(o)}return r},n.zero2=i,n.toHex=s,n.encode=function(t,e){return"hex"===e?s(t):t}},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=s(e,1,this._bitLength),i=(1<=u;e--)f=(f<<1)+n[e];o.push(f)}for(var h=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u=0;f--){for(e=0;f>=0&&0===o[f];f--)e++;if(f>=0&&e++,u=u.dblp(e),f<0)break;var h=o[f];a(0!==h),u="affine"===t.type?h>0?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):h>0?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,f=this._wnafT3,h=0,c=0;c=1;c-=2){var l=c-1,p=c;if(1===a[l]&&1===a[p]){var b=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(b[1]=e[l].add(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].add(e[p].neg())):(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=o(r[l],r[p]);h=Math.max(g[0].length,h),f[l]=new Array(h),f[p]=new Array(h);for(var y=0;y=0;c--){for(var O=0;c>=0;){var E=!0;for(y=0;y=0&&O++,_=_.dblp(O),c<0)break;for(y=0;y0?I=u[y][P-1>>1]:P<0&&(I=u[y][-P-1>>1].neg()),_="affine"===I.type?_.mixedAdd(I):_.add(I))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i64)throw new Error("More than 512 bits of entropy is nonstandard");const r=a.a.sha512Hmac(e,t.from("Bitcoin seed"));return this.depth=0,this.parentFingerPrint=t.from([0,0,0,0]),this.childIndex=0,this.chainCode=r.slice(32,64),this.versionBytesNum=this.Constants.privKey,this.privKey=(new this.PrivKey).fromBn((new i.a).fromBuffer(r.slice(0,32))),this.pubKey=(new h.a).fromPrivKey(this.privKey),this}static fromSeed(t){return(new this).fromSeed(t)}async asyncFromSeed(t){const e=await l.a.asyncObjectMethod(this,"fromSeed",[t]);return this.fromFastBuffer(e.resbuf)}static asyncFromSeed(t){return(new this).asyncFromSeed(t)}fromBuffer(t){if(78!==t.length)throw new Error("incorrect bip32 data length");this.versionBytesNum=t.slice(0,4).readUInt32BE(0),this.depth=t.slice(4,5).readUInt8(0),this.parentFingerPrint=t.slice(5,9),this.childIndex=t.slice(9,13).readUInt32BE(0),this.chainCode=t.slice(13,45);const e=t.slice(45,78),r=this.versionBytesNum===this.Constants.privKey,n=this.versionBytesNum===this.Constants.pubKey;if(r&&0===e[0])this.privKey=(new this.PrivKey).fromBn((new i.a).fromBuffer(e.slice(1,33))),this.pubKey=(new h.a).fromPrivKey(this.privKey);else{if(!n||2!==e[0]&&3!==e[0])throw new Error("Invalid key");this.pubKey=(new h.a).fromDer(e)}return this}fromFastBuffer(t){if(0===t.length)return this;if(78!==t.length&&111!==t.length)throw new Error("incorrect bip32 fastBuffer data length: "+t.length);this.versionBytesNum=t.slice(0,4).readUInt32BE(0),this.depth=t.slice(4,5).readUInt8(0),this.parentFingerPrint=t.slice(5,9),this.childIndex=t.slice(9,13).readUInt32BE(0),this.chainCode=t.slice(13,45);const e=t.slice(45,t.length),r=this.versionBytesNum===this.Constants.privKey,n=this.versionBytesNum===this.Constants.pubKey;if(r&&0===e[0]&&78===t.length)this.privKey=(new this.PrivKey).fromBn((new i.a).fromBuffer(e.slice(1,33))),this.pubKey=(new h.a).fromPrivKey(this.privKey);else{if(!n||111!==t.length)throw new Error("Invalid key");this.pubKey=(new h.a).fromFastBuffer(e),this.pubKey.compressed=!0}return this}derive(t){const e=t.split("/");if("m"===t)return this;let r=this;for(const t in e){const n=e[t];if("0"===t){if("m"!==n)throw new Error("invalid path");continue}if(parseInt(n.replace("'",""),10).toString()!==n.replace("'",""))throw new Error("invalid path");const i=n.length>1&&"'"===n[n.length-1];let s=2147483647&parseInt(i?n.slice(0,n.length-1):n,10);i&&(s+=2147483648),r=r.deriveChild(s)}return r}async asyncDerive(t){const e=await l.a.asyncObjectMethod(this,"derive",[t]);return(new this.constructor).fromFastBuffer(e.resbuf)}deriveChild(e){if("number"!=typeof e)throw new Error("i must be a number");const r=[];r.push(e>>24&255),r.push(e>>16&255),r.push(e>>8&255),r.push(255&e);const n=t.from(r),s=0!=(2147483648&e),o=this.versionBytesNum===this.Constants.privKey;if(s&&(!this.privKey||!o))throw new Error("Cannot do private key derivation without private key");let f=null;if(this.privKey){let e=null;e=s?t.concat([t.from([0]),this.privKey.bn.toBuffer({size:32}),n]):t.concat([this.pubKey.toBuffer(),n]);const r=a.a.sha512Hmac(e,this.chainCode),o=(new i.a).fromBuffer(r.slice(0,32)),c=r.slice(32,64),d=o.add(this.privKey.bn).mod(u.a.getN());f=new p,f.chainCode=c,f.privKey=(new this.PrivKey).fromBn(d),f.pubKey=(new h.a).fromPrivKey(f.privKey)}else{const e=t.concat([this.pubKey.toBuffer(),n]),r=a.a.sha512Hmac(e,this.chainCode),s=(new i.a).fromBuffer(r.slice(0,32)),o=r.slice(32,64),c=u.a.getG().mul(s),d=this.pubKey.point,l=c.add(d),b=new h.a;b.point=l,f=new p,f.chainCode=o,f.pubKey=b}f.childIndex=e;const c=a.a.sha256Ripemd160(this.pubKey.toBuffer());return f.parentFingerPrint=c.slice(0,4),f.versionBytesNum=this.versionBytesNum,f.depth=this.depth+1,f}toPublic(){const t=(new p).fromObject(this);return t.versionBytesNum=this.Constants.pubKey,t.privKey=void 0,t}toBuffer(){const t=this.versionBytesNum===this.Constants.privKey,e=this.versionBytesNum===this.Constants.pubKey;if(t)return(new s.a).writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).writeUInt8(0).write(this.privKey.bn.toBuffer({size:32})).toBuffer();if(e){if(!1===this.pubKey.compressed)throw new Error("cannot convert bip32 to buffer if pubKey is not compressed");return(new s.a).writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).write(this.pubKey.toBuffer()).toBuffer()}throw new Error("bip32: invalid versionBytesNum byte")}toFastBuffer(){if(!this.versionBytesNum)return t.alloc(0);const e=this.versionBytesNum===this.Constants.privKey,r=this.versionBytesNum===this.Constants.pubKey;if(e)return(new s.a).writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).writeUInt8(0).write(this.privKey.bn.toBuffer({size:32})).toBuffer();if(r)return(new s.a).writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).write(this.pubKey.toFastBuffer()).toBuffer();throw new Error("bip32: invalid versionBytesNum byte")}toString(){return n.a.encode(this.toBuffer())}async asyncToString(){const t=await l.a.asyncObjectMethod(this,"toString",[]);return JSON.parse(t.resbuf.toString())}toJSON(){return this.toFastHex()}fromJSON(t){return this.fromFastHex(t)}isPrivate(){return this.versionBytesNum===this.Constants.privKey}}p.Mainnet=class extends p{constructor(t,e,r,n,i,s,a){super(t,e,r,n,i,s,a,o.a.Mainnet.Bip32,f.a.Mainnet)}},p.Testnet=class extends p{constructor(t,e,r,n,i,s,a){super(t,e,r,n,i,s,a,o.a.Testnet.Bip32,f.a.Testnet)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return h}));var n=r(84),i=r(85),s=r(6),o=r(3),a=r(16),u=r(4),f=r(2);class h extends u.a{constructor(t,e,r=i.a){super({mnemonic:t,seed:e}),this.Wordlist=r}toBw(e){if(e||(e=new s.a),this.mnemonic){const r=t.from(this.mnemonic);e.writeVarIntNum(r.length),e.write(r)}else e.writeVarIntNum(0);return this.seed?(e.writeVarIntNum(this.seed.length),e.write(this.seed)):e.writeVarIntNum(0),e}fromBr(t){const e=t.readVarIntNum();e>0&&(this.mnemonic=t.read(e).toString());const r=t.readVarIntNum();return r>0&&(this.seed=t.read(r)),this}fromRandom(t){if(t||(t=128),t%32!=0)throw new Error("bits must be multiple of 32");if(t<128)throw new Error("bits must be at least 128");const e=a.a.getRandomBuffer(t/8);return this.entropy2Mnemonic(e),this.mnemonic2Seed(),this}static fromRandom(t){return(new this).fromRandom(t)}async asyncFromRandom(t){t||(t=128);const e=a.a.getRandomBuffer(t/8);let r=await f.a.asyncObjectMethod(this,"entropy2Mnemonic",[e]);const n=(new h).fromFastBuffer(r.resbuf);return r=await f.a.asyncObjectMethod(n,"mnemonic2Seed",[]),this.fromFastBuffer(r.resbuf)}static asyncFromRandom(t){return(new this).asyncFromRandom(t)}fromEntropy(t){return this.entropy2Mnemonic(t),this}static fromEntropy(t){return(new this).fromEntropy(t)}async asyncFromEntropy(t){const e=await f.a.asyncObjectMethod(this,"fromEntropy",[t]);return this.fromFastBuffer(e.resbuf)}static asyncFromEntropy(t){return(new this).asyncFromEntropy(t)}fromString(t){return this.mnemonic=t,this}toString(){return this.mnemonic}toSeed(t){return this.mnemonic2Seed(t),this.seed}async asyncToSeed(t){void 0===t&&(t="");const e=[t];return(await f.a.asyncObjectMethod(this,"toSeed",e)).resbuf}entropy2Mnemonic(e){if(!t.isBuffer(e)||e.length<16)throw new Error("Entropy is less than 128 bits. It must be 128 bits or more.");const r=o.a.sha256(e);let n="";const i=8*e.length;for(let t=0;tr||e!=e)throw new TypeError("Bad key length")}},function(t,e,r){(function(e){var r;r=e.browser?"utf-8":e.version?parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",t.exports=r}).call(this,r(26))},function(t,e,r){var n=r(109),i=r(120),s=r(121),o=r(21).Buffer,a=r(62),u=r(63),f=r(76),h=o.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,r){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?n:function(e){return s(t).update(e).digest()}}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length=this._blockSize;){for(var s=this._blockOffset;s0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},s.prototype._update=function(){throw new Error("_update is not implemented")},s.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},s.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=s},function(t,e,r){"use strict";(function(e,n){var i;t.exports=I,I.ReadableState=E,r(67).EventEmitter;var s,o=function(t,e){return t.listeners(e).length},a=r(68),u=r(7).Buffer,f=e.Uint8Array||function(){},h=r(112);s=h&&h.debuglog?h.debuglog("stream"):function(){};var c,d,l,p=r(113),b=r(69),m=r(70).getHighWaterMark,g=r(34).codes,y=g.ERR_INVALID_ARG_TYPE,v=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(17)(I,a);var S=b.errorOrDestroy,O=["error","close","destroy","pause","resume"];function E(t,e,n){i=i||r(35),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(72).StringDecoder),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function I(t){if(i=i||r(35),!(this instanceof I))return new I(t);var e=this instanceof i;this._readableState=new E(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function P(t,e,r,n,i){s("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(s("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?k(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,x(t)))}}(t,a);else if(i||(o=function(t,e){var r,n;return n=e,u.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),o)S(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n)a.endEmitted?S(t,new _):M(t,a,e,!0);else if(a.ended)S(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?M(t,a,e,!1):R(t,a)):M(t,a,e,!1)}else n||(a.reading=!1,R(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;s("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(s("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(x,t))}function x(t){var e=t._readableState;s("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,L(t)}function R(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(T,t,e))}function T(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function N(t){s("readable nexttick read 0"),t.read(0)}function C(t,e){s("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),L(t),e.flowing&&!e.reading&&t.read(0)}function L(t){var e=t._readableState;for(s("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){var r;return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r)}function D(t){var e=t._readableState;s("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(H,e,t))}function H(t,e){if(s("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function j(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return s("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?D(this):k(this),null;if(0===(t=A(t,e))&&e.ended)return 0===e.length&&D(this),null;var n,i=e.needReadable;return s("need readable",i),(0===e.length||e.length-t0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&D(this)),null!==n&&this.emit("data",n),n},I.prototype._read=function(t){S(this,new w("_read()"))},I.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,s("pipe count=%d opts=%j",i.pipesCount,e);var a=e&&!1===e.end||t===n.stdout||t===n.stderr?b:u;function u(){s("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",(function e(n,o){s("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,s("cleanup"),t.removeListener("close",l),t.removeListener("finish",p),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",e),r.removeListener("end",u),r.removeListener("end",b),r.removeListener("data",c),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}));var f=function(t){return function(){var e=t._readableState;s("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,L(t))}}(r);t.on("drain",f);var h=!1;function c(e){s("ondata");var n=t.write(e);s("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==j(i.pipes,t))&&!h&&(s("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){s("onerror",e),b(),t.removeListener("error",d),0===o(t,"error")&&S(t,e)}function l(){t.removeListener("finish",p),b()}function p(){s("onfinish"),t.removeListener("close",l),b()}function b(){s("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",l),t.once("finish",p),t.emit("pipe",r),i.flowing||(s("pipe resume"),r.resume()),t},I.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?k(this):i.reading||n.nextTick(N,this))),r},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(B,this),r},I.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(B,this),e},I.prototype.resume=function(){var t=this._readableState;return t.flowing||(s("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(C,t,e))}(this,t)),t.paused=!1,this},I.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(s("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var f=u.length,h=m(u,f);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):b.call(t,e)},a.prototype.listenerCount=b,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){t.exports=r(67).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,s){var o=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(s?s(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!s&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(n,o):(o._writableState.errorEmitted=!0,e.nextTick(r,o,t)):e.nextTick(r,o,t):s?(e.nextTick(n,o),s(t)):e.nextTick(n,o)})),this)},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.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(26))},function(t,e,r){"use strict";var n=r(34).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var s=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new n(i?r:"highWaterMark",s);return Math.floor(s)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(undefined),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var s;t.exports=I,I.WritableState=E;var o,a={deprecate:r(115)},u=r(68),f=r(7).Buffer,h=e.Uint8Array||function(){},c=r(69),d=r(70).getHighWaterMark,l=r(34).codes,p=l.ERR_INVALID_ARG_TYPE,b=l.ERR_METHOD_NOT_IMPLEMENTED,m=l.ERR_MULTIPLE_CALLBACK,g=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,v=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,_=l.ERR_UNKNOWN_ENCODING,S=c.errorOrDestroy;function O(){}function E(t,e,o){s=s||r(35),t=t||{},"boolean"!=typeof o&&(o=e instanceof s),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,s=r.writecb;if("function"!=typeof s)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,s){--e.pendingcb,r?(n.nextTick(s,i),n.nextTick(R,t,e),t._writableState.errorEmitted=!0,S(t,i)):(s(i),t._writableState.errorEmitted=!0,S(t,i),R(t,e))}(t,r,i,e,s);else{var o=k(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||A(t,r),i?n.nextTick(M,t,r,o,s):M(t,r,o,s)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function I(t){var e=this instanceof(s=s||r(35));if(!e&&!o.call(I,this))return new I(t);this._writableState=new E(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function P(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),R(t,e)}function A(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,s=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)s[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;s.allBuffers=u,P(t,e,!0,e.length,s,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,h=r.encoding,c=r.callback;if(P(t,e,!1,e.objectMode?1:f.length,f,h,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function k(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(r){e.pendingcb--,r&&S(t,r),e.prefinished=!0,t.emit("prefinish"),R(t,e)}))}function R(t,e){var r=k(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(x,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(17)(I,u),E.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(E.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(t){return!!o.call(this,t)||this===I&&t&&t._writableState instanceof E}})):o=function(t){return t instanceof this},I.prototype.pipe=function(){S(this,new g)},I.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,f.isBuffer(i)||i instanceof h);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=O),s.ending?function(t,e){var r=new w;S(t,r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var s;return null===r?s=new v:"string"==typeof r||e.objectMode||(s=new p("chunk",["string","Buffer"],r)),!s||(S(t,s),n.nextTick(i,s),!1)}(this,s,t,r))&&(s.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(t,e,r){r(new b("_write()"))},I.prototype._writev=null,I.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,R(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=c.destroy,I.prototype._undestroy=c.undestroy,I.prototype._destroy=function(t,e){e(t)}}).call(this,r(33),r(26))},function(t,e,r){"use strict";var n=r(21).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=h;var n=r(34).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(35);function f(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function l(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+l(r[g-15])+r[g-16];for(var y=0;y<64;++y){var v=m+d(u)+f(u,p,b)+o[y]+r[y]|0,w=c(n)+h(n,i,s)|0;m=b,b=p,p=u,u=a+v|0,a=s,s=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=s.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var n=r(17),i=r(36),s=r(21).Buffer,o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,S=0|this._cl,O=0|this._dl,E=0|this._el,I=0|this._fl,P=0|this._gl,M=0|this._hl,A=0;A<32;A+=2)e[A]=t.readInt32BE(4*A),e[A+1]=t.readInt32BE(4*A+4);for(;A<160;A+=2){var k=e[A-30],x=e[A-30+1],R=l(k,x),T=p(x,k),B=b(k=e[A-4],x=e[A-4+1]),N=m(x,k),C=e[A-14],L=e[A-14+1],U=e[A-32],D=e[A-32+1],H=T+L|0,j=R+C+g(H,T)|0;j=(j=j+B+g(H=H+N|0,N)|0)+U+g(H=H+D|0,D)|0,e[A]=j,e[A+1]=H}for(var F=0;F<160;F+=2){j=e[F],H=e[F+1];var K=h(r,n,i),V=h(w,_,S),q=c(r,w),G=c(w,r),Y=d(a,E),z=d(E,a),W=o[F],J=o[F+1],Z=f(a,u,y),X=f(E,I,P),Q=M+z|0,$=v+Y+g(Q,M)|0;$=($=($=$+Z+g(Q=Q+X|0,X)|0)+W+g(Q=Q+J|0,J)|0)+j+g(Q=Q+H|0,H)|0;var tt=G+V|0,et=q+K+g(tt,G)|0;v=y,M=P,y=u,P=I,u=a,I=E,a=s+$+g(E=O+Q|0,O)|0,s=i,O=S,i=n,S=_,n=r,_=w,r=$+et+g(w=Q+tt|0,Q)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+O|0,this._el=this._el+E|0,this._fl=this._fl+I|0,this._gl=this._gl+P|0,this._hl=this._hl+M|0,this._ah=this._ah+r+g(this._al,w)|0,this._bh=this._bh+n+g(this._bl,_)|0,this._ch=this._ch+i+g(this._cl,S)|0,this._dh=this._dh+s+g(this._dl,O)|0,this._eh=this._eh+a+g(this._el,E)|0,this._fh=this._fh+u+g(this._fl,I)|0,this._gh=this._gh+y+g(this._gl,P)|0,this._hh=this._hh+v+g(this._hl,M)|0},u.prototype._hash=function(){var t=s.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,r){var n=r(21).Buffer;t.exports=function(t,e,r){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,e);if(ArrayBuffer.isView(t))return n.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return d}));var n=r(28),i=r(6),s=r(18),o=r(29),a=r(3),u=r(22),f=r(5),h=r(4),c=r(2);class d extends h.a{constructor(t,e,r,n,i){super({messageBuf:t,keyPair:e,sig:r,address:n,verified:i})}static magicHash(e){if(!t.isBuffer(e))throw new Error("messageBuf must be a buffer");const r=new i.a;r.writeVarIntNum(d.magicBytes.length),r.write(d.magicBytes),r.writeVarIntNum(e.length),r.write(e);const n=r.toBuffer();return a.a.sha256Sha256(n)}static async asyncMagicHash(t){const e=[t];return(await c.a.asyncClassMethod(d,"magicHash",e)).resbuf}static sign(t,e){const r=new d(t,e);return r.sign(),r.sig.toCompact().toString("base64")}static async asyncSign(t,e){const r=[t,e],n=await c.a.asyncClassMethod(d,"sign",r);return JSON.parse(n.resbuf.toString())}static verify(e,r,n){const i=t.from(r,"base64"),s=new d;return s.messageBuf=e,s.sig=(new f.a).fromCompact(i),s.address=n,s.verify().verified}static async asyncVerify(t,e,r){const n=[t,e,r],i=await c.a.asyncClassMethod(d,"verify",n);return JSON.parse(i.resbuf.toString())}sign(){const t=d.magicHash(this.messageBuf),e=(new o.a).fromObject({hashBuf:t,keyPair:this.keyPair});return e.sign(),e.calcrecovery(),this.sig=e.sig,this}verify(){const t=d.magicHash(this.messageBuf),e=new o.a;if(e.hashBuf=t,e.sig=this.sig,e.keyPair=new u.a,e.keyPair.pubKey=e.sig2PubKey(),!e.verify())return this.verified=!1,this;const r=(new n.a).fromPubKey(e.keyPair.pubKey);return Object(s.a)(r.hashBuf,this.address.hashBuf)?this.verified=!0:this.verified=!1,this}}d.magicBytes=t.from("Bitcoin Signed Message:\n")}).call(this,r(7).Buffer)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return g}));var n=r(28),i=r(1),s=r(19),o=r(41),a=r(9),u=r(5),f=r(46),h=r(4),c=r(15),d=r(13),l=r(20),p=r(47),b=r(10);const m=s.a.Default.TxBuilder;class g extends h.a{constructor(t=new c.a,e=[],r=[],n=new p.a,i=new f.a,s,a,u,h=m.feePerKbNum,d=0,l=1,b=1,g=m.dust,y=!1,v=new o.a){super({tx:t,txIns:e,txOuts:r,uTxOutMap:n,sigOperations:i,changeScript:s,changeAmountBn:a,feeAmountBn:u,feePerKbNum:h,nLockTime:d,versionBytesNum:l,sigsPerInput:b,dust:g,dustChangeToFees:y,hashCache:v})}toJSON(){const t={};return t.tx=this.tx.toHex(),t.txIns=this.txIns.map((t=>t.toHex())),t.txOuts=this.txOuts.map((t=>t.toHex())),t.uTxOutMap=this.uTxOutMap.toJSON(),t.sigOperations=this.sigOperations.toJSON(),t.changeScript=this.changeScript?this.changeScript.toHex():void 0,t.changeAmountBn=this.changeAmountBn?this.changeAmountBn.toNumber():void 0,t.feeAmountBn=this.feeAmountBn?this.feeAmountBn.toNumber():void 0,t.feePerKbNum=this.feePerKbNum,t.sigsPerInput=this.sigsPerInput,t.dust=this.dust,t.dustChangeToFees=this.dustChangeToFees,t.hashCache=this.hashCache.toJSON(),t}fromJSON(t){return this.tx=(new c.a).fromHex(t.tx),this.txIns=t.txIns.map((t=>d.a.fromHex(t))),this.txOuts=t.txOuts.map((t=>l.a.fromHex(t))),this.uTxOutMap=(new p.a).fromJSON(t.uTxOutMap),this.sigOperations=(new f.a).fromJSON(t.sigOperations),this.changeScript=t.changeScript?(new a.a).fromHex(t.changeScript):void 0,this.changeAmountBn=t.changeAmountBn?new i.a(t.changeAmountBn):void 0,this.feeAmountBn=t.feeAmountBn?new i.a(t.feeAmountBn):void 0,this.feePerKbNum=t.feePerKbNum||this.feePerKbNum,this.sigsPerInput=t.sigsPerInput||this.sigsPerInput,this.dust=t.dust||this.dust,this.dustChangeToFees=t.dustChangeToFees||this.dustChangeToFees,this.hashCache=o.a.fromJSON(t.hashCache),this}setFeePerKbNum(t){if("number"!=typeof t||t<0)throw new Error("cannot set a fee of zero or less");return this.feePerKbNum=t,this}setChangeAddress(t){return this.changeScript=t.toTxOutScript(),this}setChangeScript(t){return this.changeScript=t,this}setNLocktime(t){return this.nLockTime=t,this}setVersion(t){return this.versionBytesNum=t,this}setDust(t=m.dust){return this.dust=t,this}sendDustChangeToFees(t=!1){return this.dustChangeToFees=t,this}importPartiallySignedTx(t,e=this.uTxOutMap,r=this.sigOperations){return this.tx=t,this.uTxOutMap=e,this.sigOperations=r,this}inputFromScript(e,r,n,i,s){if(!(t.isBuffer(e)&&"number"==typeof r&&n instanceof l.a&&i instanceof a.a))throw new Error("invalid one of: txHashBuf, txOutNum, txOut, script");return this.txIns.push(d.a.fromProperties(e,r,i,s)),this.uTxOutMap.set(e,r,n),this}addSigOperation(t,e,r,n,i,s){return this.sigOperations.addOne(t,e,r,n,i,s),this}inputFromPubKeyHash(e,r,i,s,o,a){if(!(t.isBuffer(e)&&"number"==typeof r&&i instanceof l.a))throw new Error("invalid one of: txHashBuf, txOutNum, txOut");this.txIns.push((new d.a).fromObject({nSequence:o}).fromPubKeyHashTxOut(e,r,i,s)),this.uTxOutMap.set(e,r,i);const u=n.a.fromTxOutScript(i.script).toString();return this.addSigOperation(e,r,0,"sig",u,a),this.addSigOperation(e,r,1,"pubKey",u),this}outputToAddress(t,e){if(!(e instanceof n.a&&t instanceof i.a))throw new Error("addr must be an Address, and valueBn must be a Bn");const r=(new a.a).fromPubKeyHash(e.hashBuf);return this.outputToScript(t,r),this}outputToScript(t,e){if(!(e instanceof a.a&&t instanceof i.a))throw new Error("script must be a Script, and valueBn must be a Bn");const r=l.a.fromProperties(t,e);return this.txOuts.push(r),this}buildOutputs(){let t=new i.a(0);for(const e of this.txOuts){if(e.valueBn.lt(this.dust)&&!e.script.isNonSpendable())throw new Error("cannot create output lesser than dust");t=t.add(e.valueBn),this.tx.addTxOut(e)}return t}buildInputs(t,e=0){let r=new i.a(0);for(const n of this.txIns){const i=this.uTxOutMap.get(n.txHashBuf,n.txOutNum);if(r=r.add(i.valueBn),this.tx.addTxIn(n),r.geq(t)){if(e<=0)break;e--}}if(r.lt(t))throw new Error("not enough funds for outputs: inAmountBn "+r.toNumber()+" outAmountBn "+t.toNumber());return r}estimateSize(){let t=this.tx.toBuffer().length;for(const e of this.tx.txIns){const{txHashBuf:r,txOutNum:n}=e,i=this.sigOperations.get(r,n);for(const r of i){const{nScriptChunk:n,type:i}=r;if(t-=new a.a([e.script.chunks[n]]).toBuffer().length,"sig"===i)t+=72;else{if("pubKey"!==r.type)throw new Error("unsupported sig operations type");t+=35}}}return t+=1,Math.round(t)}estimateFee(t=new i.a(0)){const e=Math.ceil(this.estimateSize()/1e3*this.feePerKbNum);return new i.a(e).add(t)}build(t={useAllInputs:!1}){let e;if(this.txIns.length<=0)throw Error("tx-builder number of inputs must be greater than 0");if(!this.changeScript)throw new Error("must specify change script to use build method");for(let r=t.useAllInputs?this.txIns.length-1:0;rn.a.MAX_BLOCK_SIZE)return this.errStr="transaction over the maximum block size",this.errStr;let t=new i.a(0);for(let e=0;e100)return this.errStr="coinbase trasaction script size invalid",this.errStr}else for(let t=0;t4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o0?o-4:o;for(r=0;r>16&255,u[h++]=e>>8&255,u[h++]=255&e;return 2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[h++]=255&e),1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e),u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=0,a=r-i;oa?a:o+16383));return 1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,s,o=[],a=e;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */e.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,d=r?-1:1,l=t[e+c];for(c+=d,s=l&(1<<-h)-1,l>>=-h,h+=a;h>0;s=256*s+t[e+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=n;h>0;o=256*o+t[e+c],c+=d,h-=8);if(0===s)s=1-f;else{if(s===u)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,n),s-=f}return(l?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,r,n,i,s){var o,a,u,f=8*s-i-1,h=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:s-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?d/u:d*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(e*u-1)*Math.pow(2,i),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+l]=255&a,l+=p,a/=256,i-=8);for(o=o<0;t[r+l]=255&o,l+=p,o/=256,f-=8);t[r+l-p]|=128*b}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=r(21).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(o);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var d=0,l=o-1;(0!==c||d>>0,h[l]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");s=d,r++}if(" "!==t[r]){for(var p=o-s;p!==o&&0===h[p];)p++;var b=n.allocUnsafe(i+(o-p));b.fill(0,0,i);for(var m=i;p!==o;)b[m++]=h[p++];return b}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,s=0,o=e.length;s!==o&&0===e[s];)s++,r++;for(var f=(o-s)*h+1>>>0,c=new Uint8Array(f);s!==o;){for(var d=e[s],l=0,p=f-1;(0!==d||l>>0,c[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");i=l,s++}for(var b=f-i;b!==f&&0===c[b];)b++;for(var m=u.repeat(r);bthis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e","contributors":[{"name":"Ryan X. Charles","email":"ryanxcharles@gmail.com"}],"license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/moneybutton/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.0.8","grunt":"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^2.1.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^4.0.1","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.2","jscs":"^3.0.7","jshint":"^2.11.1","mocha":"^7.1.2"},"dependencies":{"bn.js":"^5.1.1","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},"_resolved":"https://registry.npmjs.org/bitcoin-elliptic/-/bitcoin-elliptic-7.0.1.tgz","_integrity":"sha512-eJIERwXIIjJK7gfVoevk0G1CbYbxezZ6ePZXIxngjyI+QQHXWqXMbY+gpxsND8FCLvWl050fw6W+PVZge5fBHw==","_from":"bitcoin-elliptic@7.0.1"}')},function(t,e){},function(t,e,r){"use strict";var n=r(31),i=r(14),s=r(17),o=r(58),a=n.assert;function u(t){o.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(t,e,r,n){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(u,o),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),s=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,s,o,a,u,f,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),g=new i(1),y=0;0!==d.cmpn(0);){var v=l.div(d);f=l.sub(v.mul(d)),h=m.sub(v.mul(p));var w=g.sub(v.mul(b));if(!n&&f.cmp(c)<0)e=u.neg(),r=p,n=f.neg(),s=h;else if(n&&2==++y)break;u=f,l=d,d=f,m=p,p=h,g=b,b=w}o=f.neg(),a=h;var _=n.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=e,a=r),n.negative&&(n=n.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),f=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=n.fromRed().isOdd();return(e&&!s||!e&&s)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(h,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=n.redMul(f),d=u.redSqr().redIAdd(h).redISub(c).redISub(c),l=u.redMul(c.redISub(d)).redISub(s.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),f=u.redMul(o),h=r.redMul(u),c=a.redSqr().redIAdd(f).redISub(h).redISub(h),d=a.redMul(h.redISub(c)).redISub(i.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(c,d,l)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,r){"use strict";var n=r(14),i=r(105),s=r(31),o=r(59),a=r(56),u=s.assert,f=r(106),h=r(107);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(u(o.hasOwnProperty(t),"Unknown curve "+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=c,c.prototype.keyPair=function(t){return new f(this,t)},c.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new n(2));;){var o=new n(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,s){"object"==typeof r&&(s=r,r=null),s||(s={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new i({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),c=this.n.sub(new n(1)),d=0;;d++){var l=s.k?s.k(d):new n(f.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var g=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return s.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new h({r:m,s:g,recoveryParam:y})}}}}}},c.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var s=(e=new h(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,u=o.invm(this.n),f=u.mul(t).umod(this.n),c=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},c.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var s=this.n,o=new n(t),a=e.r,f=e.s,c=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=e.r.invm(s),p=s.sub(o).mul(l).umod(s),b=f.mul(l).umod(s);return this.g.mulAdd(p,a,b)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var n=r(32),i=r(55),s=r(30);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=o,o.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var s=[];s.length"}},function(t,e,r){"use strict";var n=r(14),i=r(31),s=i.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,s=0,o=e.place;s>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;if(u(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r),o=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=u(t,r);if(t.length!==f+r.place)return!1;var h=t.slice(r.place,f+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(o),this.s=new n(h),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=f(e),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var s=n.concat(r),o=[48];return h(o,s.length),o=o.concat(s),i.encode(o,t)}},function(t,e,r){(function(e,n){var i,s=r(21).Buffer,o=r(62),a=r(63),u=r(64),f=r(76),h=e.crypto&&e.crypto.subtle,c={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"},d=[];function l(t,e,r,n,i){return h.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return h.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return s.from(t)}))}t.exports=function(t,r,p,b,m,g){"function"==typeof m&&(g=m,m=void 0);var y=c[(m=m||"sha1").toLowerCase()];if(!y||"function"!=typeof e.Promise)return n.nextTick((function(){var e;try{e=u(t,r,p,b,m)}catch(t){return g(t)}g(null,e)}));if(o(p,b),t=f(t,a,"Password"),r=f(r,a,"Salt"),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){n.nextTick((function(){e(null,t)}))}),(function(t){n.nextTick((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==d[t])return d[t];var r=l(i=i||s.alloc(8),i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return d[t]=r,r}(y).then((function(e){return e?l(t,r,p,b,y):u(t,r,p,b,m)})),g)}}).call(this,r(33),r(26))},function(t,e,r){var n=r(110);t.exports=function(t){return(new n).update(t).digest()}},function(t,e,r){"use strict";var n=r(17),i=r(65),s=r(21).Buffer,o=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function f(t,e,r,n,i,s,o){return u(t+(e&r|~e&n)+i+s|0,o)+e|0}function h(t,e,r,n,i,s,o){return u(t+(e&n|r&~n)+i+s|0,o)+e|0}function c(t,e,r,n,i,s,o){return u(t+(e^r^n)+i+s|0,o)+e|0}function d(t,e,r,n,i,s,o){return u(t+(r^(e|~n))+i+s|0,o)+e|0}n(a,i),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,s=this._d;r=f(r,n,i,s,t[0],3614090360,7),s=f(s,r,n,i,t[1],3905402710,12),i=f(i,s,r,n,t[2],606105819,17),n=f(n,i,s,r,t[3],3250441966,22),r=f(r,n,i,s,t[4],4118548399,7),s=f(s,r,n,i,t[5],1200080426,12),i=f(i,s,r,n,t[6],2821735955,17),n=f(n,i,s,r,t[7],4249261313,22),r=f(r,n,i,s,t[8],1770035416,7),s=f(s,r,n,i,t[9],2336552879,12),i=f(i,s,r,n,t[10],4294925233,17),n=f(n,i,s,r,t[11],2304563134,22),r=f(r,n,i,s,t[12],1804603682,7),s=f(s,r,n,i,t[13],4254626195,12),i=f(i,s,r,n,t[14],2792965006,17),r=h(r,n=f(n,i,s,r,t[15],1236535329,22),i,s,t[1],4129170786,5),s=h(s,r,n,i,t[6],3225465664,9),i=h(i,s,r,n,t[11],643717713,14),n=h(n,i,s,r,t[0],3921069994,20),r=h(r,n,i,s,t[5],3593408605,5),s=h(s,r,n,i,t[10],38016083,9),i=h(i,s,r,n,t[15],3634488961,14),n=h(n,i,s,r,t[4],3889429448,20),r=h(r,n,i,s,t[9],568446438,5),s=h(s,r,n,i,t[14],3275163606,9),i=h(i,s,r,n,t[3],4107603335,14),n=h(n,i,s,r,t[8],1163531501,20),r=h(r,n,i,s,t[13],2850285829,5),s=h(s,r,n,i,t[2],4243563512,9),i=h(i,s,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,s,r,t[12],2368359562,20),i,s,t[5],4294588738,4),s=c(s,r,n,i,t[8],2272392833,11),i=c(i,s,r,n,t[11],1839030562,16),n=c(n,i,s,r,t[14],4259657740,23),r=c(r,n,i,s,t[1],2763975236,4),s=c(s,r,n,i,t[4],1272893353,11),i=c(i,s,r,n,t[7],4139469664,16),n=c(n,i,s,r,t[10],3200236656,23),r=c(r,n,i,s,t[13],681279174,4),s=c(s,r,n,i,t[0],3936430074,11),i=c(i,s,r,n,t[3],3572445317,16),n=c(n,i,s,r,t[6],76029189,23),r=c(r,n,i,s,t[9],3654602809,4),s=c(s,r,n,i,t[12],3873151461,11),i=c(i,s,r,n,t[15],530742520,16),r=d(r,n=c(n,i,s,r,t[2],3299628645,23),i,s,t[0],4096336452,6),s=d(s,r,n,i,t[7],1126891415,10),i=d(i,s,r,n,t[14],2878612391,15),n=d(n,i,s,r,t[5],4237533241,21),r=d(r,n,i,s,t[12],1700485571,6),s=d(s,r,n,i,t[3],2399980690,10),i=d(i,s,r,n,t[10],4293915773,15),n=d(n,i,s,r,t[1],2240044497,21),r=d(r,n,i,s,t[8],1873313359,6),s=d(s,r,n,i,t[15],4264355552,10),i=d(i,s,r,n,t[6],2734768916,15),n=d(n,i,s,r,t[13],1309151649,21),r=d(r,n,i,s,t[4],4149444226,6),s=d(s,r,n,i,t[11],3174756917,10),i=d(i,s,r,n,t[2],718787259,15),n=d(n,i,s,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=s.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(e=t.exports=r(66)).Stream=e,e.Readable=e,e.Writable=r(71),e.Duplex=r(35),e.Transform=r(73),e.PassThrough=r(118),e.finished=r(50),e.pipeline=r(119)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,n,i=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=i,n=a,o.prototype.copy.call(e,r,n),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(s===i.length?n+=i:n+=i.slice(0,t),0==(t-=s)){s===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0==(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e0,(function(t){n||(n=t),t&&o.forEach(f),s||(o.forEach(f),i(n))}))}));return e.reduce(h)}},function(t,e,r){"use strict";var n=r(7).Buffer,i=r(17),s=r(65),o=new Array(16),a=[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],u=[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],f=[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],h=[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],c=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function l(){s.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function b(t,e,r,n,i,s,o,a){return p(t+(e^r^n)+s+o|0,a)+i|0}function m(t,e,r,n,i,s,o,a){return p(t+(e&r|~e&n)+s+o|0,a)+i|0}function g(t,e,r,n,i,s,o,a){return p(t+((e|~r)^n)+s+o|0,a)+i|0}function y(t,e,r,n,i,s,o,a){return p(t+(e&n|r&~n)+s+o|0,a)+i|0}function v(t,e,r,n,i,s,o,a){return p(t+(e^(r|~n))+s+o|0,a)+i|0}i(l,s),l.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,l=0|this._e,w=0|this._a,_=0|this._b,S=0|this._c,O=0|this._d,E=0|this._e,I=0;I<80;I+=1){var P,M;I<16?(P=b(r,n,i,s,l,t[a[I]],c[0],f[I]),M=v(w,_,S,O,E,t[u[I]],d[0],h[I])):I<32?(P=m(r,n,i,s,l,t[a[I]],c[1],f[I]),M=y(w,_,S,O,E,t[u[I]],d[1],h[I])):I<48?(P=g(r,n,i,s,l,t[a[I]],c[2],f[I]),M=g(w,_,S,O,E,t[u[I]],d[2],h[I])):I<64?(P=y(r,n,i,s,l,t[a[I]],c[3],f[I]),M=m(w,_,S,O,E,t[u[I]],d[3],h[I])):(P=v(r,n,i,s,l,t[a[I]],c[4],f[I]),M=b(w,_,S,O,E,t[u[I]],d[4],h[I])),r=l,l=s,s=p(i,10),i=n,n=P,w=E,E=O,O=p(S,10),S=_,_=M}var A=this._b+i+O|0;this._b=this._c+s+E|0,this._c=this._d+l+w|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=A},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=l},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(122),e.sha1=r(123),e.sha224=r(124),e.sha256=r(74),e.sha384=r(125),e.sha512=r(75)},function(t,e,r){var n=r(17),i=r(36),s=r(21).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var d=0;d<80;++d){var l=~~(d/20),p=0|((e=n)<<5|e>>>27)+h(l,i,s,a)+u+r[d]+o[l];u=a,a=s,s=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(17),i=r(36),s=r(21).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var l=0;l<80;++l){var p=~~(l/20),b=f(n)+c(p,i,s,a)+u+r[l]+o[p]|0;u=a,a=s,s=h(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(17),i=r(74),s=r(36),o=r(21).Buffer,a=new Array(64);function u(){this.init(),this._w=a,s.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var n=r(17),i=r(75),s=r(36),o=r(21).Buffer,a=new Array(160);function u(){this.init(),this._w=a,s.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e){function r(t){var e,r,n;this._tables[0][0][0]||this._precompute();var i=this._tables[0][4],s=this._tables[1],o=t.length,a=1;if(4!==o&&6!==o&&8!==o)throw new Error("invalid aes key size");this._key=[r=t.slice(0),n=[]];for(var u=o;u<4*o+28;u++)e=r[u-1],(u%o==0||8===o&&u%o==4)&&(e=i[e>>>24]<<24^i[e>>16&255]<<16^i[e>>8&255]<<8^i[255&e],u%o==0&&(e=e<<8^e>>>24^a<<24,a=a<<1^283*(a>>7))),r[u]=r[u-o]^e;for(var f=0;u;f++,u--)e=r[3&f?u:u-4],n[f]=u<=4||f<4?e:s[0][i[e>>>24]]^s[1][i[e>>16&255]]^s[2][i[e>>8&255]]^s[3][i[255&e]]}t.exports=r,r.prototype={encrypt:function(t){return this._crypt(t,0)},decrypt:function(t){return this._crypt(t,1)},_tables:[[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]],_precompute:function(){var t,e,r,n,i,s,o,a,u=this._tables[0],f=this._tables[1],h=u[4],c=f[4],d=new Uint8Array(256),l=new Uint8Array(256);for(t=0;t<256;t++)l[(d[t]=t<<1^283*(t>>7))^t]=t;for(e=r=0;!h[e];e^=n||1,r=l[r]||1)for(s=(s=r^r<<1^r<<2^r<<3^r<<4)>>8^255&s^99,h[e]=s,c[s]=e,a=16843009*d[i=d[n=d[e]]]^65537*i^257*n^16843008*e,o=257*d[s]^16843008*s,t=0;t<4;t++)u[t][e]=o=o<<24^o>>>8,f[t][s]=a=a<<24^a>>>8},_crypt:function(t,e){if(4!==t.length)throw new Error("invalid aes block size");var r,n,i,s,o=this._key[e],a=t[0]^o[0],u=t[e?3:1]^o[1],f=t[2]^o[2],h=t[e?1:3]^o[3],c=o.length/4-2,d=4,l=new Uint32Array(4),p=this._tables[e],b=p[0],m=p[1],g=p[2],y=p[3],v=p[4];for(s=0;s>>24]^m[u>>16&255]^g[f>>8&255]^y[255&h]^o[d],n=b[u>>>24]^m[f>>16&255]^g[h>>8&255]^y[255&a]^o[d+1],i=b[f>>>24]^m[h>>16&255]^g[a>>8&255]^y[255&u]^o[d+2],h=b[h>>>24]^m[a>>16&255]^g[u>>8&255]^y[255&f]^o[d+3],d+=4,a=r,u=n,f=i;for(s=0;s<4;s++)l[e?3&-s:s]=v[a>>>24]<<24^v[u>>16&255]<<16^v[f>>8&255]<<8^v[255&h]^o[d++],r=a,a=u,u=f,f=h,h=r;return l}}}]);void 0===n&&console.error("esm-webpack-plugin: nothing exported!");const i=n.Address,s=n.Bip32,o=n.Bip39,a=n.Bn,u=n.Br,f=n.Bsm,h=n.Bw,c=n.Base58,d=n.Base58Check,l=n.Block,p=n.BlockHeader,b=n.Constants,m=n.getConstants,g=n.Ecdsa,y=n.Hash,v=n.Interp,w=n.KeyPair,_=n.OpCode,S=n.Point,O=n.PrivKey,E=n.PubKey,I=n.Random,P=n.Script,M=n.Sig,A=n.SigOperations,k=n.Struct,x=n.Tx,R=n.TxBuilder,T=n.TxIn,B=n.TxOut,N=n.TxOutMap,C=n.TxVerifier,L=n.VarInt,U=n.Workers,D=n.WorkersResult,H=n.cmp,j=n.Ach,F=n.Aes,K=n.Aescbc,V=n.Cbc,q=n.Ecies,G=n.deps})),s.register("7xhmU",(function(t,e){"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();t.exports=e=r.fetch,r.fetch&&(e.default=r.fetch.bind(r)),e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response})),s.register("eBt9c",(function(e,r){var n;t(e.exports,"randomBytes",(()=>n),(t=>n=t)),n=s("kVI2k"),s("6PGLY"),s("gornR");var i=s("d4xXr"),o=Object.keys(i),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(o);var u=s("iw4r8");u.pbkdf2,u.pbkdf2Sync;var f=s("1MAjW");f.Cipher,f.createCipher,f.Cipheriv,f.createCipheriv,f.Decipher,f.createDecipher,f.Decipheriv,f.createDecipheriv,f.getCiphers,f.listCiphers;var h=s("3TK8j");h.DiffieHellmanGroup,h.createDiffieHellmanGroup,h.getDiffieHellman,h.createDiffieHellman,h.DiffieHellman;var c=s("iX3ZY");c.createSign,c.Sign,c.createVerify,c.Verify,s("7v5kj");var d=s("fMk2m");d.publicEncrypt,d.privateEncrypt,d.publicDecrypt,d.privateDecrypt;var l=s("bQftW");l.randomFill,l.randomFillSync})),s.register("kVI2k",(function(t,r){var n=s("gHWWg"),i=65536;var o=s("dUSMG").Buffer,a=e.crypto||e.msCrypto;a&&a.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>i)for(var s=0;s1)for(var r=1;r */ var r=s("bfD9J"),n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,t.exports),t.exports.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}})),s.register("bfD9J",(function(e,r){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */var n,i,o,a;t(e.exports,"Buffer",(()=>n),(t=>n=t)),t(e.exports,"SlowBuffer",(()=>i),(t=>i=t)),t(e.exports,"INSPECT_MAX_BYTES",(()=>o),(t=>o=t)),t(e.exports,"kMaxLength",(()=>a),(t=>a=t));var u=s("i6CO2"),f=s("e4QUe"),h="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;n=l,i=function(t){+t!=t&&(t=0);return l.alloc(+t)},o=50;var c=2147483647;function d(t){if(t>c)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return m(t)}return p(t,e,r)}function p(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|w(t,e),n=d(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){var e=new Uint8Array(t);return y(e.buffer,e.byteOffset,e.byteLength)}return g(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return y(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return y(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return l.from(n,e,r);var i=function(t){if(l.isBuffer(t)){var e=0|v(t.length),r=d(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||z(t.length)?d(0):g(t);if("Buffer"===t.type&&Array.isArray(t.data))return g(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function b(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function m(t){return b(t),d(t<0?0:0|v(t))}function g(t){for(var e=t.length<0?0:0|v(t.length),r=d(e),n=0;n=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|t}function w(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(i)return n?-1:V(t).length;e=(""+e).toLowerCase(),i=!0}}function _(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function S(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function O(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function f(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var h=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var c=!0,d=0;di&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?u.fromByteArray(t):u.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&f)<<6|63&s)>127&&(h=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&f)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&f)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nn.length?l.from(s).copy(n,i):Uint8Array.prototype.set.call(n,s,i);else{if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i)}i+=s.length}return n},l.byteLength=w,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;ee&&(t+=" ... "),""},h&&(l.prototype[h]=l.prototype.inspect),l.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),u=this.slice(n,i),f=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return I(this,t,e,r);case"utf8":case"utf-8":return P(this,t,e,r);case"ascii":case"latin1":case"binary":return M(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function B(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,s){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function H(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,i){return e=+e,r>>>=0,i||H(t,0,r,4),f.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return e=+e,r>>>=0,i||H(t,0,r,8),f.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},l.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),f.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),f.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),f.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),f.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function q(t){return u.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var W=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()})),s.register("i6CO2",(function(e,r){var n,i;t(e.exports,"toByteArray",(()=>n),(t=>n=t)),t(e.exports,"fromByteArray",(()=>i),(t=>i=t)),n=function(t){var e,r,n=c(t),i=n[0],s=n[1],u=new a(function(t,e,r){return 3*(e+r)/4-r}(0,i,s)),f=0,h=s>0?i-4:i;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===s&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===s&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},i=function(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;au?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],o=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,h=u.length;f0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function d(t,e,r){for(var n,i,o=[],a=e;a>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63})),s.register("e4QUe",(function(e,r){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */var n,i;t(e.exports,"read",(()=>n),(t=>n=t)),t(e.exports,"write",(()=>i),(t=>i=t)),n=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,d=r?-1:1,l=t[e+c];for(c+=d,s=l&(1<<-h)-1,l>>=-h,h+=a;h>0;s=256*s+t[e+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=n;h>0;o=256*o+t[e+c],c+=d,h-=8);if(0===s)s=1-f;else{if(s===u)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,n),s-=f}return(l?-1:1)*o*Math.pow(2,s-n)},i=function(t,e,r,n,i,s){var o,a,u,f=8*s-i-1,h=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:s-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?d/u:d*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(e*u-1)*Math.pow(2,i),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+l]=255&a,l+=p,a/=256,i-=8);for(o=o<0;t[r+l]=255&o,l+=p,o/=256,f-=8);t[r+l-p]|=128*b}})),s.register("6PGLY",(function(t,e){"use strict";var r=s("fmwGI"),n=s("1sJOB"),i=s("2844X"),o=s("8uGwn"),a=s("5S03o");function u(t){a.call(this,"digest"),this._hash=t}r(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new n:"rmd160"===t||"ripemd160"===t?new i:new u(o(t))}})),s.register("fmwGI",(function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),s.register("1sJOB",(function(t,e){"use strict";var r=s("fmwGI"),n=s("d0GrK"),i=s("dUSMG").Buffer,o=new Array(16);function a(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function f(t,e,r,n,i,s,o){return u(t+(e&r|~e&n)+i+s|0,o)+e|0}function h(t,e,r,n,i,s,o){return u(t+(e&n|r&~n)+i+s|0,o)+e|0}function c(t,e,r,n,i,s,o){return u(t+(e^r^n)+i+s|0,o)+e|0}function d(t,e,r,n,i,s,o){return u(t+(r^(e|~n))+i+s|0,o)+e|0}r(a,n),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,s=this._d;r=f(r,n,i,s,t[0],3614090360,7),s=f(s,r,n,i,t[1],3905402710,12),i=f(i,s,r,n,t[2],606105819,17),n=f(n,i,s,r,t[3],3250441966,22),r=f(r,n,i,s,t[4],4118548399,7),s=f(s,r,n,i,t[5],1200080426,12),i=f(i,s,r,n,t[6],2821735955,17),n=f(n,i,s,r,t[7],4249261313,22),r=f(r,n,i,s,t[8],1770035416,7),s=f(s,r,n,i,t[9],2336552879,12),i=f(i,s,r,n,t[10],4294925233,17),n=f(n,i,s,r,t[11],2304563134,22),r=f(r,n,i,s,t[12],1804603682,7),s=f(s,r,n,i,t[13],4254626195,12),i=f(i,s,r,n,t[14],2792965006,17),r=h(r,n=f(n,i,s,r,t[15],1236535329,22),i,s,t[1],4129170786,5),s=h(s,r,n,i,t[6],3225465664,9),i=h(i,s,r,n,t[11],643717713,14),n=h(n,i,s,r,t[0],3921069994,20),r=h(r,n,i,s,t[5],3593408605,5),s=h(s,r,n,i,t[10],38016083,9),i=h(i,s,r,n,t[15],3634488961,14),n=h(n,i,s,r,t[4],3889429448,20),r=h(r,n,i,s,t[9],568446438,5),s=h(s,r,n,i,t[14],3275163606,9),i=h(i,s,r,n,t[3],4107603335,14),n=h(n,i,s,r,t[8],1163531501,20),r=h(r,n,i,s,t[13],2850285829,5),s=h(s,r,n,i,t[2],4243563512,9),i=h(i,s,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,s,r,t[12],2368359562,20),i,s,t[5],4294588738,4),s=c(s,r,n,i,t[8],2272392833,11),i=c(i,s,r,n,t[11],1839030562,16),n=c(n,i,s,r,t[14],4259657740,23),r=c(r,n,i,s,t[1],2763975236,4),s=c(s,r,n,i,t[4],1272893353,11),i=c(i,s,r,n,t[7],4139469664,16),n=c(n,i,s,r,t[10],3200236656,23),r=c(r,n,i,s,t[13],681279174,4),s=c(s,r,n,i,t[0],3936430074,11),i=c(i,s,r,n,t[3],3572445317,16),n=c(n,i,s,r,t[6],76029189,23),r=c(r,n,i,s,t[9],3654602809,4),s=c(s,r,n,i,t[12],3873151461,11),i=c(i,s,r,n,t[15],530742520,16),r=d(r,n=c(n,i,s,r,t[2],3299628645,23),i,s,t[0],4096336452,6),s=d(s,r,n,i,t[7],1126891415,10),i=d(i,s,r,n,t[14],2878612391,15),n=d(n,i,s,r,t[5],4237533241,21),r=d(r,n,i,s,t[12],1700485571,6),s=d(s,r,n,i,t[3],2399980690,10),i=d(i,s,r,n,t[10],4293915773,15),n=d(n,i,s,r,t[1],2240044497,21),r=d(r,n,i,s,t[8],1873313359,6),s=d(s,r,n,i,t[15],4264355552,10),i=d(i,s,r,n,t[6],2734768916,15),n=d(n,i,s,r,t[13],1309151649,21),r=d(r,n,i,s,t[4],4149444226,6),s=d(s,r,n,i,t[11],3174756917,10),i=d(i,s,r,n,t[2],718787259,15),n=d(n,i,s,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a})),s.register("d0GrK",(function(t,e){"use strict";var r=s("dUSMG").Buffer,n=s("eqix4").Transform;function i(t){n.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}s("fmwGI")(i,n),i.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var s=this._blockOffset;s0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=i})),s.register("eqix4",(function(t,e){(e=t.exports=s("dPjC7")).Stream=e,e.Readable=e,e.Writable=s("i4sVA"),e.Duplex=s("90eWY"),e.Transform=s("jRc4C"),e.PassThrough=s("1uBQ8"),e.finished=s("77Ctn"),e.pipeline=s("1kCx2")})),s.register("dPjC7",(function(t,r){var n,i=s("gHWWg");t.exports=P,P.ReadableState=I;s("4gJ4t").EventEmitter;var o=function(t,e){return t.listeners(e).length},a=s("lM7MF"),u=s("bfD9J").Buffer,f=e.Uint8Array||function(){};var h,c=s("dfeT0");h=c&&c.debuglog?c.debuglog("stream"):function(){};var d,l,p,b=s("deIzz"),m=s("cnRNS"),g=s("lH7on").getHighWaterMark,y=s("isYJW").codes,v=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,S=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;s("fmwGI")(P,a);var O=m.errorOrDestroy,E=["error","close","destroy","pause","resume"];function I(t,e,r){n=n||s("90eWY"),t=t||{},"boolean"!=typeof r&&(r=e instanceof n),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",r),this.buffer=new b,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=s("gaUDj").StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function P(t){if(n=n||s("90eWY"),!(this instanceof P))return new P(t);var e=this instanceof n;this._readableState=new I(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function M(t,e,r,n,i){h("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(h("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,T(t)))}(t,o);else if(i||(s=function(t,e){var r;n=e,u.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(o,e)),s)O(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n)o.endEmitted?O(t,new S):A(t,o,e,!0);else if(o.ended)O(t,new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?A(t,o,e,!1):B(t,o)):A(t,o,e,!1)}else n||(o.reading=!1,B(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=k?t=k:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(T,t))}function T(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,D(t)}function B(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){h("readable nexttick read 0"),t.read(0)}function U(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),D(t),e.flowing&&!e.reading&&t.read(0)}function D(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function H(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function j(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(F,e,t))}function F(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function K(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):R(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&j(this),null;var n,i=e.needReadable;return h("need readable",i),(0===e.length||e.length-t0?H(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&j(this)),null!==n&&this.emit("data",n),n},P.prototype._read=function(t){O(this,new _("_read()"))},P.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var s=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:m;function a(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",l),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",m),r.removeListener("data",d),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,D(t))}}(r);t.on("drain",f);var c=!1;function d(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==K(n.pipes,t))&&!c&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function l(e){h("onerror",e),m(),t.removeListener("error",l),0===o(t,"error")&&O(t,e)}function p(){t.removeListener("finish",b),m()}function b(){h("onfinish"),t.removeListener("close",p),m()}function m(){h("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",p),t.once("finish",b),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},P.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?R(this):n.reading||i.nextTick(L,this))),r},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(C,this),r},P.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(C,this),e},P.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(U,t,e))}(this,t)),t.paused=!1,this},P.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},P.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s0&&o.length>i&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,a=h,console&&console.warn&&console.warn(a)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function l(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,e);else{var f=u.length,h=b(u,f);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return l(this,t,!0)},o.prototype.rawListeners=function(t){return l(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}})),s.register("lM7MF",(function(t,e){t.exports=s("4gJ4t").EventEmitter})),s.register("dfeT0",(function(t,e){})),s.register("deIzz",(function(t,e){"use strict";function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,n,i=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=i,n=a,o.prototype.copy.call(e,r,n),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(s===i.length?n+=i:n+=i.slice(0,t),0==(t-=s)){s===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0==(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;en),(t=>n=t));var i={};function s(t,e,r){r||(r=Error);var n=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}s("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),s("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),n=i})),s.register("90eWY",(function(t,e){var r=s("gHWWg"),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=s("dPjC7"),o=s("i4sVA");s("fmwGI")(h,i);for(var a=n(o.prototype),u=0;u-1))throw new S(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(P.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(P.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),P.prototype._write=function(t,e,r){r(new m("_write()"))},P.prototype._writev=null,P.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(P.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),P.prototype.destroy=d.destroy,P.prototype._undestroy=d.undestroy,P.prototype._destroy=function(t,e){e(t)}})),s.register("bEA8T",(function(t,r){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}})),s.register("gaUDj",(function(e,r){var n;t(e.exports,"StringDecoder",(()=>n),(t=>n=t));var i=s("dUSMG").Buffer,o=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===o||!o(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=c,e=4;break;case"utf8":this.fillLast=f,e=4;break;case"base64":this.text=d,this.end=l,e=3;break;default:return this.write=p,void(this.end=b)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function u(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function f(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function d(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function p(t){return t.toString(this.encoding)}function b(t){return t&&t.length?this.write(t):""}n=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}})),s.register("kgYwh",(function(t,e){var r,n=s("gHWWg");function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=s("77Ctn"),a=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),h=Symbol("ended"),c=Symbol("lastPromise"),d=Symbol("handlePromise"),l=Symbol("stream");function p(t,e){return{value:t,done:e}}function b(t){var e=t[a];if(null!==e){var r=t[l].read();null!==r&&(t[c]=null,t[a]=null,t[u]=null,e(p(r,!1)))}}function m(t){n.nextTick(b,t)}var g=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(r={get stream(){return this[l]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[h])return Promise.resolve(p(void 0,!0));if(this[l].destroyed)return new Promise((function(e,r){n.nextTick((function(){t[f]?r(t[f]):e(p(void 0,!0))}))}));var r,i=this[c];if(i)r=new Promise(function(t,e){return function(r,n){t.then((function(){e[h]?r(p(void 0,!0)):e[d](r,n)}),n)}}(i,this));else{var s=this[l].read();if(null!==s)return Promise.resolve(p(s,!1));r=new Promise(this[d])}return this[c]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,r){t[l].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),r),g);t.exports=function(t){var e,r=Object.create(y,(i(e={},l,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,h,{value:t._readableState.endEmitted,writable:!0}),i(e,d,{value:function(t,e){var n=r[l].read();n?(r[c]=null,r[a]=null,r[u]=null,t(p(n,!1))):(r[a]=t,r[u]=e)},writable:!0}),e));return r[c]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[u];return null!==e&&(r[c]=null,r[a]=null,r[u]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[c]=null,r[a]=null,r[u]=null,n(p(void 0,!0))),r[h]=!0})),t.on("readable",m.bind(null,r)),r}})),s.register("77Ctn",(function(t,e){"use strict";var r=s("isYJW").codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,i,s){if("function"==typeof i)return t(e,null,i);i||(i={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i0,(function(t){n||(n=t),t&&o.forEach(f),i||(o.forEach(f),s(n))}))}));return e.reduce(h)}})),s.register("2844X",(function(t,e){"use strict";var r=s("bfD9J").Buffer,n=s("fmwGI"),i=s("d0GrK"),o=new Array(16),a=[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],u=[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],f=[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],h=[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],c=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function l(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function b(t,e,r,n,i,s,o,a){return p(t+(e^r^n)+s+o|0,a)+i|0}function m(t,e,r,n,i,s,o,a){return p(t+(e&r|~e&n)+s+o|0,a)+i|0}function g(t,e,r,n,i,s,o,a){return p(t+((e|~r)^n)+s+o|0,a)+i|0}function y(t,e,r,n,i,s,o,a){return p(t+(e&n|r&~n)+s+o|0,a)+i|0}function v(t,e,r,n,i,s,o,a){return p(t+(e^(r|~n))+s+o|0,a)+i|0}n(l,i),l.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,l=0|this._e,w=0|this._a,_=0|this._b,S=0|this._c,O=0|this._d,E=0|this._e,I=0;I<80;I+=1){var P,M;I<16?(P=b(r,n,i,s,l,t[a[I]],c[0],f[I]),M=v(w,_,S,O,E,t[u[I]],d[0],h[I])):I<32?(P=m(r,n,i,s,l,t[a[I]],c[1],f[I]),M=y(w,_,S,O,E,t[u[I]],d[1],h[I])):I<48?(P=g(r,n,i,s,l,t[a[I]],c[2],f[I]),M=g(w,_,S,O,E,t[u[I]],d[2],h[I])):I<64?(P=y(r,n,i,s,l,t[a[I]],c[3],f[I]),M=m(w,_,S,O,E,t[u[I]],d[3],h[I])):(P=v(r,n,i,s,l,t[a[I]],c[4],f[I]),M=b(w,_,S,O,E,t[u[I]],d[4],h[I])),r=l,l=s,s=p(i,10),i=n,n=P,w=E,E=O,O=p(S,10),S=_,_=M}var A=this._b+i+O|0;this._b=this._c+s+E|0,this._c=this._d+l+w|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=A},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=l})),s.register("8uGwn",(function(t,e){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=s("8sN9x"),r.sha1=s("kDy33"),r.sha224=s("ceT23"),r.sha256=s("cPn5V"),r.sha384=s("1WkiW"),r.sha512=s("jk0B2")})),s.register("8sN9x",(function(t,e){var r=s("fmwGI"),n=s("aC39s"),i=s("dUSMG").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}r(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var d=0;d<80;++d){var l=~~(d/20),p=0|((e=n)<<5|e>>>27)+h(l,i,s,a)+u+r[d]+o[l];u=a,a=s,s=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=i.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u})),s.register("aC39s",(function(t,e){var r=s("dUSMG").Buffer;function n(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}n.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,s=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n})),s.register("kDy33",(function(t,e){var r=s("fmwGI"),n=s("aC39s"),i=s("dUSMG").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function f(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}r(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var l=0;l<80;++l){var p=~~(l/20),b=f(n)+c(p,i,s,a)+u+r[l]+o[p]|0;u=a,a=s,s=h(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=i.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u})),s.register("ceT23",(function(t,e){var r=s("fmwGI"),n=s("cPn5V"),i=s("aC39s"),o=s("dUSMG").Buffer,a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}r(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u})),s.register("cPn5V",(function(t,e){var r=s("fmwGI"),n=s("aC39s"),i=s("dUSMG").Buffer,o=[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],a=new Array(64);function u(){this.init(),this._w=a,n.call(this,64,56)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function l(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,n),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+l(r[g-15])+r[g-16];for(var y=0;y<64;++y){var v=m+d(u)+f(u,p,b)+o[y]+r[y]|0,w=c(n)+h(n,i,s)|0;m=b,b=p,p=u,u=a+v|0,a=s,s=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=i.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u})),s.register("1WkiW",(function(t,e){var r=s("fmwGI"),n=s("jk0B2"),i=s("aC39s"),o=s("dUSMG").Buffer,a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}r(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u})),s.register("jk0B2",(function(t,e){var r=s("fmwGI"),n=s("aC39s"),i=s("dUSMG").Buffer,o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,n.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0>>0?1:0}r(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,S=0|this._cl,O=0|this._dl,E=0|this._el,I=0|this._fl,P=0|this._gl,M=0|this._hl,A=0;A<32;A+=2)e[A]=t.readInt32BE(4*A),e[A+1]=t.readInt32BE(4*A+4);for(;A<160;A+=2){var k=e[A-30],x=e[A-30+1],R=l(k,x),T=p(x,k),B=b(k=e[A-4],x=e[A-4+1]),N=m(x,k),C=e[A-14],L=e[A-14+1],U=e[A-32],D=e[A-32+1],H=T+L|0,j=R+C+g(H,T)|0;j=(j=j+B+g(H=H+N|0,N)|0)+U+g(H=H+D|0,D)|0,e[A]=j,e[A+1]=H}for(var F=0;F<160;F+=2){j=e[F],H=e[F+1];var K=h(r,n,i),V=h(w,_,S),q=c(r,w),G=c(w,r),Y=d(a,E),z=d(E,a),W=o[F],J=o[F+1],Z=f(a,u,y),X=f(E,I,P),Q=M+z|0,$=v+Y+g(Q,M)|0;$=($=($=$+Z+g(Q=Q+X|0,X)|0)+W+g(Q=Q+J|0,J)|0)+j+g(Q=Q+H|0,H)|0;var tt=G+V|0,et=q+K+g(tt,G)|0;v=y,M=P,y=u,P=I,u=a,I=E,a=s+$+g(E=O+Q|0,O)|0,s=i,O=S,i=n,S=_,n=r,_=w,r=$+et+g(w=Q+tt|0,Q)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+O|0,this._el=this._el+E|0,this._fl=this._fl+I|0,this._gl=this._gl+P|0,this._hl=this._hl+M|0,this._ah=this._ah+r+g(this._al,w)|0,this._bh=this._bh+n+g(this._bl,_)|0,this._ch=this._ch+i+g(this._cl,S)|0,this._dh=this._dh+s+g(this._dl,O)|0,this._eh=this._eh+a+g(this._el,E)|0,this._fh=this._fh+u+g(this._fl,I)|0,this._gh=this._gh+y+g(this._gl,P)|0,this._hh=this._hh+v+g(this._hl,M)|0},u.prototype._hash=function(){var t=i.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u})),s.register("5S03o",(function(t,e){var r=s("dUSMG").Buffer,n=s("5bwD6").Transform,i=s("gaUDj").StringDecoder;function o(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s("fmwGI")(o,n),o.prototype.update=function(t,e,n){"string"==typeof t&&(t=r.from(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},o.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},o.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},o.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new i(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=o})),s.register("5bwD6",(function(t,e){t.exports=n;var r=s("4gJ4t").EventEmitter;function n(){r.call(this)}s("fmwGI")(n,r),n.Readable=s("dPjC7"),n.Writable=s("i4sVA"),n.Duplex=s("90eWY"),n.Transform=s("jRc4C"),n.PassThrough=s("1uBQ8"),n.finished=s("77Ctn"),n.pipeline=s("1kCx2"),n.Stream=n,n.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function s(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(h(),0===r.listenerCount(this,"error"))throw t}function h(){n.removeListener("data",i),t.removeListener("drain",s),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",f),t.removeListener("error",f),n.removeListener("end",h),n.removeListener("close",h),t.removeListener("close",h)}return n.on("error",f),t.on("error",f),n.on("end",h),n.on("close",h),t.on("close",h),t.emit("pipe",n),t}})),s.register("gornR",(function(t,e){"use strict";var r=s("fmwGI"),n=s("lY7to"),i=s("5S03o"),o=s("dUSMG").Buffer,a=s("ltlIh"),u=s("2844X"),f=s("8uGwn"),h=o.alloc(128);function c(t,e){i.call(this,"digest"),"string"==typeof e&&(e=o.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:f(t)).update(e).digest():e.lengtha?e=t(e):e.lengthn),(t=>n=t)),t(e.exports,"pbkdf2Sync",(()=>i),(t=>i=t)),n=s("1mMKO"),i=s("bqsL8")})),s.register("1mMKO",(function(t,r){var n,i,o=s("dUSMG").Buffer,a=s("8bkjm"),u=s("g11OX"),f=s("bqsL8"),h=s("jT17a"),c=e.crypto&&e.crypto.subtle,d={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=[];function p(){return i||(i=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function b(t,e,r,n,i){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,r,i,s,m,g){"function"==typeof m&&(g=m,m=void 0);var y=d[(m=m||"sha1").toLowerCase()];if(y&&"function"==typeof e.Promise){if(a(i,s),t=h(t,u,"Password"),r=h(r,u,"Salt"),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){p()((function(){e(null,t)}))}),(function(t){p()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==l[t])return l[t];var r=b(n=n||o.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return l[t]=r,r}(y).then((function(e){return e?b(t,r,i,s,y):f(t,r,i,s,m)})),g)}else p()((function(){var e;try{e=f(t,r,i,s,m)}catch(t){return g(t)}g(null,e)}))}})),s.register("8bkjm",(function(t,e){var r=Math.pow(2,30)-1;t.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>r||e!=e)throw new TypeError("Bad key length")}})),s.register("g11OX",(function(t,r){var n,i=s("gHWWg");if(e.process&&e.process.browser)n="utf-8";else if(e.process&&e.process.version){n=parseInt(i.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n})),s.register("bqsL8",(function(t,e){var r=s("ltlIh"),n=s("2844X"),i=s("8uGwn"),o=s("dUSMG").Buffer,a=s("8bkjm"),u=s("g11OX"),f=s("jT17a"),h=o.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,s){var a=function(t){function e(e){return i(t).update(e).digest()}function s(t){return(new n).update(t).digest()}return"rmd160"===t||"ripemd160"===t?s:"md5"===t?r:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.lengthn),(t=>n=t)),t(e.exports,"Cipher",(()=>i),(t=>i=t)),t(e.exports,"createCipheriv",(()=>o),(t=>o=t)),t(e.exports,"Cipheriv",(()=>a),(t=>a=t)),t(e.exports,"createDecipher",(()=>u),(t=>u=t)),t(e.exports,"Decipher",(()=>f),(t=>f=t)),t(e.exports,"createDecipheriv",(()=>h),(t=>h=t)),t(e.exports,"Decipheriv",(()=>c),(t=>c=t)),t(e.exports,"listCiphers",(()=>d),(t=>d=t)),t(e.exports,"getCiphers",(()=>l),(t=>l=t));var p=s("lrljg"),b=s("9ctAy"),m=s("8yms2"),g=s("1XiOE"),y=s("2SCt2");function v(t,e,r){if(t=t.toLowerCase(),m[t])return b.createCipheriv(t,e,r);if(g[t])return new p({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function w(t,e,r){if(t=t.toLowerCase(),m[t])return b.createDecipheriv(t,e,r);if(g[t])return new p({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}n=i=function(t,e){var r,n;if(t=t.toLowerCase(),m[t])r=m[t].key,n=m[t].iv;else{if(!g[t])throw new TypeError("invalid suite type");r=8*g[t].key,n=g[t].iv}var i=y(e,!1,r,n);return v(t,i.key,i.iv)},o=a=v,u=f=function(t,e){var r,n;if(t=t.toLowerCase(),m[t])r=m[t].key,n=m[t].iv;else{if(!g[t])throw new TypeError("invalid suite type");r=8*g[t].key,n=g[t].iv}var i=y(e,!1,r,n);return w(t,i.key,i.iv)},h=c=w,d=l=function(){return Object.keys(g).concat(b.getCiphers())}})),s.register("lrljg",(function(t,e){var r=s("5S03o"),n=s("6udTt"),i=s("fmwGI"),o=s("dUSMG").Buffer,a={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(t){r.call(this);var e,n=t.mode.toLowerCase(),i=a[n];e=t.decrypt?"decrypt":"encrypt";var s=t.key;o.isBuffer(s)||(s=o.from(s)),"des-ede"!==n&&"des-ede-cbc"!==n||(s=o.concat([s,s.slice(0,8)]));var u=t.iv;o.isBuffer(u)||(u=o.from(u)),this._des=i.create({key:s,iv:u,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=u,i(u,r),u.prototype._update=function(t){return o.from(this._des.update(t))},u.prototype._final=function(){return o.from(this._des.final())}})),s.register("6udTt",(function(e,r){var n,i,o;t(e.exports,"DES",(()=>n),(t=>n=t)),t(e.exports,"CBC",(()=>i),(t=>i=t)),t(e.exports,"EDE",(()=>o),(t=>o=t)),s("gox91"),s("auYcU"),n=s("i1mWY"),i=s("1GLGd"),o=s("7NiBY")})),s.register("gox91",(function(e,r){var n,i,s,o,a,u,f,h,c,d,l;t(e.exports,"readUInt32BE",(()=>n),(t=>n=t)),t(e.exports,"writeUInt32BE",(()=>i),(t=>i=t)),t(e.exports,"ip",(()=>s),(t=>s=t)),t(e.exports,"rip",(()=>o),(t=>o=t)),t(e.exports,"pc1",(()=>a),(t=>a=t)),t(e.exports,"r28shl",(()=>u),(t=>u=t)),t(e.exports,"pc2",(()=>f),(t=>f=t)),t(e.exports,"expand",(()=>h),(t=>h=t)),t(e.exports,"substitute",(()=>c),(t=>c=t)),t(e.exports,"permute",(()=>d),(t=>d=t)),t(e.exports,"padSplit",(()=>l),(t=>l=t)),n=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},i=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},s=function(t,e,r,n){for(var i=0,s=0,o=6;o>=0;o-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+o&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+o&1}for(o=6;o>=0;o-=2){for(a=1;a<=25;a+=8)s<<=1,s|=e>>>a+o&1;for(a=1;a<=25;a+=8)s<<=1,s|=t>>>a+o&1}r[n+0]=i>>>0,r[n+1]=s>>>0},o=function(t,e,r,n){for(var i=0,s=0,o=0;o<4;o++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+o&1,i<<=1,i|=t>>>a+o&1;for(o=4;o<8;o++)for(a=24;a>=0;a-=8)s<<=1,s|=e>>>a+o&1,s<<=1,s|=t>>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},a=function(t,e,r,n){for(var i=0,s=0,o=7;o>=5;o--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+o&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(o=1;o<=3;o++){for(a=0;a<=24;a+=8)s<<=1,s|=e>>a+o&1;for(a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1}for(a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},u=function(t,e){return t<>>28-e};var p=[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];f=function(t,e,r,n){for(var i=0,s=0,o=p.length>>>1,a=0;a>>p[a]&1;for(a=o;a>>p[a]&1;r[n+0]=i>>>0,r[n+1]=s>>>0},h=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(s=11;s>=3;s-=4)i|=t>>>s&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var b=[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];c=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=b[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=b[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var m=[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];d=function(t){for(var e=0,r=0;r>>m[r]&1;return e>>>0},l=function(t,e,r){for(var n=t.toString(2);n.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];n=i.r28shl(n,a),s=i.r28shl(s,a),i.pc2(n,s,t.keys,o)}},u.prototype._update=function(t,e,r,n){var s=this._desState,o=i.readUInt32BE(t,e),a=i.readUInt32BE(t,e+4);i.ip(o,a,s.tmp,0),o=s.tmp[0],a=s.tmp[1],"encrypt"===this.type?this._encrypt(s,o,a,s.tmp,0):this._decrypt(s,o,a,s.tmp,0),o=s.tmp[0],a=s.tmp[1],i.writeUInt32BE(r,o,n),i.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,o=d}i.rip(a,o,n,s)},u.prototype._decrypt=function(t,e,r,n,s){for(var o=r,a=e,u=t.keys.length-2;u>=0;u-=2){var f=t.keys[u],h=t.keys[u+1];i.expand(o,t.tmp,0),f^=t.tmp[0],h^=t.tmp[1];var c=i.substitute(f,h),d=o;o=(a^i.permute(c))>>>0,a=d}i.rip(o,a,n,s)}})),s.register("1GLGd",(function(e,r){var n;t(e.exports,"instantiate",(()=>n),(t=>n=t));var i=s("cxHvZ"),o=s("fmwGI"),a={};function u(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;en),(t=>n=t)),t(e.exports,"createDecipheriv",(()=>i),(t=>i=t)),t(e.exports,"getCiphers",(()=>o),(t=>o=t));var a=s("egRiO"),u=s("2Uwm7"),f=s("biO8J");a.createCipher,n=a.createCipheriv,u.createDecipher,i=u.createDecipheriv,o=function(){return Object.keys(f)}})),s.register("egRiO",(function(e,r){var n,i;t(e.exports,"createCipheriv",(()=>n),(t=>n=t)),t(e.exports,"createCipher",(()=>i),(t=>i=t));var o=s("8yms2"),a=s("g1V3C"),u=s("dUSMG").Buffer,f=s("lnXw7"),h=s("5S03o"),c=s("48GbP"),d=s("2SCt2");function l(t,e,r){h.call(this),this._cache=new b,this._cipher=new c.AES(e),this._prev=u.from(r),this._mode=t,this._autopadding=!0}s("fmwGI")(l,h),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return u.concat(n)};var p=u.alloc(16,16);function b(){this.cache=u.allocUnsafe(0)}function m(t,e,r){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=u.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=u.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===n.type?new f(n.module,e,r):"auth"===n.type?new a(n.module,e,r):new l(n.module,e,r)}l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(p))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},b.prototype.add=function(t){this.cache=u.concat([this.cache,t])},b.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},b.prototype.flush=function(){for(var t=16-this.cache.length,e=u.allocUnsafe(t),r=-1;++rn),(t=>n=t)),t(e.exports,"decrypt",(()=>i),(t=>i=t)),n=function(t,e){return t._cipher.encryptBlock(e)},i=function(t,e){return t._cipher.decryptBlock(e)}})),s.register("9kn6y",(function(e,r){var n,i;t(e.exports,"encrypt",(()=>n),(t=>n=t)),t(e.exports,"decrypt",(()=>i),(t=>i=t));var o=s("104lC");n=function(t,e){var r=o(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},i=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return o(n,r)}})),s.register("104lC",(function(t,e){var r=s("bfD9J").Buffer;t.exports=function(t,e){for(var n=Math.min(t.length,e.length),i=new r(n),s=0;sn),(t=>n=t));var i=s("dUSMG").Buffer,o=s("104lC");function a(t,e,r){var n=e.length,s=o(e,t._cache);return t._cache=t._cache.slice(n),t._prev=i.concat([t._prev,r?e:s]),s}n=function(t,e,r){for(var n,s=i.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),!(t._cache.length<=e.length)){s=i.concat([s,a(t,e,r)]);break}n=t._cache.length,s=i.concat([s,a(t,e.slice(0,n),r)]),e=e.slice(n)}return s}})),s.register("d72aE",(function(e,r){var n;t(e.exports,"encrypt",(()=>n),(t=>n=t));var i=s("dUSMG").Buffer;function o(t,e,r){var n=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=i.concat([t._prev.slice(1),i.from([r?e:n])]),n}n=function(t,e,r){for(var n=e.length,s=i.allocUnsafe(n),a=-1;++an),(t=>n=t));var i=s("dUSMG").Buffer;function o(t,e,r){for(var n,i,s=-1,o=0;++s<8;)n=e&1<<7-s?128:0,o+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>s%8,t._prev=a(t._prev,r?n:i);return o}function a(t,e){var r=t.length,n=-1,s=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return s}n=function(t,e,r){for(var n=e.length,s=i.allocUnsafe(n),a=-1;++an),(t=>n=t));var i=s("bfD9J").Buffer,o=s("104lC");function a(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}n=function(t,e){for(;t._cache.lengthn),(t=>n=t));var i=s("104lC"),o=s("dUSMG").Buffer,a=s("1IGxR");function u(t){var e=t._cipher.encryptBlockRaw(t._prev);return a(t._prev),e}n=function(t,e){var r=Math.ceil(e.length/16),n=t._cache.length;t._cache=o.concat([t._cache,o.allocUnsafe(16*r)]);for(var s=0;sn),(t=>n=t));var i=s("dUSMG").Buffer;function o(t){i.isBuffer(t)||(t=i.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n>>24]^h[p>>>16&255]^c[b>>>8&255]^d[255&m]^e[g++],o=f[p>>>24]^h[b>>>16&255]^c[m>>>8&255]^d[255&l]^e[g++],a=f[b>>>24]^h[m>>>16&255]^c[l>>>8&255]^d[255&p]^e[g++],u=f[m>>>24]^h[l>>>16&255]^c[p>>>8&255]^d[255&b]^e[g++],l=s,p=o,b=a,m=u;return s=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&m])^e[g++],o=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[m>>>8&255]<<8|n[255&l])^e[g++],a=(n[b>>>24]<<24|n[m>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[g++],u=(n[m>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[g++],[s>>>=0,o>>>=0,a>>>=0,u>>>=0]}var f=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],s=[[],[],[],[]],o=0,a=0,u=0;u<256;++u){var f=a^a<<1^a<<2^a<<3^a<<4;f=f>>>8^255&f^99,r[o]=f,n[f]=o;var h=t[o],c=t[h],d=t[c],l=257*t[f]^16843008*f;i[0][o]=l<<24|l>>>8,i[1][o]=l<<16|l>>>16,i[2][o]=l<<8|l>>>24,i[3][o]=l,l=16843009*d^65537*c^257*h^16843008*o,s[0][f]=l<<24|l>>>8,s[1][f]=l<<16|l>>>16,s[2][f]=l<<8|l>>>24,s[3][f]=l,0===o?o=a=1:(o=h^t[t[t[d^h]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:s}}();function c(t){this._key=o(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],s=0;s>>24,o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o],o^=f[s/e|0]<<24):e>6&&s%e==4&&(o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o]),i[s]=i[s-e]^o}for(var a=[],u=0;u>>24]]^h.INV_SUB_MIX[1][h.SBOX[d>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[d>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a},c.prototype.encryptBlockRaw=function(t){return u(t=o(t),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){var e=(t=o(t))[1];t[1]=t[3],t[3]=e;var r=u(t,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},c.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},n=c})),s.register("5mAX3",(function(t,e){var r=s("dUSMG").Buffer,n=r.alloc(16,0);function i(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=-520093696^n[0])}this.state=i(s)},o.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,n],16)),this.ghash(i([0,t,0,e])),this.state},t.exports=o})),s.register("lnXw7",(function(t,e){var r=s("48GbP"),n=s("dUSMG").Buffer,i=s("5S03o");function o(t,e,s,o){i.call(this),this._cipher=new r.AES(e),this._prev=n.from(s),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._mode=t}s("fmwGI")(o,i),o.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},t.exports=o})),s.register("2SCt2",(function(t,e){var r=s("dUSMG").Buffer,n=s("1sJOB");t.exports=function(t,e,i,s){if(r.isBuffer(t)||(t=r.from(t,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=i/8,a=r.alloc(o),u=r.alloc(s||0),f=r.alloc(0);o>0||s>0;){var h=new n;h.update(f),h.update(t),e&&h.update(e),f=h.digest();var c=0;if(o>0){var d=a.length-o;c=Math.min(o,f.length),f.copy(a,d,0,c),o-=c}if(c0){var l=u.length-s,p=Math.min(s,f.length-c);f.copy(u,l,c,c+p),s-=p}}return f.fill(0),{key:a,iv:u}}})),s.register("2Uwm7",(function(e,r){var n,i;t(e.exports,"createDecipher",(()=>n),(t=>n=t)),t(e.exports,"createDecipheriv",(()=>i),(t=>i=t));var o=s("g1V3C"),a=s("dUSMG").Buffer,u=s("8yms2"),f=s("lnXw7"),h=s("5S03o"),c=s("48GbP"),d=s("2SCt2");function l(t,e,r){h.call(this),this._cache=new p,this._last=void 0,this._cipher=new c.AES(e),this._prev=a.from(r),this._mode=t,this._autopadding=!0}function p(){this.cache=a.allocUnsafe(0)}function b(t,e,r){var n=u[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=a.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=a.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===n.type?new f(n.module,e,r,!0):"auth"===n.type?new o(n.module,e,r,!0):new l(n.module,e,r)}s("fmwGI")(l,h),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return a.concat(n)},l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},p.prototype.flush=function(){if(this.cache.length)return this.cache},n=function(t,e){var r=u[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=d(e,!1,r.key,r.iv);return b(t,n.key,n.iv)},i=b})),s.register("1XiOE",(function(e,r){var n,i,s,o,a,u,f,h;t(e.exports,"des-ecb",(()=>n),(t=>n=t)),t(e.exports,"des-cbc",(()=>i),(t=>i=t)),t(e.exports,"des",(()=>s),(t=>s=t)),t(e.exports,"des-ede3-cbc",(()=>o),(t=>o=t)),t(e.exports,"des3",(()=>a),(t=>a=t)),t(e.exports,"des-ede3",(()=>u),(t=>u=t)),t(e.exports,"des-ede-cbc",(()=>f),(t=>f=t)),t(e.exports,"des-ede",(()=>h),(t=>h=t)),n={key:8,iv:0},i=s={key:8,iv:8},o=a={key:24,iv:8},u={key:24,iv:0},f={key:16,iv:8},h={key:16,iv:0}})),s.register("3TK8j",(function(e,r){var n,i,o,a,u;t(e.exports,"DiffieHellmanGroup",(()=>n),(t=>n=t)),t(e.exports,"createDiffieHellmanGroup",(()=>i),(t=>i=t)),t(e.exports,"getDiffieHellman",(()=>o),(t=>o=t)),t(e.exports,"createDiffieHellman",(()=>a),(t=>a=t)),t(e.exports,"DiffieHellman",(()=>u),(t=>u=t));var f=s("bfD9J").Buffer,h=s("2KPfG"),c=s("d1lUJ"),d=s("lkdUA");var l={binary:!0,hex:!0,base64:!0};n=i=o=function(t){var e=new f(c[t].prime,"hex"),r=new f(c[t].gen,"hex");return new d(e,r)},a=u=function t(e,r,n,i){return f.isBuffer(r)||void 0===l[r]?t(e,"binary",r,n):(r=r||"binary",i=i||"binary",n=n||new f([2]),f.isBuffer(n)||(n=new f(n,i)),"number"==typeof e?new d(h(e,n),n,!0):(f.isBuffer(e)||(e=new f(e,r)),new d(e,n,!0)))}})),s.register("2KPfG",(function(t,e){var r=s("kVI2k");t.exports=g,g.simpleSieve=b,g.fermatTest=m;var n=s("isk9v"),i=new n(24),o=new(s("lYixV")),a=new n(1),u=new n(2),f=new n(5),h=(new n(16),new n(8),new n(10)),c=new n(3),d=(new n(7),new n(11)),l=new n(4),p=(new n(12),null);function b(t){for(var e=function(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;it;)s.ishrn(1);if(s.isEven()&&s.iadd(a),s.testn(1)||s.iadd(u),e.cmp(u)){if(!e.cmp(f))for(;s.mod(h).cmp(c);)s.iadd(l)}else for(;s.mod(i).cmp(d);)s.iadd(l);if(b(p=s.shrn(1))&&b(s)&&m(p)&&m(s)&&o.test(p)&&o.test(s))return s}}})),s.register("isk9v",(function(t,e){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:s("dfeT0").Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,s=Math.min(t.length,r),o=e;o=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f>>26,c=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;h+=(o=(i=0|t.words[p])*(s=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,s=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,o--)}for(0!==s&&(n=s.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=c[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);n=(p=p.idivn(l)).isZero()?b+n:h[f-b.length]+b+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===e,f=new t(s),h=this.clone();if(u){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),f[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],g=8191&m,y=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,S=0|o[4],O=8191&S,E=S>>>13,I=0|o[5],P=8191&I,M=I>>>13,A=0|o[6],k=8191&A,x=A>>>13,R=0|o[7],T=8191&R,B=R>>>13,N=0|o[8],C=8191&N,L=N>>>13,U=0|o[9],D=8191&U,H=U>>>13,j=0|a[0],F=8191&j,K=j>>>13,V=0|a[1],q=8191&V,G=V>>>13,Y=0|a[2],z=8191&Y,W=Y>>>13,J=0|a[3],Z=8191&J,X=J>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,K))+Math.imul(d,F)|0))<<13)|0;f=((s=Math.imul(d,K))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,K))+Math.imul(b,F)|0,s=Math.imul(b,K);var gt=(f+(n=n+Math.imul(c,q)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,q)|0))<<13)|0;f=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,K))+Math.imul(y,F)|0,s=Math.imul(y,K),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,q)|0,s=s+Math.imul(b,G)|0;var yt=(f+(n=n+Math.imul(c,z)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,z)|0))<<13)|0;f=((s=s+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,K))+Math.imul(_,F)|0,s=Math.imul(_,K),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(y,q)|0,s=s+Math.imul(y,G)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,z)|0,s=s+Math.imul(b,W)|0;var vt=(f+(n=n+Math.imul(c,Z)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,Z)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,K))+Math.imul(E,F)|0,s=Math.imul(E,K),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,q)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,z)|0,s=s+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,X)|0;var wt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,K))+Math.imul(M,F)|0,s=Math.imul(M,K),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(E,q)|0,s=s+Math.imul(E,G)|0,n=n+Math.imul(w,z)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,z)|0,s=s+Math.imul(_,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,K))+Math.imul(x,F)|0,s=Math.imul(x,K),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(M,q)|0,s=s+Math.imul(M,G)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(E,z)|0,s=s+Math.imul(E,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0;var St=(f+(n=n+Math.imul(c,st)|0)|0)+((8191&(i=(i=i+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,K))+Math.imul(B,F)|0,s=Math.imul(B,K),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,q)|0,s=s+Math.imul(x,G)|0,n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(M,z)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,nt)|0,n=n+Math.imul(p,st)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0;var Ot=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,K))+Math.imul(L,F)|0,s=Math.imul(L,K),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,q)|0,s=s+Math.imul(B,G)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(x,z)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,nt)|0,n=n+Math.imul(g,st)|0,i=(i=i+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,s=s+Math.imul(b,ft)|0;var Et=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,K))+Math.imul(H,F)|0,s=Math.imul(H,K),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,q)|0,s=s+Math.imul(L,G)|0,n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,z)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(w,st)|0,i=(i=i+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,s=s+Math.imul(b,dt)|0;var It=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((s=s+Math.imul(d,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(H,q)|0,s=Math.imul(H,G),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(L,z)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(O,st)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,s=s+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((s=s+Math.imul(b,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,W))+Math.imul(H,z)|0,s=Math.imul(H,W),n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,X)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(P,st)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,dt)|0;var Mt=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((s=s+Math.imul(y,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,X))+Math.imul(H,Z)|0,s=Math.imul(H,X),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,s=s+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(k,st)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(M,ut)|0,s=s+Math.imul(M,ft)|0,n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var At=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((s=s+Math.imul(_,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,tt))+Math.imul(H,$)|0,s=Math.imul(H,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,s=s+Math.imul(L,nt)|0,n=n+Math.imul(T,st)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ft)|0)+Math.imul(x,ut)|0,s=s+Math.imul(x,ft)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(M,ct)|0,s=s+Math.imul(M,dt)|0;var kt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(E,pt)|0))<<13)|0;f=((s=s+Math.imul(E,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(H,rt)|0,s=Math.imul(H,nt),n=n+Math.imul(C,st)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,st)|0,s=s+Math.imul(L,ot)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(B,ut)|0,s=s+Math.imul(B,ft)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(x,ct)|0,s=s+Math.imul(x,dt)|0;var xt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((s=s+Math.imul(M,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,st),i=(i=Math.imul(D,ot))+Math.imul(H,st)|0,s=Math.imul(H,ot),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(L,ut)|0,s=s+Math.imul(L,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,s=s+Math.imul(B,dt)|0;var Rt=(f+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,bt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((s=s+Math.imul(x,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ft))+Math.imul(H,ut)|0,s=Math.imul(H,ft),n=n+Math.imul(C,ct)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(L,ct)|0,s=s+Math.imul(L,dt)|0;var Tt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((s=s+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,dt))+Math.imul(H,ct)|0,s=Math.imul(H,dt);var Bt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((s=s+Math.imul(L,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Nt=(f+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(H,pt)|0))<<13)|0;return f=((s=Math.imul(H,bt))+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Ot,u[8]=Et,u[9]=It,u[10]=Pt,u[11]=Mt,u[12]=At,u[13]=kt,u[14]=xt,u[15]=Rt,u[16]=Tt,u[17]=Bt,u[18]=Nt,0!==f&&(u[19]=f,r.length++),r};function b(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=l),i.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?l(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}(this,t,e):b(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,n[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=s>>>26,this.words[n]=67108863&s}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(e=0;e>>26-n}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,f=0;f=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i>26,this.words[i+n]=67108863&s;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),s=t,o=0|s.words[s.length-1];0!==(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f=0;c--){var d=67108864*(0|n.words[s.length+c])+(0|n.words[s.length+c-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=d)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(s=a.div.neg()),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:s,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var s,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=67108864%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s=new i(1),o=new i(0),a=new i(0),u=new i(1),f=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++f;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(h),o.isub(c)),s.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(n.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a),o.isub(u)):(n.isub(e),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(f)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s,o=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return(s=0===e.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(t),s},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new O(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){O.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(v,y),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,s=o}s>>>=22,t.words[i-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},O.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},O.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},O.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},O.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},O.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},O.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},O.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},O.prototype.isqr=function(t){return this.imul(t,t.clone())},O.prototype.sqr=function(t){return this.mul(t,t)},O.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,s),d=this.pow(t,s.addn(1).iushrn(1)),l=this.pow(t,s),p=o;0!==l.cmp(a);){for(var b=l,m=0;0!==b.cmp(a);m++)b=b.redSqr();r(m=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;s!==r[0]&&(s=this.sqr(s)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===h)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},O.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},O.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},n(E,O),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)})),s.register("lYixV",(function(t,e){var r=s("isk9v"),n=s("CIbpD");function i(t){this.rand=t||new n.Rand}t.exports=i,i.create=function(t){return new i(t)},i.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(t)>=0);return i},i.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},i.prototype.test=function(t,e,n){var i=t.bitLength(),s=r.mont(t),o=new r(1).toRed(s);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var f=t.shrn(u),h=a.toRed(s);e>0;e--){var c=this._randrange(new r(2),a);n&&n(c);var d=c.toRed(s).redPow(f);if(0!==d.cmp(o)&&0!==d.cmp(h)){for(var l=1;l0;e--){var h=this._randrange(new r(2),o),c=t.gcd(h);if(0!==c.cmpn(1))return c;var d=h.toRed(i).redPow(u);if(0!==d.cmp(s)&&0!==d.cmp(f)){for(var l=1;l0&&r.ishrn(n),r}function d(t,e,i){var s,o;do{for(s=r.alloc(0);8*s.length=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),s=e.modulus.byteLength(),a=new n(t).mul(i.blinder).umod(e.modulus),u=a.toRed(n.mont(e.prime1)),f=a.toRed(n.mont(e.prime2)),h=e.coefficient,c=e.prime1,d=e.prime2,l=u.redPow(e.exponent1).fromRed(),p=f.redPow(e.exponent2).fromRed(),b=l.isub(p).imul(h).umod(c).imul(d);return p.iadd(b).imul(i.unblinder).umod(e.modulus).toArrayLike(r,"be",s)}a.getr=o,t.exports=a})),s.register("1Zyr1",(function(t,e){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:s("dfeT0").Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,n,i){for(var s=0,o=0,a=Math.min(t.length,n),u=e;u=49?f-49+10:f>=17?f-17+10:f,r(f>=0&&o0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,s=0,o=0;o>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==s||o!==this.length-1?d[6-u.length]+u+n:u+n}for(0!==s&&(n=s.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],h=p[t];n="";var c=this.clone();for(c.negative=0;!c.isZero();){var b=c.modrn(h).toString(t);n=(c=c.idivn(h)).isZero()?b+n:d[f-b.length]+b+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f>>26,c=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;h+=(o=(i=0|t.words[p])*(s=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,s=0;i>8&255),r>16&255),6===s?(r>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],g=8191&m,y=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,S=0|o[4],O=8191&S,E=S>>>13,I=0|o[5],P=8191&I,M=I>>>13,A=0|o[6],k=8191&A,x=A>>>13,R=0|o[7],T=8191&R,B=R>>>13,N=0|o[8],C=8191&N,L=N>>>13,U=0|o[9],D=8191&U,H=U>>>13,j=0|a[0],F=8191&j,K=j>>>13,V=0|a[1],q=8191&V,G=V>>>13,Y=0|a[2],z=8191&Y,W=Y>>>13,J=0|a[3],Z=8191&J,X=J>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,K))+Math.imul(d,F)|0))<<13)|0;f=((s=Math.imul(d,K))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,K))+Math.imul(b,F)|0,s=Math.imul(b,K);var gt=(f+(n=n+Math.imul(c,q)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,q)|0))<<13)|0;f=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,K))+Math.imul(y,F)|0,s=Math.imul(y,K),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,q)|0,s=s+Math.imul(b,G)|0;var yt=(f+(n=n+Math.imul(c,z)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,z)|0))<<13)|0;f=((s=s+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,K))+Math.imul(_,F)|0,s=Math.imul(_,K),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(y,q)|0,s=s+Math.imul(y,G)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,z)|0,s=s+Math.imul(b,W)|0;var vt=(f+(n=n+Math.imul(c,Z)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,Z)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,K))+Math.imul(E,F)|0,s=Math.imul(E,K),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,q)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,z)|0,s=s+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,X)|0;var wt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,K))+Math.imul(M,F)|0,s=Math.imul(M,K),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(E,q)|0,s=s+Math.imul(E,G)|0,n=n+Math.imul(w,z)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,z)|0,s=s+Math.imul(_,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,K))+Math.imul(x,F)|0,s=Math.imul(x,K),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(M,q)|0,s=s+Math.imul(M,G)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(E,z)|0,s=s+Math.imul(E,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0;var St=(f+(n=n+Math.imul(c,st)|0)|0)+((8191&(i=(i=i+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,K))+Math.imul(B,F)|0,s=Math.imul(B,K),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,q)|0,s=s+Math.imul(x,G)|0,n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(M,z)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,nt)|0,n=n+Math.imul(p,st)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0;var Ot=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,K))+Math.imul(L,F)|0,s=Math.imul(L,K),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,q)|0,s=s+Math.imul(B,G)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(x,z)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,nt)|0,n=n+Math.imul(g,st)|0,i=(i=i+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,s=s+Math.imul(b,ft)|0;var Et=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,K))+Math.imul(H,F)|0,s=Math.imul(H,K),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,q)|0,s=s+Math.imul(L,G)|0,n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,z)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(w,st)|0,i=(i=i+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,s=s+Math.imul(b,dt)|0;var It=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((s=s+Math.imul(d,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(H,q)|0,s=Math.imul(H,G),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(L,z)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(O,st)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,s=s+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((s=s+Math.imul(b,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,W))+Math.imul(H,z)|0,s=Math.imul(H,W),n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,X)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(P,st)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,dt)|0;var Mt=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((s=s+Math.imul(y,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,X))+Math.imul(H,Z)|0,s=Math.imul(H,X),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,s=s+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(k,st)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(M,ut)|0,s=s+Math.imul(M,ft)|0,n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var At=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((s=s+Math.imul(_,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,tt))+Math.imul(H,$)|0,s=Math.imul(H,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,s=s+Math.imul(L,nt)|0,n=n+Math.imul(T,st)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ft)|0)+Math.imul(x,ut)|0,s=s+Math.imul(x,ft)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(M,ct)|0,s=s+Math.imul(M,dt)|0;var kt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(E,pt)|0))<<13)|0;f=((s=s+Math.imul(E,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(H,rt)|0,s=Math.imul(H,nt),n=n+Math.imul(C,st)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,st)|0,s=s+Math.imul(L,ot)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(B,ut)|0,s=s+Math.imul(B,ft)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(x,ct)|0,s=s+Math.imul(x,dt)|0;var xt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((s=s+Math.imul(M,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,st),i=(i=Math.imul(D,ot))+Math.imul(H,st)|0,s=Math.imul(H,ot),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(L,ut)|0,s=s+Math.imul(L,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,s=s+Math.imul(B,dt)|0;var Rt=(f+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,bt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((s=s+Math.imul(x,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ft))+Math.imul(H,ut)|0,s=Math.imul(H,ft),n=n+Math.imul(C,ct)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(L,ct)|0,s=s+Math.imul(L,dt)|0;var Tt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((s=s+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,dt))+Math.imul(H,ct)|0,s=Math.imul(H,dt);var Bt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((s=s+Math.imul(L,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Nt=(f+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(H,pt)|0))<<13)|0;return f=((s=Math.imul(H,bt))+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Ot,u[8]=Et,u[9]=It,u[10]=Pt,u[11]=Mt,u[12]=At,u[13]=kt,u[14]=xt,u[15]=Rt,u[16]=Tt,u[17]=Bt,u[18]=Nt,0!==f&&(u[19]=f,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=b),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?b(this,t,e):r<1024?g(this,t,e):y(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,n[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,n+=s/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(e=0;e>>26-n}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,f=0;f=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i>26,this.words[i+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),s=t,o=0|s.words[s.length-1];0!==(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f=0;c--){var d=67108864*(0|n.words[s.length+c])+(0|n.words[s.length+c-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=d)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(s=a.div.neg()),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:s,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var s,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=67108864%t,i=0,s=this.length-1;s>=0;s--)i=(n*i+(0|this.words[s]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*n;this.words[i]=s/t|0,n=s%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s=new i(1),o=new i(0),a=new i(0),u=new i(1),f=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++f;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(h),o.isub(c)),s.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(n.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a),o.isub(u)):(n.isub(e),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(f)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s,o=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return(s=0===e.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(t),s},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new P(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function O(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){P.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}_.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},n(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,s=o}s>>>=22,t.words[i-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new O;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return w[t]=e,e},P.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},P.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},P.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},P.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},P.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},P.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},P.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},P.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},P.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},P.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},P.prototype.isqr=function(t){return this.imul(t,t.clone())},P.prototype.sqr=function(t){return this.mul(t,t)},P.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,s),d=this.pow(t,s.addn(1).iushrn(1)),l=this.pow(t,s),p=o;0!==l.cmp(a);){for(var b=l,m=0;0!==b.cmp(a);m++)b=b.redSqr();r(m=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;s!==r[0]&&(s=this.sqr(s)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===h)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},P.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},P.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,P),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)})),s.register("l8Hix",(function(t,e){"use strict";var r=t.exports;r.version=s("9LKIe").version,r.utils=s("aVUEH"),r.rand=s("CIbpD"),r.curve=s("9bMBJ"),r.curves=s("7xvWs"),r.ec=s("4GLUy"),r.eddsa=s("ckmnE")})),s.register("9LKIe",(function(t,e){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')})),s.register("aVUEH",(function(t,e){"use strict";var r=t.exports,n=s("isk9v"),i=s("cxHvZ"),o=s("cmaVp");r.assert=i,r.toArray=o.toArray,r.zero2=o.zero2,r.toHex=o.toHex,r.encode=o.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,s=0;t.cmpn(-i)>0||e.cmpn(-s)>0;){var o,a,u=t.andln(3)+i&3,f=e.andln(3)+s&3;3===u&&(u=-1),3===f&&(f=-1),o=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==f?u:-u,r[0].push(o),a=0==(1&f)?0:3!==(n=e.andln(7)+s&7)&&5!==n||2!==u?f:-f,r[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new n(t,"hex","le")}})),s.register("cmaVp",(function(t,e){"use strict";var r=t.exports;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,o=255&i;s?r.push(s,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),s.register("9bMBJ",(function(t,e){"use strict";var r=t.exports;r.base=s("i0GDZ"),r.short=s("4H04c"),r.mont=s("jJuD9"),r.edwards=s("gWebU")})),s.register("i0GDZ",(function(t,e){"use strict";var r=s("isk9v"),n=s("aVUEH"),i=n.getNAF,o=n.getJSF,a=n.assert;function u(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=i(e,1,this._bitLength),s=(1<=o;h--)u=(u<<1)+n[h];f.push(u)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),l=s;l>0;l--){for(o=0;o=0;f--){for(var h=0;f>=0&&0===o[f];f--)h++;if(f>=0&&h++,u=u.dblp(h),f<0)break;var c=o[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(s[c-1>>1]):u.mixedAdd(s[-c-1>>1].neg()):c>0?u.add(s[c-1>>1]):u.add(s[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,s){var a,u,f,h=this._wnafT1,c=this._wnafT2,d=this._wnafT3,l=0;for(a=0;a=1;a-=2){var b=a-1,m=a;if(1===h[b]&&1===h[m]){var g=[e[b],null,null,e[m]];0===e[b].y.cmp(e[m].y)?(g[1]=e[b].add(e[m]),g[2]=e[b].toJ().mixedAdd(e[m].neg())):0===e[b].y.cmp(e[m].y.redNeg())?(g[1]=e[b].toJ().mixedAdd(e[m]),g[2]=e[b].add(e[m].neg())):(g[1]=e[b].toJ().mixedAdd(e[m]),g[2]=e[b].toJ().mixedAdd(e[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=o(r[b],r[m]);for(l=Math.max(v[0].length,l),d[b]=new Array(l),d[m]=new Array(l),u=0;u=0;a--){for(var E=0;a>=0;){var I=!0;for(u=0;u=0&&E++,S=S.dblp(E),a<0)break;for(u=0;u0?f=c[u][P-1>>1]:P<0&&(f=c[u][-P-1>>1].neg()),S="affine"===f.type?S.mixedAdd(f):S.add(f))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),f=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(e&&!s||!e&&s)&&(i=i.redNeg()),this.point(t,i)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},i(h,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=n.redMul(f),d=u.redSqr().redIAdd(h).redISub(c).redISub(c),l=u.redMul(c.redISub(d)).redISub(s.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),f=u.redMul(o),h=r.redMul(u),c=a.redSqr().redIAdd(f).redISub(h).redISub(h),d=a.redMul(h.redISub(c)).redISub(i.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(c,d,l)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}})),s.register("jJuD9",(function(t,e){"use strict";var r=s("isk9v"),n=s("fmwGI"),i=s("i0GDZ"),o=s("aVUEH");function a(t){i.call(this,"mont",t),this.a=new r(t.a,16).toRed(this.red),this.b=new r(t.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,n){i.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(e,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,i),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},n(u,i.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=i.redMul(n),a=e.z.redMul(s.redAdd(o).redSqr()),u=e.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var s=i.length-1;s>=0;s--)0===i[s]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}})),s.register("gWebU",(function(t,e){"use strict";var r=s("aVUEH"),n=s("isk9v"),i=s("fmwGI"),o=s("i0GDZ"),a=r.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function f(t,e,r,i,s){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}i(u,o),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},i(f,o.BasePoint),u.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new f(this,t,e,r,n)},f.fromJSON=function(t,e){return new f(t,e[0],e[1],e[2])},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),u=i.redMul(o),f=s.redMul(a),h=i.redMul(a),c=o.redMul(s);return this.curve.point(u,f,c,h)},f.prototype._projDbl=function(){var t,e,r,n,i,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var f=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=o.redSub(a).redSub(u).redMul(f.redSub(this.curve.two)),e=f.redMul(n.redSub(u)),r=f.redSqr().redSub(f).redSub(f)):(i=this.z.redSqr(),s=f.redSub(i).redISub(i),t=o.redSub(a).redISub(u).redMul(s),e=f.redMul(n.redSub(u)),r=f.redMul(s))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),s=n.redSub(i).redSub(i),t=this.curve._mulC(o.redISub(n)).redMul(s),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(s);return this.curve.point(t,e,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=s.redMul(o),h=a.redMul(u),c=s.redMul(u),d=o.redMul(a);return this.curve.point(f,h,d,c)},f.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),u=i.redSub(a),f=i.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),c=n.redMul(u).redMul(h);return this.curve.twisted?(e=n.redMul(f).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(f)):(e=n.redMul(f).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(f)),this.curve.point(c,e,r)},f.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},f.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add})),s.register("7xvWs",(function(t,e){"use strict";var r,n=t.exports,i=s("aI3Mi"),o=s("9bMBJ"),a=s("aVUEH").assert;function u(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,f("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"]}),f("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"]}),f("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"]}),f("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"]}),f("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"]}),f("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"]}),f("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"]});try{r=s("bUv8l")}catch(t){r=void 0}f("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",r]})})),s.register("aI3Mi",(function(t,e){var r=t.exports;r.utils=s("fF0zp"),r.common=s("i0wl1"),r.sha=s("etk7N"),r.ripemd=s("bNdgT"),r.hmac=s("l8gnY"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160})),s.register("fF0zp",(function(e,r){var n,i,o,a,u,f,h,c,d,l,p,b,m,g,y,v,w,_,S,O,E,I,P,M,A,k;t(e.exports,"inherits",(()=>n),(t=>n=t)),t(e.exports,"toArray",(()=>i),(t=>i=t)),t(e.exports,"toHex",(()=>o),(t=>o=t)),t(e.exports,"htonl",(()=>a),(t=>a=t)),t(e.exports,"toHex32",(()=>u),(t=>u=t)),t(e.exports,"zero2",(()=>f),(t=>f=t)),t(e.exports,"zero8",(()=>h),(t=>h=t)),t(e.exports,"join32",(()=>c),(t=>c=t)),t(e.exports,"split32",(()=>d),(t=>d=t)),t(e.exports,"rotr32",(()=>l),(t=>l=t)),t(e.exports,"rotl32",(()=>p),(t=>p=t)),t(e.exports,"sum32",(()=>b),(t=>b=t)),t(e.exports,"sum32_3",(()=>m),(t=>m=t)),t(e.exports,"sum32_4",(()=>g),(t=>g=t)),t(e.exports,"sum32_5",(()=>y),(t=>y=t)),t(e.exports,"sum64",(()=>v),(t=>v=t)),t(e.exports,"sum64_hi",(()=>w),(t=>w=t)),t(e.exports,"sum64_lo",(()=>_),(t=>_=t)),t(e.exports,"sum64_4_hi",(()=>S),(t=>S=t)),t(e.exports,"sum64_4_lo",(()=>O),(t=>O=t)),t(e.exports,"sum64_5_hi",(()=>E),(t=>E=t)),t(e.exports,"sum64_5_lo",(()=>I),(t=>I=t)),t(e.exports,"rotr64_hi",(()=>P),(t=>P=t)),t(e.exports,"rotr64_lo",(()=>M),(t=>M=t)),t(e.exports,"shr64_hi",(()=>A),(t=>A=t)),t(e.exports,"shr64_lo",(()=>k),(t=>k=t));var x=s("cxHvZ"),R=s("fmwGI");function T(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function B(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function N(t){return 1===t.length?"0"+t:t}function C(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}n=R,i=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&s|128):T(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},d=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r},l=function(t,e){return t>>>e|t<<32-e},p=function(t,e){return t<>>32-e},b=function(t,e){return t+e>>>0},m=function(t,e,r){return t+e+r>>>0},g=function(t,e,r,n){return t+e+r+n>>>0},y=function(t,e,r,n,i){return t+e+r+n+i>>>0},v=function(t,e,r,n){var i=t[e],s=n+t[e+1]>>>0,o=(s>>0,t[e+1]=s},w=function(t,e,r,n){return(e+n>>>0>>0},_=function(t,e,r,n){return e+n>>>0},S=function(t,e,r,n,i,s,o,a){var u=0,f=e;return u+=(f=f+n>>>0)>>0)>>0)>>0},O=function(t,e,r,n,i,s,o,a){return e+n+s+a>>>0},E=function(t,e,r,n,i,s,o,a,u,f){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},I=function(t,e,r,n,i,s,o,a,u,f){return e+n+s+a+f>>>0},P=function(t,e,r){return(e<<32-r|t>>>r)>>>0},M=function(t,e,r){return(t<<32-r|e>>>r)>>>0},A=function(t,e,r){return t>>>r},k=function(t,e,r){return(t<<32-r|e>>>r)>>>0}})),s.register("i0wl1",(function(e,r){var n;t(e.exports,"BlockHash",(()=>n),(t=>n=t));var i=s("fF0zp"),o=s("cxHvZ");function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}n=a,a.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;sn),(t=>n=t)),t(e.exports,"sha224",(()=>i),(t=>i=t)),t(e.exports,"sha256",(()=>o),(t=>o=t)),t(e.exports,"sha384",(()=>a),(t=>a=t)),t(e.exports,"sha512",(()=>u),(t=>u=t)),n=s("gqMLi"),i=s("eWxin"),o=s("Pa3Qc"),a=s("1S1YQ"),u=s("kV1Az")})),s.register("gqMLi",(function(t,e){"use strict";var r=s("fF0zp"),n=s("i0wl1"),i=s("a3uGB"),o=r.rotl32,a=r.sum32,u=r.sum32_5,f=i.ft_1,h=n.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(d,h),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nn),(t=>n=t)),t(e.exports,"ch32",(()=>i),(t=>i=t)),t(e.exports,"maj32",(()=>o),(t=>o=t)),t(e.exports,"s0_256",(()=>a),(t=>a=t)),t(e.exports,"s1_256",(()=>u),(t=>u=t)),t(e.exports,"g0_256",(()=>f),(t=>f=t)),t(e.exports,"g1_256",(()=>h),(t=>h=t));var c=s("fF0zp").rotr32;function d(t,e,r){return t&e^~t&r}function l(t,e,r){return t&e^t&r^e&r}function p(t,e,r){return t^e^r}n=function(t,e,r,n){return 0===t?d(e,r,n):1===t||3===t?p(e,r,n):2===t?l(e,r,n):void 0},i=d,o=l,a=function(t){return c(t,2)^c(t,13)^c(t,22)},u=function(t){return c(t,6)^c(t,11)^c(t,25)},f=function(t){return c(t,7)^c(t,18)^t>>>3},h=function(t){return c(t,17)^c(t,19)^t>>>10}})),s.register("eWxin",(function(t,e){"use strict";var r=s("fF0zp"),n=s("Pa3Qc");function i(){if(!(this instanceof i))return new i;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(i,n),t.exports=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}})),s.register("Pa3Qc",(function(t,e){"use strict";var r=s("fF0zp"),n=s("i0wl1"),i=s("a3uGB"),o=s("cxHvZ"),a=r.sum32,u=r.sum32_4,f=r.sum32_5,h=i.ch32,c=i.maj32,d=i.s0_256,l=i.s1_256,p=i.g0_256,b=i.g1_256,m=n.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}r.inherits(y,m),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nn),(t=>n=t));var i=s("fF0zp"),o=s("i0wl1"),a=i.rotl32,u=i.sum32,f=i.sum32_3,h=i.sum32_4,c=o.BlockHash;function d(){if(!(this instanceof d))return new d;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function p(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function b(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}i.inherits(d,c),n=d,d.blockSize=512,d.outSize=160,d.hmacStrength=192,d.padLength=64,d.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],s=this.h[3],o=this.h[4],c=r,d=n,w=i,_=s,S=o,O=0;O<80;O++){var E=u(a(h(r,l(O,n,i,s),t[m[O]+e],p(O)),y[O]),o);r=o,o=s,s=a(i,10),i=n,n=E,E=u(a(h(c,l(79-O,d,w,_),t[g[O]+e],b(O)),v[O]),S),c=S,S=_,_=a(w,10),w=d,d=E}E=f(this.h[1],i,_),this.h[1]=f(this.h[2],s,S),this.h[2]=f(this.h[3],o,c),this.h[3]=f(this.h[4],r,d),this.h[4]=f(this.h[0],n,w),this.h[0]=E},d.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var m=[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],g=[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],y=[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],v=[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]})),s.register("l8gnY",(function(t,e){"use strict";var r=s("fF0zp"),n=s("cxHvZ");function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}t.exports=i,i.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,i,s){"object"==typeof i&&(s=i,i=null),s||(s={}),e=this.keyFromPrivate(e,i),t=this._truncateToN(new r(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new n({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),c=this.n.sub(new r(1)),d=0;;d++){var l=s.k?s.k(d):new r(f.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var g=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return s.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new h({r:m,s:g,recoveryParam:y})}}}}}},c.prototype.verify=function(t,e,n,i){t=this._truncateToN(new r(t,16)),n=this.keyFromPublic(n,i);var s=(e=new h(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,u=o.invm(this.n),f=u.mul(t).umod(this.n),c=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,n.getPublic(),c)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(f,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},c.prototype.recoverPubKey=function(t,e,n,i){u((3&n)===n,"The recovery param is more than two bits"),e=new h(e,i);var s=this.n,o=new r(t),a=e.r,f=e.s,c=1&n,d=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=e.r.invm(s),p=s.sub(o).mul(l).umod(s),b=f.mul(l).umod(s);return this.g.mulAdd(p,a,b)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}})),s.register("dhP6n",(function(t,e){"use strict";var r=s("aI3Mi"),n=s("cmaVp"),i=s("cxHvZ");function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),s=n.toArray(t.pers,t.persEnc||"hex");i(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,s)}t.exports=o,o.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"}})),s.register("ieLrs",(function(t,e){"use strict";var r=s("isk9v"),n=s("aVUEH"),i=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(i(t.r&&t.s,"Signature without r or s"),this.r=new r(t.r,16),this.s=new r(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return!(i<=127)&&(e.place=o,i)}function f(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var i=new a;if(48!==t[i.place++])return!1;var s=u(t,i);if(!1===s)return!1;if(s+i.place!==t.length)return!1;if(2!==t[i.place++])return!1;var o=u(t,i);if(!1===o)return!1;var f=t.slice(i.place,o+i.place);if(i.place+=o,2!==t[i.place++])return!1;var h=u(t,i);if(!1===h)return!1;if(t.length!==h+i.place)return!1;var c=t.slice(i.place,h+i.place);if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new r(f),this.s=new r(c),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=f(e),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];h(i,e.length),(i=i.concat(e)).push(2),h(i,r.length);var s=i.concat(r),o=[48];return h(o,s.length),o=o.concat(s),n.encode(o,t)}})),s.register("ckmnE",(function(t,e){"use strict";var r=s("aI3Mi"),n=s("7xvWs"),i=s("aVUEH"),o=i.assert,a=i.parseBytes,u=s("63Qp4"),f=s("hu8dJ");function h(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=r.sha512}t.exports=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:s})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,n,i){for(var s=0,o=0,a=Math.min(t.length,n),u=e;u=49?f-49+10:f>=17?f-17+10:f,r(f>=0&&o0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,s=0,o=0;o>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==s||o!==this.length-1?d[6-u.length]+u+n:u+n}for(0!==s&&(n=s.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],h=p[t];n="";var c=this.clone();for(c.negative=0;!c.isZero();){var b=c.modrn(h).toString(t);n=(c=c.idivn(h)).isZero()?b+n:d[f-b.length]+b+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],s=0|e.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f>>26,c=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;h+=(o=(i=0|t.words[p])*(s=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,s=0;i>8&255),r>16&255),6===s?(r>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],g=8191&m,y=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,S=0|o[4],O=8191&S,E=S>>>13,I=0|o[5],P=8191&I,M=I>>>13,A=0|o[6],k=8191&A,x=A>>>13,R=0|o[7],T=8191&R,B=R>>>13,N=0|o[8],C=8191&N,L=N>>>13,U=0|o[9],D=8191&U,H=U>>>13,j=0|a[0],F=8191&j,K=j>>>13,V=0|a[1],q=8191&V,G=V>>>13,Y=0|a[2],z=8191&Y,W=Y>>>13,J=0|a[3],Z=8191&J,X=J>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,K))+Math.imul(d,F)|0))<<13)|0;f=((s=Math.imul(d,K))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,K))+Math.imul(b,F)|0,s=Math.imul(b,K);var gt=(f+(n=n+Math.imul(c,q)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,q)|0))<<13)|0;f=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,K))+Math.imul(y,F)|0,s=Math.imul(y,K),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,q)|0,s=s+Math.imul(b,G)|0;var yt=(f+(n=n+Math.imul(c,z)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,z)|0))<<13)|0;f=((s=s+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,K))+Math.imul(_,F)|0,s=Math.imul(_,K),n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(y,q)|0,s=s+Math.imul(y,G)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,z)|0,s=s+Math.imul(b,W)|0;var vt=(f+(n=n+Math.imul(c,Z)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,Z)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,K))+Math.imul(E,F)|0,s=Math.imul(E,K),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,q)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,z)|0,s=s+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,X)|0;var wt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,K))+Math.imul(M,F)|0,s=Math.imul(M,K),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(E,q)|0,s=s+Math.imul(E,G)|0,n=n+Math.imul(w,z)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,z)|0,s=s+Math.imul(_,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,K))+Math.imul(x,F)|0,s=Math.imul(x,K),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(M,q)|0,s=s+Math.imul(M,G)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(E,z)|0,s=s+Math.imul(E,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0;var St=(f+(n=n+Math.imul(c,st)|0)|0)+((8191&(i=(i=i+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,K))+Math.imul(B,F)|0,s=Math.imul(B,K),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,q)|0,s=s+Math.imul(x,G)|0,n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(M,z)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,nt)|0,n=n+Math.imul(p,st)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0;var Ot=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,K))+Math.imul(L,F)|0,s=Math.imul(L,K),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,q)|0,s=s+Math.imul(B,G)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(x,z)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,nt)|0,n=n+Math.imul(g,st)|0,i=(i=i+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,s=s+Math.imul(b,ft)|0;var Et=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,K))+Math.imul(H,F)|0,s=Math.imul(H,K),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,q)|0,s=s+Math.imul(L,G)|0,n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,z)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(w,st)|0,i=(i=i+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,s=s+Math.imul(b,dt)|0;var It=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((s=s+Math.imul(d,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(H,q)|0,s=Math.imul(H,G),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(L,z)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(O,st)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,s=s+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((s=s+Math.imul(b,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,W))+Math.imul(H,z)|0,s=Math.imul(H,W),n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,X)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(P,st)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,dt)|0;var Mt=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((s=s+Math.imul(y,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,X))+Math.imul(H,Z)|0,s=Math.imul(H,X),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,s=s+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,s=s+Math.imul(B,nt)|0,n=n+Math.imul(k,st)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(M,ut)|0,s=s+Math.imul(M,ft)|0,n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var At=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((s=s+Math.imul(_,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,tt))+Math.imul(H,$)|0,s=Math.imul(H,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,s=s+Math.imul(L,nt)|0,n=n+Math.imul(T,st)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(B,st)|0,s=s+Math.imul(B,ot)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ft)|0)+Math.imul(x,ut)|0,s=s+Math.imul(x,ft)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(M,ct)|0,s=s+Math.imul(M,dt)|0;var kt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(E,pt)|0))<<13)|0;f=((s=s+Math.imul(E,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(H,rt)|0,s=Math.imul(H,nt),n=n+Math.imul(C,st)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,st)|0,s=s+Math.imul(L,ot)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(B,ut)|0,s=s+Math.imul(B,ft)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(x,ct)|0,s=s+Math.imul(x,dt)|0;var xt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((s=s+Math.imul(M,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,st),i=(i=Math.imul(D,ot))+Math.imul(H,st)|0,s=Math.imul(H,ot),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(L,ut)|0,s=s+Math.imul(L,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,s=s+Math.imul(B,dt)|0;var Rt=(f+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,bt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((s=s+Math.imul(x,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ft))+Math.imul(H,ut)|0,s=Math.imul(H,ft),n=n+Math.imul(C,ct)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(L,ct)|0,s=s+Math.imul(L,dt)|0;var Tt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((s=s+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,dt))+Math.imul(H,ct)|0,s=Math.imul(H,dt);var Bt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((s=s+Math.imul(L,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Nt=(f+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(H,pt)|0))<<13)|0;return f=((s=Math.imul(H,bt))+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Ot,u[8]=Et,u[9]=It,u[10]=Pt,u[11]=Mt,u[12]=At,u[13]=kt,u[14]=xt,u[15]=Rt,u[16]=Tt,u[17]=Bt,u[18]=Nt,0!==f&&(u[19]=f,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=b),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?b(this,t,e):r<1024?g(this,t,e):y(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,n[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,n+=s/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(e=0;e>>26-n}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,f=0;f=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i>26,this.words[i+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),s=t,o=0|s.words[s.length-1];0!==(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f=0;c--){var d=67108864*(0|n.words[s.length+c])+(0|n.words[s.length+c-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=d)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(s=a.div.neg()),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:s,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var s,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=67108864%t,i=0,s=this.length-1;s>=0;s--)i=(n*i+(0|this.words[s]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*n;this.words[i]=s/t|0,n=s%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s=new i(1),o=new i(0),a=new i(0),u=new i(1),f=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++f;for(var h=n.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(h),o.isub(c)),s.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(n.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a),o.isub(u)):(n.isub(e),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(f)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s,o=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return(s=0===e.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(t),s},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new P(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function O(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){P.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}_.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},n(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,s=o}s>>>=22,t.words[i-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new O;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return w[t]=e,e},P.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},P.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},P.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},P.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},P.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},P.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},P.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},P.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},P.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},P.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},P.prototype.isqr=function(t){return this.imul(t,t.clone())},P.prototype.sqr=function(t){return this.mul(t,t)},P.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,s),d=this.pow(t,s.addn(1).iushrn(1)),l=this.pow(t,s),p=o;0!==l.cmp(a);){for(var b=l,m=0;0!==b.cmp(a);m++)b=b.redSqr();r(m=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;s!==r[0]&&(s=this.sqr(s)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===h)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},P.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},P.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,P),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)})),s.register("gZ6Jv",(function(t,e){var r=s("6uV5B"),n=s("krSrj"),i=s("2L3AI"),o=s("9ctAy"),a=s("7gX28"),u=s("dUSMG").Buffer;function f(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var s,f,h=i(t,e),c=h.tag,d=h.data;switch(c){case"CERTIFICATE":f=r.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=r.PublicKey.decode(d,"der")),s=f.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.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=r.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+s)}case"ENCRYPTED PRIVATE KEY":d=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),s=n[t.algorithm.decrypt.cipher.algo.join(".")],f=t.algorithm.decrypt.cipher.iv,h=t.subjectPrivateKey,c=parseInt(s.split("-")[1],10)/8,d=a.pbkdf2Sync(e,r,i,c,"sha1"),l=o.createDecipheriv(s,d,f),p=[];return p.push(l.update(h)),p.push(l.final()),u.concat(p)}(d=r.EncryptedPrivateKey.decode(d,"der"),e);case"PRIVATE KEY":switch(s=(f=r.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:r.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=r.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+s)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=r.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+c)}}t.exports=f,f.signature=r.signature})),s.register("6uV5B",(function(e,r){var n,i,o,a,u,f,h,c,d,l;t(e.exports,"certificate",(()=>n),(t=>n=t)),t(e.exports,"RSAPrivateKey",(()=>i),(t=>i=t)),t(e.exports,"RSAPublicKey",(()=>o),(t=>o=t)),t(e.exports,"PublicKey",(()=>a),(t=>a=t)),t(e.exports,"PrivateKey",(()=>u),(t=>u=t)),t(e.exports,"EncryptedPrivateKey",(()=>f),(t=>f=t)),t(e.exports,"DSAPrivateKey",(()=>h),(t=>h=t)),t(e.exports,"DSAparam",(()=>c),(t=>c=t)),t(e.exports,"ECPrivateKey",(()=>d),(t=>d=t)),t(e.exports,"signature",(()=>l),(t=>l=t));var p=s("lxHrG");n=s("a2ekw");var b=p.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())}));i=b;var m=p.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));o=m;var g=p.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(y),this.key("subjectPublicKey").bitstr())}));a=g;var y=p.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())})),v=p.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(y),this.key("subjectPrivateKey").octstr())}));u=v;var w=p.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())}));f=w;var _=p.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())}));h=_,c=p.define("DSAparam",(function(){this.int()}));var S=p.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(O),this.key("publicKey").optional().explicit(1).bitstr())}));d=S;var O=p.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));l=p.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))})),s.register("lxHrG",(function(t,e){"use strict";const r=t.exports;r.bignum=s("isk9v"),r.define=s("289Hn").define,r.base=s("f3uUn"),r.constants=s("94tvK"),r.decoders=s("jgNbV"),r.encoders=s("6GvtM")})),s.register("289Hn",(function(t,e){"use strict";var r=s("6GvtM"),n=s("jgNbV"),i=s("fmwGI");function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}t.exports.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return i(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n[t])),this.decoders[t]},o.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r[t])),this.encoders[t]},o.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}})),s.register("6GvtM",(function(t,e){"use strict";const r=t.exports;r.der=s("6ZGA6"),r.pem=s("54F3g")})),s.register("6ZGA6",(function(t,e){"use strict";var r=s("fmwGI"),n=s("7d3vs").Buffer,i=s("lV85q"),o=s("1iCNA");function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){i.call(this,"der",t)}function f(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(u,i),u.prototype._encodeComposite=function(t,e,r,i){const s=function(t,e,r,n){let i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(o.tagByName.hasOwnProperty(t))i=o.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}if(i>=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=o.tagClassByName[r||"universal"]<<6,i}(t,e,r,this.reporter);if(i.length<128){const t=n.alloc(2);return t[0]=s,t[1]=i.length,this._createEncoderBuffer([t,i])}let a=1;for(let t=i.length;t>=256;t>>=8)a++;const u=n.alloc(2+a);u[0]=s,u[1]=128|a;for(let t=1+a,e=i.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,i])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=n.alloc(2*t.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let i=0;for(let e=0;e=128;r>>=7)i++}const s=n.alloc(i);let o=s.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(s[o--]=127&r;(r>>=7)>0;)s[o--]=128|127&r}return this._createEncoderBuffer(s)},u.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[f(n.getUTCFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[f(n.getUTCFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=n.from(e)}if(n.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=n.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const i=new Array(r);for(let e=i.length-1;e>=0;e--)i[e]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(n.from(i))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const s=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),s.length!==n.defaultBuffer.length)return!1;for(i=0;i=2147483648)throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=o(t);return e&&0!==e.length?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n}),!a.kStringMaxLength)try{a.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a})),s.register("lV85q",(function(t,e){"use strict";var r=s("dmDm4").Reporter,n=s("h73bz").EncoderBuffer,i=s("h73bz").DecoderBuffer,o=s("cxHvZ");const a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function f(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=f;const h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function(){const t=this._baseState,e={};h.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},f.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},f.prototype._init=function(t){const e=this._baseState;o(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),o.equal(e.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(o(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(o(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){f.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){f.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===e.tag),e.tag=t,this._useArgs(r),this}})),f.prototype.use=function(t){o(t);const e=this._baseState;return o(null===e.use),e.use=t,this},f.prototype.optional=function(){return this._baseState.optional=!0,this},f.prototype.def=function(t){const e=this._baseState;return o(null===e.default),e.default=t,e.optional=!0,this},f.prototype.explicit=function(t){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.explicit=t,this},f.prototype.implicit=function(t){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.implicit=t,this},f.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},f.prototype.key=function(t){const e=this._baseState;return o(null===e.key),e.key=t,this},f.prototype.any=function(){return this._baseState.any=!0,this},f.prototype.choice=function(t){const e=this._baseState;return o(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},f.prototype.contains=function(t){const e=this._baseState;return o(null===e.use),e.contains=t,this},f.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,s=r.default,o=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(o=this._peekTag(t,n,r.any),t.isError(o))return o}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(n)}}if(r.obj&&o&&(n=t.enterObject()),o){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?s=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(s=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(s))return s;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new i(s);s=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&o&&(s=t.leaveObject(n)),null===r.key||null===s&&!0!==o?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,s),s},f.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},f.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),o(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},f.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(s){const o=t.save(),a=r.choice[s];try{const r=a._decode(t,e);if(t.isError(r))return!1;n={type:s,value:r},i=!0}catch(e){return t.restore(o),!1}return!0}),this),i?n:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},f.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},f.prototype._encodeValue=function(t,e,n){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new r);let s=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let o=null,a=!1;if(i.any)s=this._createEncoderBuffer(t);else if(i.choice)s=this._encodeChoice(t,e);else if(i.contains)o=this._getUse(i.contains,n)._encode(t,e),a=!0;else if(i.children)o=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==i.use?s=this._getUse(i.use,n)._encode(t,e):(o=this._encodePrimitive(i.tag,t),a=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(s=this._encodeComposite(t,a,r,o))}return null!==i.explicit&&(s=this._encodeComposite(i.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||o(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},f.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}})),s.register("dmDm4",(function(e,r){var n;t(e.exports,"Reporter",(()=>n),(t=>n=t));var i=s("fmwGI");function o(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function a(t,e){this.path=t,this.rethrow(e)}n=o,o.prototype.isError=function(t){return t instanceof a},o.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},o.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},o.prototype.enterKey=function(t){return this._reporterState.path.push(t)},o.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},o.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},o.prototype.path=function(){return this._reporterState.path.join("/")},o.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},o.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},o.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof a;if(e=n?t:new a(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},o.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(a,Error),a.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}})),s.register("h73bz",(function(e,r){var n,i;t(e.exports,"DecoderBuffer",(()=>n),(t=>n=t)),t(e.exports,"EncoderBuffer",(()=>i),(t=>i=t));var o=s("fmwGI"),a=s("dmDm4").Reporter,u=s("7d3vs").Buffer;function f(t,e){a.call(this,e),u.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function h(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return h.isEncoderBuffer(t)||(t=new h(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=u.byteLength(t);else{if(!u.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}o(f,a),n=f,f.isDecoderBuffer=function(t){if(t instanceof f)return!0;return"object"==typeof t&&u.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},f.prototype.save=function(){return{offset:this.offset,reporter:a.prototype.save.call(this)}},f.prototype.restore=function(t){const e=new f(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,a.prototype.restore.call(this,t.reporter),e},f.prototype.isEmpty=function(){return this.offset===this.length},f.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},f.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new f(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},f.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},i=h,h.isEncoderBuffer=function(t){if(t instanceof h)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},h.prototype.join=function(t,e){return t||(t=u.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):u.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}})),s.register("1iCNA",(function(e,r){var n,i,s,o;function a(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}t(e.exports,"tagClass",(()=>n),(t=>n=t)),t(e.exports,"tagClassByName",(()=>i),(t=>i=t)),t(e.exports,"tag",(()=>s),(t=>s=t)),t(e.exports,"tagByName",(()=>o),(t=>o=t)),i=a(n={0:"universal",1:"application",2:"context",3:"private"}),o=a(s={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"})})),s.register("54F3g",(function(t,e){"use strict";var r=s("fmwGI"),n=s("6ZGA6");function i(t){n.call(this,t),this.enc="pem"}r(i,n),t.exports=i,i.prototype.encode=function(t,e){const r=n.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+e.label+"-----"];for(let t=0;t>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}function c(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;en),(t=>n=t)),s("8fqzO"),n=s("5EjYL")})),s.register("8fqzO",(function(t,r){var n,i,o=s("dUSMG").Buffer,a=s("i5RYA"),u=s("fMHPi"),f=s("5EjYL"),h=s("gm5lI"),c=e.crypto&&e.crypto.subtle,d={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=[];function p(){return i||(i=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function b(t,e,r,n,i){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,r,i,s,m,g){"function"==typeof m&&(g=m,m=void 0);var y=d[(m=m||"sha1").toLowerCase()];if(y&&"function"==typeof e.Promise){if(a(i,s),t=h(t,u,"Password"),r=h(r,u,"Salt"),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){p()((function(){e(null,t)}))}),(function(t){p()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==l[t])return l[t];var r=b(n=n||o.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return l[t]=r,r}(y).then((function(e){return e?b(t,r,i,s,y):f(t,r,i,s,m)})),g)}else p()((function(){var e;try{e=f(t,r,i,s,m)}catch(t){return g(t)}g(null,e)}))}})),s.register("i5RYA",(function(t,e){var r=Math.pow(2,30)-1;t.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>r||e!=e)throw new TypeError("Bad key length")}})),s.register("fMHPi",(function(t,r){var n,i=s("gHWWg");if(e.process&&e.process.browser)n="utf-8";else if(e.process&&e.process.version){n=parseInt(i.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n})),s.register("5EjYL",(function(t,e){var r=s("ltlIh"),n=s("2844X"),i=s("8uGwn"),o=s("dUSMG").Buffer,a=s("i5RYA"),u=s("fMHPi"),f=s("gm5lI"),h=o.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,s){var a=function(t){function e(e){return i(t).update(e).digest()}function s(t){return(new n).update(t).digest()}return"rmd160"===t||"ripemd160"===t?s:"md5"===t?r:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length=e)throw new Error("invalid sig")}t.exports=function(t,e,s,f,h){var c=o(s);if("ec"===c.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var n=a[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var s=new i(n),o=r.data.subjectPrivateKey.data;return s.verify(e,t,o)}(t,e,c)}if("dsa"===c.type){if("dsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,s=r.data.q,a=r.data.g,f=r.data.pub_key,h=o.signature.decode(t,"der"),c=h.s,d=h.r;u(c,s),u(d,s);var l=n.mont(i),p=c.invm(s),b=a.toRed(l).redPow(new n(e).mul(p).mod(s)).fromRed().mul(f.toRed(l).redPow(d.mul(p).mod(s)).fromRed()).mod(i).mod(s);return 0===b.cmp(d)}(t,e,c)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");e=r.concat([h,e]);for(var d=c.modulus.byteLength(),l=[1],p=0;e.length+l.length+2n),(t=>n=t)),t(e.exports,"privateDecrypt",(()=>i),(t=>i=t)),t(e.exports,"privateEncrypt",(()=>o),(t=>o=t)),t(e.exports,"publicDecrypt",(()=>a),(t=>a=t)),n=s("hSn7Q"),i=s("1QJqA"),o=function(t,e){return n(t,e,!0)},a=function(t,e){return i(t,e,!0)}})),s.register("hSn7Q",(function(t,e){var r=s("gZ6Jv"),n=s("kVI2k"),i=s("6PGLY"),o=s("6O1rP"),a=s("7zily"),u=s("isk9v"),f=s("fJ8Xl"),h=s("fSrjB"),c=s("dUSMG").Buffer;t.exports=function(t,e,s){var d;d=t.padding?t.padding:s?1:4;var l,p=r(t);if(4===d)l=function(t,e){var r=t.modulus.byteLength(),s=e.length,f=i("sha1").update(c.alloc(0)).digest(),h=f.length,d=2*h;if(s>r-d-2)throw new Error("message too long");var l=c.alloc(r-s-d-2),p=r-h-1,b=n(h),m=a(c.concat([f,l,c.alloc(1,1),e],p),o(b,p)),g=a(b,o(m,h));return new u(c.concat([c.alloc(1),g,m],r))}(p,e);else if(1===d)l=function(t,e,r){var i,s=e.length,o=t.modulus.byteLength();if(s>o-11)throw new Error("message too long");i=r?c.alloc(o-s-3,255):function(t){var e,r=c.allocUnsafe(t),i=0,s=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return s?h(l,p):f(l,p)}})),s.register("6O1rP",(function(t,e){var r=s("6PGLY"),n=s("dUSMG").Buffer;function i(t){var e=n.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var s,o=n.alloc(0),a=0;o.lengthp||new o(e).cmp(l.modulus)>=0)throw new Error("decryption error");d=s?f(new o(e),l):a(e,l);var b=h.alloc(p-d.length);if(d=h.concat([b,d],p),4===c)return function(t,e){var r=t.modulus.byteLength(),s=u("sha1").update(h.alloc(0)).digest(),o=s.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,o+1),f=e.slice(o+1),c=i(a,n(f,o)),d=i(f,n(c,r-o-1));if(function(t,e){t=h.from(t),e=h.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i=e.length){s++;break}var o=e.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&s++;o.length<8&&s++;if(s)throw new Error("decryption error");return e.slice(i)}(0,d,s);if(3===c)return d;throw new Error("unknown padding")}})),s.register("bQftW",(function(r,n){var i,o;t(r.exports,"randomFill",(()=>i),(t=>i=t)),t(r.exports,"randomFillSync",(()=>o),(t=>o=t));var a=s("gHWWg");function u(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var f=s("dUSMG"),h=(s("kVI2k"),f.Buffer),c=f.kMaxLength,d=e.crypto||e.msCrypto,l=Math.pow(2,32)-1;function p(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>l||t<0)throw new TypeError("offset must be a uint32");if(t>c||t>e)throw new RangeError("offset out of range")}function b(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>l||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>c)throw new RangeError("buffer too small")}function m(t,e,r,n){var i=t.buffer,s=new Uint8Array(i,e,r);if(d.getRandomValues(s),!n)return t;a.nextTick((function(){n(null,t)}))}d&&d.getRandomValues?(i=function(t,r,n,i){if(!(h.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)i=r,r=0,n=t.length;else if("function"==typeof n)i=n,n=t.length-r;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return p(r,t.length),b(n,r,t.length),m(t,r,n,i)},o=function(t,r,n){void 0===r&&(r=0);if(!(h.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');p(r,t.length),void 0===n&&(n=t.length-r);return b(n,r,t.length),m(t,r,n)}):(i=u,o=u)})),s.register("caLQh",(function(t,e){"use strict";var r=t.exports;r.crypto={},r.crypto.BN=s("h6qln"),r.crypto.ECDSA=s("6vV2b"),r.crypto.Hash=s("giRii"),r.crypto.Random=s("3wcw8"),r.crypto.Point=s("lyoMU"),r.crypto.Signature=s("cnE2Z"),r.encoding={},r.encoding.Base58=s("doO3n"),r.encoding.Base58Check=s("gIBlU"),r.encoding.BufferReader=s("bW8cN"),r.encoding.BufferWriter=s("jH8RT"),r.encoding.Varint=s("lotH8"),r.util={},r.util.js=s("gdNRY"),r.util.preconditions=s("92anD"),r.errors=s("jyzVj"),r.Address=s("jnlO6"),r.BlockHeader=s("hiEGN"),r.Opcode=s("lT7Qw"),r.PrivateKey=s("97Qx9"),r.PublicKey=s("5XlX7"),r.Script=s("lGskS"),r.Transaction=s("k40G4")})),s.register("h6qln",(function(t,e){var r=s("bfD9J").Buffer,n=s("isk9v"),i=s("92anD"),o=s("duWgj"),a=function(t){for(var e=r.alloc(t.length),n=0;nt.size?e=n.trim(e,s):s0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(t,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.trim=function(t,e){return t.slice(e-t.length,t.length)},n.pad=function(t,e,n){for(var i=r.alloc(n),s=0;sArray.isArray(t),isNumber:t=>"number"==typeof t,isObject:t=>t&&"object"==typeof t,isString:t=>"string"==typeof t,isUndefined:t=>void 0===t,isFunction:t=>"function"==typeof t,isNull:t=>null===t,isDate:t=>t instanceof Date,extend:(t,e)=>Object.assign(t,e),noop:()=>{},every:(t,e)=>t.every(e||(t=>t)),map:(t,e)=>Array.from(t).map(e||(t=>t)),includes:(t,e)=>t.includes(e),each:(t,e)=>t.forEach(e),clone:t=>Object.assign({},t),pick:(t,e)=>{const r={};return e.forEach((e=>{void 0!==t[e]&&(r[e]=t[e])})),r},values:t=>Object.values(t),filter:(t,e)=>t.filter(e),reduce:(t,e,r)=>t.reduce(e,r),without:(t,e)=>t.filter((t=>t!==e)),shuffle:t=>{const e=t.slice(0);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e},difference:(t,e)=>t.filter((t=>!e.includes(t))),findIndex:(t,e)=>t.findIndex(e),some:(t,e)=>t.some(e),range:t=>[...Array(t).keys()]};t.exports=r})),s.register("jMiDR",(function(t,e){"use strict";var r="https://docs.moneybutton.com/";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: "+r+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof 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:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{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"}]}]})),s.register("6vV2b",(function(t,e){var r=s("bfD9J").Buffer,n=s("h6qln"),i=s("lyoMU"),o=s("cnE2Z"),a=s("5XlX7"),u=s("3wcw8"),f=s("giRii"),h=s("duWgj"),c=s("92anD"),d=function t(e){if(!(this instanceof t))return new t(e);e&&this.set(e)};d.prototype.set=function(t){return this.hashbuf=t.hashbuf||this.hashbuf,this.endian=t.endian||this.endian,this.privkey=t.privkey||this.privkey,this.pubkey=t.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=t.sig||this.sig,this.k=t.k||this.k,this.verified=t.verified||this.verified,this},d.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},d.prototype.calci=function(){for(var t=0;t<4;t++){var e;this.sig.i=t;try{e=this.toPublicKey()}catch(t){console.error(t);continue}if(e.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")},d.fromString=function(t){var e=JSON.parse(t);return new d(e)},d.prototype.randomK=function(){var t,e=i.getN();do{t=n.fromBuffer(u.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},d.prototype.deterministicK=function(t){h.isUndefined(t)&&(t=0);var e=r.alloc(32);e.fill(1);var s=r.alloc(32);s.fill(0);var o=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?r.from(this.hashbuf).reverse():this.hashbuf;s=f.sha256hmac(r.concat([e,r.from([0]),o,a]),s),e=f.sha256hmac(e,s),s=f.sha256hmac(r.concat([e,r.from([1]),o,a]),s),e=f.sha256hmac(e,s),e=f.sha256hmac(e,s);for(var u=n.fromBuffer(e),c=i.getN(),d=0;d>1,f=i.getN(),h=i.getG(),d=u?r.add(f):r,l=i.fromX(o,d);if(!l.mul(f).isInfinity())throw new Error("nR is not a valid curve point");var p=e.neg().umod(f),b=r.invm(f),m=l.mul(s).add(h.mul(p)).mul(b);return a.fromPoint(m,this.sig.compressed)},d.prototype.sigError=function(){if(!r.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,e=this.sig.s;if(!(t.gt(n.Zero)&&t.lt(i.getN())&&e.gt(n.Zero)&&e.lt(i.getN())))return"r and s not in range";var s=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=i.getN(),a=e.invm(o),u=a.mul(s).umod(o),f=a.mul(t).umod(o),h=i.getG().mulAdd(u,this.pubkey.point,f);return h.isInfinity()?"p is infinity":0!==h.getX().umod(o).cmp(t)&&"Invalid signature"},d.toLowS=function(t){return t.gt(n.fromBuffer(r.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=i.getN().sub(t)),t},d.prototype._findSignature=function(t,e){var r,s,o,a=i.getN(),u=i.getG(),f=0;do{(!this.k||f>0)&&this.deterministicK(f),f++,r=this.k,s=u.mul(r).x.umod(a),o=r.invm(a).mul(e.add(t.mul(s))).umod(a)}while(s.cmp(n.Zero)<=0||o.cmp(n.Zero)<=0);return{s:o=d.toLowS(o),r:s}},d.prototype.sign=function(){var t=this.hashbuf,e=this.privkey,i=e.bn;c.checkState(t&&e&&i,new Error("invalid parameters")),c.checkState(r.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var s=n.fromBuffer(t,this.endian?{endian:this.endian}:void 0),a=this._findSignature(i,s);return a.compressed=this.pubkey.compressed,this.sig=new o(a),this},d.prototype.signRandomK=function(){return this.randomK(),this.sign()},d.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},d.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},d.sign=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().sig},d.signWithCalcI=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().calci().sig},d.signRandomK=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).signRandomK().sig},d.verify=function(t,e,r,n){return d().set({hashbuf:t,endian:n,sig:e,pubkey:r}).verify().verified},t.exports=d})),s.register("lyoMU",(function(t,e){var r=s("bfD9J").Buffer,n=s("h6qln"),i=new(0,s("l8Hix").ec)("secp256k1"),o=i.curve.point.bind(i.curve),a=i.curve.pointFromX.bind(i.curve),u=function(t,e,r){try{var n=o(t,e,r)}catch(t){throw new Error("Invalid Point")}return n.validate(),n};u.prototype=Object.getPrototypeOf(i.curve.point()),u.fromX=function(t,e){try{var r=a(e,t)}catch(t){throw new Error("Invalid X")}return r.validate(),r},u.getG=function(){return i.curve.g},u.getN=function(){return new n(i.curve.n.toArray())},u.prototype._getX||(u.prototype._getX=u.prototype.getX),u.prototype.getX=function(){return new n(this._getX().toArray())},u.prototype._getY||(u.prototype._getY=u.prototype.getY),u.prototype.getY=function(){return new n(this._getY().toArray())},u.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var t;try{t=a(this.getX(),this.getY().isOdd())}catch(t){throw new Error("Point does not lie on the curve")}if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(u.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},u.pointToCompressed=function(t){var e,n=t.getX().toBuffer({size:32}),i=t.getY().toBuffer({size:32});return e=i[i.length-1]%2?r.from([3]):r.from([2]),r.concat([e,n])},u.pointFromCompressed=function(t){if(33!==t.length)throw new Error("invalid buffer length");let e,r=t[0];if(3===r)e=!0;else{if(2!==r)throw new Error("invalid value of compressed prefix");e=!1}let i=t.slice(1,33),s=n.fromBuffer(i);return u.fromX(e,s)},u.prototype.toBuffer=function(){return u.pointToCompressed(this)},u.prototype.toHex=function(){return this.toBuffer().toString("hex")},u.fromBuffer=function(t){return u.pointFromCompressed(t)},u.fromHex=function(t){return u.fromBuffer(r.from(t,"hex"))},t.exports=u})),s.register("cnE2Z",(function(t,e){var r=s("bfD9J").Buffer,n=s("h6qln"),i=s("duWgj"),o=s("92anD"),a=s("gdNRY"),u=function t(e,r){if(!(this instanceof t))return new t(e,r);if(e instanceof n)this.set({r:e,s:r});else if(e){var i=e;this.set(i)}};u.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i=void 0!==t.i?t.i:this.i,this.compressed=void 0!==t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},u.fromCompact=function(t){o.checkArgument(r.isBuffer(t),"Argument is expected to be a Buffer");var e=new u,i=!0,s=t.slice(0,1)[0]-27-4;s<0&&(i=!1,s+=4);var a=t.slice(1,33),f=t.slice(33,65);return o.checkArgument(0===s||1===s||2===s||3===s,new Error("i must be 0, 1, 2, or 3")),o.checkArgument(32===a.length,new Error("r must be 32 bytes")),o.checkArgument(32===f.length,new Error("s must be 32 bytes")),e.compressed=i,e.i=s,e.r=n.fromBuffer(a),e.s=n.fromBuffer(f),e},u.fromDER=u.fromBuffer=function(t,e){var r=u.parseDER(t,e),n=new u;return n.r=r.r,n.s=r.s,n},u.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),n=u.fromDER(r,!1);return n.nhashtype=e,n},u.fromString=function(t){var e=r.from(t,"hex");return u.fromDER(e)},u.parseDER=function(t,e){o.checkArgument(r.isBuffer(t),new Error("DER formatted signature should be a buffer")),i.isUndefined(e)&&(e=!0);var s=t[0];o.checkArgument(48===s,new Error("Header byte should be 0x30"));var a=t[1],u=t.slice(2).length;o.checkArgument(!e||a===u,new Error("Length byte should length of what follows")),a=a73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;var i=t.slice(6+e);return!(2!==t[6+e-2]||0===r||128&i[0]||r>1&&0===i[0]&&!(128&i[1]))},u.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=31&this.nhashtype;return!(tu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var t=this.toDER(),e=r.alloc(1);return e.writeUInt8(this.nhashtype,0),r.concat([t,e])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_FORKID=64,u.SIGHASH_ANYONECANPAY=128,t.exports=u})),s.register("gdNRY",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("92anD"),o=function(t){return!!n.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};t.exports={isValidJSON:function(t){var e;if(!n.isString(t))return!1;try{e=JSON.parse(t)}catch(t){return!1}return"object"==typeof e},isHexa:o,isHexaString:o,defineImmutable:function(t,e){return Object.keys(e).forEach((function(r){Object.defineProperty(t,r,{configurable:!1,enumerable:!0,value:e[r]})})),t},isNaturalNumber:function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0},integerAsBuffer:function(t){i.checkArgumentType(t,"number","integer");const e=r.allocUnsafe(4);return e.writeUInt32BE(t,0),e}}})),s.register("5XlX7",(function(t,e){var r=s("bfD9J").Buffer,n=s("h6qln"),i=s("lyoMU"),o=s("giRii"),a=s("gdNRY"),u=s("49Roq"),f=s("duWgj"),h=s("92anD");function c(t,e){if(!(this instanceof c))return new c(t,e);if(h.checkArgument(t,"First argument is required, please include public key data."),t instanceof c)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||u.defaultNetwork}),this}c.prototype._classifyArgs=function(t,e){var n={compressed:f.isUndefined(e.compressed)||e.compressed};if(t instanceof i)n.point=t;else if(t.x&&t.y)n=c._transformObject(t);else if("string"==typeof t)n=c._transformDER(r.from(t,"hex"));else if(c._isBuffer(t))n=c._transformDER(t);else{if(!c._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");n=c._transformPrivateKey(t)}return n.network||(n.network=f.isUndefined(e.network)?void 0:u.get(e.network)),n},c._isPrivateKey=function(t){return t instanceof s("97Qx9")},c._isBuffer=function(t){return t instanceof r||t instanceof Uint8Array},c._transformPrivateKey=function(t){h.checkArgument(c._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=i.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},c._transformDER=function(t,e){h.checkArgument(c._isBuffer(t),"Must be a buffer of DER encoded public key");var r,s,o,a,u={};if(e=!!f.isUndefined(e)||e,4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])o=t.slice(1),r=new n(o),(u=c._transformX(!0,r)).compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");o=t.slice(1),r=new n(o),(u=c._transformX(!1,r)).compressed=!0}else{if(o=t.slice(1,33),a=t.slice(33,65),32!==o.length||32!==a.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");r=new n(o),s=new n(a),u.point=new i(r,s),u.compressed=!1}return u},c._transformX=function(t,e){h.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=i.fromX(t,e),r},c._transformObject=function(t){var e=new n(t.x,"hex"),r=new n(t.y,"hex");return new c(new i(e,r),{compressed:t.compressed})},c.fromPrivateKey=function(t){h.checkArgument(c._isPrivateKey(t),"Must be an instance of PrivateKey");var e=c._transformPrivateKey(t);return new c(e.point,{compressed:e.compressed,network:e.network})},c.fromDER=c.fromBuffer=function(t,e){h.checkArgument(c._isBuffer(t),"Must be a buffer of DER encoded public key");var r=c._transformDER(t,e);return new c(r.point,{compressed:r.compressed})},c.fromPoint=function(t,e){return h.checkArgument(t instanceof i,"First argument must be an instance of Point."),new c(t,{compressed:e})},c.fromHex=c.fromString=function(t,e){var n=r.from(t,e||"hex"),i=c._transformDER(n);return new c(i.point,{compressed:i.compressed})},c.fromX=function(t,e){var r=c._transformX(t,e);return new c(r.point,{compressed:r.compressed})},c.getValidationError=function(t){var e;try{new c(t)}catch(t){e=t}return e},c.isValid=function(t){return!c.getValidationError(t)},c.prototype.toObject=c.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},c.prototype.toBuffer=c.prototype.toDER=function(){var t,e=this.point.getX(),n=this.point.getY(),i=e.toBuffer({size:32}),s=n.toBuffer({size:32});return this.compressed?(t=s[s.length-1]%2?r.from([3]):r.from([2]),r.concat([t,i])):(t=r.from([4]),r.concat([t,i,s]))},c.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},c.prototype.toAddress=function(t){return s("jnlO6").fromPublicKey(this,t||this.network)},c.prototype.toString=c.prototype.toHex=function(){return this.toDER().toString("hex")},c.prototype.inspect=function(){return""},t.exports=c})),s.register("giRii",(function(t,e){t.exports=s("lQPSs")})),s.register("lQPSs",(function(t,e){var r=s("bfD9J").Buffer,n=s("aI3Mi"),i=s("92anD"),o=t.exports;o.sha1=function(t){return i.checkArgument(r.isBuffer(t)),r.from(n.sha1().update(t).digest("hex"),"hex")},o.sha1.blocksize=512,o.sha256=function(t){return i.checkArgument(r.isBuffer(t)),r.from(n.sha256().update(t).digest("hex"),"hex")},o.sha256.blocksize=512,o.sha256sha256=function(t){return i.checkArgument(r.isBuffer(t)),o.sha256(o.sha256(t))},o.ripemd160=function(t){return i.checkArgument(r.isBuffer(t)),r.from(n.ripemd160().update(t).digest("hex"),"hex")},o.sha256ripemd160=function(t){return i.checkArgument(r.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return i.checkArgument(r.isBuffer(t)),r.from(n.sha512().update(t).digest("hex"),"hex")},o.sha512.blocksize=1024,o.hmac=function(t,e,n){i.checkArgument(r.isBuffer(e)),i.checkArgument(r.isBuffer(n)),i.checkArgument(t.blocksize);var s=t.blocksize/8;if(n.length>s)n=t(n);else if(n"},t.exports=p})),s.register("jnlO6",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("92anD"),o=s("jyzVj"),a=s("gIBlU"),u=s("49Roq"),f=s("giRii"),h=s("gdNRY"),c=s("5XlX7");function d(t,e,r){if(!(this instanceof d))return new d(t,e,r);if(n.isArray(t)&&n.isNumber(e))return d.createMultisig(t,e,r);if(t instanceof d)return t;if(i.checkArgument(t,"First argument is required, please include address data.","guide/address.html"),e&&!u.get(e))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==d.PayToPublicKeyHash&&r!==d.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var s=this._classifyArguments(t,e,r);return s.network=s.network||u.get(e)||u.defaultNetwork,s.type=s.type||r||d.PayToPublicKeyHash,h.defineImmutable(this,{hashBuffer:s.hashBuffer,network:s.network,type:s.type}),this}d.prototype._classifyArguments=function(t,e,i){if((t instanceof r||t instanceof Uint8Array)&&20===t.length)return d._transformHash(t);if((t instanceof r||t instanceof Uint8Array)&&21===t.length)return d._transformBuffer(t,e,i);if(t instanceof c)return d._transformPublicKey(t);if(t instanceof l)return d._transformScript(t,e);if("string"==typeof t)return d._transformString(t,e,i);if(n.isObject(t))return d._transformObject(t);throw new TypeError("First argument is an unrecognized data format.")},d.PayToPublicKeyHash="pubkeyhash",d.PayToScriptHash="scripthash",d._transformHash=function(t){var e={};if(!(t instanceof r||t instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==t.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return e.hashBuffer=t,e},d._transformObject=function(t){return i.checkArgument(t.hash||t.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),i.checkArgument(t.type,"Must provide a `type` property"),{hashBuffer:t.hash?r.from(t.hash,"hex"):t.hashBuffer,network:u.get(t.network)||u.defaultNetwork,type:t.type}},d._classifyFromVersion=function(t){var e={},r=u.get(t[0],"pubkeyhash"),n=u.get(t[0],"scripthash");return r?(e.network=r,e.type=d.PayToPublicKeyHash):n&&(e.network=n,e.type=d.PayToScriptHash),e},d._transformBuffer=function(t,e,n){var i={};if(!(t instanceof r||t instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==t.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var s=u.get(e),o=d._classifyFromVersion(t);if(e&&!s)throw new TypeError("Unknown network");if(!o.network||s&&s!==o.network)throw new TypeError("Address has mismatched network type.");if(!o.type||n&&n!==o.type)throw new TypeError("Address has mismatched type.");return i.hashBuffer=t.slice(1),i.network=o.network,i.type=o.type,i},d._transformPublicKey=function(t){var e={};if(!(t instanceof c))throw new TypeError("Address must be an instance of PublicKey.");return e.hashBuffer=f.sha256ripemd160(t.toBuffer()),e.type=d.PayToPublicKeyHash,e},d._transformScript=function(t,e){i.checkArgument(t instanceof l,"script must be a Script instance");var r=t.getAddressInfo(e);if(!r)throw new o.Script.CantDeriveAddress(t);return r},d.createMultisig=function(t,e,r){return r=r||t[0].network||u.defaultNetwork,d.payingTo(l.buildMultisigOut(t,e),r)},d._transformString=function(t,e,r){if("string"!=typeof t)throw new TypeError("data parameter supplied is not a string.");if(t.length<27)throw new Error("Invalid Address string provided");t=t.trim();var n=u.get(e);if(e&&!n)throw new TypeError("Unknown network");var i=a.decode(t);return d._transformBuffer(i,e,r)},d.fromPublicKey=function(t,e){var r=d._transformPublicKey(t);return e=e||u.defaultNetwork,new d(r.hashBuffer,e,r.type)},d.fromPrivateKey=function(t,e){let r=c.fromPrivateKey(t);return e=e||t.network||u.defaultNetwork,d.fromPublicKey(r,e)},d.fromPublicKeyHash=function(t,e){var r=d._transformHash(t);return new d(r.hashBuffer,e,d.PayToPublicKeyHash)},d.fromScriptHash=function(t,e){i.checkArgument(t,"hash parameter is required");var r=d._transformHash(t);return new d(r.hashBuffer,e,d.PayToScriptHash)},d.payingTo=function(t,e){return i.checkArgument(t,"script is required"),i.checkArgument(t instanceof l,"script must be instance of Script"),d.fromScriptHash(f.sha256ripemd160(t.toBuffer()),e)},d.fromScript=function(t,e){i.checkArgument(t instanceof l,"script must be a Script instance");var r=d._transformScript(t,e);return new d(r.hashBuffer,e,r.type)},d.fromBuffer=function(t,e,r){var n=d._transformBuffer(t,e,r);return new d(n.hashBuffer,n.network,n.type)},d.fromHex=function(t,e,n){return d.fromBuffer(r.from(t,"hex"),e,n)},d.fromString=function(t,e,r){var n=d._transformString(t,e,r);return new d(n.hashBuffer,n.network,n.type)},d.fromObject=function(t){return i.checkState(h.isHexa(t.hash),'Unexpected hash property, "'+t.hash+'", expected to be hex.'),new d(r.from(t.hash,"hex"),t.network,t.type)},d.getValidationError=function(t,e,r){var n;try{new d(t,e,r)}catch(t){n=t}return n},d.isValid=function(t,e,r){return!d.getValidationError(t,e,r)},d.prototype.isPayToPublicKeyHash=function(){return this.type===d.PayToPublicKeyHash},d.prototype.isPayToScriptHash=function(){return this.type===d.PayToScriptHash},d.prototype.toBuffer=function(){var t=r.from([this.network[this.type]]);return r.concat([t,this.hashBuffer])},d.prototype.toHex=function(){return this.toBuffer().toString("hex")},d.prototype.toObject=d.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},d.prototype.inspect=function(){return""},d.prototype.toString=function(){return a.encode(this.toBuffer())},t.exports=d;var l=s("lGskS")})),s.register("gIBlU",(function(t,e){var r=(o=s("bfD9J")).Buffer,n=s("duWgj"),i=s("doO3n"),o=s("bfD9J"),a=s("giRii").sha256sha256,u=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}};u.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},u.validChecksum=function(t,e){return n.isString(t)&&(t=o.Buffer.from(i.decode(t))),n.isString(e)&&(e=o.Buffer.from(i.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),u.checksum(t).toString("hex")===e.toString("hex")},u.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=r.from(i.decode(t));if(e.length<4)throw new Error("Input string too short");var n=e.slice(0,-4),s=e.slice(-4),o=a(n).slice(0,4);if(s.toString("hex")!==o.toString("hex"))throw new Error("Checksum mismatch");return n},u.checksum=function(t){return a(t).slice(0,4)},u.encode=function(t){if(!r.isBuffer(t))throw new Error("Input must be a buffer");var e=r.alloc(t.length+4),n=u.checksum(t);return t.copy(e),n.copy(e,t.length),i.encode(e)},u.prototype.fromBuffer=function(t){return this.buf=t,this},u.fromBuffer=function(t){return(new u).fromBuffer(t)},u.fromHex=function(t){return u.fromBuffer(r.from(t,"hex"))},u.prototype.fromString=function(t){var e=u.decode(t);return this.buf=e,this},u.fromString=function(t){var e=u.decode(t);return new i(e)},u.prototype.toBuffer=function(){return this.buf},u.prototype.toHex=function(){return this.toBuffer().toString("hex")},u.prototype.toString=function(){return u.encode(this.buf)},t.exports=u})),s.register("doO3n",(function(t,e){var r=(o=s("bfD9J")).Buffer,n=s("duWgj"),i=s("Ns67M"),o=s("bfD9J"),a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),u=function t(e){if(!(this instanceof t))return new t(e);if(r.isBuffer(e)){var n=e;this.fromBuffer(n)}else if("string"==typeof e){var i=e;this.fromString(i)}};u.validCharacters=function(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),n.every(n.map(t,(function(t){return n.includes(a,t)})))},u.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},u.encode=function(t){if(!o.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return i.encode(t)},u.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return r.from(i.decode(t))},u.prototype.fromBuffer=function(t){return this.buf=t,this},u.fromBuffer=function(t){return(new u).fromBuffer(t)},u.fromHex=function(t){return u.fromBuffer(r.from(t,"hex"))},u.prototype.fromString=function(t){var e=u.decode(t);return this.buf=e,this},u.fromString=function(t){return(new u).fromString(t)},u.prototype.toBuffer=function(){return this.buf},u.prototype.toHex=function(){return this.toBuffer().toString("hex")},u.prototype.toString=function(){return u.encode(this.buf)},t.exports=u})),s.register("Ns67M",(function(t,e){var r=s("7h5XZ");t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")})),s.register("7h5XZ",(function(t,e){"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,f=new Uint8Array(s);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var c=0,d=s-1;(0!==h||c>>0,f[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=c,r++}for(var l=s-i;l!==s&&0===f[l];)l++;for(var p=new Uint8Array(n+(s-l)),b=n;l!==s;)p[b++]=f[l++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,s=e.length;i!==s&&0===e[i];)i++,r++;for(var u=(s-i)*f+1>>>0,h=new Uint8Array(u);i!==s;){for(var c=e[i],d=0,l=u-1;(0!==c||d>>0,h[l]=c%o>>>0,c=c/o>>>0;if(0!==c)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===h[p];)p++;for(var b=a.repeat(r);p0&&o=0&&f0&&o0&&(i=n?i+" "+t.buf.toString("hex"):i+" "+t.len+" 0x"+t.buf.toString("hex"));else if(void 0!==u.reverseMap[r])n?0===r?i+=" 0":79===r?i+=" -1":i=i+" "+u(r).toString():i=i+" "+u(r).toString();else{var s=r.toString(16);s.length%2!=0&&(s="0"+s),i=n?i+" "+s:i+" 0x"+s}return i},g.prototype.toASM=function(){for(var t="",e=0;e"},g.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==u.OP_DUP||this.chunks[1].opcodenum!==u.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==u.OP_EQUALVERIFY||this.chunks[4].opcodenum!==u.OP_CHECKSIG)},g.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},g.prototype.getPublicKey=function(){return d.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},g.prototype.getPublicKeyHash=function(){return d.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},g.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===u.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if((4!==e&&6!==e&&7!==e||65!==t.length)&&(3!==e&&2!==e||33!==t.length)||(r=!0),r)return f.isValid(t)}return!1},g.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},g.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===u.OP_HASH160&&20===t[1]&&t[t.length-1]===u.OP_EQUAL},g.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t,e=this.chunks[this.chunks.length-1].buf;if(!e)return!1;try{t=g.fromBuffer(e)}catch(t){if(t instanceof p.Script.InvalidBuffer)return!1;throw t}return t.classify()!==g.types.UNKNOWN},g.prototype.isMultisigOut=function(){return this.chunks.length>3&&u.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every((function(t){return t.buf&&r.isBuffer(t.buf)}))&&u.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===u.OP_CHECKMULTISIG},g.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every((function(t){return t.buf&&r.isBuffer(t.buf)&&h.isTxDER(t.buf)}))},g.prototype.isDataOut=function(){if(!(this.chunks.length>=1&&this.chunks[0].opcodenum===u.OP_RETURN))return!1;var t=this.chunks.slice(1);return new g({chunks:t}).isPushOnly()},g.prototype.isSafeDataOut=function(){if(this.chunks.length<2)return!1;if(this.chunks[0].opcodenum!==u.OP_FALSE)return!1;var t=this.chunks.slice(1);return new g({chunks:t}).isDataOut()},g.prototype.getData=function(){if(this.isSafeDataOut())return this.chunks.slice(2).map((t=>t.buf));if(this.isDataOut()||this.isScriptHashOut())return l.isUndefined(this.chunks[1])?r.alloc(0):r.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return r.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},g.prototype.isPushOnly=function(){return l.every(this.chunks,(function(t){return t.opcodenum<=u.OP_16||t.opcodenum===u.OP_PUSHDATA1||t.opcodenum===u.OP_PUSHDATA2||t.opcodenum===u.OP_PUSHDATA4}))},(g.types={}).UNKNOWN="Unknown",g.types.PUBKEY_OUT="Pay to public key",g.types.PUBKEY_IN="Spend from public key",g.types.PUBKEYHASH_OUT="Pay to public key hash",g.types.PUBKEYHASH_IN="Spend from public key hash",g.types.SCRIPTHASH_OUT="Pay to script hash",g.types.SCRIPTHASH_IN="Spend from script hash",g.types.MULTISIG_OUT="Pay to multisig",g.types.MULTISIG_IN="Spend from multisig",g.types.DATA_OUT="Data push",g.types.SAFE_DATA_OUT="Safe data push",g.OP_RETURN_STANDARD_SIZE=220,g.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var t=this.classifyOutput();return t!==g.types.UNKNOWN?t:this.classifyInput()},(g.outputIdentifiers={}).PUBKEY_OUT=g.prototype.isPublicKeyOut,g.outputIdentifiers.PUBKEYHASH_OUT=g.prototype.isPublicKeyHashOut,g.outputIdentifiers.MULTISIG_OUT=g.prototype.isMultisigOut,g.outputIdentifiers.SCRIPTHASH_OUT=g.prototype.isScriptHashOut,g.outputIdentifiers.DATA_OUT=g.prototype.isDataOut,g.outputIdentifiers.SAFE_DATA_OUT=g.prototype.isSafeDataOut,g.prototype.classifyOutput=function(){for(var t in g.outputIdentifiers)if(g.outputIdentifiers[t].bind(this)())return g.types[t];return g.types.UNKNOWN},(g.inputIdentifiers={}).PUBKEY_IN=g.prototype.isPublicKeyIn,g.inputIdentifiers.PUBKEYHASH_IN=g.prototype.isPublicKeyHashIn,g.inputIdentifiers.MULTISIG_IN=g.prototype.isMultisigIn,g.inputIdentifiers.SCRIPTHASH_IN=g.prototype.isScriptHashIn,g.prototype.classifyInput=function(){for(var t in g.inputIdentifiers)if(g.inputIdentifiers[t].bind(this)())return g.types[t];return g.types.UNKNOWN},g.prototype.isStandard=function(){return this.classify()!==g.types.UNKNOWN},g.prototype.prepend=function(t){return this._addByType(t,!0),this},g.prototype.equals=function(t){if(d.checkState(t instanceof g,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e=0&&nt.toString("hex"))).sort().map((t=>new f(t))));for(var s=0;s=1&&r[0]<=16?n!==u.OP_1+(r[0]-1):1===r.length&&129===r[0]?n!==u.OP_1NEGATE:r.length<=75?n!==r.length:r.length<=255?n!==u.OP_PUSHDATA1:r.length<=65535&&n!==u.OP_PUSHDATA2))},g.prototype._decodeOP_N=function(t){if(t===u.OP_0)return 0;if(t>=u.OP_1&&t<=u.OP_16)return t-(u.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},g.prototype.getSignatureOperationsCount=function(t){t=!!l.isUndefined(t)||t;var e=this,r=0,n=u.OP_INVALIDOPCODE;return l.each(e.chunks,(function(i){var s=i.opcodenum;s===u.OP_CHECKSIG||s===u.OP_CHECKSIGVERIFY?r++:s!==u.OP_CHECKMULTISIG&&s!==u.OP_CHECKMULTISIGVERIFY||(t&&n>=u.OP_1&&n<=u.OP_16?r+=e._decodeOP_N(n):r+=20),n=s})),r},t.exports=g})),s.register("bW8cN",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("92anD"),o=s("h6qln"),a=function t(e){if(!(this instanceof t))return new t(e);if(!n.isUndefined(e))if(r.isBuffer(e))this.set({buf:e});else if(n.isString(e)){var i=r.from(e,"hex");if(2*i.length!==e.length)throw new TypeError("Invalid hex string");this.set({buf:i})}else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for BufferReader");var s=e;this.set(s)}};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(t){i.checkArgument(!n.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},a.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},a.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},a.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readInt32LE=function(){var t=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=o.fromBuffer(t);return this.pos=this.pos+8,e},a.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=4294967296*this.buf.readUInt32LE(this.pos+4)+e;if(r<=9007199254740991)t=new o(r);else{var n=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new o(n,10,"le")}return this.pos=this.pos+8,t},a.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN().toNumber();if(e<=Math.pow(2,53))return e;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},a.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return i.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},a.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(t)}},a.prototype.reverse=function(){for(var t=r.alloc(this.buf.length),e=0;e1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;in),(t=>n=t));var f,h,c={};function d(t,e,r){r||(r=Error);var n=function(r){function n(r,i,s){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),u=o(this,a(n).call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,i,s))),u.code=t,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(n,r),n}(r);c[t]=n}function l(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}d("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),d("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,o,a,u;if(void 0===f&&(f=s("971OZ")),f("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(o="not ",e.substr(!a||a<0?0:+a,o.length)===o)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))u="The ".concat(t," ").concat(n," ").concat(l(e,"type"));else{var h=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";u='The "'.concat(t,'" ').concat(h," ").concat(n," ").concat(l(e,"type"))}return u+=". Received type ".concat(i(r))}),TypeError),d("ERR_INVALID_ARG_VALUE",(function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===h&&(h=s("9fk5b"));var n=h.inspect(e);return n.length>128&&(n="".concat(n.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(r,". Received ").concat(n)}),TypeError,RangeError),d("ERR_INVALID_RETURN_VALUE",(function(t,e,r){var n;return n=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(i(r)),"Expected ".concat(t,' to be returned from the "').concat(e,'"')+" function but got ".concat(n,".")}),TypeError),d("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),r=0;r0,"At least one arg needs to be specified");var n="The ",i=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),i){case 1:n+="".concat(e[0]," argument");break;case 2:n+="".concat(e[0]," and ").concat(e[1]," arguments");break;default:n+=e.slice(0,i-1).join(", "),n+=", and ".concat(e[i-1]," arguments")}return"".concat(n," must be specified")}),TypeError),n=c})),s.register("9fk5b",(function(t,e){var r=s("gHWWg"),n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),a=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(r)?n.showHidden=r:r&&t.exports._extend(n,r),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=f),c(n,e,n.depth)}function f(t,e){var r=u.styles[e];return r?"["+u.colors[r][0]+"m"+t+"["+u.colors[r][1]+"m":t}function h(t,e){return t}function c(e,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return y(i)||(i=c(e,i,n)),i}var s=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(b(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(e,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),O(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return d(r);if(0===o.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(w(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return d(r)}var f,h="",_=!1,I=["{","}"];(p(r)&&(_=!0,I=["[","]"]),E(r))&&(h=" [Function"+(r.name?": "+r.name:"")+"]");return w(r)&&(h=" "+RegExp.prototype.toString.call(r)),S(r)&&(h=" "+Date.prototype.toUTCString.call(r)),O(r)&&(h=" "+d(r)),0!==o.length||_&&0!=r.length?n<0?w(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),f=_?function(t,e,r,n,i){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return n>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(f,h,I)):I[0]+h+I[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,r,n,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),k(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),v(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function y(t){return"string"==typeof t}function v(t){return void 0===t}function w(t){return _(t)&&"[object RegExp]"===I(t)}function _(t){return"object"==typeof t&&null!==t}function S(t){return _(t)&&"[object Date]"===I(t)}function O(t){return _(t)&&("[object Error]"===I(t)||t instanceof Error)}function E(t){return"function"==typeof t}function I(t){return Object.prototype.toString.call(t)}function P(t){return t<10?"0"+t.toString(10):t.toString(10)}t.exports.debuglog=function(e){if(e=e.toUpperCase(),!o[e])if(a.test(e)){var n=r.pid;o[e]=function(){var r=t.exports.format.apply(t.exports,arguments);console.error("%s %d: %s",e,n,r)}}else o[e]=function(){};return o[e]},t.exports.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.exports.types=s("6giT1"),t.exports.isArray=p,t.exports.isBoolean=b,t.exports.isNull=m,t.exports.isNullOrUndefined=function(t){return null==t},t.exports.isNumber=g,t.exports.isString=y,t.exports.isSymbol=function(t){return"symbol"==typeof t},t.exports.isUndefined=v,t.exports.isRegExp=w,t.exports.types.isRegExp=w,t.exports.isObject=_,t.exports.isDate=S,t.exports.types.isDate=S,t.exports.isError=O,t.exports.types.isNativeError=O,t.exports.isFunction=E,t.exports.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},t.exports.isBuffer=s("dhfQ1");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var t=new Date,e=[P(t.getHours()),P(t.getMinutes()),P(t.getSeconds())].join(":");return[t.getDate(),M[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports.log=function(){console.log("%s - %s",A(),t.exports.format.apply(t.exports,arguments))},t.exports.inherits=s("fmwGI"),t.exports._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}t.exports.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(x&&t[x]){var e;if("function"!=typeof(e=t[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,x,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],s=0;s=0&&"[object Array]"!==n(t)&&"[object Function]"===n(t.callee)},a=function(){return i(arguments)}();i.isLegacyArguments=o,t.exports=a?i:o})),s.register("dmEoO",(function(t,e){"use strict";var r=s("bs0rV");t.exports=function(){return r()&&!!Symbol.toStringTag}})),s.register("bs0rV",(function(t,e){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}})),s.register("eQ9SB",(function(t,e){"use strict";var r=s("jfHMz"),n=s("eXuM8"),i=n(r("String.prototype.indexOf"));t.exports=function(t,e){var s=r(t,!!e);return"function"==typeof s&&i(t,".prototype.")>-1?n(s):s}})),s.register("jfHMz",(function(t,e){"use strict";var r,n=SyntaxError,i=Function,o=TypeError,a=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var f=function(){throw new o},h=u?function(){try{return f}catch(t){try{return u(arguments,"callee").get}catch(t){return f}}}():f,c=s("RAFlp")(),d=Object.getPrototypeOf||function(t){return t.__proto__},l={},p="undefined"==typeof Uint8Array?r:d(Uint8Array),b={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":c?d([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c?d(d([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&c?d((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&c?d((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c?d(""[Symbol.iterator]()):r,"%Symbol%":c?Symbol:r,"%SyntaxError%":n,"%ThrowTypeError%":h,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet},m=function t(e){var r;if("%AsyncFunction%"===e)r=a("async function () {}");else if("%GeneratorFunction%"===e)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=a("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(r=d(i.prototype))}return b[e]=r,r},g={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=s("kaSxE"),v=s("9Ug5c"),w=y.call(Function.call,Array.prototype.concat),_=y.call(Function.apply,Array.prototype.splice),S=y.call(Function.call,String.prototype.replace),O=y.call(Function.call,String.prototype.slice),E=y.call(Function.call,RegExp.prototype.exec),I=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,M=function(t){var e=O(t,0,1),r=O(t,-1);if("%"===e&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var i=[];return S(t,I,(function(t,e,r,n){i[i.length]=r?S(n,P,"$1"):e||t})),i},A=function(t,e){var r,i=t;if(v(g,i)&&(i="%"+(r=g[i])[0]+"%"),v(b,i)){var s=b[i];if(s===l&&(s=m(i)),void 0===s&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:s}}throw new n("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===E(/^%?[^%]*%?$/,t))throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=M(t),i=r.length>0?r[0]:"",s=A("%"+i+"%",e),a=s.name,f=s.value,h=!1,c=s.alias;c&&(i=c[0],_(r,w([0,1],c)));for(var d=1,l=!0;d=r.length){var y=u(f,p);f=(l=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:f[p]}else l=v(f,p),f=f[p];l&&!h&&(b[a]=f)}}return f}})),s.register("RAFlp",(function(t,e){"use strict";var r="undefined"!=typeof Symbol&&Symbol,n=s("bs0rV");t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&n())))}})),s.register("kaSxE",(function(t,e){"use strict";var r=s("dBLuZ");t.exports=Function.prototype.bind||r})),s.register("dBLuZ",(function(t,e){"use strict";var r="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,i=Object.prototype.toString,s="[object Function]";t.exports=function(t){var e=this;if("function"!=typeof e||i.call(e)!==s)throw new TypeError(r+e);for(var o,a=n.call(arguments,1),u=function(){if(this instanceof o){var r=e.apply(this,a.concat(n.call(arguments)));return Object(r)===r?r:this}return e.apply(t,a.concat(n.call(arguments)))},f=Math.max(0,e.length-a.length),h=[],c=0;c=3&&(s=i),"[object Array]"===n.call(t)?o(t,e,s):"string"==typeof t?a(t,e,s):u(t,e,s)}})),s.register("9760C",(function(t,e){"use strict";var r,n,i=Function.prototype.toString,s="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof s&&"function"==typeof Object.defineProperty)try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},s((function(){throw 42}),null,r)}catch(t){t!==n&&(s=null)}else s=null;var o=/^\s*class\b/,a=function(t){try{var e=i.call(t);return o.test(e)}catch(t){return!1}},u=function(t){try{return!a(t)&&(i.call(t),!0)}catch(t){return!1}},f=Object.prototype.toString,h="function"==typeof Symbol&&!!Symbol.toStringTag,c=!(0 in[,]),d=function(){return!1};if("object"==typeof document){var l=document.all;f.call(l)===f.call(document.all)&&(d=function(t){if((c||!t)&&(void 0===t||"object"==typeof t))try{var e=f.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=s?function(t){if(d(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{s(t,null,r)}catch(t){if(t!==n)return!1}return!a(t)&&u(t)}:function(t){if(d(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(h)return u(t);if(a(t))return!1;var e=f.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&u(t)}})),s.register("d0MPI",(function(t,r){"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?e:globalThis;t.exports=function(){for(var t=[],e=0;e-1}return!!f&&function(t){var e=!1;return n(p,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}})),s.register("dhfQ1",(function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}})),s.register("1BfYr",(function(t,e){var r=s("gHWWg");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){for(var r=0;rt.length)&&(r=t.length),t.substring(r-e.length,r)===e}var g="",y="",v="",w="",_={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function S(t){var e=Object.keys(t),r=Object.create(Object.getPrototypeOf(t));return e.forEach((function(e){r[e]=t[e]})),Object.defineProperty(r,"message",{value:t.message}),r}function O(t){return p(t,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function E(t,e,n){var i="",s="",o=0,a="",u=!1,f=O(t),h=f.split("\n"),c=O(e).split("\n"),d=0,p="";if("strictEqual"===n&&"object"===l(t)&&"object"===l(e)&&null!==t&&null!==e&&(n="strictEqualObject"),1===h.length&&1===c.length&&h[0]!==c[0]){var b=h[0].length+c[0].length;if(b<=10){if(!("object"===l(t)&&null!==t||"object"===l(e)&&null!==e||0===t&&0===e))return"".concat(_[n],"\n\n")+"".concat(h[0]," !== ").concat(c[0],"\n")}else if("strictEqualObject"!==n){if(b<(r.stderr&&r.stderr.isTTY?r.stderr.columns:80)){for(;h[0][d]===c[0][d];)d++;d>2&&(p="\n ".concat(function(t,e){if(e=Math.floor(e),0==t.length||0==e)return"";var r=t.length*e;for(e=Math.floor(Math.log(e)/Math.log(2));e;)t+=t,e--;return t+t.substring(0,r-t.length)}(" ",d),"^"),d=0)}}}for(var S=h[h.length-1],E=c[c.length-1];S===E&&(d++<2?a="\n ".concat(S).concat(a):i=S,h.pop(),c.pop(),0!==h.length&&0!==c.length);)S=h[h.length-1],E=c[c.length-1];var I=Math.max(h.length,c.length);if(0===I){var P=f.split("\n");if(P.length>30)for(P[26]="".concat(g,"...").concat(w);P.length>27;)P.pop();return"".concat(_.notIdentical,"\n\n").concat(P.join("\n"),"\n")}d>3&&(a="\n".concat(g,"...").concat(w).concat(a),u=!0),""!==i&&(a="\n ".concat(i).concat(a),i="");var M=0,A=_[n]+"\n".concat(y,"+ actual").concat(w," ").concat(v,"- expected").concat(w),k=" ".concat(g,"...").concat(w," Lines skipped");for(d=0;d1&&d>2&&(x>4?(s+="\n".concat(g,"...").concat(w),u=!0):x>3&&(s+="\n ".concat(c[d-2]),M++),s+="\n ".concat(c[d-1]),M++),o=d,i+="\n".concat(v,"-").concat(w," ").concat(c[d]),M++;else if(c.length1&&d>2&&(x>4?(s+="\n".concat(g,"...").concat(w),u=!0):x>3&&(s+="\n ".concat(h[d-2]),M++),s+="\n ".concat(h[d-1]),M++),o=d,s+="\n".concat(y,"+").concat(w," ").concat(h[d]),M++;else{var R=c[d],T=h[d],B=T!==R&&(!m(T,",")||T.slice(0,-1)!==R);B&&m(R,",")&&R.slice(0,-1)===T&&(B=!1,T+=","),B?(x>1&&d>2&&(x>4?(s+="\n".concat(g,"...").concat(w),u=!0):x>3&&(s+="\n ".concat(h[d-2]),M++),s+="\n ".concat(h[d-1]),M++),o=d,s+="\n".concat(y,"+").concat(w," ").concat(T),i+="\n".concat(v,"-").concat(w," ").concat(R),M+=2):(s+=i,i="",1!==x&&0!==d||(s+="\n ".concat(T),M++))}if(M>20&&d30)for(m[26]="".concat(g,"...").concat(w);m.length>27;)m.pop();n=1===m.length?o(this,d(e).call(this,"".concat(p," ").concat(m[0]))):o(this,d(e).call(this,"".concat(p,"\n\n").concat(m.join("\n"),"\n")))}else{var I=O(f),P="",M=_[s];"notDeepEqual"===s||"notEqual"===s?(I="".concat(_[s],"\n\n").concat(I)).length>1024&&(I="".concat(I.slice(0,1021),"...")):(P="".concat(O(h)),I.length>512&&(I="".concat(I.slice(0,509),"...")),P.length>512&&(P="".concat(P.slice(0,509),"...")),"deepEqual"===s||"equal"===s?I="".concat(M,"\n\n").concat(I,"\n\nshould equal\n\n"):P=" ".concat(s," ").concat(P)),n=o(this,d(e).call(this,"".concat(I).concat(P)))}return Error.stackTraceLimit=c,n.generatedMessage=!i,Object.defineProperty(a(n),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),n.code="ERR_ASSERTION",n.actual=f,n.expected=h,n.operator=s,Error.captureStackTrace&&Error.captureStackTrace(a(n),u),n.stack,n.name="AssertionError",o(n)}var s,u,f;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),s=e,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(t,e){return p(this,function(t){for(var e=1;e2?arguments[2]:{},s=r(e);n&&(s=o.call(s,Object.getOwnPropertySymbols(e)));for(var a=0;a=0&&"[object Function]"===r.call(t.callee)),n}})),s.register("dE8mC",(function(t,e){"use strict";var r;if(!Object.keys){var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=s("bAV8O"),a=Object.prototype.propertyIsEnumerable,u=!a.call({toString:null},"toString"),f=a.call((function(){}),"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(t){var e=t.constructor;return e&&e.prototype===t},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},l=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!d["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{c(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();r=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===i.call(t),s=o(t),a=e&&"[object String]"===i.call(t),d=[];if(!e&&!r&&!s)throw new TypeError("Object.keys called on a non-object");var p=f&&r;if(a&&t.length>0&&!n.call(t,0))for(var b=0;b0)for(var m=0;m10)return!0;for(var e=0;e57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function T(t){return Object.keys(t).filter(R).concat(f(t).filter(Object.prototype.propertyIsEnumerable.bind(t)))} /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */function B(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i=0&&t<=16,"Invalid Argument: n must be between 0 and 16"),0===t?a("OP_0"):new a(a.map.OP_1+t-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_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;n.extend(a,a.map),a.isSmallIntOp=function(t){return t instanceof a&&(t=t.toNumber()),t===a.map.OP_0||t>=a.map.OP_1&&t<=a.map.OP_16},a.prototype.inspect=function(){return""},t.exports=a})),s.register("ffEPJ",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("iKagK"),o=s("lT7Qw"),a=s("h6qln"),u=s("giRii"),f=s("cnE2Z"),h=s("5XlX7"),c=s("7Zybh"),d=function t(e){if(!(this instanceof t))return new t(e);e?(this.initialize(),this.set(e)):this.initialize()};d.prototype.verify=function(t,e,r,o,a,u){var f,h=s("k40G4");if(n.isUndefined(r)&&(r=new h),n.isUndefined(o)&&(o=0),n.isUndefined(a)&&(a=0),a&d.SCRIPT_ENABLE_SIGHASH_FORKID&&(a|=d.SCRIPT_VERIFY_STRICTENC,!u))throw new Error("internal error - need satoshisBN to verify FORKID transactions");if(this.set({script:t,tx:r,nin:o,flags:a,satoshisBN:u}),0!=(a&d.SCRIPT_VERIFY_SIGPUSHONLY)&&!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&d.SCRIPT_VERIFY_P2SH&&(f=this.stack.slice());var c=this.stack;if(this.initialize(),this.set({script:e,stack:c,tx:r,nin:o,flags:a,satoshisBN:u}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var l=this.stack[this.stack.length-1];if(!d.castToBool(l))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&d.SCRIPT_VERIFY_P2SH&&e.isScriptHashOut()){if(!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===f.length)throw new Error("internal error - stack copy empty");var p=f[f.length-1],b=i.fromBuffer(p);if(f.pop(),this.initialize(),this.set({script:b,stack:f,tx:r,nin:o,flags:a,satoshisBN:u}),!this.evaluate())return!1;if(0===f.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!d.castToBool(f[f.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if(0!=(a&d.SCRIPT_VERIFY_CLEANSTACK)){if(0==(a&d.SCRIPT_VERIFY_P2SH))throw new Error("internal error - CLEANSTACK without P2SH");if(1!==f.length)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0},t.exports=d,d.prototype.initialize=function(){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},d.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin=void 0!==t.nin?t.nin:this.nin,this.satoshisBN=t.satoshisBN||this.satoshisBN,this.stack=t.stack||this.stack,this.altstack=t.altstack||this.altstack,this.pc=void 0!==t.pc?t.pc:this.pc,this.pbegincodehash=void 0!==t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags=void 0!==t.flags?t.flags:this.flags},d.true=r.from([1]),d.false=r.from([]),d.MAX_SCRIPT_ELEMENT_SIZE=520,d.MAXIMUM_ELEMENT_SIZE=4,d.LOCKTIME_THRESHOLD_BN=new a(d.LOCKTIME_THRESHOLD=5e8),d.SCRIPT_VERIFY_NONE=0,d.SCRIPT_VERIFY_P2SH=1,d.SCRIPT_VERIFY_STRICTENC=2,d.SCRIPT_VERIFY_DERSIG=4,d.SCRIPT_VERIFY_LOW_S=8,d.SCRIPT_VERIFY_NULLDUMMY=16,d.SCRIPT_VERIFY_SIGPUSHONLY=32,d.SCRIPT_VERIFY_MINIMALDATA=64,d.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,d.SCRIPT_VERIFY_CLEANSTACK=256,d.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,d.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,d.SCRIPT_VERIFY_MINIMALIF=8192,d.SCRIPT_VERIFY_NULLFAIL=16384,d.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768,d.SCRIPT_ENABLE_SIGHASH_FORKID=65536,d.SCRIPT_ENABLE_REPLAY_PROTECTION=131072,d.SCRIPT_ENABLE_MONOLITH_OPCODES=262144,d.SCRIPT_ENABLE_MAGNETIC_OPCODES=524288,d.SEQUENCE_LOCKTIME_DISABLE_FLAG=-2147483648,d.SEQUENCE_LOCKTIME_TYPE_FLAG=4194304,d.SEQUENCE_LOCKTIME_MASK=65535,d.castToBool=function(t){for(var e=0;ee||t.length>0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))},d._minimallyEncode=function(t){if(0===t.length)return t;var e=t[t.length-1];if(127&e)return t;if(1===t.length)return r.from("");if(128&t[t.length-2])return t;for(var n=t.length-1;n>0;n--)if(0!==t[n-1])return 128&t[n-1]?t[n++]=e:t[n-1]|=e,t.slice(0,n);return r.from("")},d.prototype.evaluate=function(){if(this.script.toBuffer().length>1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return!(this.vfExec.length>0&&(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",1))},d.prototype._callbackStep=function(t){if("function"==typeof this.stepListener)try{this.stepListener(t,c(this.stack,!0),c(this.altstack,!0))}catch(t){console.log(`Error in Step callback:${t}`)}},d.prototype.checkLockTime=function(t){return!!(this.tx.nLockTime=d.LOCKTIME_THRESHOLD&&t.gte(d.LOCKTIME_THRESHOLD_BN))&&!t.gt(new a(this.tx.nLockTime))&&!this.tx.inputs[this.nin].isFinal()},d.prototype.checkSequence=function(t){var e=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2)return!1;if(e&d.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=d.SEQUENCE_LOCKTIME_TYPE_FLAG|d.SEQUENCE_LOCKTIME_MASK,n=new a(e&r),i=t.and(r),s=new a(d.SEQUENCE_LOCKTIME_TYPE_FLAG);return!!(n.lt(s)&&i.lt(s)||n.gte(s)&&i.gte(s))&&!i.gt(n)},d.prototype.step=function(){var t=this;function e(e){return t.stack[t.stack.length+e]}var s,c,l,p,b,m,g,y,v,w,_,S,O,E,I,P,M,A=0!=(this.flags&d.SCRIPT_VERIFY_MINIMALDATA),k=-1===this.vfExec.indexOf(!1),x=this.script.chunks[this.pc];this.pc++;var R=x.opcodenum;if(n.isUndefined(R))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(x.buf&&x.buf.length>d.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(R>o.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(function(e){switch(e){case o.OP_2MUL:case o.OP_2DIV:return!0;case o.OP_INVERT:case o.OP_MUL:case o.OP_LSHIFT:case o.OP_RSHIFT:if(0==(t.flags&d.SCRIPT_ENABLE_MAGNETIC_OPCODES))return!0;break;case o.OP_DIV:case o.OP_MOD:case o.OP_SPLIT:case o.OP_CAT:case o.OP_AND:case o.OP_OR:case o.OP_XOR:case o.OP_BIN2NUM:case o.OP_NUM2BIN:if(0==(t.flags&d.SCRIPT_ENABLE_MONOLITH_OPCODES))return!0}return!1}(R))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(k&&R>=0&&R<=o.OP_PUSHDATA4){if(A&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(x.buf){if(x.len!==x.buf.length)throw new Error(`Length of push value not equal to length of data (${x.len},${x.buf.length})`);this.stack.push(x.buf)}else this.stack.push(d.false)}else if(k||o.OP_IF<=R&&R<=o.OP_ENDIF)switch(R){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:b=R-(o.OP_1-1),s=new a(b).toScriptNumBuffer(),this.stack.push(s);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&d.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&d.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var T=a.fromScriptNumBuffer(this.stack[this.stack.length-1],A,5);if(T.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(T))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP3:case o.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&d.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&d.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var B=a.fromScriptNumBuffer(e(-1),A,5);if(B.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(B&d.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(B))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&d.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(P=!1,k){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(s=e(-1),this.flags&d.SCRIPT_VERIFY_MINIMALIF){if(s.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(1===s.length&&1!==s[0])return this.errstr="SCRIPT_ERR_MINIMALIF",!1}P=d.castToBool(s),R===o.OP_NOTIF&&(P=!P),this.stack.pop()}this.vfExec.push(P);break;case o.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 o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=e(-1),!(P=d.castToBool(s)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;c=e(-2),l=e(-1),this.stack.push(r.from(c)),this.stack.push(r.from(l));break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;c=e(-3),l=e(-2);var N=e(-1);this.stack.push(r.from(c)),this.stack.push(r.from(l)),this.stack.push(r.from(N));break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;c=e(-4),l=e(-3),this.stack.push(r.from(c)),this.stack.push(r.from(l));break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-6,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-4,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=e(-1),(P=d.castToBool(s))&&this.stack.push(r.from(s));break;case o.OP_DEPTH:s=new a(this.stack.length).toScriptNumBuffer(),this.stack.push(s);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(r.from(e(-1)));break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(r.from(e(-2)));break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=e(-1),b=(y=a.fromScriptNumBuffer(s,A)).toNumber(),this.stack.pop(),b<0||b>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=e(-b-1),R===o.OP_ROLL&&this.stack.splice(this.stack.length-b-1,1),this.stack.push(r.from(s));break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=e(-3),g=e(-2);var C=e(-1);this.stack[this.stack.length-3]=g,this.stack[this.stack.length-2]=C,this.stack[this.stack.length-1]=m;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=e(-2),g=e(-1),this.stack[this.stack.length-2]=g,this.stack[this.stack.length-1]=m;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,r.from(e(-1)));break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new a(e(-1).length),this.stack.push(y.toScriptNumBuffer());break;case o.OP_AND:case o.OP_OR:case o.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(c=e(-2),l=e(-1),c.length!==l.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(R){case o.OP_AND:for(let t=0;t0)+0);break;case o.OP_LESSTHANOREQUAL:y=new a((v.cmp(w)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:y=new a((v.cmp(w)>=0)+0);break;case o.OP_MIN:y=v.cmp(w)<0?v:w;break;case o.OP_MAX:y=v.cmp(w)>0?v:w}if(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),R===o.OP_NUMEQUALVERIFY){if(!d.castToBool(e(-1)))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;v=a.fromScriptNumBuffer(e(-3),A),w=a.fromScriptNumBuffer(e(-2),A);var U=a.fromScriptNumBuffer(e(-1),A);P=w.cmp(v)<=0&&v.cmp(U)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(P?d.true:d.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var D;s=e(-1),R===o.OP_RIPEMD160?D=u.ripemd160(s):R===o.OP_SHA1?D=u.sha1(s):R===o.OP_SHA256?D=u.sha256(s):R===o.OP_HASH160?D=u.sha256ripemd160(s):R===o.OP_HASH256&&(D=u.sha256sha256(s)),this.stack.pop(),this.stack.push(D);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(_=e(-2),S=e(-1),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(S))return!1;O=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var H=(new i).add(_);O.findAndDelete(H);try{E=f.fromTxFormat(_),I=h.fromBuffer(S,!1),M=this.tx.verifySignature(E,I,this.nin,O,this.satoshisBN,this.flags)}catch(t){M=!1}if(!M&&this.flags&d.SCRIPT_VERIFY_NULLFAIL&&_.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(M?d.true:d.false),R===o.OP_CHECKSIGVERIFY){if(!M)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var j=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=F,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var K=++j;j+=F;var V=F+2;if(this.stack.lengthF)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var G=++j;if(j+=q,this.stack.length0;){if(_=e(-G),S=e(-K),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(S))return!1;var z;try{E=f.fromTxFormat(_),I=h.fromBuffer(S,!1),z=this.tx.verifySignature(E,I,this.nin,O,this.satoshisBN,this.flags)}catch(t){z=!1}z&&(G++,q--),K++,q>--F&&(M=!1)}for(;j-- >1;){if(!M&&this.flags&d.SCRIPT_VERIFY_NULLFAIL&&!V&&e(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;V>0&&V--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&d.SCRIPT_VERIFY_NULLDUMMY&&e(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(M?d.true:d.false),R===o.OP_CHECKMULTISIGVERIFY){if(!M)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;case o.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(c=e(-2),l=e(-1),c.length+l.length>d.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=r.concat([c,l]),this.stack.pop();break;case o.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;c=e(-2);var W=a.fromScriptNumBuffer(e(-1),A).toNumber();if(W<0||W>c.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var J=r.from(c);this.stack[this.stack.length-2]=J.slice(0,W),this.stack[this.stack.length-1]=J.slice(W);break;case o.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var Z=a.fromScriptNumBuffer(e(-1),A).toNumber();if(Z>d.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var X=e(-1);if((X=d._minimallyEncode(X)).length>Z)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(X.length===Z){this.stack[this.stack.length-1]=X;break}var Q=0;X.length>0&&(Q=128&X[X.length-1],X[X.length-1]&=127);var $=r.alloc(Z);X.copy($,0);for(var tt=X.length-1;tt++ * * Copyright (c) 2015-present, Jon Schlinkert. * Released under the MIT License. */ var r=s("bfD9J").Buffer;const n=Symbol.prototype.valueOf;var i=s("dKUyb");t.exports=function(t,e){switch(i(t)){case"array":return t.slice();case"object":return Object.assign({},t);case"date":return new t.constructor(Number(t));case"map":return new Map(t);case"set":return new Set(t);case"buffer":return function(t){const e=t.length,n=r.allocUnsafe?r.allocUnsafe(e):r.from(e);return t.copy(n),n}(t);case"symbol":return function(t){return n?Object(n.call(t)):{}}(t);case"arraybuffer":return function(t){const e=new t.constructor(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}(t);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return function(t,e){return new t.constructor(t.buffer,t.byteOffset,t.length)}(t);case"regexp":return function(t){const e=void 0!==t.flags?t.flags:/\w+$/.exec(t)||void 0,r=new t.constructor(t.source,e);return r.lastIndex=t.lastIndex,r}(t);case"error":return Object.create(t);default:return t}}})),s.register("dKUyb",(function(t,e){var r=Object.prototype.toString;function n(t){return"function"==typeof t.constructor?t.constructor.name:null}t.exports=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e=typeof t;if("boolean"===e)return"boolean";if("string"===e)return"string";if("number"===e)return"number";if("symbol"===e)return"symbol";if("function"===e)return"GeneratorFunction"===n(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(n(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(t))return"generator";switch(e=r.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}})),s.register("iPOJy",(function(t,e){ /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ "use strict";var r=s("lsigg");function n(t){return!0===r(t)&&"[object Object]"===Object.prototype.toString.call(t)}t.exports=function(t){var e,r;return!1!==n(t)&&("function"==typeof(e=t.constructor)&&(!1!==n(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}})),s.register("lsigg",(function(t,e){ /*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ "use strict";t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}})),s.register("k40G4",(function(t,e){t.exports=s("f8Gyl"),t.exports.Input=s("RUxbc"),t.exports.Output=s("8rP0b"),t.exports.UnspentOutput=s("3B4mQ"),t.exports.Signature=s("icrxZ"),t.exports.Sighash=s("jO8r4")})),s.register("f8Gyl",(function(t,e){var r=(o=s("bfD9J")).Buffer,n=s("duWgj"),i=s("92anD"),o=s("bfD9J"),a=s("jyzVj"),u=s("gdNRY"),f=s("bW8cN"),h=s("jH8RT"),c=s("lotH8"),d=s("giRii"),l=s("cnE2Z"),p=s("jO8r4"),b=s("jnlO6"),m=s("3B4mQ"),g=s("RUxbc"),y=g.PublicKeyHash,v=g.PublicKey,w=g.MultiSigScriptHash,_=g.MultiSig,S=s("8rP0b"),O=s("lGskS"),E=s("97Qx9"),I=s("h6qln");function P(t){if(!(this instanceof P))return new P(t);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,t){if(t instanceof P)return P.shallowCopy(t);if(u.isHexa(t))this.fromString(t);else if(r.isBuffer(t))this.fromBuffer(t);else{if(!n.isObject(t))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(t)}}else this._newTransaction()}P.DUST_AMOUNT=546,P.FEE_SECURITY_MARGIN=150,P.MAX_MONEY=21e14,P.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,P.NLOCKTIME_MAX_VALUE=4294967295,P.FEE_PER_KB=500,P.CHANGE_OUTPUT_MAX_SIZE=62,P.shallowCopy=function(t){return new P(t.toBuffer())};var M={configurable:!1,enumerable:!0,get:function(){return this._hash=new f(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty(P.prototype,"hash",M),Object.defineProperty(P.prototype,"id",M);var A={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(P.prototype,"inputAmount",A),A.get=function(){return this._getOutputAmount()},Object.defineProperty(P.prototype,"outputAmount",A),P.prototype._getHash=function(){return d.sha256sha256(this.toBuffer())},P.prototype.serialize=function(t){return!0===t||t&&t.disableAll?this.uncheckedSerialize():this.checkedSerialize(t)},P.prototype.uncheckedSerialize=P.prototype.toString=function(){return this.toBuffer().toString("hex")},P.prototype.checkedSerialize=function(t){var e=this.getSerializationError(t);if(e)throw e.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",e;return this.uncheckedSerialize()},P.prototype.invalidSatoshis=function(){for(var t=!1,e=0;er)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+e)}},P.prototype._missingChange=function(){return!this._changeScript},P.prototype._hasDustOutputs=function(t){var e,r;if(!t.disableDustOutputs)for(e in this.outputs)if((r=this.outputs[e]).satoshis"},P.prototype.toBuffer=function(){var t=new h;return this.toBufferWriter(t).toBuffer()},P.prototype.toBufferWriter=function(t){return t.writeInt32LE(this.version),t.writeVarintNum(this.inputs.length),n.each(this.inputs,(function(e){e.toBufferWriter(t)})),t.writeVarintNum(this.outputs.length),n.each(this.outputs,(function(e){e.toBufferWriter(t)})),t.writeUInt32LE(this.nLockTime),t},P.prototype.fromBuffer=function(t){var e=new f(t);return this.fromBufferReader(e)},P.prototype.fromBufferReader=function(t){var e,r,n;for(i.checkArgument(!t.finished(),"No transaction data received"),this.version=t.readInt32LE(),r=t.readVarintNum(),e=0;e=P.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(t<0)throw new a.Transaction.NLockTimeOutOfRange;for(var e=0;e=P.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new S({script:this._changeScript,satoshis:t})))}},P.prototype.getFee=function(){return this.isCoinbase()?0:n.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},P.prototype._estimateFee=function(){var t=this._estimateSize();return Math.ceil(t/1e3*(this._feePerKb||P.FEE_PER_KB))},P.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},P.prototype._clearSignatures=function(){n.each(this.inputs,(function(t){t.clearSignatures()}))},P.prototype._estimateSize=function(){var t=8;return t+=c(this.inputs.length).toBuffer().length,t+=c(this.outputs.length).toBuffer().length,n.each(this.inputs,(function(e){t+=e._estimateSize()})),n.each(this.outputs,(function(e){t+=e.getSize()})),t},P.prototype._removeOutput=function(t){var e=this.outputs[t];this.outputs=n.without(this.outputs,e),this._outputAmount=void 0},P.prototype.removeOutput=function(t){this._removeOutput(t),this._updateChangeOutput()},P.prototype.sort=function(){return this.sortInputs((function(t){var e=Array.prototype.concat.apply([],t);return e.sort((function(t,e){return t.prevTxId.compare(e.prevTxId)||t.outputIndex-e.outputIndex})),e})),this.sortOutputs((function(t){var e=Array.prototype.concat.apply([],t);return e.sort((function(t,e){return t.satoshis-e.satoshis||t.script.toBuffer().compare(e.script.toBuffer())})),e})),this},P.prototype.shuffleOutputs=function(){return this.sortOutputs(n.shuffle)},P.prototype.sortOutputs=function(t){var e=t(this.outputs);return this._newOutputOrder(e)},P.prototype.sortInputs=function(t){return this.inputs=t(this.inputs),this._clearSignatures(),this},P.prototype._newOutputOrder=function(t){if(this.outputs.length!==t.length||0!==n.difference(this.outputs,t).length)throw new a.Transaction.InvalidSorting;if(!n.isUndefined(this._changeIndex)){var e=this.outputs[this._changeIndex];this._changeIndex=t.indexOf(e)}return this.outputs=t,this},P.prototype.removeInput=function(t,e){var r;if((r=!e&&n.isNumber(t)?t:n.findIndex(this.inputs,(function(r){return r.prevTxId.toString("hex")===t&&r.outputIndex===e})))<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var i=this.inputs[r];this.inputs=n.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},P.prototype.sign=function(t,e){i.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return n.isArray(t)?(n.each(t,(function(t){r.sign(t,e)})),this):(n.each(this.getSignatures(t,e),(function(t){r.applySignature(t)})),this)},P.prototype.getSignatures=function(t,e){t=new E(t),e=e||l.SIGHASH_ALL|l.SIGHASH_FORKID;var r=this,i=[],s=d.sha256ripemd160(t.publicKey.toBuffer());return n.each(this.inputs,(function(o,a){n.each(o.getSignatures(r,t,a,e,s),(function(t){i.push(t)}))})),i},P.prototype.applySignature=function(t){return this.inputs[t.inputIndex].addSignature(this,t),this},P.prototype.isFullySigned=function(){return n.each(this.inputs,(function(t){if(t.isFullySigned===g.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")})),n.every(n.map(this.inputs,(function(t){return t.isFullySigned()})))},P.prototype.isValidSignature=function(t){if(this.inputs[t.inputIndex].isValidSignature===g.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[t.inputIndex].isValidSignature(this,t)},P.prototype.verifySignature=function(t,e,r,n,i,s){return p.verify(this,t,e,r,n,i,s)},P.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var t=new I(0),e=0;e1e6)return"transaction over the maximum block size";var i={};for(e=0;e100)return"coinbase transaction script size invalid"}else for(e=0;e>8)<<8|255&e),e&i.SIGHASH_FORKID&&v&p.SCRIPT_ENABLE_SIGHASH_FORKID)return function(t,e,n,s,o){var a=t.inputs[n];function u(t,e){var r=new f;b.isUndefined(e)?b.each(t.outputs,(function(t){t.toBufferWriter(r)})):t.outputs[e].toBufferWriter(r);var n=r.toBuffer();return c.sha256sha256(n)}l.checkArgument(o instanceof h,"For ForkId=0 signatures, satoshis or complete input must be provided");var d=r.alloc(32),p=r.alloc(32),m=r.alloc(32);e&i.SIGHASH_ANYONECANPAY||(d=function(t){var e=new f;b.each(t.inputs,(function(t){e.writeReverse(t.prevTxId),e.writeUInt32LE(t.outputIndex)}));var r=e.toBuffer();return c.sha256sha256(r)}(t)),e&i.SIGHASH_ANYONECANPAY||(31&e)===i.SIGHASH_SINGLE||(31&e)===i.SIGHASH_NONE||(p=function(t){var e=new f;b.each(t.inputs,(function(t){e.writeUInt32LE(t.sequenceNumber)}));var r=e.toBuffer();return c.sha256sha256(r)}(t)),(31&e)!==i.SIGHASH_SINGLE&&(31&e)!==i.SIGHASH_NONE?m=u(t):(31&e)===i.SIGHASH_SINGLE&&n>>0),g.toBuffer()}(O,e,u,d,y);for(d.removeCodeseparators(),S=0;S=O.outputs.length)return m;for(O.outputs.length=u+1,S=0;S9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Object.defineProperty(l.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(t){this._satoshisBN=t,this._satoshis=t.toNumber(),c.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),l.prototype.toObject=l.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},l.fromObject=function(t){return new l(t)},l.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=h.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(!(t instanceof d.Script.InvalidBuffer))throw t;this._script=null}},l.prototype.setScript=function(t){if(t instanceof h)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(n.isString(t))this._script=h.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!r.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},l.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},l.fromBufferReader=function(t){var e={};e.satoshis=t.readUInt64LEBN();var r=t.readVarintNum();return e.script=0!==r?t.read(r):o.Buffer.from([]),new l(e)},l.prototype.toBufferWriter=function(t){t||(t=new u),t.writeUInt64LEBN(this._satoshisBN);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t},l.prototype.getSize=function(){var t=this.script.toBuffer().length;return 8+f(t).toBuffer().length+t},t.exports=l})),s.register("RUxbc",(function(t,e){t.exports=s("b0zHO"),t.exports.PublicKey=s("hGx78"),t.exports.PublicKeyHash=s("7FAI7"),t.exports.MultiSig=s("l3lfk"),t.exports.MultiSigScriptHash=s("dcnj0")})),s.register("b0zHO",(function(t,e){var r=(u=s("bfD9J")).Buffer,n=s("duWgj"),i=s("92anD"),o=s("jyzVj"),a=s("jH8RT"),u=s("bfD9J"),f=s("gdNRY"),h=s("lGskS"),c=s("jO8r4"),d=s("8rP0b"),l=4294967295,p=l;function b(t){return this instanceof b?t?this._fromObject(t):void 0:new b(t)}b.MAXINT=l,b.DEFAULT_SEQNUMBER=p,b.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,b.DEFAULT_RBF_SEQNUMBER=4294967293,b.BASE_SIZE=40,Object.defineProperty(b.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),b.fromObject=function(t){return i.checkArgument(n.isObject(t)),(new b)._fromObject(t)},b.prototype._fromObject=function(t){var e;if(e=n.isString(t.prevTxId)&&f.isHexa(t.prevTxId)?u.Buffer.from(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof d?t.output:new d(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=n.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=n.isUndefined(t.sequenceNumber)?n.isUndefined(t.seqnum)?p:t.seqnum:t.sequenceNumber,n.isUndefined(t.script)&&n.isUndefined(t.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},b.prototype.toObject=b.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},b.fromBufferReader=function(t){var e=new b;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},b.prototype.toBufferWriter=function(t){t||(t=new a),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},b.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(null===t)this._script=h.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(f.isHexa(t))this._scriptBuffer=u.Buffer.from(t,"hex");else if(n.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!r.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=u.Buffer.from(t)}return this},b.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},b.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},b.prototype.isFinal=function(){return this.sequenceNumber===b.MAXINT},b.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},b.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},b.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,c.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},b.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},b.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},t.exports=b})),s.register("hGx78",(function(t,e){"use strict";var r=s("fmwGI"),n=s("92anD"),i=s("b0zHO"),o=s("8rP0b"),a=s("jO8r4"),u=s("lGskS"),f=s("cnE2Z"),h=s("icrxZ");function c(){i.apply(this,arguments)}r(c,i),c.prototype.getSignatures=function(t,e,r,i){n.checkState(this.output instanceof o),i=i||f.SIGHASH_ALL|f.SIGHASH_FORKID;var s=e.toPublicKey();return s.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:s,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:a.sign(t,e,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]},c.prototype.addSignature=function(t,e){return n.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},c.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},c.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},c.SCRIPT_MAX_SIZE=74,c.prototype._estimateSize=function(){return i.BASE_SIZE+c.SCRIPT_MAX_SIZE},t.exports=c})),s.register("icrxZ",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("92anD"),o=s("fmwGI"),a=s("gdNRY"),u=s("5XlX7"),f=s("jyzVj"),h=s("cnE2Z");function c(t){if(!(this instanceof c))return new c(t);if(t instanceof c)return t;if(n.isObject(t))return this._fromObject(t);throw new f.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(c,h),c.prototype._fromObject=function(t){return this._checkObjectArgs(t),this.publicKey=new u(t.publicKey),this.prevTxId=r.isBuffer(t.prevTxId)?t.prevTxId:r.from(t.prevTxId,"hex"),this.outputIndex=t.outputIndex,this.inputIndex=t.inputIndex,this.signature=t.signature instanceof h?t.signature:r.isBuffer(t.signature)?h.fromBuffer(t.signature):h.fromString(t.signature),this.sigtype=t.sigtype,this},c.prototype._checkObjectArgs=function(t){i.checkArgument(u(t.publicKey),"publicKey"),i.checkArgument(!n.isUndefined(t.inputIndex),"inputIndex"),i.checkArgument(!n.isUndefined(t.outputIndex),"outputIndex"),i.checkState(n.isNumber(t.inputIndex),"inputIndex must be a number"),i.checkState(n.isNumber(t.outputIndex),"outputIndex must be a number"),i.checkArgument(t.signature,"signature"),i.checkArgument(t.prevTxId,"prevTxId"),i.checkState(t.signature instanceof h||r.isBuffer(t.signature)||a.isHexa(t.signature),"signature must be a buffer or hexa value"),i.checkState(r.isBuffer(t.prevTxId)||a.isHexa(t.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(t.sigtype,"sigtype"),i.checkState(n.isNumber(t.sigtype),"sigtype must be a number")},c.prototype.toObject=c.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},c.fromObject=function(t){return i.checkArgument(t),new c(t)},t.exports=c})),s.register("7FAI7",(function(t,e){"use strict";var r=s("fmwGI"),n=s("92anD"),i=s("giRii"),o=s("b0zHO"),a=s("8rP0b"),u=s("jO8r4"),f=s("lGskS"),h=s("cnE2Z"),c=s("icrxZ");function d(){o.apply(this,arguments)}r(d,o),d.prototype.getSignatures=function(t,e,r,s,o){return n.checkState(this.output instanceof a),o=o||i.sha256ripemd160(e.publicKey.toBuffer()),s=s||h.SIGHASH_ALL|h.SIGHASH_FORKID,o.equals(this.output.script.getPublicKeyHash())?[new c({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(t,e,s,r,this.output.script,this.output.satoshisBN),sigtype:s})]:[]},d.prototype.addSignature=function(t,e){return n.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},d.SCRIPT_MAX_SIZE=108,d.prototype._estimateSize=function(){return o.BASE_SIZE+d.SCRIPT_MAX_SIZE},t.exports=d})),s.register("l3lfk",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("fmwGI"),o=s("b0zHO"),a=s("8rP0b"),u=s("92anD"),f=s("lGskS"),h=s("cnE2Z"),c=s("jO8r4"),d=s("icrxZ"),l=s("5XlX7"),p=s("lotH8");function b(t,e,r,i){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,i=i||t.signatures,this.publicKeys=e.map((t=>t.toString("hex"))).sort().map((t=>new l(t))),u.checkState(f.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},n.each(this.publicKeys,(function(t,e){s.publicKeyIndex[t.toString()]=e})),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(b,o),b.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=n.map(this.publicKeys,(function(t){return t.toString()})),t.signatures=this._serializeSignatures(),t},b.prototype._deserializeSignatures=function(t){return n.map(t,(function(t){if(t)return new d(t)}))},b.prototype._serializeSignatures=function(){return n.map(this.signatures,(function(t){if(t)return t.toObject()}))},b.prototype.getSignatures=function(t,e,r,i){u.checkState(this.output instanceof a),i=i||h.SIGHASH_ALL|h.SIGHASH_FORKID;var s=this,o=[];return n.each(this.publicKeys,(function(n){n.toString()===e.publicKey.toString()&&o.push(new d({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:c.sign(t,e,i,r,s.output.script,s.output.satoshisBN),sigtype:i}))})),o},b.prototype.addSignature=function(t,e){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!n.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},b.prototype._updateScript=function(){return this.setScript(f.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},b.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,(function(t){return!n.isUndefined(t)})),(function(t){return r.concat([t.signature.toDER(),r.from([255&t.sigtype])])}))},b.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},b.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},b.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},b.prototype.countSignatures=function(){return n.reduce(this.signatures,(function(t,e){return t+!!e}),0)},b.prototype.publicKeysWithoutSignature=function(){var t=this;return n.filter(this.publicKeys,(function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]}))},b.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,c.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},b.normalizeSignatures=function(t,e,r,n,i){return i.map((function(i){var s=null;return n=n.filter((function(n){if(s)return!0;var o=new d({signature:h.fromTxFormat(n),publicKey:i,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:h.SIGHASH_ALL});return o.signature.nhashtype=o.sigtype,!c.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script)||(s=o,!1)})),s||null}))},b.SIGNATURE_SIZE=73,b.prototype._estimateSize=function(){var t=1+this.threshold*b.SIGNATURE_SIZE;return o.BASE_SIZE+p(t).toBuffer().length+t},t.exports=b})),s.register("dcnj0",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("fmwGI"),o=s("b0zHO"),a=s("8rP0b"),u=s("92anD"),f=s("lGskS"),h=s("cnE2Z"),c=s("jO8r4"),d=s("icrxZ"),l=s("5XlX7"),p=s("lotH8");function b(t,e,r,i){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,i=i||t.signatures,this.publicKeys=e.map((t=>t.toString("hex"))).sort().map((t=>new l(t))),this.redeemScript=f.buildMultisigOut(this.publicKeys,r),u.checkState(f.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},n.each(this.publicKeys,(function(t,e){s.publicKeyIndex[t.toString()]=e})),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(b,o),b.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=n.map(this.publicKeys,(function(t){return t.toString()})),t.signatures=this._serializeSignatures(),t},b.prototype._deserializeSignatures=function(t){return n.map(t,(function(t){if(t)return new d(t)}))},b.prototype._serializeSignatures=function(){return n.map(this.signatures,(function(t){if(t)return t.toObject()}))},b.prototype.getSignatures=function(t,e,r,i){u.checkState(this.output instanceof a),i=i||h.SIGHASH_ALL|h.SIGHASH_FORKID;var s=this,o=[];return n.each(this.publicKeys,(function(n){n.toString()===e.publicKey.toString()&&o.push(new d({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:c.sign(t,e,i,r,s.redeemScript,s.output.satoshisBN),sigtype:i}))})),o},b.prototype.addSignature=function(t,e){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!n.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},b.prototype._updateScript=function(){return this.setScript(f.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},b.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,(function(t){return!n.isUndefined(t)})),(function(t){return r.concat([t.signature.toDER(),r.from([255&t.sigtype])])}))},b.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},b.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},b.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},b.prototype.countSignatures=function(){return n.reduce(this.signatures,(function(t,e){return t+!!e}),0)},b.prototype.publicKeysWithoutSignature=function(){var t=this;return n.filter(this.publicKeys,(function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]}))},b.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,c.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript,this.output.satoshisBN)},b.SIGNATURE_SIZE=73,b.PUBKEY_SIZE=34,b.prototype._estimateSize=function(){var t=3+this.publicKeys.length*b.PUBKEY_SIZE,e=this.threshold*b.SIGNATURE_SIZE+1+(t<=75?1:t<=255?2:3)+t;return o.BASE_SIZE+p(e).toBuffer().length+e},t.exports=b})),s.register("3B4mQ",(function(t,e){"use strict";var r=s("duWgj"),n=s("92anD"),i=s("gdNRY"),o=s("lGskS"),a=s("jnlO6");function u(t){if(!(this instanceof u))return new u(t);n.checkArgument(r.isObject(t),"Must provide an object from where to extract data");var e=t.address?new a(t.address):void 0,s=t.txid?t.txid:t.txId;if(!s||!i.isHexaString(s)||s.length>64)throw new Error("Invalid TXID in object",t);var f=r.isUndefined(t.vout)?t.outputIndex:t.vout;if(!r.isNumber(f))throw new Error("Invalid outputIndex, received "+f);n.checkArgument(!r.isUndefined(t.scriptPubKey)||!r.isUndefined(t.script),"Must provide the scriptPubKey for that output!");var h=new o(t.scriptPubKey||t.script);n.checkArgument(!r.isUndefined(t.amount)||!r.isUndefined(t.satoshis),"Must provide an amount for the output");var c=r.isUndefined(t.amount)?t.satoshis:Math.round(1e8*t.amount);n.checkArgument(r.isNumber(c),"Amount must be a number"),i.defineImmutable(this,{address:e,txId:s,outputIndex:f,script:h,satoshis:c})}u.prototype.inspect=function(){return""},u.prototype.toString=function(){return this.txId+":"+this.outputIndex},u.fromObject=function(t){return new u(t)},u.prototype.toObject=u.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:Number.parseFloat((this.satoshis/1e8).toFixed(8))}},t.exports=u})),s.register("3wcw8",(function(t,e){var r=s("bfD9J").Buffer;function n(){}n.getRandomBuffer=function(t){return n.getRandomBufferBrowser(t)},n.getRandomBufferNode=function(t){return s("eBt9c").randomBytes(t)},n.getRandomBufferBrowser=function(t){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");var e;if(window.crypto&&window.crypto.getRandomValues)e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");e=window.msCrypto}var n=new Uint8Array(t);return e.getRandomValues(n),r.from(n)},t.exports=n})),s.register("hiEGN",(function(t,e){var r=s("bfD9J").Buffer,n=s("duWgj"),i=s("h6qln"),o=s("bW8cN"),a=s("jH8RT"),u=s("giRii"),f=s("92anD"),h=function t(e){if(!(this instanceof t))return new t(e);var r=t._from(e);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&f.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};h._from=function(t){var e={};if(r.isBuffer(t))e=h._fromBufferReader(o(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");e=h._fromObject(t)}return e},h._fromObject=function(t){f.checkArgument(t,"data is required");var e=t.prevHash,i=t.merkleRoot;return n.isString(t.prevHash)&&(e=r.from(t.prevHash,"hex").reverse()),n.isString(t.merkleRoot)&&(i=r.from(t.merkleRoot,"hex").reverse()),{hash:t.hash,version:t.version,prevHash:e,merkleRoot:i,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce}},h.fromObject=function(t){var e=h._fromObject(t);return new h(e)},h.fromRawBlock=function(t){r.isBuffer(t)||(t=r.from(t,"binary"));var e=o(t);e.pos=h.Constants.START_OF_HEADER;var n=h._fromBufferReader(e);return new h(n)},h.fromBuffer=function(t){var e=h._fromBufferReader(o(t));return new h(e)},h.fromString=function(t){var e=r.from(t,"hex");return h.fromBuffer(e)},h._fromBufferReader=function(t){var e={};return e.version=t.readInt32LE(),e.prevHash=t.read(32),e.merkleRoot=t.read(32),e.time=t.readUInt32LE(),e.bits=t.readUInt32LE(),e.nonce=t.readUInt32LE(),e},h.fromBufferReader=function(t){var e=h._fromBufferReader(t);return new h(e)},h.prototype.toObject=h.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:r.from(this.prevHash).reverse().toString("hex"),merkleRoot:r.from(this.merkleRoot).reverse().toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},h.prototype.toBuffer=function(){return this.toBufferWriter().concat()},h.prototype.toString=function(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function(t){return t||(t=new a),t.writeInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},h.prototype.getTargetDifficulty=function(t){t=t||this.bits;for(var e=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)e=e.mul(new i(2));return e},h.prototype.getDifficulty=function(){var t=this.getTargetDifficulty(486604799).mul(new i(Math.pow(10,8))),e=this.getTargetDifficulty(),r=t.div(e).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},h.prototype._getHash=function(){var t=this.toBuffer();return u.sha256sha256(t)};var c={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(h.prototype,"id",c),Object.defineProperty(h.prototype,"hash",c),h.prototype.validTimestamp=function(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return!(t.cmp(e)>0)},h.prototype.inspect=function(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=h})),s.register("5QJqD",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.Proof=t.exports.pow_string=t.exports.meta=t.exports.Solution=t.exports.Puzzle=t.exports.PowString=void 0;var n=s("caLQh"),i=s("ecdon"),o=s("bdCP2"),a=s("iU1Nf"),u=s("f55ta"),f=s("2uXT7"),h=s("3M6mG");h=s("3M6mG");Object.defineProperty(t.exports,"PowString",{enumerable:!0,get:function(){return h.PowString}});t.exports.Puzzle=class{constructor(t,e,r,n,i,s){this.Category=t,this.Content=e,this.Difficulty=r,this.MetaBegin=n,this.MetaEnd=i,this.Mask=s}};class c{constructor(t,e,r,n,i){this.Time=t,this.ExtraNonce1=e,this.ExtraNonce2=r,this.Nonce=n,this.GeneralPurposeBits=i}toJSON(){let t={share:{timestamp:this.Time.hex,nonce:this.Nonce.hex,extra_nonce_2:this.Nonce.hex},extra_nonce_1:this.ExtraNonce1.hex};return this.GeneralPurposeBits&&(t.share.bits=this.GeneralPurposeBits.hex),t}static fromJSON(t){if(!t.share||!t.extra_nonce_1||!t.share.timestamp||!t.share.nonce||!t.share.extra_nonce_2||"string"!=typeof t.extra_nonce_1||"string"!=typeof t.share.timestamp||"string"!=typeof t.share.nonce||"string"!=typeof t.share.extra_nonce_2||t.share.bits&&"string"!=typeof t.share.bits)return;let e=o.UInt32Little.fromHex(t.share.timestamp);if(void 0===e)return;let r=a.UInt32Big.fromHex(t.extra_nonce_1);if(void 0===r)return;let n=u.Bytes.fromHex(t.share.extra_nonce_2);if(void 0===n)return;let s,f=o.UInt32Little.fromHex(t.share.nonce);return void 0!==f?t.share.bits&&(s=i.Int32Little.fromHex(t.share.bits),void 0===s)?void 0:new c(e,r,n,f,s):void 0}}function d(t,e){return new u.Bytes(r.concat([t.MetaBegin.buffer,e.ExtraNonce1.buffer,e.ExtraNonce2.buffer,t.MetaEnd.buffer]))}function l(t,e){var i;if(t.Mask){var s=e.GeneralPurposeBits;if(!s)return;i=f.Utils.writeInt32LE(t.Category.number&t.Mask.number|s.number&~t.Mask.number)}else{if(e.GeneralPurposeBits)return;i=t.Category.buffer}const o=d(t,e);return new h.PowString(n.BlockHeader.fromBuffer(r.concat([i,t.Content.buffer,o.hash256.buffer,e.Time.buffer,t.Difficulty.buffer,e.Nonce.buffer])))}t.exports.Solution=c,t.exports.meta=d,t.exports.pow_string=l;t.exports.Proof=class{constructor(t,e){this.Puzzle=t,this.Solution=e}metadata(){return d(this.Puzzle,this.Solution)}string(){return l(this.Puzzle,this.Solution)}valid(){let t=this.string();return!!t&&t.valid()}}})),s.register("ecdon",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.Int32Little=void 0;var n=s("2uXT7");class i{constructor(t){this.data=t}static fromNumber(t){let e=r.alloc(4);return t<=2147483647&&t>=-2147483648&&e.writeInt32LE(t),new i(e)}static fromHex(t){if(8!=t.length)return;let e=r.from(t,"hex");return 4==e.length?new i(e):void 0}get buffer(){return this.data}get hex(){return this.buffer.toString("hex")}get number(){return this.buffer.readInt32LE()}get string(){return this.utf8}get utf8(){return n.Utils.trimBufferString(this.buffer,!0)}}t.exports.Int32Little=i})),s.register("2uXT7",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.Utils=void 0;var n=s("caLQh");class i{static getSha256(t,e="utf8"){const i=r.from(t,e);return n.crypto.Hash.sha256(i).toString("hex")}static writeInt32LE(t){if(t>2147483647)throw"number too big to be an int32.";if(t<-2147483648)throw"number too small to be an int32.";let e=r.alloc(4);return e.writeInt32LE(t),e}static writeUInt32LE(t){if(t>4294967295)throw"number too big to be a uint32.";let e=r.alloc(4);return e.writeUInt32LE(t),e}static trimBufferString(t,e=!0){const r=t.toString("utf8");return e?r.replace(/\0+$/g,""):r}static maxBits(){return 553713663}static minBits(){return 50331649}static unitBits(){return 486604799}static getTargetDifficulty(t){for(var e=new n.crypto.BN(16777215&t),r=(t>>>24)-3;r-- >0;)e=e.mul(new n.crypto.BN(256));return e}static difficulty(t){var e=i.getTargetDifficulty(i.unitBits()),r=i.getTargetDifficulty(t);if(r.gt(e))return parseFloat(e.toString(10))/parseFloat(r.toString(10));var s=e.mul(new n.crypto.BN(Math.pow(10,8))).div(r).toString(10),o=s.length-8;return s=s.slice(0,o)+"."+s.slice(o),parseFloat(s)}static difficulty2bits(t){if(t<0)throw"difficulty cannot be negative";if(!isFinite(t))throw"difficulty cannot be infinite";for(var e=parseFloat(i.getTargetDifficulty(i.unitBits()).toString(10))/t,r=0;e>1;)e/=256,r++;if(r<3)return i.minBits();if(r>32)return i.maxBits();let n=16777215&Math.trunc(16777216*e);return 8388608&n&&(n>>=8,r++),r<<24|n}static getTargetAsNumberBuffer(t){const e=i.difficulty2bits(t);return r.from(e.toString(16),"hex").reverse()}static stringToBuffer(t,e){if(!e)return r.from(t,"utf8");if(t.length>e)throw"string is too big";let n=r.from(t,"utf8"),i=r.alloc(e-t.length);return r.concat([n,i])}static fromOpCode(t){return t.opcodenum>=n.Opcode.OP_1&&t.opcodenum<=n.Opcode.OP_16?r.from([t.opcodenum-n.Opcode.OP_1+1]):t.opcodenum==n.Opcode.OP_0?r.from([]):t.opcodenum==n.Opcode.OP_1NEGATE?r.from([129]):t.buf}static generalPurposeBitsMask(){return-536862721}static generalPurposeBits(t){return~this.generalPurposeBitsMask()&t>>13}static magicNumber(t){return 8191&t|(3758096384&t)>>16}static version(t){return this.generalPurposeBitsMask()&t}static createBufferAndPad(t,e,n=!0){if(!t){const t=r.alloc(e);return t.fill(0),t}let i;if("buffer"===(typeof t).toString()){if(t.byteLength>e)throw new Error("The buffer is out of bounds: "+e+" bytes or small expected");i=t}else{if(t.length>2*e)throw new Error("The buffer is out of bounds: "+e+" bytes expected");if(!/^([0-9A-Fa-f][0-9A-Fa-f])+$/g.test(t))throw"not a hex string";i=r.from(t,"hex")}if(i.byteLength=0&&e.writeUInt32LE(t),new i(e)}static fromHex(t){if(8!=t.length)return;let e=r.from(t,"hex");return 4==e.length?new i(e):void 0}get hex(){return this.data.toString("hex")}get number(){return this.data.readUInt32LE()}get buffer(){return this.data}get string(){return this.utf8}get utf8(){return n.Utils.trimBufferString(this.data,!0)}}t.exports.UInt32Little=i})),s.register("iU1Nf",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.UInt32Big=t.exports.InvalidUInt32Big=void 0;var n=s("2uXT7");class i{constructor(){this.name="InvalidUInt32Big",this.message="Value must be between 0 and 4294967295"}}t.exports.InvalidUInt32Big=i;class o{constructor(t){this.data=t}static fromNumber(t){let e=r.alloc(4);if(t>4294967295||t<0)throw new i;return e.writeUInt32BE(t),new o(e)}static fromHex(t){if(8!=t.length)return;let e=r.from(t,"hex");return 4==e.length?new o(e):void 0}get hex(){return this.data.toString("hex")}get number(){return this.data.readUInt32BE()}get buffer(){return this.data}get string(){return this.utf8}get utf8(){return n.Utils.trimBufferString(this.data,!0)}}t.exports.UInt32Big=o})),s.register("f55ta",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.Bytes=void 0;var n=s("caLQh"),i=s("2uXT7"),o=s("c7O58");class a{constructor(t){this.data=t}static fromHex(t){return new a(r.from(t,"hex"))}get buffer(){return this.data}get hex(){return this.buffer.toString("hex")}get string(){return this.utf8}get utf8(){return i.Utils.trimBufferString(this.buffer,!0)}get hash256(){return new o.Digest32(n.crypto.Hash.sha256sha256(this.buffer))}get length(){return this.data.length}}t.exports.Bytes=a})),s.register("c7O58",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.Digest32=void 0;var n=s("caLQh"),i=s("2uXT7");class o{constructor(t){this.data=t}static fromHex(t){return new o(r.from(t,"hex").reverse())}get hex(){return r.from(this.data).reverse().toString("hex")}get number(){return new n.crypto.BN(this.hex,"hex","be")}get buffer(){return this.data}get string(){return this.utf8}get utf8(){return i.Utils.trimBufferString(this.data,!0)}}t.exports.Digest32=o})),s.register("3M6mG",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.BoostPowString=t.exports.PowString=void 0;var n=s("caLQh"),i=s("ecdon"),o=s("bdCP2"),a=s("9x5Bc"),u=s("c7O58"),f=s("2uXT7");class h{constructor(t){this._blockheader=t}get boostHash(){return this.hash}get hash(){return u.Digest32.fromHex(this._blockheader.hash)}get id(){return this.hash}get category(){return i.Int32Little.fromNumber(this._blockheader.version)}get magicNumber(){return a.UInt16Little.fromNumber(f.Utils.magicNumber(this.category.number))}get content(){return new u.Digest32(r.from(this.toObject().content,"hex").reverse())}get bits(){return o.UInt32Little.fromNumber(this._blockheader.toObject().bits)}get metadataHash(){return new u.Digest32(r.from(this.toObject().metadataHash,"hex").reverse())}get nonce(){return o.UInt32Little.fromNumber(this._blockheader.nonce)}get time(){return o.UInt32Little.fromNumber(this._blockheader.time)}valid(){return this._blockheader.validProofOfWork()}static fromBuffer(t){return new h(n.BlockHeader.fromBuffer(t))}static fromString(t){var e=r.from(t,"hex");return new h(n.BlockHeader.fromBuffer(e))}static fromHex(t){var e=r.from(t,"hex");return new h(n.BlockHeader.fromBuffer(e))}static fromObject(t){const e={prevHash:t.content,bits:t.bits,version:t.category,merkleRoot:t.metadataHash,time:t.time,nonce:t.nonce};return new h(n.BlockHeader.fromObject(e))}toBuffer(){return this._blockheader.toBufferWriter().concat()}toString(){return this._blockheader.toBuffer().toString("hex")}toHex(){return this._blockheader.toBuffer().toString("hex")}toObject(){const t=this._blockheader.toObject();return{hash:t.hash,content:t.prevHash,bits:t.bits,difficulty:this.difficulty,category:t.version,metadataHash:t.merkleRoot,time:t.time,nonce:t.nonce}}get difficulty(){return this._blockheader.getDifficulty()}}t.exports.PowString=h,t.exports.BoostPowString=h})),s.register("9x5Bc",(function(t,e){var r=s("bfD9J").Buffer;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports.UInt16Little=void 0;class n{constructor(t){this.data=t}static fromNumber(t){let e=r.alloc(2);return t<=65536&&t>=0&&e.writeUInt16LE(t),new n(e)}get hex(){return this.data.toString("hex")}get number(){return this.data.readUInt16LE()}get buffer(){return this.data}get string(){return this.hex}}t.exports.UInt16Little=n})),s.register("2bId1",(function(t,e){ //! moment.js t.exports=function(){"use strict";var e,r;function n(){return e.apply(null,arguments)}function i(t){e=t}function s(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0}function u(t){return void 0===t}function f(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function h(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function c(t,e){var r,n=[];for(r=0;r>>0,n=0;n0)for(r=0;r0?"future":"past"];return T(r)?r(e):r.replace(/%s/i,e)}var W={};function J(t,e){var r=t.toLowerCase();W[r]=W[r+"s"]=W[e]=t}function Z(t){return"string"==typeof t?W[t]||W[t.toLowerCase()]:void 0}function X(t){var e,r,n={};for(r in t)d(t,r)&&(e=Z(r))&&(n[e]=t[r]);return n}var Q={};function $(t,e){Q[t]=e}function tt(t){var e=[];for(var r in t)e.push({unit:r,priority:Q[r]});return e.sort((function(t,e){return t.priority-e.priority})),e}function et(t,e,r){var n=""+Math.abs(t),i=e-n.length;return(t>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var rt=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,nt=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,it={},st={};function ot(t,e,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),t&&(st[t]=i),e&&(st[e[0]]=function(){return et(i.apply(this,arguments),e[1],e[2])}),r&&(st[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function at(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function ut(t){var e,r,n=t.match(rt);for(e=0,r=n.length;e=0&&nt.test(t);)t=t.replace(nt,n),nt.lastIndex=0,r-=1;return t}var ct=/\d/,dt=/\d\d/,lt=/\d{3}/,pt=/\d{4}/,bt=/[+-]?\d{6}/,mt=/\d\d?/,gt=/\d\d\d\d?/,yt=/\d\d\d\d\d\d?/,vt=/\d{1,3}/,wt=/\d{1,4}/,_t=/[+-]?\d{1,6}/,St=/\d+/,Ot=/[+-]?\d+/,Et=/Z|[+-]\d\d:?\d\d/gi,It=/Z|[+-]\d\d(?::?\d\d)?/gi,Pt=/[+-]?\d+(\.\d{1,3})?/,Mt=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,At={};function kt(t,e,r){At[t]=T(e)?e:function(t,n){return t&&r?r:e}}function xt(t,e){return d(At,t)?At[t](e._strict,e._locale):new RegExp(Rt(t))}function Rt(t){return Tt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(t,e,r,n,i){return e||r||n||i})))}function Tt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var Bt={};function Nt(t,e){var r,n=e;for("string"==typeof t&&(t=[t]),f(e)&&(n=function(t,r){r[e]=I(t)}),r=0;r68?1900:2e3)};var Wt,Jt=Xt("FullYear",!0);function Zt(){return zt(this.year())}function Xt(t,e){return function(r){return null!=r?($t(this,t,r),n.updateOffset(this,e),this):Qt(this,t)}}function Qt(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function $t(t,e,r){t.isValid()&&!isNaN(r)&&("FullYear"===e&&zt(t.year())&&1===t.month()&&29===t.date()?t._d["set"+(t._isUTC?"UTC":"")+e](r,t.month(),ne(r,t.month())):t._d["set"+(t._isUTC?"UTC":"")+e](r))}function te(t){return T(this[t=Z(t)])?this[t]():this}function ee(t,e){if("object"==typeof t)for(var r=tt(t=X(t)),n=0;n=0?(a=new Date(t+400,e,r,n,i,s,o),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,r,n,i,s,o),a}function we(t){var e;if(t<100&&t>=0){var r=Array.prototype.slice.call(arguments);r[0]=t+400,e=new Date(Date.UTC.apply(null,r)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)}else e=new Date(Date.UTC.apply(null,arguments));return e}function _e(t,e,r){var n=7+e-r;return-(7+we(t,0,n).getUTCDay()-e)%7+n-1}function Se(t,e,r,n,i){var s,o,a=1+7*(e-1)+(7+r-n)%7+_e(t,n,i);return a<=0?o=Yt(s=t-1)+a:a>Yt(t)?(s=t+1,o=a-Yt(t)):(s=t,o=a),{year:s,dayOfYear:o}}function Oe(t,e,r){var n,i,s=_e(t.year(),e,r),o=Math.floor((t.dayOfYear()-s-1)/7)+1;return o<1?n=o+Ee(i=t.year()-1,e,r):o>Ee(t.year(),e,r)?(n=o-Ee(t.year(),e,r),i=t.year()+1):(i=t.year(),n=o),{week:n,year:i}}function Ee(t,e,r){var n=_e(t,e,r),i=_e(t+1,e,r);return(Yt(t)-n+i)/7}function Ie(t){return Oe(t,this._week.dow,this._week.doy).week}ot("w",["ww",2],"wo","week"),ot("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),$("week",5),$("isoWeek",5),kt("w",mt),kt("ww",mt,dt),kt("W",mt),kt("WW",mt,dt),Ct(["w","ww","W","WW"],(function(t,e,r,n){e[n.substr(0,1)]=I(t)}));var Pe={dow:0,doy:6};function Me(){return this._week.dow}function Ae(){return this._week.doy}function ke(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function xe(t){var e=Oe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Re(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function Te(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Be(t,e){return t.slice(e,7).concat(t.slice(0,e))}ot("d",0,"do","day"),ot("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),ot("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),ot("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),ot("e",0,0,"weekday"),ot("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),$("day",11),$("weekday",11),$("isoWeekday",11),kt("d",mt),kt("e",mt),kt("E",mt),kt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),kt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),kt("dddd",(function(t,e){return e.weekdaysRegex(t)})),Ct(["dd","ddd","dddd"],(function(t,e,r,n){var i=r._locale.weekdaysParse(t,n,r._strict);null!=i?e.d=i:m(r).invalidWeekday=t})),Ct(["d","e","E"],(function(t,e,r,n){e[n]=I(t)}));var Ne="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");function Ce(t,e){var r=s(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Be(r,this._week.dow):t?r[t.day()]:r}var Le="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function Ue(t){return!0===t?Be(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}var De="Su_Mo_Tu_We_Th_Fr_Sa".split("_");function He(t){return!0===t?Be(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function je(t,e,r){var n,i,s,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)s=p([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(s,"").toLocaleLowerCase();return r?"dddd"===e?-1!==(i=Wt.call(this._weekdaysParse,o))?i:null:"ddd"===e?-1!==(i=Wt.call(this._shortWeekdaysParse,o))?i:null:-1!==(i=Wt.call(this._minWeekdaysParse,o))?i:null:"dddd"===e?-1!==(i=Wt.call(this._weekdaysParse,o))||-1!==(i=Wt.call(this._shortWeekdaysParse,o))||-1!==(i=Wt.call(this._minWeekdaysParse,o))?i:null:"ddd"===e?-1!==(i=Wt.call(this._shortWeekdaysParse,o))||-1!==(i=Wt.call(this._weekdaysParse,o))||-1!==(i=Wt.call(this._minWeekdaysParse,o))?i:null:-1!==(i=Wt.call(this._minWeekdaysParse,o))||-1!==(i=Wt.call(this._weekdaysParse,o))||-1!==(i=Wt.call(this._shortWeekdaysParse,o))?i:null}function Fe(t,e,r){var n,i,s;if(this._weekdaysParseExact)return je.call(this,t,e,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=p([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=new RegExp(s.replace(".",""),"i")),r&&"dddd"===e&&this._fullWeekdaysParse[n].test(t))return n;if(r&&"ddd"===e&&this._shortWeekdaysParse[n].test(t))return n;if(r&&"dd"===e&&this._minWeekdaysParse[n].test(t))return n;if(!r&&this._weekdaysParse[n].test(t))return n}}function Ke(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Re(t,this.localeData()),this.add(t-e,"d")):e}function Ve(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function qe(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Te(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}var Ge=Mt;function Ye(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=Ge),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}var ze=Mt;function We(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ze),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}var Je=Mt;function Ze(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Xe(){function t(t,e){return e.length-t.length}var e,r,n,i,s,o=[],a=[],u=[],f=[];for(e=0;e<7;e++)r=p([2e3,1]).day(e),n=this.weekdaysMin(r,""),i=this.weekdaysShort(r,""),s=this.weekdays(r,""),o.push(n),a.push(i),u.push(s),f.push(n),f.push(i),f.push(s);for(o.sort(t),a.sort(t),u.sort(t),f.sort(t),e=0;e<7;e++)a[e]=Tt(a[e]),u[e]=Tt(u[e]),f[e]=Tt(f[e]);this._weekdaysRegex=new RegExp("^("+f.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function Qe(){return this.hours()%12||12}function $e(){return this.hours()||24}function tr(t,e){ot(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function er(t,e){return e._meridiemParse}function rr(t){return"p"===(t+"").toLowerCase().charAt(0)}ot("H",["HH",2],0,"hour"),ot("h",["hh",2],0,Qe),ot("k",["kk",2],0,$e),ot("hmm",0,0,(function(){return""+Qe.apply(this)+et(this.minutes(),2)})),ot("hmmss",0,0,(function(){return""+Qe.apply(this)+et(this.minutes(),2)+et(this.seconds(),2)})),ot("Hmm",0,0,(function(){return""+this.hours()+et(this.minutes(),2)})),ot("Hmmss",0,0,(function(){return""+this.hours()+et(this.minutes(),2)+et(this.seconds(),2)})),tr("a",!0),tr("A",!1),J("hour","h"),$("hour",13),kt("a",er),kt("A",er),kt("H",mt),kt("h",mt),kt("k",mt),kt("HH",mt,dt),kt("hh",mt,dt),kt("kk",mt,dt),kt("hmm",gt),kt("hmmss",yt),kt("Hmm",gt),kt("Hmmss",yt),Nt(["H","HH"],jt),Nt(["k","kk"],(function(t,e,r){var n=I(t);e[jt]=24===n?0:n})),Nt(["a","A"],(function(t,e,r){r._isPm=r._locale.isPM(t),r._meridiem=t})),Nt(["h","hh"],(function(t,e,r){e[jt]=I(t),m(r).bigHour=!0})),Nt("hmm",(function(t,e,r){var n=t.length-2;e[jt]=I(t.substr(0,n)),e[Ft]=I(t.substr(n)),m(r).bigHour=!0})),Nt("hmmss",(function(t,e,r){var n=t.length-4,i=t.length-2;e[jt]=I(t.substr(0,n)),e[Ft]=I(t.substr(n,2)),e[Kt]=I(t.substr(i)),m(r).bigHour=!0})),Nt("Hmm",(function(t,e,r){var n=t.length-2;e[jt]=I(t.substr(0,n)),e[Ft]=I(t.substr(n))})),Nt("Hmmss",(function(t,e,r){var n=t.length-4,i=t.length-2;e[jt]=I(t.substr(0,n)),e[Ft]=I(t.substr(n,2)),e[Kt]=I(t.substr(i))}));var nr=/[ap]\.?m?\.?/i;function ir(t,e,r){return t>11?r?"pm":"PM":r?"am":"AM"}var sr,or=Xt("Hours",!0),ar={calendar:L,longDateFormat:D,invalidDate:j,ordinal:K,dayOfMonthOrdinalParse:V,relativeTime:G,months:se,monthsShort:ae,week:Pe,weekdays:Ne,weekdaysMin:De,weekdaysShort:Le,meridiemParse:nr},ur={},fr={};function hr(t){return t?t.toLowerCase().replace("_","-"):t}function cr(t){for(var e,r,n,i,s=0;s0;){if(n=dr(i.slice(0,e).join("-")))return n;if(r&&r.length>=e&&P(i,r,!0)>=e-1)break;e--}s++}return sr}function dr(e){var r=null;if(!ur[e]&&t&&t.exports)try{r=sr._abbr,(void 0)("./locale/"+e),lr(r)}catch(t){}return ur[e]}function lr(t,e){var r;return t&&((r=u(e)?mr(t):pr(t,e))?sr=r:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),sr._abbr}function pr(t,e){if(null!==e){var r,n=ar;if(e.abbr=t,null!=ur[t])R("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=ur[t]._config;else if(null!=e.parentLocale)if(null!=ur[e.parentLocale])n=ur[e.parentLocale]._config;else{if(null==(r=dr(e.parentLocale)))return fr[e.parentLocale]||(fr[e.parentLocale]=[]),fr[e.parentLocale].push({name:t,config:e}),null;n=r._config}return ur[t]=new C(N(n,e)),fr[t]&&fr[t].forEach((function(t){pr(t.name,t.config)})),lr(t),ur[t]}return delete ur[t],null}function br(t,e){if(null!=e){var r,n,i=ar;null!=(n=dr(t))&&(i=n._config),(r=new C(e=N(i,e))).parentLocale=ur[t],ur[t]=r,lr(t)}else null!=ur[t]&&(null!=ur[t].parentLocale?ur[t]=ur[t].parentLocale:null!=ur[t]&&delete ur[t]);return ur[t]}function mr(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return sr;if(!s(t)){if(e=dr(t))return e;t=[t]}return cr(t)}function gr(){return k(ur)}function yr(t){var e,r=t._a;return r&&-2===m(t).overflow&&(e=r[Dt]<0||r[Dt]>11?Dt:r[Ht]<1||r[Ht]>ne(r[Ut],r[Dt])?Ht:r[jt]<0||r[jt]>24||24===r[jt]&&(0!==r[Ft]||0!==r[Kt]||0!==r[Vt])?jt:r[Ft]<0||r[Ft]>59?Ft:r[Kt]<0||r[Kt]>59?Kt:r[Vt]<0||r[Vt]>999?Vt:-1,m(t)._overflowDayOfYear&&(eHt)&&(e=Ht),m(t)._overflowWeeks&&-1===e&&(e=qt),m(t)._overflowWeekday&&-1===e&&(e=Gt),m(t).overflow=e),t}function vr(t,e,r){return null!=t?t:null!=e?e:r}function wr(t){var e=new Date(n.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function _r(t){var e,r,n,i,s,o=[];if(!t._d){for(n=wr(t),t._w&&null==t._a[Ht]&&null==t._a[Dt]&&Sr(t),null!=t._dayOfYear&&(s=vr(t._a[Ut],n[Ut]),(t._dayOfYear>Yt(s)||0===t._dayOfYear)&&(m(t)._overflowDayOfYear=!0),r=we(s,0,t._dayOfYear),t._a[Dt]=r.getUTCMonth(),t._a[Ht]=r.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=o[e]=n[e];for(;e<7;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[jt]&&0===t._a[Ft]&&0===t._a[Kt]&&0===t._a[Vt]&&(t._nextDay=!0,t._a[jt]=0),t._d=(t._useUTC?we:ve).apply(null,o),i=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[jt]=24),t._w&&void 0!==t._w.d&&t._w.d!==i&&(m(t).weekdayMismatch=!0)}}function Sr(t){var e,r,n,i,s,o,a,u;if(null!=(e=t._w).GG||null!=e.W||null!=e.E)s=1,o=4,r=vr(e.GG,t._a[Ut],Oe(zr(),1,4).year),n=vr(e.W,1),((i=vr(e.E,1))<1||i>7)&&(u=!0);else{s=t._locale._week.dow,o=t._locale._week.doy;var f=Oe(zr(),s,o);r=vr(e.gg,t._a[Ut],f.year),n=vr(e.w,f.week),null!=e.d?((i=e.d)<0||i>6)&&(u=!0):null!=e.e?(i=e.e+s,(e.e<0||e.e>6)&&(u=!0)):i=s}n<1||n>Ee(r,s,o)?m(t)._overflowWeeks=!0:null!=u?m(t)._overflowWeekday=!0:(a=Se(r,n,i,s,o),t._a[Ut]=a.year,t._dayOfYear=a.dayOfYear)}var Or=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Er=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ir=/Z|[+-]\d\d(?::?\d\d)?/,Pr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Mr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ar=/^\/?Date\((\-?\d+)/i;function kr(t){var e,r,n,i,s,o,a=t._i,u=Or.exec(a)||Er.exec(a);if(u){for(m(t).iso=!0,e=0,r=Pr.length;e0&&m(t).unusedInput.push(o),a=a.slice(a.indexOf(r)+r.length),f+=r.length),st[s]?(r?m(t).empty=!1:m(t).unusedTokens.push(s),Lt(s,r,t)):t._strict&&!r&&m(t).unusedTokens.push(s);m(t).charsLeftOver=u-f,a.length>0&&m(t).unusedInput.push(a),t._a[jt]<=12&&!0===m(t).bigHour&&t._a[jt]>0&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[jt]=jr(t._locale,t._a[jt],t._meridiem),_r(t),yr(t)}else Ur(t);else kr(t)}function jr(t,e,r){var n;return null==r?e:null!=t.meridiemHour?t.meridiemHour(e,r):null!=t.isPM?((n=t.isPM(r))&&e<12&&(e+=12),n||12!==e||(e=0),e):e}function Fr(t){var e,r,n,i,s;if(0===t._f.length)return m(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;ithis?this:t:y()}));function Zr(t,e){var r,n;if(1===e.length&&s(e[0])&&(e=e[0]),!e.length)return zr();for(r=e[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function wn(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t={};if(w(t,this),(t=qr(t))._a){var e=t._isUTC?p(t._a):zr(t._a);this._isDSTShifted=this.isValid()&&P(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function _n(){return!!this.isValid()&&!this._isUTC}function Sn(){return!!this.isValid()&&this._isUTC}function On(){return!!this.isValid()&&this._isUTC&&0===this._offset}n.updateOffset=function(){};var En=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,In=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Pn(t,e){var r,n,i,s=t,o=null;return on(t)?s={ms:t._milliseconds,d:t._days,M:t._months}:f(t)?(s={},e?s[e]=t:s.milliseconds=t):(o=En.exec(t))?(r="-"===o[1]?-1:1,s={y:0,d:I(o[Ht])*r,h:I(o[jt])*r,m:I(o[Ft])*r,s:I(o[Kt])*r,ms:I(an(1e3*o[Vt]))*r}):(o=In.exec(t))?(r="-"===o[1]?-1:1,s={y:Mn(o[2],r),M:Mn(o[3],r),w:Mn(o[4],r),d:Mn(o[5],r),h:Mn(o[6],r),m:Mn(o[7],r),s:Mn(o[8],r)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(i=kn(zr(s.from),zr(s.to)),(s={}).ms=i.milliseconds,s.M=i.months),n=new sn(s),on(t)&&d(t,"_locale")&&(n._locale=t._locale),n}function Mn(t,e){var r=t&&parseFloat(t.replace(",","."));return(isNaN(r)?0:r)*e}function An(t,e){var r={};return r.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(r.months,"M").isAfter(e)&&--r.months,r.milliseconds=+e-+t.clone().add(r.months,"M"),r}function kn(t,e){var r;return t.isValid()&&e.isValid()?(e=cn(e,t),t.isBefore(e)?r=An(t,e):((r=An(e,t)).milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function xn(t,e){return function(r,n){var i;return null===n||isNaN(+n)||(R(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),Rn(this,Pn(r="string"==typeof r?+r:r,n),t),this}}function Rn(t,e,r,i){var s=e._milliseconds,o=an(e._days),a=an(e._months);t.isValid()&&(i=null==i||i,a&&ce(t,Qt(t,"Month")+a*r),o&&$t(t,"Date",Qt(t,"Date")+o*r),s&&t._d.setTime(t._d.valueOf()+s*r),i&&n.updateOffset(t,o||a))}Pn.fn=sn.prototype,Pn.invalid=nn;var Tn=xn(1,"add"),Bn=xn(-1,"subtract");function Nn(t,e){var r=t.diff(e,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"}function Cn(t,e){var r=t||zr(),i=cn(r,this).startOf("day"),s=n.calendarFormat(this,i)||"sameElse",o=e&&(T(e[s])?e[s].call(this,r):e[s]);return this.format(o||this.localeData().calendar(s,this,zr(r)))}function Ln(){return new S(this)}function Un(t,e){var r=O(t)?t:zr(t);return!(!this.isValid()||!r.isValid())&&("millisecond"===(e=Z(e)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()9999?ft(r,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):T(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+6e4*this.utcOffset()).toISOString().replace("Z",ft(r,"Z")):ft(r,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function zn(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var r="["+t+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",s=e+'[")]';return this.format(r+n+i+s)}function Wn(t){t||(t=this.isUtc()?n.defaultFormatUtc:n.defaultFormat);var e=ft(this,t);return this.localeData().postformat(e)}function Jn(t,e){return this.isValid()&&(O(t)&&t.isValid()||zr(t).isValid())?Pn({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Zn(t){return this.from(zr(),t)}function Xn(t,e){return this.isValid()&&(O(t)&&t.isValid()||zr(t).isValid())?Pn({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Qn(t){return this.to(zr(),t)}function $n(t){var e;return void 0===t?this._locale._abbr:(null!=(e=mr(t))&&(this._locale=e),this)}n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",n.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ti=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(t){return void 0===t?this.localeData():this.locale(t)}));function ei(){return this._locale}var ri=1e3,ni=60*ri,ii=60*ni,si=3506328*ii;function oi(t,e){return(t%e+e)%e}function ai(t,e,r){return t<100&&t>=0?new Date(t+400,e,r)-si:new Date(t,e,r).valueOf()}function ui(t,e,r){return t<100&&t>=0?Date.UTC(t+400,e,r)-si:Date.UTC(t,e,r)}function fi(t){var e;if(void 0===(t=Z(t))||"millisecond"===t||!this.isValid())return this;var r=this._isUTC?ui:ai;switch(t){case"year":e=r(this.year(),0,1);break;case"quarter":e=r(this.year(),this.month()-this.month()%3,1);break;case"month":e=r(this.year(),this.month(),1);break;case"week":e=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=r(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=oi(e+(this._isUTC?0:this.utcOffset()*ni),ii);break;case"minute":e=this._d.valueOf(),e-=oi(e,ni);break;case"second":e=this._d.valueOf(),e-=oi(e,ri)}return this._d.setTime(e),n.updateOffset(this,!0),this}function hi(t){var e;if(void 0===(t=Z(t))||"millisecond"===t||!this.isValid())return this;var r=this._isUTC?ui:ai;switch(t){case"year":e=r(this.year()+1,0,1)-1;break;case"quarter":e=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=r(this.year(),this.month()+1,1)-1;break;case"week":e=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=ii-oi(e+(this._isUTC?0:this.utcOffset()*ni),ii)-1;break;case"minute":e=this._d.valueOf(),e+=ni-oi(e,ni)-1;break;case"second":e=this._d.valueOf(),e+=ri-oi(e,ri)-1}return this._d.setTime(e),n.updateOffset(this,!0),this}function ci(){return this._d.valueOf()-6e4*(this._offset||0)}function di(){return Math.floor(this.valueOf()/1e3)}function li(){return new Date(this.valueOf())}function pi(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function bi(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function mi(){return this.isValid()?this.toISOString():null}function gi(){return g(this)}function yi(){return l({},m(this))}function vi(){return m(this).overflow}function wi(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function _i(t,e){ot(0,[t,t.length],0,e)}function Si(t){return Pi.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Oi(t){return Pi.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Ei(){return Ee(this.year(),1,4)}function Ii(){var t=this.localeData()._week;return Ee(this.year(),t.dow,t.doy)}function Pi(t,e,r,n,i){var s;return null==t?Oe(this,n,i).year:(e>(s=Ee(t,n,i))&&(e=s),Mi.call(this,t,e,r,n,i))}function Mi(t,e,r,n,i){var s=Se(t,e,r,n,i),o=we(s.year,0,s.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function Ai(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}ot(0,["gg",2],0,(function(){return this.weekYear()%100})),ot(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),_i("gggg","weekYear"),_i("ggggg","weekYear"),_i("GGGG","isoWeekYear"),_i("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),$("weekYear",1),$("isoWeekYear",1),kt("G",Ot),kt("g",Ot),kt("GG",mt,dt),kt("gg",mt,dt),kt("GGGG",wt,pt),kt("gggg",wt,pt),kt("GGGGG",_t,bt),kt("ggggg",_t,bt),Ct(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,r,n){e[n.substr(0,2)]=I(t)})),Ct(["gg","GG"],(function(t,e,r,i){e[i]=n.parseTwoDigitYear(t)})),ot("Q",0,"Qo","quarter"),J("quarter","Q"),$("quarter",7),kt("Q",ct),Nt("Q",(function(t,e){e[Dt]=3*(I(t)-1)})),ot("D",["DD",2],"Do","date"),J("date","D"),$("date",9),kt("D",mt),kt("DD",mt,dt),kt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),Nt(["D","DD"],Ht),Nt("Do",(function(t,e){e[Ht]=I(t.match(mt)[0])}));var ki=Xt("Date",!0);function xi(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}ot("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),$("dayOfYear",4),kt("DDD",vt),kt("DDDD",lt),Nt(["DDD","DDDD"],(function(t,e,r){r._dayOfYear=I(t)})),ot("m",["mm",2],0,"minute"),J("minute","m"),$("minute",14),kt("m",mt),kt("mm",mt,dt),Nt(["m","mm"],Ft);var Ri=Xt("Minutes",!1);ot("s",["ss",2],0,"second"),J("second","s"),$("second",15),kt("s",mt),kt("ss",mt,dt),Nt(["s","ss"],Kt);var Ti,Bi=Xt("Seconds",!1);for(ot("S",0,0,(function(){return~~(this.millisecond()/100)})),ot(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),ot(0,["SSS",3],0,"millisecond"),ot(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),ot(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),ot(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),ot(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),ot(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),ot(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),J("millisecond","ms"),$("millisecond",16),kt("S",vt,ct),kt("SS",vt,dt),kt("SSS",vt,lt),Ti="SSSS";Ti.length<=9;Ti+="S")kt(Ti,St);function Ni(t,e){e[Vt]=I(1e3*("0."+t))}for(Ti="S";Ti.length<=9;Ti+="S")Nt(Ti,Ni);var Ci=Xt("Milliseconds",!1);function Li(){return this._isUTC?"UTC":""}function Ui(){return this._isUTC?"Coordinated Universal Time":""}ot("z",0,0,"zoneAbbr"),ot("zz",0,0,"zoneName");var Di=S.prototype;function Hi(t){return zr(1e3*t)}function ji(){return zr.apply(null,arguments).parseZone()}function Fi(t){return t}Di.add=Tn,Di.calendar=Cn,Di.clone=Ln,Di.diff=Vn,Di.endOf=hi,Di.format=Wn,Di.from=Jn,Di.fromNow=Zn,Di.to=Xn,Di.toNow=Qn,Di.get=te,Di.invalidAt=vi,Di.isAfter=Un,Di.isBefore=Dn,Di.isBetween=Hn,Di.isSame=jn,Di.isSameOrAfter=Fn,Di.isSameOrBefore=Kn,Di.isValid=gi,Di.lang=ti,Di.locale=$n,Di.localeData=ei,Di.max=Jr,Di.min=Wr,Di.parsingFlags=yi,Di.set=ee,Di.startOf=fi,Di.subtract=Bn,Di.toArray=pi,Di.toObject=bi,Di.toDate=li,Di.toISOString=Yn,Di.inspect=zn,Di.toJSON=mi,Di.toString=Gn,Di.unix=di,Di.valueOf=ci,Di.creationData=wi,Di.year=Jt,Di.isLeapYear=Zt,Di.weekYear=Si,Di.isoWeekYear=Oi,Di.quarter=Di.quarters=Ai,Di.month=de,Di.daysInMonth=le,Di.week=Di.weeks=ke,Di.isoWeek=Di.isoWeeks=xe,Di.weeksInYear=Ii,Di.isoWeeksInYear=Ei,Di.date=ki,Di.day=Di.days=Ke,Di.weekday=Ve,Di.isoWeekday=qe,Di.dayOfYear=xi,Di.hour=Di.hours=or,Di.minute=Di.minutes=Ri,Di.second=Di.seconds=Bi,Di.millisecond=Di.milliseconds=Ci,Di.utcOffset=ln,Di.utc=bn,Di.local=mn,Di.parseZone=gn,Di.hasAlignedHourOffset=yn,Di.isDST=vn,Di.isLocal=_n,Di.isUtcOffset=Sn,Di.isUtc=On,Di.isUTC=On,Di.zoneAbbr=Li,Di.zoneName=Ui,Di.dates=A("dates accessor is deprecated. Use date instead.",ki),Di.months=A("months accessor is deprecated. Use month instead",de),Di.years=A("years accessor is deprecated. Use year instead",Jt),Di.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",pn),Di.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",wn);var Ki=C.prototype;function Vi(t,e,r,n){var i=mr(),s=p().set(n,e);return i[r](s,t)}function qi(t,e,r){if(f(t)&&(e=t,t=void 0),t=t||"",null!=e)return Vi(t,e,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=Vi(t,n,r,"month");return i}function Gi(t,e,r,n){"boolean"==typeof t?(f(e)&&(r=e,e=void 0),e=e||""):(r=e=t,t=!1,f(e)&&(r=e,e=void 0),e=e||"");var i,s=mr(),o=t?s._week.dow:0;if(null!=r)return Vi(e,(r+o)%7,n,"day");var a=[];for(i=0;i<7;i++)a[i]=Vi(e,(i+o)%7,n,"day");return a}function Yi(t,e){return qi(t,e,"months")}function zi(t,e){return qi(t,e,"monthsShort")}function Wi(t,e,r){return Gi(t,e,r,"weekdays")}function Ji(t,e,r){return Gi(t,e,r,"weekdaysShort")}function Zi(t,e,r){return Gi(t,e,r,"weekdaysMin")}Ki.calendar=U,Ki.longDateFormat=H,Ki.invalidDate=F,Ki.ordinal=q,Ki.preparse=Fi,Ki.postformat=Fi,Ki.relativeTime=Y,Ki.pastFuture=z,Ki.set=B,Ki.months=oe,Ki.monthsShort=ue,Ki.monthsParse=he,Ki.monthsRegex=ge,Ki.monthsShortRegex=be,Ki.week=Ie,Ki.firstDayOfYear=Ae,Ki.firstDayOfWeek=Me,Ki.weekdays=Ce,Ki.weekdaysMin=He,Ki.weekdaysShort=Ue,Ki.weekdaysParse=Fe,Ki.weekdaysRegex=Ye,Ki.weekdaysShortRegex=We,Ki.weekdaysMinRegex=Ze,Ki.isPM=rr,Ki.meridiem=ir,lr("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===I(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),n.lang=A("moment.lang is deprecated. Use moment.locale instead.",lr),n.langData=A("moment.langData is deprecated. Use moment.localeData instead.",mr);var Xi=Math.abs;function Qi(){var t=this._data;return this._milliseconds=Xi(this._milliseconds),this._days=Xi(this._days),this._months=Xi(this._months),t.milliseconds=Xi(t.milliseconds),t.seconds=Xi(t.seconds),t.minutes=Xi(t.minutes),t.hours=Xi(t.hours),t.months=Xi(t.months),t.years=Xi(t.years),this}function $i(t,e,r,n){var i=Pn(e,r);return t._milliseconds+=n*i._milliseconds,t._days+=n*i._days,t._months+=n*i._months,t._bubble()}function ts(t,e){return $i(this,t,e,1)}function es(t,e){return $i(this,t,e,-1)}function rs(t){return t<0?Math.floor(t):Math.ceil(t)}function ns(){var t,e,r,n,i,s=this._milliseconds,o=this._days,a=this._months,u=this._data;return s>=0&&o>=0&&a>=0||s<=0&&o<=0&&a<=0||(s+=864e5*rs(ss(a)+o),o=0,a=0),u.milliseconds=s%1e3,t=E(s/1e3),u.seconds=t%60,e=E(t/60),u.minutes=e%60,r=E(e/60),u.hours=r%24,o+=E(r/24),a+=i=E(is(o)),o-=rs(ss(i)),n=E(a/12),a%=12,u.days=o,u.months=a,u.years=n,this}function is(t){return 4800*t/146097}function ss(t){return 146097*t/4800}function os(t){if(!this.isValid())return NaN;var e,r,n=this._milliseconds;if("month"===(t=Z(t))||"quarter"===t||"year"===t)switch(e=this._days+n/864e5,r=this._months+is(e),t){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(e=this._days+Math.round(ss(this._months)),t){case"week":return e/7+n/6048e5;case"day":return e+n/864e5;case"hour":return 24*e+n/36e5;case"minute":return 1440*e+n/6e4;case"second":return 86400*e+n/1e3;case"millisecond":return Math.floor(864e5*e)+n;default:throw new Error("Unknown unit "+t)}}function as(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*I(this._months/12):NaN}function us(t){return function(){return this.as(t)}}var fs=us("ms"),hs=us("s"),cs=us("m"),ds=us("h"),ls=us("d"),ps=us("w"),bs=us("M"),ms=us("Q"),gs=us("y");function ys(){return Pn(this)}function vs(t){return t=Z(t),this.isValid()?this[t+"s"]():NaN}function ws(t){return function(){return this.isValid()?this._data[t]:NaN}}var _s=ws("milliseconds"),Ss=ws("seconds"),Os=ws("minutes"),Es=ws("hours"),Is=ws("days"),Ps=ws("months"),Ms=ws("years");function As(){return E(this.days()/7)}var ks=Math.round,xs={ss:44,s:45,m:45,h:22,d:26,M:11};function Rs(t,e,r,n,i){return i.relativeTime(e||1,!!r,t,n)}function Ts(t,e,r){var n=Pn(t).abs(),i=ks(n.as("s")),s=ks(n.as("m")),o=ks(n.as("h")),a=ks(n.as("d")),u=ks(n.as("M")),f=ks(n.as("y")),h=i<=xs.ss&&["s",i]||i0,h[4]=r,Rs.apply(null,h)}function Bs(t){return void 0===t?ks:"function"==typeof t&&(ks=t,!0)}function Ns(t,e){return void 0!==xs[t]&&(void 0===e?xs[t]:(xs[t]=e,"s"===t&&(xs.ss=e-1),!0))}function Cs(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),r=Ts(this,!t,e);return t&&(r=e.pastFuture(+this,r)),e.postformat(r)}var Ls=Math.abs;function Us(t){return(t>0)-(t<0)||+t}function Ds(){if(!this.isValid())return this.localeData().invalidDate();var t,e,r=Ls(this._milliseconds)/1e3,n=Ls(this._days),i=Ls(this._months);t=E(r/60),e=E(t/60),r%=60,t%=60;var s=E(i/12),o=i%=12,a=n,u=e,f=t,h=r?r.toFixed(3).replace(/\.?0+$/,""):"",c=this.asSeconds();if(!c)return"P0D";var d=c<0?"-":"",l=Us(this._months)!==Us(c)?"-":"",p=Us(this._days)!==Us(c)?"-":"",b=Us(this._milliseconds)!==Us(c)?"-":"";return d+"P"+(s?l+s+"Y":"")+(o?l+o+"M":"")+(a?p+a+"D":"")+(u||f||h?"T":"")+(u?b+u+"H":"")+(f?b+f+"M":"")+(h?b+h+"S":"")}var Hs=sn.prototype;return Hs.isValid=rn,Hs.abs=Qi,Hs.add=ts,Hs.subtract=es,Hs.as=os,Hs.asMilliseconds=fs,Hs.asSeconds=hs,Hs.asMinutes=cs,Hs.asHours=ds,Hs.asDays=ls,Hs.asWeeks=ps,Hs.asMonths=bs,Hs.asQuarters=ms,Hs.asYears=gs,Hs.valueOf=as,Hs._bubble=ns,Hs.clone=ys,Hs.get=vs,Hs.milliseconds=_s,Hs.seconds=Ss,Hs.minutes=Os,Hs.hours=Es,Hs.days=Is,Hs.weeks=As,Hs.months=Ps,Hs.years=Ms,Hs.humanize=Cs,Hs.toISOString=Ds,Hs.toString=Ds,Hs.toJSON=Ds,Hs.locale=$n,Hs.localeData=ei,Hs.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ds),Hs.lang=ti,ot("X",0,0,"unix"),ot("x",0,0,"valueOf"),kt("x",Ot),kt("X",Pt),Nt("X",(function(t,e,r){r._d=new Date(1e3*parseFloat(t,10))})),Nt("x",(function(t,e,r){r._d=new Date(I(t))})),n.version="2.24.0",i(zr),n.fn=Di,n.min=Xr,n.max=Qr,n.now=$r,n.utc=p,n.unix=Hi,n.months=Yi,n.isDate=h,n.locale=lr,n.invalid=y,n.duration=Pn,n.isMoment=O,n.weekdays=Wi,n.parseZone=ji,n.localeData=mr,n.isDuration=on,n.monthsShort=zi,n.weekdaysMin=Zi,n.defineLocale=pr,n.updateLocale=br,n.locales=gr,n.weekdaysShort=Ji,n.normalizeUnits=Z,n.relativeTimeRounding=Bs,n.relativeTimeThreshold=Ns,n.calendarFormat=Nn,n.prototype=Di,n.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},n}()}));var o=s("bfD9J"),a=s("kVFKx"),u=(o=s("bfD9J"),s("7xhmU")),f=(o=s("bfD9J"),s("eBt9c"));const h=(t,e)=>{if(!t)throw new Error(`cannot get cell value of: ${t}`);return"string"===e?t.s?t.s:t.ls||"":"hex"===e?t.h?t.h:t.lh||(t.b?o.Buffer.from(t.b,"base64").toString("hex"):t.lb&&o.Buffer.from(t.lb,"base64").toString("hex"))||"":"number"===e?parseInt(t.h?t.h:t.lh||"0",16):"file"===e?`bitfs://${t.f?t.f:t.lf}`:(t.b?t.b:t.lb)||""},c=function(t){return t.cell[0]&&t.cell[1]&&0===t.cell[0].op&&t.cell[1].op&&106===t.cell[1].op||106===t.cell[0].op},d=(t,e,r)=>{if(t[e]){if(!Array.isArray(t[e])){const r=t[e];t[e]=[],t[e][0]=r}t[e][t[e].length]=r}else t[e]=[r]},l=function(t,e,r,n,i){const s={},o=e.length+1;if(n.length{const e=await(f.webcrypto||window.crypto).subtle.digest("SHA-256",t);return o.Buffer.from(e)},b="15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva",m=[{algorithm:"string"},{address:"string"},{signature:"binary"},[{index:"binary"}]],g=async function(t){let e=o.Buffer.from("");try{const n=await r(u)(`https://x.bitfs.network/${t}`,{});e=await n.buffer()}catch(t){console.error(t)}return e};let y;var v;(v=y||(y={})).HAIP="HAIP",v.AIP="AIP",v.BITCOM_HASHED="BITCOM_HASHED",v.PSP="PSP";const w=async function(t,e,r,n,i,s){const u={};if(n.length<4)throw new Error("AIP requires at least 4 fields including the prefix "+s);for(const[e,r]of Object.entries(t)){const t=parseInt(e,10);let i,s;if(r instanceof Array){i=r[0].index,[s]=Object.keys(r[0]);const e=[];for(let r=t+1;r{t.cell===e&&(n=r)})),-1===n)throw new Error("AIP could not find cell in tape");let i=t.index||[];const s=["6a"];for(let t=0;t0?i.forEach((t=>{u.push(o.Buffer.from(s[t],"hex"))})):s.forEach((t=>{u.push(o.Buffer.from(t,"hex"))})),t.hashing_algorithm){t.index_unit_size||u.shift();const e=a.Script.fromSafeDataArray(u);let r=o.Buffer.from(e.toHex(),"hex");t.index_unit_size&&(r=r.slice(1)),f=await p(o.Buffer.from(r.toString("hex")))}else f=o.Buffer.concat([...u]);const h=t.address||t.signing_address;try{t.verified=a.Bsm.verify(f,t.signature||"",a.Address.fromString(h))}catch(e){t.verified=!1}if(!t.verified){f=o.Buffer.concat([...u.slice(1,u.length-1)]);const e=await p(f);f=o.Buffer.from(e.toString("hex"));try{t.verified=a.Bsm.verify(f,t.signature||"",a.Address.fromString(h))}catch(e){t.verified=!1}}return t.verified||!1}(u,n,i),d(r,e,u)},_={name:"AIP",address:b,opReturnSchema:m,handler:async({dataObj:t,cell:e,tape:r,tx:n})=>{if(!r)throw new Error("Invalid AIP transaction. tape is required");if(!n)throw new Error("Invalid AIP transaction. tx is required");return await w(m,"AIP",t,e,r,n)}},S=[{content:["string","binary","file"]},{"content-type":"string"},{encoding:"string"},{filename:"string"}],O={name:"B",address:"19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut",opReturnSchema:S,handler:function({dataObj:t,cell:e,tx:r}){const n=new Map;if(n.set("utf8","string"),n.set("text","string"),n.set("gzip","binary"),n.set("text/plain","string"),n.set("image/png","binary"),n.set("image/jpeg","binary"),!e[1]||!e[2])throw new Error(`Invalid B tx: ${r}`);if(e.length>S.length+1)throw new Error("Invalid B tx. Too many fields.");const i={};for(const[t,r]of Object.entries(S)){const s=parseInt(t,10),o=Object.keys(r)[0];let a=Object.values(r)[0];if("content"===o)if(e[1].f)a="file";else if(e[3]&&e[3].s||!e[2].s)a=e[3]&&e[3].s?n.get(e[3].s.replace("-","").toLowerCase()):null;else{if(a=n.get(e[2].s),!a)return void console.warn("Problem inferring encoding. Malformed B data.",e);e[3]||(e[3]={h:"",b:"",s:"",i:0,ii:0}),e[3].s="string"===a?"utf-8":"binary"}if("encoding"===o&&!e[s+1])continue;if("filename"===o&&!e[s+1])continue;if(!e||!e[s+1])throw new Error("malformed B syntax "+e);const u=e[s+1];i[o]=h(u,a)}d(t,"B",i)}},E=[{type:"string"},{hash:"string"},{sequence:"string"}],I={name:"BAP",address:"1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT",opReturnSchema:E,handler:({dataObj:t,cell:e,tx:r})=>{if(!r)throw new Error("Invalid BAP tx, tx required");l("BAP",E,t,e,r)}},P={name:"BITCOM",address:"$",opReturnSchema:[{su:[{pubkey:"string"},{sign_position:"string"},{signature:"string"}],echo:[{data:"string"},{to:"string"},{filename:"string"}],route:[[{add:[{bitcom_address:"string"},{route_matcher:"string"},{endpoint_template:"string"}]},{enable:[{path:"string"}]}]],useradd:[{address:"string"}]}],handler:({dataObj:t,cell:e})=>{if(!e.length||!e.every((t=>t.s)))throw new Error("Invalid Bitcom tx");const r=e.map((t=>t&&t.s?t.s:""));d(t,"BITCOM",r)}};a=s("kVFKx"),o=s("bfD9J"),a=s("kVFKx");var M=(o=s("bfD9J")).Buffer;const A=(t,e,r)=>{const n=e.join(", ").trim(),i=[t.trim()+n+(r.toString()||"")].join("").trim();let s=a.Hash.sha256Sha256(M.from(i));return s=s.reverse(),s.toString("hex").substring(0,12)};var k={};const{AbortController:x,AbortSignal:R}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;(k=x).AbortSignal=R,k.default=x;var T={};T=function(){"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map((function(t){t(r)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,r)}))}}}var a="expiry",u="add",f="get",h="remove",c="clear",d=function(t){if(t)throw new Error("Cannot use disposed instance.")},l={expiryCheckInterval:100},p=function(){function t(){var n=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,t),s(this,"expire",(function(){d(n.disposed);for(var t=Date.now(),e=t;e>=n.lastExpiredTime;e-=1){var r=n.queue[e];r&&(delete n.queue[e],r.forEach((function(t){var e=t.key;return(0,t.onExpire)(e)})))}n.lastExpiredTime=t})),this.config=e(e({},l),i),this.queue={},this.disposed=!1,this.lastExpiredTime=Date.now()-1;var o=this.config.expiryCheckInterval;this.timer=setInterval(this.expire,o)}return i(t,[{key:"add",value:function(t,e,r){return d(this.disposed),this.queue[t]||(this.queue[t]=[]),this.queue[t].push({key:e,onExpire:r}),!0}},{key:"remove",value:function(t,e){d(this.disposed);var r=this.queue[t];if(r){var n=r.filter((function(t){return t.key!==e}));return n.length?this.queue[t]=n:delete this.queue[t],!0}return!1}},{key:"dispose",value:function(){return d(this.disposed),clearInterval(this.timer),this.timer=null,this.queue={},this.disposed=!0,!0}}]),t}(),b={defaultCacheExpiryIn:6e4,expiryCheckInterval:100};return function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;r(this,t),this.config=e(e({},b),n);var s=o(),a=[s.on,s.off,s.emit];this.on=a[0],this.off=a[1],this.emit=a[2],this.cacheStore={},this.disposed=!1;var u=this.config.expiryCheckInterval;this.cacheExpirer=new i({expiryCheckInterval:u})}return i(t,[{key:"put",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.config.defaultCacheExpiryIn;d(this.disposed),this.cacheStore[e]&&this.remove(e);var i=Date.now(),s=n?i+n:null,o={value:r,addedAt:i,expiryAt:s};if(this.cacheStore[e]=o,s){var f=function(){t.remove(e),t.emit(a,{key:e,data:t.cacheStore[e]})};this.cacheExpirer.add(s,e,f)}return this.emit(u,{key:e,data:o}),o}},{key:"get",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";d(this.disposed);var e=this.cacheStore[t];return e?(this.emit(f,{key:t,data:e}),e):null}},{key:"remove",value:function(t){d(this.disposed);var e=this.cacheStore[t];if(e){delete this.cacheStore[t];var r=e.expiryAt;return this.cacheExpirer.remove(r,t),this.emit(h,{key:t,data:e}),!0}return!1}},{key:"dispose",value:function(){var t=this;return d(this.disposed),Object.keys(this.cacheStore).forEach((function(e){return t.remove(e)})),this.emit(c,{}),this.cacheExpirer.dispose(),this.disposed=!0,!0}}]),t}()}();var B,N=s("2bId1"),C="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==C&&C,L="URLSearchParams"in C,U="Symbol"in C&&"iterator"in Symbol,D="FileReader"in C&&"Blob"in C&&function(){try{return new Blob,!0}catch(t){return!1}}(),H="FormData"in C,j="ArrayBuffer"in C;if(j)var F=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],K=ArrayBuffer.isView||function(t){return t&&F.indexOf(Object.prototype.toString.call(t))>-1};function V(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function q(t){return"string"!=typeof t&&(t=String(t)),t}function G(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return U&&(e[Symbol.iterator]=function(){return e}),e}function Y(t){this.map={},t instanceof Y?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function z(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function W(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function J(t){var e=new FileReader,r=W(e);return e.readAsArrayBuffer(t),r}function Z(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function X(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:D&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:H&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:L&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():j&&D&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=Z(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):j&&(ArrayBuffer.prototype.isPrototypeOf(t)||K(t))?this._bodyArrayBuffer=Z(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):L&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},D&&(this.blob=function(){var t=z(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=z(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(J)}),this.text=function(){var t,e,r,n=z(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=W(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function tt(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function et(t,e){if(!(this instanceof et))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new Y(e.headers),this.url=e.url||"",this._initBody(t)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})},X.call($.prototype),X.call(et.prototype),et.prototype.clone=function(){return new et(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Y(this.headers),url:this.url})},et.error=function(){var t=new et(null,{status:0,statusText:""});return t.type="error",t};var rt=[301,302,303,307,308];et.redirect=function(t,e){if(-1===rt.indexOf(e))throw new RangeError("Invalid status code");return new et(null,{status:e,headers:{location:t}})};var nt=C.DOMException;try{new nt}catch(t){(nt=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),nt.prototype.constructor=nt}function it(t,e){return new Promise((function(r,n){var i=new $(t,e);if(i.signal&&i.signal.aborted)return n(new nt("Aborted","AbortError"));var s=new XMLHttpRequest;function o(){s.abort()}s.onload=function(){var t,e,n={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new Y,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;setTimeout((function(){r(new et(i,n))}),0)},s.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){n(new nt("Aborted","AbortError"))}),0)},s.open(i.method,function(t){try{return""===t&&C.location.href?C.location.href:t}catch(e){return t}}(i.url),!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&(D?s.responseType="blob":j&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof Y?i.headers.forEach((function(t,e){s.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){s.setRequestHeader(t,q(e.headers[t]))})),i.signal&&(i.signal.addEventListener("abort",o),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",o)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}it.polyfill=!0,C.fetch||(C.fetch=it,C.Headers=Y,C.Request=$,C.Response=et),B=self.fetch.bind(self);var st={};t(st,"default",(()=>ct),(t=>ct=t)),t(st,"getStatusCode",(()=>ut),(t=>ut=t)),t(st,"getReasonPhrase",(()=>$82b77d4d6b6c730f$re_export$getReasonPhrase),(t=>$82b77d4d6b6c730f$re_export$getReasonPhrase=t)),t(st,"getStatusText",(()=>ft),(t=>ft=t)),t(st,"StatusCodes",(()=>$82b77d4d6b6c730f$re_export$StatusCodes),(t=>$82b77d4d6b6c730f$re_export$StatusCodes=t)),t(st,"ReasonPhrases",(()=>$82b77d4d6b6c730f$re_export$ReasonPhrases),(t=>$82b77d4d6b6c730f$re_export$ReasonPhrases=t));var ot={202:"Accepted",502:"Bad Gateway",400:"Bad Request",409:"Conflict",100:"Continue",201:"Created",417:"Expectation Failed",424:"Failed Dependency",403:"Forbidden",504:"Gateway Timeout",410:"Gone",505:"HTTP Version Not Supported",418:"I'm a teapot",419:"Insufficient Space on Resource",507:"Insufficient Storage",500:"Internal Server Error",411:"Length Required",423:"Locked",420:"Method Failure",405:"Method Not Allowed",301:"Moved Permanently",302:"Moved Temporarily",207:"Multi-Status",300:"Multiple Choices",511:"Network Authentication Required",204:"No Content",203:"Non Authoritative Information",406:"Not Acceptable",404:"Not Found",501:"Not Implemented",304:"Not Modified",200:"OK",206:"Partial Content",402:"Payment Required",308:"Permanent Redirect",412:"Precondition Failed",428:"Precondition Required",102:"Processing",407:"Proxy Authentication Required",431:"Request Header Fields Too Large",408:"Request Timeout",413:"Request Entity Too Large",414:"Request-URI Too Long",416:"Requested Range Not Satisfiable",205:"Reset Content",303:"See Other",503:"Service Unavailable",101:"Switching Protocols",307:"Temporary Redirect",429:"Too Many Requests",401:"Unauthorized",451:"Unavailable For Legal Reasons",422:"Unprocessable Entity",415:"Unsupported Media Type",305:"Use Proxy",421:"Misdirected Request"},at={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421};function ut(t){var e=at[t];if(!e)throw new Error("Reason phrase does not exist: "+t);return e}var ft=function(t){var e=ot[t.toString()];if(!e)throw new Error("Status code does not exist: "+t);return e},ht=function(){return ht=Object.assign||function(t){for(var e,r=1,n=arguments.length;r{this.dns.resolveSrv(`_bsvalias._tcp.${t}`,(async(n,i)=>{try{if(n&&("ENODATA"===n.code||"ENOTFOUND"===n.code))return e({domain:t,port:443,isSecure:!0});if(n)return r(n);const{name:s,port:o,isSecure:a}=i[0];e({domain:s,port:o,isSecure:this.checkDomainIsSecure(s,t)||a})}catch(t){return r(t)}}))})).then((e=>e.isSecure?e:this.validateDnssec(t)),(t=>(console.error(t),t)))}checkDomainIsSecure(t,e){return!!this.domainsAreEqual(t,e)||(!!this.responseIsWwwSubdomain(t,e)||(this.isHandcashDomain(e)?this.domainsAreEqual("handcash-paymail-production.herokuapp.com",t)||this.domainsAreEqual("handcash-cloud-production.herokuapp.com",t):this.isHandcashInternalDomain(e)?this.domainsAreEqual("handcash-cloud-staging.herokuapp.com",t):!!this.domainsAreEqual("localhost",t)||!!this.isMoneyButtonDomain(t)))}isMoneyButtonDomain(t){return this.domainsAreEqual(t,"moneybutton.com")||this.domainsAreEqual(t,"www.moneybutton.com")}responseIsWwwSubdomain(t,e){return this.domainsAreEqual(t,`www.${e}`)}isHandcashDomain(t){return this.domainsAreEqual("handcash.io",t)}isHandcashInternalDomain(t){return this.domainsAreEqual("internal.handcash.io",t)}async validateDnssec(t){const e=await this.doh.queryBsvaliasDomain(t);if(0!==e.Status||!e.Answer)throw new pt(`${t} is not correctly configured: insecure domain`);const r=e.Answer[0].data.split(" "),n=r[2],i=r[3];if(!e.AD&&!this.domainsAreEqual(t,i))throw new pt(`${t} is not correctly configured: insecure domain`);return{port:n,domain:i,isSecure:e.AD}}domainsAreEqual(t,e){return t.replace(/\.$/,"")===e.replace(/\.$/,"")}}class mt{constructor(t,e){this.fetch=t,this.config=e}async resolveSrv(t){const e=await this.fetch(`${this.config.baseUrl}?name=${t}&type=SRV&cd=0`);return await e.json()}async queryBsvaliasDomain(t){return this.resolveSrv(`_bsvalias._tcp.${t}`)}}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function yt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class vt{constructor(t){this.fetch=t}async get(t){return this._basicRequest(t)}async postJson(t,e){return this._basicRequest(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async _basicRequest(t,e={}){var n=new(r(k));const i=setTimeout((()=>n.abort()),3e4);return this.fetch(t,function(t){for(var e=1;e(clearTimeout(i),t)))}}class wt{constructor(t=null,e,n=0){this.dnsClient=new bt(t,new mt(e,{baseUrl:"https://dns.google.com/resolve"})),this.http=new vt(e),this.defaultCacheTTL=n,n&&(this.cache=new(r(T))({expiryCheckInterval:1e4}),this.cache.cacheExpirer.timer.unref&&this.cache.cacheExpirer.timer.unref())}static create(t,e){const r=new wt(null,e);return r.dnsClient=t,r}async getIdentityUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.pki);return(await this.getApiDescriptionFor(r)).capabilities.pki.replace("{alias}",e).replace("{domain.tld}",r)}async getAddressUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.paymentDestination);return(await this.getApiDescriptionFor(r)).capabilities.paymentDestination.replace("{alias}",e).replace("{domain.tld}",r)}async getVerifyUrlFor(t,e){const[r,n]=t.split("@");await this.ensureCapabilityFor(n,lt.verifyPublicKeyOwner);return(await this.getApiDescriptionFor(n)).capabilities[lt.verifyPublicKeyOwner].replace("{alias}",r).replace("{domain.tld}",n).replace("{pubkey}",e)}async getPublicProfileUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.publicProfile);return(await this.getApiDescriptionFor(r)).capabilities[lt.publicProfile].replace("{alias}",e).replace("{domain.tld}",r)}async getSendTxUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.receiveTransaction);return(await this.getApiDescriptionFor(r)).capabilities[lt.receiveTransaction].replace("{alias}",e).replace("{domain.tld}",r)}async getP2pPaymentDestinationUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.p2pPaymentDestination);return(await this.getApiDescriptionFor(r)).capabilities[lt.p2pPaymentDestination].replace("{alias}",e).replace("{domain.tld}",r)}async getP2pPaymentDestinationWithTokensSupportUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.p2pPaymentDestinationWithTokensSupport);return(await this.getApiDescriptionFor(r)).capabilities[lt.p2pPaymentDestinationWithTokensSupport].replace("{alias}",e).replace("{domain.tld}",r)}async getSfpBuildActionUrlFor(t){const[,e]=t.split("@");await this.ensureCapabilityFor(e,lt.sfpBuildAction);return(await this.getApiDescriptionFor(e)).capabilities[lt.sfpBuildAction]}async getSfpAuthoriseActionUrlFor(t){const[,e]=t.split("@");await this.ensureCapabilityFor(e,lt.sfpAuthoriseAction);return(await this.getApiDescriptionFor(e)).capabilities[lt.sfpAuthoriseAction]}async getAssetInformationUrlFor(t){const[e,r]=t.split("@");await this.ensureCapabilityFor(r,lt.assetInformation);return(await this.getApiDescriptionFor(r)).capabilities[lt.assetInformation].replace("{alias}",e).replace("{domain.tld}",r)}async domainHasCapability(t,e){const r=await this.getApiDescriptionFor(t);return r.capabilities&&!!r.capabilities[e]}async getApiDescriptionFor(t){let e=this.cache&&this.cache.get(t);if(e)return e.value;const{domain:r,port:n}=await this.getWellKnownBaseUrl(t);return e=await this.fetchApiDescriptor(r,n),this.cache&&this.cache.put(t,e,this.defaultCacheTTL),e}async fetchApiDescriptor(t,e){const r="localhost"===t||"localhost."===t?"http":"https",n="443"===e.toString()?"":`:${e}`,i=/^(.*?)\.?$/.exec(t)[1];if(!i)throw new Error(`Invalid domain: ${t}`);try{const t=await this.http.get(`${r}://${i}${n}/.well-known/bsvalias`);return await t.json()}catch(e){if(e.message.includes("invalid json response")||e.message.includes("Unexpected token"))throw new pt(`Paymail server at ${t} returned an invalid capabilities description`);if(e.message.includes("getaddrinfo ENOTFOUND"))throw new pt(`Couldn't find domain ${t}`);if(e.message.includes("failed"))throw new pt(`Couldn't connect to domain ${t}`);throw e}}async getWellKnownBaseUrl(t){return this.dnsClient.checkSrv(t)}async ensureCapabilityFor(t,e){if(!await this.domainHasCapability(t,e))throw new Error(`Unknown capability "${e}" for "${t}"`)}}class _t{constructor(t,e=null){null===e&&(e=s("kVFKx")),this.bsv=e,this.concatenated=dt.from(t.join(""))}static forBasicAddressResolution({senderHandle:t,amount:e,dt:r,purpose:n}){return r.toISOString&&(r=r.toISOString()),new _t([t,e||"0",r,n])}sign(t){let e=this.bsv.PrivKey.fromWif(t),r=this.bsv.KeyPair.fromPrivKey(e);return this.bsv.Bsm.sign(this.concatenated,r)}verify(t,e){return this.bsv.Bsm.verify(this.concatenated,e,this.bsv.Address.fromString(t))}}class St{constructor(t){this.clock=t}buildBodyToRequestAddress(t,e=null){const{senderHandle:r,amount:n,senderName:i,purpose:s,pubkey:o,signature:a}=t;if(!a&&null===e)throw new Error("Missing private key or signature");let u,f;if(a){if(!t.dt)throw new Error("missing datetime for given signature");u=t.dt,f=a}else u=this.clock.now(),f=_t.forBasicAddressResolution({senderHandle:r,amount:n,dt:u,purpose:s}).sign(e);return{senderHandle:r,senderName:i,purpose:s,dt:u,amount:n||null,pubkey:o,signature:f}}buildBodySendTx(t,e,r){return{hex:t,metadata:r,reference:e}}buildBodyP2pPaymentDestination(t){return{satoshis:t}}}class Ot{now(){return r(N)()}}class Et extends Error{constructor(t,e){super(t),this.paymail=e}}class It{constructor(t){this.doh=new mt(t,{baseUrl:"https://dns.google.com/resolve"})}async resolveSrv(t,e){try{const r=await this.doh.resolveSrv(t);if(0===r.Status&&r.Answer){e(null,r.Answer.map((t=>{const[e,n,i,s]=t.data.split(" ");return{priority:e,weight:n,port:i,name:s,isSecure:r.AD}})))}else 3!==r.Status&&r.Answer?e(new Error("error during dns query")):e({code:"ENODATA"})}catch(t){e(t)}}}class Pt extends Error{constructor(t,e){super(t),this.protocol=e}}class Mt extends Error{constructor(t,e){super(t),this.asset=e}}class At{constructor(t=null,e=null,n=null,i=null){let o=36e5;null===e&&(e=r(B)),null===t&&(t=new It(e),o=0),null===i&&(i=s("kVFKx")),this.bsv=i,this.resolver=new wt(t,e,o),this.http=new vt(e),this.requestBodyFactory=new St(null!==n?n:new Ot),this.VerifiableMessage=_t}async getPublicKey(t){const e=await this.resolver.getIdentityUrlFor(t),r=await this.http.get(e),{pubkey:n}=await r.json();return n}async getOutputFor(t,e,r=null){const n=await this.resolver.getAddressUrlFor(t),i=this.requestBodyFactory.buildBodyToRequestAddress(e,r),s=await this.http.postJson(n,i);if(s.status===st.default.NOT_FOUND)throw new Et(`Paymail not found: ${t}`,t);if(!s.ok)throw new Error(`Server failed with: ${await s.text()}`);const{output:o}=await s.json();return o}async verifyPubkeyOwner(t,e){const r=await this.resolver.getVerifyUrlFor(e,t),n=await this.http.get(r),i=await n.json(),{match:s}=i;return s}async isValidSignature(t,e,r=null,n=null){if(null==r&&null===n)throw new Error("Must specify either paymail or pubkey");let i;if(r)if(n&&await this.resolver.domainHasCapability(r.split("@")[1],lt.verifyPublicKeyOwner)){if(!await this.verifyPubkeyOwner(n,r))return!1;i=this.bsv.PubKey.fromString(n)}else{if(!await this.resolver.domainHasCapability(r.split("@")[1],lt.pki))return!1;{const t=await this.getPublicKey(r);i=this.bsv.PubKey.fromString(t)}}const s=this.bsv.Address.fromPubKey(i||n);try{return t.verify(s.toString(),e)}catch(t){return!1}}async getPublicProfile(t){let e=await this.resolver.getPublicProfileUrlFor(t);const r=await this.http.get(e);if(!r.ok){const t=await r.json();throw new Error(`Server failed with: ${JSON.stringify(t)}`)}const{avatar:n,name:i}=await r.json();return{avatar:n,name:i}}async sendRawTx(t,e,r,n={}){if(!e)throw new Error("transaction hex cannot be empty");let i=await this.resolver.getSendTxUrlFor(t);const s=await this.http.postJson(i,this.requestBodyFactory.buildBodySendTx(e,r,n));if(!s.ok){const t=await s.text();throw new Error(`Server failed with: ${t}`)}return s.json()}async getP2pPaymentDestination(t,e){if(!e)throw new Error("Amount in satohis needs to be specified");let r=await this.resolver.getP2pPaymentDestinationUrlFor(t);const n=await this.http.postJson(r,this.requestBodyFactory.buildBodyP2pPaymentDestination(e));if(n.status===st.default.NOT_FOUND)throw new Et(`Paymail ${t} not found`,t);if(!n.ok)throw new pt(`Paymail server for ${t} returned an invalid response`);const i=await n.json();if(!i.outputs)throw new pt("Server answered with a wrong format. Missing outputs");return i}async getP2pPaymentDestinationWithTokensSupport(t,e,r,n){if(!e)throw new Error("Amount needs to be specified");let i=await this.resolver.getP2pPaymentDestinationWithTokensSupportUrlFor(t);const s=await this.http.postJson(i,{amount:e,asset:r,protocol:n});if(s.status===st.default.NOT_ACCEPTABLE)throw new Pt(`Protocol ${n} is not supported by paymail ${t}`,n);if(s.status===st.default.NOT_FOUND)throw new Et(`Paymail ${t} not found`,t);if(451===s.status)throw new Mt(`Paymail ${t} cannot accept asset ${r}`);if(!s.ok)throw new pt(`Paymail server for ${t} returned an invalid response`);const o=await s.json();if(!o.outputs)throw new pt("Server answered with a wrong format. Missing outputs");return o}async sendSfpBuildAction(t,e){const r=await this.resolver.getSfpBuildActionUrlFor(t),n=await this.http.postJson(r,e);if(!n.ok){const t=await n.json();throw new pt(t.message)}return n.json()}async sendSfpAuthoriseAction(t,e){let r=await this.resolver.getSfpAuthoriseActionUrlFor(t);const n=await this.http.postJson(r,e);if(!n.ok){const t=await n.json();throw new Error(t.message)}return n.json()}async getAssetInformation(t){let e=await this.resolver.getAssetInformationUrlFor(t);const r=await this.http.get(e);if(r.status===st.default.NOT_FOUND)throw new Error(`Asset ${t} was not found`);if(!r.ok){const t=await r.text();throw new Error(`Server failed with: ${t}`)}return r.json()}}var kt=s("dfeT0");u=s("7xhmU");const xt=async function(t,e){return new At(r(kt),r(u)).verifyPubkeyOwner(e,t)},Rt="1signyCizp1VyBsJ5Ss2tEAgw7zCYNJu4",Tt=[{signature:"string"},{pubkey:"string"},{paymail:"string"}],Bt=async(t,e,r,n,i)=>{const s={verified:!1};if(n.length<4)throw new Error("PSP requires at least 4 fields including the prefix "+n);for(const[e,r]of Object.entries(t)){const t=parseInt(e,10),[i]=Object.keys(r),[o]=Object.values(r);s[i]=h(n[t+1],o)}if(!s.signature)throw new Error("PSP requires a signature "+n);if(e===y.PSP&&!((t,e,r)=>{if(!Array.isArray(r)||r.length<3)throw new Error("PSP requires at least 3 cells including the prefix");let n=-1;if(r.forEach(((t,r)=>{t.cell===e&&(n=r)})),-1===n)throw new Error("PSP could not find cell in tape");const i=[];for(let t=0;t{let e=t.h;e||(e=o.Buffer.from(t.b,"base64").toString("hex")),e||(e=o.Buffer.from(t.s).toString("hex")),i.push(o.Buffer.from(e,"hex"))})),i.push(o.Buffer.from("7c","hex")))}const s=a.Script.fromSafeDataArray(i),u=o.Buffer.from(s.toHex(),"hex"),f=a.PubKey.fromString(t.pubkey),h=a.Address.fromPubKey(f);try{t.verified=a.Bsm.verify(u,t.signature,h)}catch(e){t.verified=!1}return t.verified})(s,n,i))throw new Error("PSP requires a valid signature "+s);if(s.pubkey&&s.paymail){const t=await xt(s.paymail,s.pubkey);s.verified=s.verified&&t}d(r,e,s)},Nt={name:"PSP",address:Rt,opReturnSchema:Tt,handler:async({dataObj:t,cell:e,tape:r})=>{if(!(e.length&&e[0].s===Rt&&e[1]&&e[2]&&e[3]&&e[1].b&&e[2].s&&e[3].s&&r))throw new Error("Invalid Paymail Signature Protocol record");return await Bt(Tt,y.PSP,t,e,r)}},Ct=[{hash:"string"},{signature:"string"},{pubkey:"binary"},{paymail:"string"}],Lt={name:"BITCOM_HASHED",address:"15igChEkUWgx4dsEcSuPitcLNZmNDfUvgA",opReturnSchema:Ct,handler:async({dataObj:t,cell:e,tape:r})=>{if(console.log({cell:e}),!r)throw new Error("Invalid BITCOM_HASHED tx. Bad tape");return await Bt(Ct,y.BITCOM_HASHED,t,e,r)}};a=s("kVFKx"),o=s("bfD9J");const Ut=[{bitkey_signature:"string"},{user_signature:"string"},{paymail:"string"},{pubkey:"string"}],Dt={name:"BITKEY",address:"13SrNDkVzY5bHBRKNu5iXTQ7K7VqTh5tJC",opReturnSchema:Ut,handler:async({dataObj:t,cell:e})=>{if(!e.length)throw new Error("Invalid Bitkey tx");const r={};for(const[t,n]of Object.entries(Ut)){const i=parseInt(t,10),s=Object.keys(n)[0],o=Object.values(n)[0];r[s]=h(e[i+1],o)}const n=a.Address.fromPubKey(a.PubKey.fromString(r.pubkey)).toString(),i=o.Buffer.from(r.paymail).toString("hex")+o.Buffer.from(r.pubkey).toString("hex"),s=await p(o.Buffer.from(i,"hex")),u=a.Bsm.verify(s,r.bitkey_signature,a.Address.fromString("13SrNDkVzY5bHBRKNu5iXTQ7K7VqTh5tJC")),f=a.Bsm.verify(o.Buffer.from(r.pubkey),r.user_signature,a.Address.fromString(n));r.verified=u&&f,d(t,"BITKEY",r)}};a=s("kVFKx"),o=s("bfD9J");const Ht="18pAqbYqhzErT6Zk3a5dwxHtB9icv8jH2p",jt={name:"BITPIC",address:Ht,opReturnSchema:[{paymail:"string"},{pubkey:"binary"},{signature:"string"}],handler:async({dataObj:t,cell:e,tape:r,tx:n})=>{if(!(e[0].s===Ht&&e[1]&&e[2]&&e[3]&&e[1].s&&e[2].b&&e[3].s&&r))throw new Error(`Invalid BITPIC record: ${n}`);const i={paymail:e[1].s,pubkey:o.Buffer.from(e[2].b,"base64").toString("hex"),signature:e[3].s||"",verified:!1};if("19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut"===r[1].cell[0].s)try{const t=e[1].lb||e[1].b,r=o.Buffer.from(t,"base64"),n=await p(r),s=a.Address.fromPubKey(a.PubKey.fromString(i.pubkey));i.verified=a.Bsm.verify(n,i.signature,s)}catch(t){i.verified=!1}d(t,"BITPIC",i)}};var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.BoostUtilsHelper=Ft.BoostPowMetadata=Ft.BoostPowJobProof=Ft.BoostPowJob=Ft.BoostPowString=Ft.Puzzle=Ft.Output=Ft.Utils=Ft.Metadata=Ft.Redeem=Ft.Job=Ft.bsv=Ft.work=Ft.UInt64Big=Ft.UInt32Big=Ft.UInt32Little=Ft.UInt16Little=Ft.Int32Little=Ft.Digest32=Ft.Digest20=Ft.Difficulty=Ft.Bytes=void 0;var Kt={},Vt=(o=s("bfD9J")).Buffer;Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Job=void 0;var qt=s("caLQh"),Gt=s("ecdon"),Yt=s("bdCP2"),zt=s("9x5Bc"),Wt=s("c7O58"),Jt=s("f55ta"),Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.Difficulty=void 0;var Xt=s("2uXT7");Yt=s("bdCP2");class Qt{constructor(t){this.diff=t}valid(){return this.diff>0}static fromBits(t){return new Qt(Xt.Utils.difficulty(t))}static fromHex(t){let e=Yt.UInt32Little.fromHex(t);if(e)return this.fromBits(e.number)}get number(){return this.diff}get bits(){return Xt.Utils.difficulty2bits(this.diff)}get buffer(){return Yt.UInt32Little.fromNumber(this.bits).buffer}get hex(){return this.buffer.toString("hex")}get string(){return this.hex}get target(){return Xt.Utils.getTargetDifficulty(this.bits)}}Zt.Difficulty=Qt;var $t=s("5QJqD"),te={},ee=(o=s("bfD9J")).Buffer;Object.defineProperty(te,"__esModule",{value:!0}),te.Metadata=void 0;qt=s("caLQh"),Xt=s("2uXT7"),Yt=s("bdCP2");var re=s("iU1Nf"),ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.UInt64Big=void 0;Xt=s("2uXT7");ne.UInt64Big=class{constructor(t){this.data=t}get hex(){return this.data.toString("hex")}get buffer(){return this.data}get string(){return this.utf8}get utf8(){return Xt.Utils.trimBufferString(this.data,!0)}};Wt=s("c7O58");var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.Digest20=void 0;Xt=s("2uXT7");ie.Digest20=class{constructor(t){this.data=t}get hex(){return this.data.toString("hex")}get buffer(){return this.data}get string(){return this.utf8}get utf8(){return Xt.Utils.trimBufferString(this.data,!0)}equals(t){return this.data.equals(t.buffer)}};Jt=s("f55ta");class se{constructor(t,e,r,n,i,s){this.Tag=t,this.MinerPubKeyHash=e,this.ExtraNonce1=r,this.ExtraNonce2=n,this.UserNonce=i,this.AdditionalData=s}static fromObject(t){return new se(new Jt.Bytes(ee.from(t.tag,"hex")),new ie.Digest20(Xt.Utils.createBufferAndPad(t.minerPubKeyHash,20,!1)),new re.UInt32Big(Xt.Utils.createBufferAndPad(t.extraNonce1,4,!1)),new ne.UInt64Big(Xt.Utils.createBufferAndPad(t.extraNonce2,8,!1)),new Yt.UInt32Little(Xt.Utils.createBufferAndPad(t.userNonce,4,!1)),new Jt.Bytes(ee.from(t.additionalData,"hex")))}static fromBuffer(t){return new se(new Jt.Bytes(t.tag),new ie.Digest20(t.minerPubKeyHash),new re.UInt32Big(t.extraNonce1),new ne.UInt64Big(t.extraNonce2),new Yt.UInt32Little(t.userNonce),new Jt.Bytes(t.additionalData))}get tag(){return this.Tag}get minerPubKeyHash(){return this.MinerPubKeyHash}get userNonce(){return this.UserNonce}get extraNonce1(){return this.ExtraNonce1}get extraNonce2(){return this.ExtraNonce2}get additionalData(){return this.AdditionalData}get getCoinbaseString(){return this.toString()}get hash(){return new Wt.Digest32(qt.crypto.Hash.sha256sha256(this.toBuffer()))}toString(){return this.toBuffer().toString("hex")}toObject(){return{tag:this.Tag.hex,minerPubKeyHash:this.minerPubKeyHash.hex,extraNonce1:this.extraNonce1.hex,extraNonce2:this.extraNonce2.hex,userNonce:this.userNonce.hex,additionalData:this.additionalData.hex}}toBuffer(){return ee.concat([this.tag.buffer,this.minerPubKeyHash.buffer,this.extraNonce1.buffer,this.extraNonce2.buffer,this.userNonce.buffer,this.additionalData.buffer])}toHex(){return this.toBuffer().toString("hex")}}te.Metadata=se;Xt=s("2uXT7");var oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.Output=void 0;Wt=s("c7O58");class ae{constructor(t,e,r,n){if(this.script=t,void 0!==e)this._value=e;else if(void 0===t.value)throw"invalid output: missing parameter value";if(void 0!==r)this._txid=r;else if(void 0===t.txid)throw"invalid output: missing parameter txid";if(void 0!==n)this._vout=n;else if(void 0===t.vout)throw"invalid output: missing parameter vout"}static fromTransaction(t,e){let r=Kt.Job.fromTransaction(t,e);if(r)return new ae(r)}get value(){return this.script.value?this.script.value:this._value}get txid(){return this.script.txid?Wt.Digest32.fromHex(this.script.txid):this._txid}get vout(){return this.script.vout?this.script.vout:this._vout}}oe.Output=ae;var ue={},fe=(o=s("bfD9J")).Buffer;Object.defineProperty(ue,"__esModule",{value:!0}),ue.Puzzle=void 0;qt=s("caLQh"),$t=s("5QJqD");var he={},ce=(o=s("bfD9J")).Buffer;Object.defineProperty(he,"__esModule",{value:!0}),he.Redeem=void 0;qt=s("caLQh"),$t=s("5QJqD"),Xt=s("2uXT7"),Yt=s("bdCP2"),re=s("iU1Nf"),Jt=s("f55ta");class de{constructor(t,e,r,n,i,s,o,a,u,f,h,c){this.Signature=t,this.MinerPubKey=e,this.Time=r,this.ExtraNonce1=n,this.ExtraNonce2=i,this.Nonce=s,this.MinerPubKeyHash=o,this.GeneralPurposeBits=a,this.Txid=u,this.Vin=f,this.SpentTxid=h,this.SpentVout=c}static fromObject(t){if(t.signature.length>166)throw new Error("signature too large. Max 83 bytes.");if(66!=t.minerPubKey.length&&130!=t.minerPubKey.length)throw new Error("minerPubKey too large. Max 65 bytes.");if(t.nonce.length>8)throw new Error("nonce too large. Max 4 bytes.");if(t.extraNonce1.length>8)throw new Error("extraNonce1 too large. Max 4 bytes.");let e,r,n=ce.from(t.minerPubKey,"hex");if(t.minerPubKeyHash){if(40!=t.minerPubKeyHash.length)throw new Error("minerPubKeyHash too large. Max 20 bytes.");e=new ie.Digest20(ce.from(t.minerPubKeyHash,"hex"))}if(t.generalPurposeBits){if(t.generalPurposeBits.length>8)throw new Error("generalPurposeBits too large. Max 8 bytes.");if(r=new Yt.UInt32Little(Xt.Utils.createBufferAndPad(t.generalPurposeBits,4,!1)),t.extraNonce2.length>32)throw new Error("extraNonce2 too large. Max 32 bytes.")}else if(16!=t.extraNonce2.length)throw new Error("extraNonce2 too large. Max 8 bytes.");return new de(new Jt.Bytes(ce.from(t.signature,"hex")),new Jt.Bytes(n),new Yt.UInt32Little(Xt.Utils.createBufferAndPad(t.time,4,!1)),new re.UInt32Big(Xt.Utils.createBufferAndPad(t.extraNonce1,4,!1)),new Jt.Bytes(ce.from(t.extraNonce2,"hex")),new Yt.UInt32Little(Xt.Utils.createBufferAndPad(t.nonce,4,!1)),e,r)}static fromSolution(t,e,r,n){return new de(t,e,r.Time,r.ExtraNonce1,r.ExtraNonce2,r.Nonce,n,r.GeneralPurposeBits)}get time(){return this.Time}get generalPurposeBits(){return this.GeneralPurposeBits}get extraNonce1(){return this.ExtraNonce1}get extraNonce2(){return this.ExtraNonce2}get nonce(){return this.Nonce}get minerPubKeyHash(){return this.MinerPubKeyHash}get signature(){return this.Signature}get minerPubKey(){return this.MinerPubKey}isContract(){return!this.MinerPubKeyHash}isBounty(){return!!this.MinerPubKeyHash}get solution(){return new $t.Solution(this.time,this.extraNonce1,this.extraNonce2,this.nonce,this.generalPurposeBits)}toObject(){let t={signature:this.signature.hex,minerPubKey:this.minerPubKey.hex,time:this.time.hex,nonce:this.nonce.hex,extraNonce1:this.extraNonce1.hex,extraNonce2:this.extraNonce2.hex};return this.generalPurposeBits&&(t.generalPurposeBits=this.generalPurposeBits.hex),this.minerPubKeyHash&&(t.minerPubKeyHash=this.minerPubKeyHash.hex),t}toScript(){let t=qt.Script();return t.add(this.signature.buffer),t.add(this.minerPubKey.buffer),t.add(this.nonce.buffer),t.add(this.time.buffer),t.add(this.extraNonce2.buffer),t.add(this.extraNonce1.buffer),this.generalPurposeBits&&t.add(this.generalPurposeBits.buffer),this.minerPubKeyHash&&t.add(this.minerPubKeyHash.buffer),t}static fromTransaction(t){if(!t)return;let e=0;for(const r of t.inputs){try{return de.fromScript(r.script,t.hash,e,r.prevTxId.toString("hex"),r.outputIndex)}catch(t){}e++}}static fromRawTransaction(t){if(!t||""===t)return;const e=new qt.Transaction(t);return de.fromTransaction(e)}static fromScript(t,e,r,n,i){let s,o,a,u,f,h,c,d;if(7===t.chunks.length&&t.chunks[0].len&&t.chunks[1].len&&t.chunks[2].len&&t.chunks[3].len&&t.chunks[4].len&&t.chunks[5].len&&t.chunks[6].len)c=new ie.Digest20(t.chunks[6].buf);else{if(!(8===t.chunks.length&&t.chunks[0].len&&t.chunks[1].len&&t.chunks[2].len&&t.chunks[3].len&&(t.chunks[4].buf&&t.chunks[4].len<=20||t.chunks[4].opcodenum==qt.Opcode.OP_0||t.chunks[4].opcodenum==qt.Opcode.OP_1NEGATE||t.chunks[4].opcodenum>=qt.Opcode.OP_1&&t.chunks[6].opcodenum<=qt.Opcode.OP_16)&&t.chunks[5].len&&t.chunks[6].len&&t.chunks[7].len))throw new Error("Not valid Boost Proof");d=new Yt.UInt32Little(t.chunks[6].buf),c=new ie.Digest20(t.chunks[7].buf)}return s=new Jt.Bytes(t.chunks[0].buf),o=new Jt.Bytes(t.chunks[1].buf),u=new Yt.UInt32Little(t.chunks[2].buf),a=new Yt.UInt32Little(t.chunks[3].buf),h=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[4])),f=new re.UInt32Big(t.chunks[5].buf),new de(s,o,a,f,h,u,c,d,e,r,n,i)}static fromHex(t,e,r,n,i){return de.fromScript(new qt.Script(t),e,r,n,i)}static fromASM(t,e,r,n,i){return de.fromScript(new qt.Script.fromASM(t),e,r,n,i)}get txInpoint(){return{txid:this.Txid,vin:this.Vin}}get txid(){return this.Txid}get vin(){return this.Vin}get spentTxid(){return this.SpentTxid}get spentVout(){return this.SpentVout}static fromASM2(t,e,r){return de.fromHex(t,e,r)}toString(){return this.toScript().toString()}toBuffer(){return this.toScript().toBuffer()}static fromBuffer(t){return de.fromScript(qt.Script.fromBuffer(t))}static fromString(t,e,r){return de.fromHex(t,e,r)}static expectedSize(t,e,r){return 96+(r?34:66)+(t?21:0)+(e?5:0)}}he.Redeem=de;Jt=s("f55ta");var le={},pe=(o=s("bfD9J")).Buffer;Object.defineProperty(le,"__esModule",{value:!0}),le.verify=le.sign=le.writeIncompleteTransaction=le.writeTransaction=le.serializedSize=le.estimateTransactionSize=void 0;qt=s("caLQh"),Wt=s("c7O58"),Gt=s("ecdon"),Yt=s("bdCP2");function be(t){return t<253?1:t<65536?3:t<4294967296?5:9}function me(t){let e=8+be(t.outputs.length)+be(t.inputs.length);for(let r of t.inputs)e+=40+be(r.script.length)+r.script.length;for(let r of t.outputs)e+=8+be(r.script.length)+r.script.length;return e}le.estimateTransactionSize=function(t){let e=8+be(t.outputs.length)+be(t.inputs.length);for(let r of t.inputs)e+=40+be(r.scriptSize)+r.scriptSize;for(let r of t.outputs)e+=8+be(r.script.length)+r.script.length;return e},le.serializedSize=me;class ge{constructor(t){this.position=0,this.buf=pe.alloc(Number(t))}write_buffer(t){t.copy(this.buf,this.position),this.position+=t.length}write_var_int(t){var e;t<253?(e=pe.alloc(1)).writeUInt8(t,0):t<65536?((e=pe.alloc(3)).writeUInt8(253,0),e.writeUInt16LE(t,1)):t<4294967296?((e=pe.alloc(5)).writeUInt8(254,0),e.writeUInt32LE(t,1)):((e=pe.alloc(9)).writeUInt8(255,0),e.writeInt32LE(-1&t,1),e.writeUInt32LE(Math.floor(t/4294967296),5)),this.write_buffer(e)}write_input(t){this.write_buffer(t.prevTxId instanceof pe?t.prevTxId:(t.prevTxId instanceof Wt.Digest32?t.prevTxId:Wt.Digest32.fromHex(t.prevTxId)).buffer),this.write_buffer((t.outputIndex instanceof Yt.UInt32Little?t.outputIndex:Yt.UInt32Little.fromNumber(t.outputIndex)).buffer);let e=t.script instanceof pe?t.script:pe.from(t.script,"hex");this.write_var_int(e.length),this.write_buffer(e),this.write_buffer((t.outputIndex instanceof Yt.UInt32Little?t.outputIndex:Yt.UInt32Little.fromNumber(t.outputIndex?t.outputIndex:4294967295)).buffer)}write_satoshis(t){this.write_buffer(qt.crypto.BN.fromNumber(t).toBuffer({size:8}).reverse())}write_output(t){this.write_satoshis(t.satoshis);let e=t.script instanceof pe?t.script:pe.from(t.script,"hex");this.write_var_int(e.length),this.write_buffer(e)}write_transaction(t){this.write_buffer((t.version instanceof Gt.Int32Little?t.version:Yt.UInt32Little.fromNumber(t.version)).buffer),this.write_var_int(t.inputs.length);for(let e of t.inputs)this.write_input(e);this.write_var_int(t.outputs.length);for(let e of t.outputs)this.write_output(e);this.write_buffer((t.locktime instanceof Yt.UInt32Little?t.locktime:Yt.UInt32Little.fromNumber(t.locktime?t.locktime:0)).buffer)}}function ye(t){let e=new ge(me(t));return e.write_transaction(t),e.buf}function ve(t){let e=[];for(let r of t.inputs)e.push({prevTxId:r.prevTxId,outputIndex:r.outputIndex,script:pe.alloc(0),sequenceNumber:r.sequenceNumber});return ye({version:t.version,inputs:e,outputs:t.outputs,locktime:t.locktime})}le.writeTransaction=ye,le.writeIncompleteTransaction=ve,le.sign=function(t,e,r=qt.crypto.Signature.SIGHASH_ALL|qt.crypto.Signature.SIGHASH_FORKID,n=qt.Script.Interpreter.SCRIPT_VERIFY_MINIMALDATA|qt.Script.Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID|qt.Script.Interpreter.SCRIPT_ENABLE_MAGNETIC_OPCODES|qt.Script.Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES){let i=e.incompleteTransaction instanceof qt.Transaction||e.incompleteTransaction instanceof pe?e.incompleteTransaction:ve(e.incompleteTransaction);return pe.concat([qt.Transaction.Sighash.sign(new qt.Transaction(i),new qt.PrivateKey(t),r,e.inputIndex,new qt.Script(e.scriptCode),new qt.crypto.BN(e.satoshis),n).toBuffer(),pe.from([255&r])])},le.verify=function(t,e,r,n=qt.Script.Interpreter.SCRIPT_VERIFY_MINIMALDATA|qt.Script.Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID|qt.Script.Interpreter.SCRIPT_ENABLE_MAGNETIC_OPCODES|qt.Script.Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES){let i=r.incompleteTransaction instanceof qt.Transaction||r.incompleteTransaction instanceof pe?r.incompleteTransaction:ve(r.incompleteTransaction),s=t instanceof pe?qt.PublicKey.fromBuffer(t):t;return qt.Transaction.Sighash.verify(new qt.Transaction(i),new qt.crypto.Signature.fromTxFormat(e),s,r.inputIndex,new qt.Script(r.scriptCode),new qt.crypto.BN(r.satoshis),n)};ue.Puzzle=class{constructor(t,e){let r=new qt.PrivateKey(e),n=r.toPublicKey(),i=new ie.Digest20(fe.from(qt.Address.fromPublicKey(n,r.network).toObject().hash,"hex"));if(t.script.minerPubKeyHash){if(!i.equals(t.script.minerPubKeyHash))throw"invalid parameters"}else this._address=i;this.output=t,this.key=r,this.pubkey=new Jt.Bytes(n.toBuffer())}get address(){return this._address?this._address:this.output.script.minerPubKeyHash}get workPuzzle(){return Kt.Job.puzzle(this.output.script,this._address)}redeem(t,e,r,n=qt.crypto.Signature.SIGHASH_ALL|qt.crypto.Signature.SIGHASH_FORKID,i=qt.Script.Interpreter.SCRIPT_VERIFY_MINIMALDATA|qt.Script.Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID|qt.Script.Interpreter.SCRIPT_ENABLE_MAGNETIC_OPCODES|qt.Script.Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES){if(!new $t.Proof(this.workPuzzle,t).valid())throw new Error("invalid solution");return he.Redeem.fromSolution(new Jt.Bytes(le.sign(this.key,{satoshis:this.output.value,scriptCode:this.output.script.toScript(),inputIndex:r,incompleteTransaction:e},n,i)),this.pubkey,t,this._address)}expectedRedeemScriptSize(){return he.Redeem.expectedSize(this.output.script.isBounty(),2==this.output.script.scriptVersion,this.key.compressed)}createRedeemTransaction(t,e,r,n=["boostpow","proof"]){let i={version:1,inputs:[{prevTxId:this.output.txid.buffer,outputIndex:this.output.vout,scriptSize:this.expectedRedeemScriptSize()}],outputs:[{satoshis:0,script:qt.Script(new qt.Address(e)).toBuffer()},{satoshis:0,script:qt.Script.buildSafeDataOut(n).toBuffer()}]},s=Math.ceil(le.estimateTransactionSize(i)*r);if(s>this.output.value)throw"not enough sats to be worth it";return i.outputs[0].satoshis=this.output.value-s,le.writeTransaction({version:1,inputs:[{prevTxId:this.output.txid.buffer,outputIndex:this.output.vout,script:this.redeem(t,i,0).toBuffer()}],outputs:i.outputs})}};class we{constructor(t,e,r,n,i,s,o,a,u,f,h){this.Content=t,this.Difficulty=e,this.Category=r,this.Tag=n,this.AdditionalData=i,this.UserNonce=s,this.useGeneralPurposeBits=o,this.MinerPubKeyHash=a,this.Txid=u,this.Vout=f,this.Value=h}get category(){return this.Category}get content(){return this.Content}get tag(){return this.Tag}get additionalData(){return this.AdditionalData}get userNonce(){return this.UserNonce}get difficulty(){return this.Difficulty}get bits(){return Yt.UInt32Little.fromNumber(Xt.Utils.difficulty2bits(this.difficulty))}get minerPubKeyHash(){return this.MinerPubKeyHash}get id(){return this.scriptHash}get scriptVersion(){return this.useGeneralPurposeBits?2:1}get useASICBoost(){return this.scriptVersion>1}isContract(){return!!this.MinerPubKeyHash}isBounty(){return!this.MinerPubKeyHash}get magicNumber(){return zt.UInt16Little.fromNumber(Xt.Utils.magicNumber(this.category.number))}static fromObject(t){if(t.content&&t.content.length>64)throw new Error("content too large. Max 32 bytes.");if(t.diff<=0||isNaN(t.diff)||"number"!=typeof t.diff)throw new Error("diff must be a positive number.");let e,r,n;if(t.category){if(t.category.length>8)throw new Error("category too large. Max 4 bytes.");e=new Gt.Int32Little(Xt.Utils.createBufferAndPad(t.category,4,!1))}else e=Gt.Int32Little.fromNumber(0);if(t.tag&&t.tag.length>40)throw new Error("tag too large. Max 20 bytes.");if(t.userNonce&&t.userNonce.length>8)throw new Error("userNonce too large. Max 4 bytes.");if(t.userNonce)r=t.userNonce;else{let t=t=>Math.floor(Math.random()*t);r=Vt.from([t(255),t(255),t(255),t(255)]).toString("hex")}if(t.minerPubKeyHash){if(t.minerPubKeyHash.length>40)throw new Error("minerPubKeyHash too large. Max 4 bytes.");n=new Jt.Bytes(Vt.from(t.minerPubKeyHash,"hex"))}return new we(new Wt.Digest32(Xt.Utils.createBufferAndPad(t.content,32)),t.diff,e,new Jt.Bytes(t.tag?Vt.from(t.tag,"hex"):Vt.alloc(0)),new Jt.Bytes(t.additionalData?Vt.from(t.additionalData,"hex"):Vt.alloc(0)),new Yt.UInt32Little(Xt.Utils.createBufferAndPad(r,4,!1)),!!t.useGeneralPurposeBits&&t.useGeneralPurposeBits,n)}toObject(){return this.minerPubKeyHash?{content:this.content.hex,diff:this.difficulty,category:this.category.hex,tag:this.tag.hex,additionalData:this.additionalData.hex,userNonce:this.userNonce.hex,minerPubKeyHash:this.minerPubKeyHash.hex,useGeneralPurposeBits:this.useGeneralPurposeBits}:{content:this.content.hex,diff:this.difficulty,category:this.category.hex,tag:this.tag.hex,additionalData:this.additionalData.hex,userNonce:this.userNonce.hex,useGeneralPurposeBits:this.useGeneralPurposeBits}}toHex(){return this.toScript().toHex()}toBuffer(){return this.toScript().toBuffer()}toOpCode(t){if(1==t.length){if(t[0]>=1&&t[0]<=16)return qt.Opcode.OP_1+(t[0]-1);if(129==t[0])return qt.Opcode.OP_1NEGATE}return t}toScript(){let t=qt.Script();t.add(this.toOpCode(Vt.from("boostpow","utf8"))),t.add(qt.Opcode.OP_DROP),this.minerPubKeyHash&&t.add(this.toOpCode(this.minerPubKeyHash.buffer)),t.add(this.toOpCode(this.category.buffer)),t.add(this.toOpCode(this.content.buffer)),t.add(this.toOpCode(this.bits.buffer)),t.add(this.toOpCode(this.tag.buffer)),t.add(this.toOpCode(this.userNonce.buffer)),t.add(this.toOpCode(this.additionalData.buffer));for(const e of we.scriptOperations(this.useGeneralPurposeBits))t.add(e);return t}static remainingOperationsMatchExactly(t,e,r){let n=0;if(t.length-e!==r.length)return!1;for(;n=qt.Opcode.OP_1&&t.chunks[5].opcodenum<=qt.Opcode.OP_16)&&t.chunks[6].buf&&4===t.chunks[6].len&&(t.chunks[7].buf||t.chunks[7].opcodenum==qt.Opcode.OP_0||t.chunks[7].opcodenum==qt.Opcode.OP_1NEGATE||t.chunks[7].opcodenum>=qt.Opcode.OP_1&&t.chunks[7].opcodenum<=qt.Opcode.OP_16)))throw new Error("Not valid Boost Output");{if(we.remainingOperationsMatchExactly(t.chunks,8,we.scriptOperationsV1NoASICBoost()))c=!1;else{if(!we.remainingOperationsMatchExactly(t.chunks,8,we.scriptOperationsV2ASICBoost()))throw new Error("Invalid script program");c=!0}i=new Gt.Int32Little(Xt.Utils.fromOpCode(t.chunks[2])),s=new Wt.Digest32(Xt.Utils.fromOpCode(t.chunks[3]));let e=(Xt.Utils.fromOpCode(t.chunks[4]).toString("hex").match(/../g)||[]).reverse().join(""),r=parseInt(e,16);o=Xt.Utils.difficulty(r),a=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[5])),f=new Yt.UInt32Little(Xt.Utils.fromOpCode(t.chunks[6])),u=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[7]))}}else{if(!(t.chunks[3].buf&&4===t.chunks[3].opcodenum&&t.chunks[4].buf&&32===t.chunks[4].len&&t.chunks[5].buf&&4===t.chunks[5].len&&(t.chunks[6].buf&&t.chunks[6].len<=20||t.chunks[6].opcodenum==qt.Opcode.OP_0||t.chunks[6].opcodenum==qt.Opcode.OP_1NEGATE||t.chunks[6].opcodenum>=qt.Opcode.OP_1&&t.chunks[6].opcodenum<=qt.Opcode.OP_16)&&t.chunks[7].buf&&4===t.chunks[7].len&&(t.chunks[8].buf||t.chunks[8].opcodenum==qt.Opcode.OP_0||t.chunks[8].opcodenum==qt.Opcode.OP_1NEGATE||t.chunks[8].opcodenum>=qt.Opcode.OP_1&&t.chunks[8].opcodenum<=qt.Opcode.OP_16)))throw new Error("Invalid boost format");{if(we.remainingOperationsMatchExactly(t.chunks,9,we.scriptOperationsV1NoASICBoost()))c=!1;else{if(!we.remainingOperationsMatchExactly(t.chunks,9,we.scriptOperationsV2ASICBoost()))throw new Error("Not valid Boost Output");c=!0}h=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[2])),i=new Gt.Int32Little(Xt.Utils.fromOpCode(t.chunks[3])),s=new Wt.Digest32(Xt.Utils.fromOpCode(t.chunks[4]));let e=(Xt.Utils.fromOpCode(t.chunks[5]).toString("hex").match(/../g)||[]).reverse().join(""),r=parseInt(e,16);o=Xt.Utils.difficulty(r),a=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[6])),f=new Yt.UInt32Little(Xt.Utils.fromOpCode(t.chunks[7])),u=new Jt.Bytes(Xt.Utils.fromOpCode(t.chunks[8]))}}return new we(s,o,i,a,u,f,c,h,e,r,n)}static fromHex(t,e,r,n){return we.readScript(new qt.Script(t),e,r,n)}static fromASM(t,e,r,n){return we.readScript(new qt.Script.fromASM(t),e,r,n)}static fromBuffer(t,e,r,n){return we.readScript(new qt.Script.fromBuffer(t),e,r,n)}toASM(){const t=this.toHex();return new qt.Script(t).toASM()}static fromASM4(t,e,r,n){return we.fromHex(t,e,r,n)}static fromASM2(t,e,r,n){return we.fromHex(t,e,r,n)}toString(){const t=this.toHex();return new qt.Script(t).toString()}static fromString(t,e,r,n){return we.fromHex(t,e,r,n)}get txOutpoint(){return{txid:this.txid,vout:this.vout,value:this.value}}get txid(){return this.Txid}get vout(){return this.Vout}get value(){return this.Value}get scriptHash(){const t=this.toHex(),e=Vt.from(t,"hex");return qt.crypto.Hash.sha256(e).reverse().toString("hex")}static fromTransaction(t,e=0){if(!t)return;let r=new qt.Transaction(t);return e>r.outputs.length-1||e<0||null==e?void 0:r.outputs[e].script&&r.outputs[e].script.chunks[0].buf&&r.outputs[e].script.chunks[0].buf.toString("hex")===Vt.from("boostpow","utf8").toString("hex")?we.readScript(r.outputs[e].script,r.hash,e,r.outputs[e].satoshis):void 0}static fromTransactionGetAllOutputs(t){if(!t)return[];const e=[];let r=0;for(const n of t.outputs)n.script&&n.script.chunks[0].buf&&n.script.chunks[0].buf.toString("hex")===Vt.from("boostpow","utf8").toString("hex")&&e.push(we.readScript(n.script,t.hash,r,n.satoshis)),r++;return e}static fromRawTransaction(t,e=0){if(isNaN(e))return;const r=new qt.Transaction(t);return we.fromTransaction(r,e)}static createRedeemTransaction(t,e,r,n,i=.5){if(!we.tryValidateJobProof(t,e))throw new Error("createRedeemTransaction: Invalid Job Proof");if(void 0===t.value)throw new Error("createRedeemTransaction: job requires satoshi value");if(void 0===t.txid)throw new Error("createRedeemTransaction: job requires txid");if(void 0===t.vout)throw new Error("createRedeemTransaction: job requires vout");return new qt.Transaction(new ue.Puzzle(new oe.Output(t),r).createRedeemTransaction(e.solution,n,i))}static puzzle(t,e){let r;if(t.isBounty()&&void 0!==e)r=e;else{if(!t.isContract()||void 0!==e)throw"invalid";r=t.minerPubKeyHash}let n=new Jt.Bytes(Vt.concat([t.tag.buffer,r.buffer])),i=new Jt.Bytes(Vt.concat([t.userNonce.buffer,t.additionalData.buffer]));return t.useGeneralPurposeBits?new $t.Puzzle(t.category,t.content,new Zt.Difficulty(t.difficulty),n,i,Gt.Int32Little.fromNumber(Xt.Utils.generalPurposeBitsMask())):new $t.Puzzle(t.category,t.content,new Zt.Difficulty(t.difficulty),n,i)}static createBoostPowMetadata(t,e){let r;if(e.minerPubKeyHash)r=e.minerPubKeyHash;else{if(!t.minerPubKeyHash)throw"invalid proof";r=t.minerPubKeyHash}return te.Metadata.fromBuffer({tag:t.tag.buffer,minerPubKeyHash:r.buffer,extraNonce1:e.extraNonce1.buffer,extraNonce2:e.extraNonce2.buffer,userNonce:t.userNonce.buffer,additionalData:t.additionalData.buffer})}static proof(t,e){const r=we.createBoostPowMetadata(t,e);let n,i=new Jt.Bytes(Vt.concat([r.tag.buffer,r.minerPubKeyHash.buffer])),s=new Jt.Bytes(Vt.concat([r.userNonce.buffer,r.additionalData.buffer]));return n=t.useGeneralPurposeBits?new $t.Puzzle(t.category,t.content,new Zt.Difficulty(t.difficulty),i,s,Gt.Int32Little.fromNumber(Xt.Utils.generalPurposeBitsMask())):new $t.Puzzle(t.category,t.content,new Zt.Difficulty(t.difficulty),i,s),new $t.Proof(n,e.solution)}static tryValidateJobProof(t,e){let r=this.proof(t,e).string();return r&&r.valid()?{boostPowString:r,boostPowMetadata:we.createBoostPowMetadata(t,e)}:null}static loopOperation(t,e){let r=[];for(let n=0;n{if(!n||!e[0]||!r)throw new Error("Invalid BOOST tx. dataObj, cell, out and tx are required.");const i=e.map((t=>t.ops?t.ops:h(t,"hex")||"")).join(" ");if(i){const e=Ft.BoostPowJob.fromASM(i,n.tx.h,r.i,r.e.v).toObject();d(t,"BOOST",e)}},address:Se,scriptChecker:t=>t[0].s===Se},Ee=[{hashing_algorithm:"string"},{signing_algorithm:"string"},{signing_address:"string"},{signature:"string"},{index_unit_size:"number"},[{index:"binary"}]],Ie={name:"HAIP",address:"1HA1P2exomAwCUycZHr8WeyFoy5vuQASE3",opReturnSchema:Ee,handler:async({dataObj:t,cell:e,tape:r,tx:n})=>{if(!r)throw new Error("Invalid HAIP tx. Bad tape");if(!n)throw new Error("Invalid HAIP tx.");return await w(Ee,y.HAIP,t,e,r,n)}};var Pe={};function Me(t){return"".concat(t<0?"-":"","0x").concat(Math.abs(t).toString(16).padStart(2,"0"))}t(Pe,"Decoder",(()=>ur),(t=>ur=t));var Ae=function(t,e){this.type=t,this.data=e},ke={};t(ke,"DecodeError",(()=>Te),(t=>Te=t));var xe,Re=(xe=function(t,e){return xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},xe(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}xe(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),Te=function(t){function e(r){var n=t.call(this,r)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(n,i),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:e.name}),n}return Re(e,t),e}(Error),Be=4294967295;function Ne(t,e,r){var n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function Ce(t,e){return 4294967296*t.getInt32(e)+t.getUint32(e+4)}function Le(t){var e=t.sec,r=t.nsec;if(e>=0&&r>=0&&e<=17179869183){if(0===r&&e<=4294967295){var n=new Uint8Array(4);return(o=new DataView(n.buffer)).setUint32(0,e),n}var i=e/4294967296,s=4294967295&e;n=new Uint8Array(8);return(o=new DataView(n.buffer)).setUint32(0,r<<2|3&i),o.setUint32(4,s),n}var o;n=new Uint8Array(12);return(o=new DataView(n.buffer)).setUint32(0,r),Ne(o,4,e),n}var Ue,De,He,je={type:-1,encode:function(t){var e,r,n,i;return t instanceof Date?Le((e=t.getTime(),r=Math.floor(e/1e3),n=1e6*(e-1e3*r),i=Math.floor(n/1e9),{sec:r+i,nsec:n-1e9*i})):null},decode:function(t){var e=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:var r=e.getUint32(0);return{sec:4294967296*(3&r)+e.getUint32(4),nsec:r>>>2};case 12:return{sec:Ce(e,4),nsec:e.getUint32(0)};default:throw new(0,ke.DecodeError)("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(t.length))}}(t);return new Date(1e3*e.sec+e.nsec/1e6)}},Fe=function(){function t(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(je)}return t.prototype.register=function(t){var e=t.type,r=t.encode,n=t.decode;if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{var i=1+e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}},t.prototype.tryToEncode=function(t,e){for(var r=0;r65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var Ye=Ve?new TextDecoder:null,ze=Ve?void 0!==Ke&&"force"!==(null===(He=null==Ke?void 0:Ke.env)||void 0===He?void 0:He.TEXT_DECODER)?200:0:Be;function We(t,e,r){var n=t.subarray(e,e+r);return Ye.decode(n)}function Je(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}function Ze(t){if(t instanceof ArrayBuffer)return new DataView(t);var e=Je(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Xe=function(){function t(t,e){void 0===t&&(t=16),void 0===e&&(e=16),this.maxKeyLength=t,this.maxLengthPerKey=e,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r0&&t<=this.maxKeyLength},t.prototype.find=function(t,e,r){t:for(var n=0,i=this.caches[r-1];n=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)},t.prototype.decode=function(t,e,r){var n=this.find(t,e,r);if(null!=n)return this.hit++,n;this.miss++;var i=Ge(t,e,r),s=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(s,i),i},t}(),Qe=function(t,e,r,n){return new(r||(r=Promise))((function(i,s){function o(t){try{u(n.next(t))}catch(t){s(t)}}function a(t){try{u(n.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))},$e=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof er?Promise.resolve(r.value.v).then(u,f):h(s[0][2],r)}catch(t){h(s[0][3],t)}var r}function u(t){a("next",t)}function f(t){a("throw",t)}function h(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}},nr=new DataView(new ArrayBuffer(0)),ir=new Uint8Array(nr.buffer),sr=function(){try{nr.getInt8(0)}catch(t){return t.constructor}throw new Error("never reached")}(),or=new sr("Insufficient data"),ar=new Xe,ur=function(){function t(t,e,r,n,i,s,o,a){void 0===t&&(t=Fe.defaultCodec),void 0===e&&(e=void 0),void 0===r&&(r=Be),void 0===n&&(n=Be),void 0===i&&(i=Be),void 0===s&&(s=Be),void 0===o&&(o=Be),void 0===a&&(a=ar),this.extensionCodec=t,this.context=e,this.maxStrLength=r,this.maxBinLength=n,this.maxArrayLength=i,this.maxMapLength=s,this.maxExtLength=o,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=nr,this.bytes=ir,this.headByte=-1,this.stack=[]}return t.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},t.prototype.setBuffer=function(t){this.bytes=Je(t),this.view=Ze(this.bytes),this.pos=0},t.prototype.appendBuffer=function(t){if(-1!==this.headByte||this.hasRemaining(1)){var e=this.bytes.subarray(this.pos),r=Je(t),n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),this.setBuffer(n)}else this.setBuffer(t)},t.prototype.hasRemaining=function(t){return this.view.byteLength-this.pos>=t},t.prototype.createExtraByteError=function(t){var e=this.view,r=this.pos;return new RangeError("Extra ".concat(e.byteLength-r," of ").concat(e.byteLength," byte(s) found at buffer[").concat(t,"]"))},t.prototype.decode=function(t){this.reinitializeState(),this.setBuffer(t);var e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e},t.prototype.decodeMulti=function(t){return $e(this,(function(e){switch(e.label){case 0:this.reinitializeState(),this.setBuffer(t),e.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))},t.prototype.decodeAsync=function(t){var e,r,n,i;return Qe(this,void 0,void 0,(function(){var s,o,a,u,f,h,c,d;return $e(this,(function(l){switch(l.label){case 0:s=!1,l.label=1;case 1:l.trys.push([1,6,7,12]),e=tr(t),l.label=2;case 2:return[4,e.next()];case 3:if((r=l.sent()).done)return[3,5];if(a=r.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{o=this.doDecodeSync(),s=!0}catch(t){if(!(t instanceof sr))throw t}this.totalPos+=this.pos,l.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return u=l.sent(),n={error:u},[3,12];case 7:return l.trys.push([7,,10,11]),r&&!r.done&&(i=e.return)?[4,i.call(e)]:[3,9];case 8:l.sent(),l.label=9;case 9:return[3,11];case 10:if(n)throw n.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw h=(f=this).headByte,c=f.pos,d=f.totalPos,new RangeError("Insufficient data in parsing ".concat(Me(h)," at ").concat(d," (").concat(c," in the current buffer)"))}}))}))},t.prototype.decodeArrayStream=function(t){return this.decodeMultiAsync(t,!0)},t.prototype.decodeStream=function(t){return this.decodeMultiAsync(t,!1)},t.prototype.decodeMultiAsync=function(t,e){return rr(this,arguments,(function(){var r,n,i,s,o,a,u,f,h;return $e(this,(function(c){switch(c.label){case 0:r=e,n=-1,c.label=1;case 1:c.trys.push([1,13,14,19]),i=tr(t),c.label=2;case 2:return[4,er(i.next())];case 3:if((s=c.sent()).done)return[3,12];if(o=s.value,e&&0===n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(n=this.readArraySize(),r=!1,this.complete()),c.label=4;case 4:c.trys.push([4,9,,10]),c.label=5;case 5:return[4,er(this.doDecodeSync())];case 6:return[4,c.sent()];case 7:return c.sent(),0==--n?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=c.sent())instanceof sr))throw a;return[3,10];case 10:this.totalPos+=this.pos,c.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return u=c.sent(),f={error:u},[3,19];case 14:return c.trys.push([14,,17,18]),s&&!s.done&&(h=i.return)?[4,er(h.call(i))]:[3,16];case 15:c.sent(),c.label=16;case 16:return[3,18];case 17:if(f)throw f.error;return[7];case 18:return[7];case 19:return[2]}}))}))},t.prototype.doDecodeSync=function(){t:for(;;){var t=this.readHeadByte(),e=void 0;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){if(0!==(n=t-128)){this.pushMapState(n),this.complete();continue t}e={}}else if(t<160){if(0!==(n=t-144)){this.pushArrayState(n),this.complete();continue t}e=[]}else{var r=t-160;e=this.decodeUtf8String(r,0)}else if(192===t)e=null;else if(194===t)e=!1;else if(195===t)e=!0;else if(202===t)e=this.readF32();else if(203===t)e=this.readF64();else if(204===t)e=this.readU8();else if(205===t)e=this.readU16();else if(206===t)e=this.readU32();else if(207===t)e=this.readU64();else if(208===t)e=this.readI8();else if(209===t)e=this.readI16();else if(210===t)e=this.readI32();else if(211===t)e=this.readI64();else if(217===t){r=this.lookU8();e=this.decodeUtf8String(r,1)}else if(218===t){r=this.lookU16();e=this.decodeUtf8String(r,2)}else if(219===t){r=this.lookU32();e=this.decodeUtf8String(r,4)}else if(220===t){if(0!==(n=this.readU16())){this.pushArrayState(n),this.complete();continue t}e=[]}else if(221===t){if(0!==(n=this.readU32())){this.pushArrayState(n),this.complete();continue t}e=[]}else if(222===t){if(0!==(n=this.readU16())){this.pushMapState(n),this.complete();continue t}e={}}else if(223===t){if(0!==(n=this.readU32())){this.pushMapState(n),this.complete();continue t}e={}}else if(196===t){var n=this.lookU8();e=this.decodeBinary(n,1)}else if(197===t){n=this.lookU16();e=this.decodeBinary(n,2)}else if(198===t){n=this.lookU32();e=this.decodeBinary(n,4)}else if(212===t)e=this.decodeExtension(1,0);else if(213===t)e=this.decodeExtension(2,0);else if(214===t)e=this.decodeExtension(4,0);else if(215===t)e=this.decodeExtension(8,0);else if(216===t)e=this.decodeExtension(16,0);else if(199===t){n=this.lookU8();e=this.decodeExtension(n,1)}else if(200===t){n=this.lookU16();e=this.decodeExtension(n,2)}else{if(201!==t)throw new(0,ke.DecodeError)("Unrecognized type byte: ".concat(Me(t)));n=this.lookU32();e=this.decodeExtension(n,4)}this.complete();for(var i=this.stack;i.length>0;){var s=i[i.length-1];if(0===s.type){if(s.array[s.position]=e,s.position++,s.position!==s.size)continue t;i.pop(),e=s.array}else{if(1===s.type){if(o=void 0,"string"!==(o=typeof e)&&"number"!==o)throw new(0,ke.DecodeError)("The type of key must be string or number but "+typeof e);if("__proto__"===e)throw new(0,ke.DecodeError)("The key __proto__ is not allowed");s.key=e,s.type=2;continue t}if(s.map[s.key]=e,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue t}i.pop(),e=s.map}}return e}var o},t.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},t.prototype.complete=function(){this.headByte=-1},t.prototype.readArraySize=function(){var t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:if(t<160)return t-144;throw new(0,ke.DecodeError)("Unrecognized array type byte: ".concat(Me(t)))}},t.prototype.pushMapState=function(t){if(t>this.maxMapLength)throw new(0,ke.DecodeError)("Max length exceeded: map length (".concat(t,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:t,key:null,readCount:0,map:{}})},t.prototype.pushArrayState=function(t){if(t>this.maxArrayLength)throw new(0,ke.DecodeError)("Max length exceeded: array length (".concat(t,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:t,array:new Array(t),position:0})},t.prototype.decodeUtf8String=function(t,e){var r;if(t>this.maxStrLength)throw new(0,ke.DecodeError)("Max length exceeded: UTF-8 byte length (".concat(t,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthze?We(this.bytes,i,t):Ge(this.bytes,i,t),this.pos+=e+t,n},t.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},t.prototype.decodeBinary=function(t,e){if(t>this.maxBinLength)throw new(0,ke.DecodeError)("Max length exceeded: bin length (".concat(t,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(t+e))throw or;var r=this.pos+e,n=this.bytes.subarray(r,r+t);return this.pos+=e+t,n},t.prototype.decodeExtension=function(t,e){if(t>this.maxExtLength)throw new(0,ke.DecodeError)("Max length exceeded: ext length (".concat(t,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,r,this.context)},t.prototype.lookU8=function(){return this.view.getUint8(this.pos)},t.prototype.lookU16=function(){return this.view.getUint16(this.pos)},t.prototype.lookU32=function(){return this.view.getUint32(this.pos)},t.prototype.readU8=function(){var t=this.view.getUint8(this.pos);return this.pos++,t},t.prototype.readI8=function(){var t=this.view.getInt8(this.pos);return this.pos++,t},t.prototype.readU16=function(){var t=this.view.getUint16(this.pos);return this.pos+=2,t},t.prototype.readI16=function(){var t=this.view.getInt16(this.pos);return this.pos+=2,t},t.prototype.readU32=function(){var t=this.view.getUint32(this.pos);return this.pos+=4,t},t.prototype.readI32=function(){var t=this.view.getInt32(this.pos);return this.pos+=4,t},t.prototype.readU64=function(){var t,e,r=(t=this.view,e=this.pos,4294967296*t.getUint32(e)+t.getUint32(e+4));return this.pos+=8,r},t.prototype.readI64=function(){var t=Ce(this.view,this.pos);return this.pos+=8,t},t.prototype.readF32=function(){var t=this.view.getFloat32(this.pos);return this.pos+=4,t},t.prototype.readF64=function(){var t=this.view.getFloat64(this.pos);return this.pos+=8,t},t}(),fr={};function hr(t,e){return void 0===e&&(e=fr),new(0,Pe.Decoder)(e.extensionCodec,e.context,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength).decode(t)}o=s("bfD9J");const cr="1PuQa7K62MiKCtssSLKy1kh56WWU7MtUR5",dr=[{cmd:{SET:[{key:"string"},{val:"string"}],SELECT:[{tx:"string"}],ADD:[{key:"string"},[{val:"string"}]],DELETE:[{key:"string"},[{val:"string"}]],JSON:"string",REMOVE:[[{key:"string"}]],CLEAR:[[{txid:"string"}]]}}],lr={name:"MAP",address:cr,opReturnSchema:dr,handler:function({dataObj:t,cell:e,tx:r}){if(!(e[0].s===cr&&e[1]&&e[1].s&&e[2]&&e[2].s))throw new Error(`Invalid MAP record: ${r}`);let n={};const i=[];let s=0;for(let t=1;t{t.unshift({s:cr,i:0});switch(t[1].s){case"ADD":!function(t,e){let r=null;for(const n of t){if(0===n.i||1===n.i)continue;const t=n.s;2===n.i?(e[t]=[],r=t):r&&Array.isArray(e[r])&&e[r].push(t)}}(t,n);break;case"REMOVE":n.key=t[2].s;break;case"DELETE":!function(t,e){let r=null;for(const n of t){if(0===n.i||1===n.i)continue;const t=n.s;2===n.i?(e[t]=[],r=t):r&&e[r].push(t)}}(t,n);break;case"CLEAR":break;case"SELECT":!function(t,e){for(const r of t)if(0===r.i||1===r.i){e.SELECT="TODO";continue}}(t,n);break;case"MSGPACK":n=function(t,e){for(const r of t)if(0!==r.i&&1!==r.i&&2===r.i)try{if(!hr)throw new Error("Msgpack is required but not loaded");e=hr(o.Buffer.from(r.b,"base64"))}catch(t){e={}}return e}(t,n);break;case"JSON":n=function(t,e){for(const r of t)if(0!==r.i&&1!==r.i&&2===r.i)try{e=JSON.parse(r.s)}catch(t){e={}}return e}(t,n);break;case"SET":!function(t,e){let r=null;for(const n of t){if(!n.s||0===n.i||1===n.i)continue;const t=n.s;if(n.i%2==0)e[t]="",r=t;else{if(!r)throw new Error(`malformed MAP syntax. Cannot parse.${r}`);e[r]=t}}}(t,n)}})),d(t,"MAP",n)}};o=s("bfD9J");const pr=async function(t,e){const r=o.Buffer.from(t+e);return(await p(r)).toString("hex")},br={name:"METANET",address:"meta",opReturnSchema:[{address:"string"},{parent:"string"},{name:"string"}],handler:async({dataObj:t,cell:e,tx:r})=>{if(!(e.length&&"meta"===e[0].s&&e[1]&&e[1].s&&e[2]&&e[2].s&&r))throw new Error("Invalid Metanet tx "+r);const n=await pr(e[1].s,r.tx.h),i={a:e[1].s,tx:r.tx.h,id:n};let s={};if(r.in){const t=await pr(r.in[0].e.a,e[2].s);s={a:r.in[0].e.a,tx:e[2].s,id:t}}t.METANET||(t.METANET=[]),t.METANET.push({node:i,parent:s})}},mr="1GvFYzwtFix3qSAZhESQVTz9DeudHZNoh1",gr={name:"RON",address:mr,opReturnSchema:[{pair:"json"},{address:"string"},{timestamp:"string"}],handler:function({dataObj:t,cell:e,tx:r}){if(!(e[0].s===mr&&e[1]&&e[2]&&e[3]&&e[1].s&&e[2].s&&e[3].s))throw console.log({cell:e}),new Error(`Invalid RON record ${r?.tx.h}`);const n=JSON.parse(e[1].s),i=Number(e[3].s);d(t,"RON",{pair:n,address:e[2].s,timestamp:i})}},yr="1SymRe7erxM46GByucUWnB9fEEMgo7spd",vr={name:"SYMRE",address:yr,opReturnSchema:[{url:"string"}],handler:function({dataObj:t,cell:e,tx:r}){if(e[0].s!==yr||!e[1]||!e[1].s)throw new Error(`Invalid SymRe tx: ${r}`);d(t,"SYMRE",{url:e[1].s})}};var wr=(o=s("bfD9J")).Buffer;const _r="OP_SIZE OP_PICK OP_SHA256 OP_SWAP OP_SPLIT OP_DROP OP_EQUALVERIFY OP_DROP OP_CHECKSIG".split(" "),Sr={name:"21E8",handler:({dataObj:t,cell:e,out:r})=>{if(!e[0]||!r)throw new Error("Invalid 21e8 tx. dataObj, cell, out and tx are required.");const n=h(e[0],"hex"),i=h(e[1],"hex");if(!i)throw new Error("Invalid 21e8 target."+JSON.stringify(e[0],null,2));const s={target:i,difficulty:wr.from(i,"hex").byteLength,value:r.e.v,txid:n};d(t,"21E8",s)},scriptChecker:t=>{if(12!==t.length)return!1;const e=[...t].map((t=>t.ops)).splice(2,t.length),r=h(t[1],"hex"),n=wr.from(r).byteLength;return e[1]=`OP_${n}`,_r[1]=`OP_${n}`,e.join()===_r.join()}},Or=new Map([]),Er=new Map([]),Ir=new Map([]),Pr=new Map,Mr=[_,O,I,lr,br,Oe,Sr,P,Dt,jt,Ie,Lt,Nt,gr,vr];[_,O,I,lr,br].forEach((t=>{t.address&&Or.set(t.address,t.name),Er.set(t.name,t.handler),t.opReturnSchema&&Pr.set(t.name,t.opReturnSchema),t.scriptChecker&&Ir.set(t.name,t.scriptChecker)}));class Ar{constructor(){this.enabledProtocols=Or,this.protocolHandlers=Er,this.protocolScriptCheckers=Ir,this.protocolOpReturnSchemas=Pr}addProtocolHandler({name:t,address:e,opReturnSchema:r,handler:n,scriptChecker:i}){e&&this.enabledProtocols.set(e,t),this.protocolHandlers.set(t,n),r&&this.protocolOpReturnSchemas.set(t,r),i&&this.protocolScriptCheckers.set(t,i)}transformTx=async t=>{if(!t||!t.in||!t.out)throw new Error("Cannot process tx");const e={};for(const[r,n]of Object.entries(t))if("out"===r)for(const n of t.out){const{tape:i}=n;if(i?.some((t=>c(t))))for(const r of i){if(c(r))continue;const{cell:s}=r;if(!s)throw new Error("empty cell while parsing");const o=s[0].s;await this.process(this.enabledProtocols.get(o||"")||o||"",{cell:s,dataObj:e,tape:i,out:n,tx:t})}else{const s=this.protocolScriptCheckers.get(Oe.name),o=this.protocolScriptCheckers.get(Sr.name);if(i?.some((t=>{const{cell:e}=t;return!(!s||!s(e))||(!(!o||!o(e))||void 0)})))for(const r of i){const{cell:a}=r;if(!a)throw new Error("empty cell while parsing");let u="";if(s&&s(a))u=Oe.name;else{if(!o||!o(a))continue;u=Sr.name}this.process(u,{tx:t,cell:a,dataObj:e,tape:i,out:n})}else this.processUnknown(r,e,n)}}else e[r]="in"===r?n.map((t=>{const e={...t};return delete e.tape,e})):n;if(e.METANET&&t.parent){const r={ancestor:t.ancestor,parent:t.parent,child:t.child,head:t.head};e.METANET.push(r),delete e.ancestor,delete e.child,delete e.parent,delete e.head,delete e.node}return e};processUnknown=(t,e,r)=>{t&&!e[t]&&(e[t]=[]),e[t].push({i:r.i,e:r.e})};process=async(t,{cell:e,dataObj:r,tape:n,out:i,tx:s})=>{if(this.protocolHandlers.has(t)&&"function"==typeof this.protocolHandlers.get(t)){const o=this.protocolHandlers.get(t);o&&await o({dataObj:r,cell:e,tape:n,out:i,tx:s})}else d(r,t,e)}}const kr=async(t,e)=>{const r=new Ar;if(e){Or.clear();for(const t of Mr)e?.includes(t.name)&&r.addProtocolHandler(t)}return r.transformTx(t)};"undefined"!=typeof window&&(window.bmap={BMAP:Ar,TransformTx:kr,supportedProtocols:Mr.map((t=>t.name))},window.Buffer||(window.Buffer=o.Buffer)); //# sourceMappingURL=bmap.cjs.map