stackswap-front-api-test-02 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/esm/index.d.ts +106 -0
- package/dist/esm/index.js +196 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/stackswap/config.d.ts +172 -0
- package/dist/esm/stackswap/config.js +302 -0
- package/dist/esm/stackswap/config.js.map +1 -0
- package/dist/esm/stackswap/manager/bridge.manager.d.ts +27 -0
- package/dist/esm/stackswap/manager/bridge.manager.js +215 -0
- package/dist/esm/stackswap/manager/bridge.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/farm.manager.d.ts +41 -0
- package/dist/esm/stackswap/manager/farm.manager.js +293 -0
- package/dist/esm/stackswap/manager/farm.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/farm2.manager.d.ts +106 -0
- package/dist/esm/stackswap/manager/farm2.manager.js +625 -0
- package/dist/esm/stackswap/manager/farm2.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/farm3.manager.d.ts +121 -0
- package/dist/esm/stackswap/manager/farm3.manager.js +557 -0
- package/dist/esm/stackswap/manager/farm3.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/governance.manager.d.ts +9 -0
- package/dist/esm/stackswap/manager/governance.manager.js +68 -0
- package/dist/esm/stackswap/manager/governance.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/groupfarm.manager.d.ts +70 -0
- package/dist/esm/stackswap/manager/groupfarm.manager.js +379 -0
- package/dist/esm/stackswap/manager/groupfarm.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/launchpad.manager.d.ts +18 -0
- package/dist/esm/stackswap/manager/launchpad.manager.js +253 -0
- package/dist/esm/stackswap/manager/launchpad.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/lbtc.manager.d.ts +31 -0
- package/dist/esm/stackswap/manager/lbtc.manager.js +327 -0
- package/dist/esm/stackswap/manager/lbtc.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/lbtcstaking.manager.d.ts +61 -0
- package/dist/esm/stackswap/manager/lbtcstaking.manager.js +248 -0
- package/dist/esm/stackswap/manager/lbtcstaking.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/multisig.manager.d.ts +11 -0
- package/dist/esm/stackswap/manager/multisig.manager.js +50 -0
- package/dist/esm/stackswap/manager/multisig.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/nft.manager.d.ts +55 -0
- package/dist/esm/stackswap/manager/nft.manager.js +274 -0
- package/dist/esm/stackswap/manager/nft.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/operator.manager.d.ts +17 -0
- package/dist/esm/stackswap/manager/operator.manager.js +86 -0
- package/dist/esm/stackswap/manager/operator.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/other.manager.d.ts +9 -0
- package/dist/esm/stackswap/manager/other.manager.js +41 -0
- package/dist/esm/stackswap/manager/other.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/pool.manager.d.ts +34 -0
- package/dist/esm/stackswap/manager/pool.manager.js +172 -0
- package/dist/esm/stackswap/manager/pool.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/poxl.manager.d.ts +16 -0
- package/dist/esm/stackswap/manager/poxl.manager.js +72 -0
- package/dist/esm/stackswap/manager/poxl.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/staking.manager.d.ts +40 -0
- package/dist/esm/stackswap/manager/staking.manager.js +295 -0
- package/dist/esm/stackswap/manager/staking.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/swap.manager.d.ts +71 -0
- package/dist/esm/stackswap/manager/swap.manager.js +730 -0
- package/dist/esm/stackswap/manager/swap.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/token.manager.d.ts +32 -0
- package/dist/esm/stackswap/manager/token.manager.js +142 -0
- package/dist/esm/stackswap/manager/token.manager.js.map +1 -0
- package/dist/esm/stackswap/util.d.ts +35 -0
- package/dist/esm/stackswap/util.js +202 -0
- package/dist/esm/stackswap/util.js.map +1 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.LICENSE.txt +25 -0
- package/dist/stackswap/config.d.ts +172 -0
- package/dist/stackswap/config.js +308 -0
- package/dist/stackswap/config.js.map +1 -0
- package/dist/stackswap/manager/bridge.manager.d.ts +27 -0
- package/dist/stackswap/manager/bridge.manager.js +222 -0
- package/dist/stackswap/manager/bridge.manager.js.map +1 -0
- package/dist/stackswap/manager/farm.manager.d.ts +41 -0
- package/dist/stackswap/manager/farm.manager.js +301 -0
- package/dist/stackswap/manager/farm.manager.js.map +1 -0
- package/dist/stackswap/manager/farm2.manager.d.ts +106 -0
- package/dist/stackswap/manager/farm2.manager.js +632 -0
- package/dist/stackswap/manager/farm2.manager.js.map +1 -0
- package/dist/stackswap/manager/farm3.manager.d.ts +121 -0
- package/dist/stackswap/manager/farm3.manager.js +564 -0
- package/dist/stackswap/manager/farm3.manager.js.map +1 -0
- package/dist/stackswap/manager/governance.manager.d.ts +9 -0
- package/dist/stackswap/manager/governance.manager.js +75 -0
- package/dist/stackswap/manager/governance.manager.js.map +1 -0
- package/dist/stackswap/manager/groupfarm.manager.d.ts +70 -0
- package/dist/stackswap/manager/groupfarm.manager.js +386 -0
- package/dist/stackswap/manager/groupfarm.manager.js.map +1 -0
- package/dist/stackswap/manager/launchpad.manager.d.ts +18 -0
- package/dist/stackswap/manager/launchpad.manager.js +257 -0
- package/dist/stackswap/manager/launchpad.manager.js.map +1 -0
- package/dist/stackswap/manager/lbtc.manager.d.ts +31 -0
- package/dist/stackswap/manager/lbtc.manager.js +334 -0
- package/dist/stackswap/manager/lbtc.manager.js.map +1 -0
- package/dist/stackswap/manager/lbtcstaking.manager.d.ts +61 -0
- package/dist/stackswap/manager/lbtcstaking.manager.js +255 -0
- package/dist/stackswap/manager/lbtcstaking.manager.js.map +1 -0
- package/dist/stackswap/manager/multisig.manager.d.ts +11 -0
- package/dist/stackswap/manager/multisig.manager.js +54 -0
- package/dist/stackswap/manager/multisig.manager.js.map +1 -0
- package/dist/stackswap/manager/nft.manager.d.ts +55 -0
- package/dist/stackswap/manager/nft.manager.js +281 -0
- package/dist/stackswap/manager/nft.manager.js.map +1 -0
- package/dist/stackswap/manager/operator.manager.d.ts +17 -0
- package/dist/stackswap/manager/operator.manager.js +93 -0
- package/dist/stackswap/manager/operator.manager.js.map +1 -0
- package/dist/stackswap/manager/other.manager.d.ts +9 -0
- package/dist/stackswap/manager/other.manager.js +45 -0
- package/dist/stackswap/manager/other.manager.js.map +1 -0
- package/dist/stackswap/manager/pool.manager.d.ts +34 -0
- package/dist/stackswap/manager/pool.manager.js +180 -0
- package/dist/stackswap/manager/pool.manager.js.map +1 -0
- package/dist/stackswap/manager/poxl.manager.d.ts +16 -0
- package/dist/stackswap/manager/poxl.manager.js +79 -0
- package/dist/stackswap/manager/poxl.manager.js.map +1 -0
- package/dist/stackswap/manager/staking.manager.d.ts +40 -0
- package/dist/stackswap/manager/staking.manager.js +302 -0
- package/dist/stackswap/manager/staking.manager.js.map +1 -0
- package/dist/stackswap/manager/swap.manager.d.ts +71 -0
- package/dist/stackswap/manager/swap.manager.js +737 -0
- package/dist/stackswap/manager/swap.manager.js.map +1 -0
- package/dist/stackswap/manager/token.manager.d.ts +32 -0
- package/dist/stackswap/manager/token.manager.js +150 -0
- package/dist/stackswap/manager/token.manager.js.map +1 -0
- package/dist/stackswap/util.d.ts +35 -0
- package/dist/stackswap/util.js +219 -0
- package/dist/stackswap/util.js.map +1 -0
- package/package.json +45 -0
- package/src/index.ts +279 -0
- package/src/stackswap/config.ts +456 -0
- package/src/stackswap/manager/bridge.manager.ts +313 -0
- package/src/stackswap/manager/farm.manager.ts +399 -0
- package/src/stackswap/manager/farm2.manager.ts +733 -0
- package/src/stackswap/manager/farm3.manager.ts +690 -0
- package/src/stackswap/manager/governance.manager.ts +112 -0
- package/src/stackswap/manager/groupfarm.manager.ts +474 -0
- package/src/stackswap/manager/launchpad.manager.ts +307 -0
- package/src/stackswap/manager/lbtc.manager.ts +566 -0
- package/src/stackswap/manager/lbtcstaking.manager.ts +360 -0
- package/src/stackswap/manager/multisig.manager.ts +87 -0
- package/src/stackswap/manager/nft.manager.ts +352 -0
- package/src/stackswap/manager/operator.manager.ts +123 -0
- package/src/stackswap/manager/other.manager.ts +72 -0
- package/src/stackswap/manager/pool.manager.ts +202 -0
- package/src/stackswap/manager/poxl.manager.ts +99 -0
- package/src/stackswap/manager/staking.manager.ts +402 -0
- package/src/stackswap/manager/swap.manager.ts +902 -0
- package/src/stackswap/manager/token.manager.ts +177 -0
- package/src/stackswap/util.ts +275 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see index.umd.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StackswapFrontAPI=e():t.StackswapFrontAPI=e()}(self,(()=>(()=>{var t,e,r={7557:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function n(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function i(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function s(t,e){i(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.output=e.exists=e.hash=e.bytes=e.bool=e.number=void 0,e.number=r,e.bool=n,e.bytes=i,e.hash=o,e.exists=a,e.output=s;const u={number:r,bool:n,bytes:i,hash:o,exists:a,output:s};e.default=u},915:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const n=r(7557),i=r(9175);class o extends i.Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){n.default.exists(this);const{view:e,buffer:r,blockLen:o}=this,a=(t=(0,i.toBytes)(t)).length;for(let n=0;n<a;){const s=Math.min(o-this.pos,a-n);if(s!==o)r.set(t.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===o&&(this.process(e,0),this.pos=0);else{const e=(0,i.createView)(t);for(;o<=a-n;n+=o)this.process(e,n)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){n.default.exists(this),n.default.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:o,isLE:a}=this;let{pos:s}=this;e[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let t=s;t<o;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,a,n),t.setUint32(e+c,s,n)}(r,o-8,BigInt(8*this.length),a),this.process(r,0);const u=(0,i.createView)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=c/4,h=this.get();if(f>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<f;t++)u.setUint32(4*t,h[t],a)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return t.length=n,t.pos=a,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}e.SHA2=o},9301:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},9615:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const n=r(7557),i=r(9175);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,n.default.hash(t);const r=(0,i.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(r.length>o?t.create().update(r).digest():r);for(let t=0;t<a.length;t++)a[t]^=54;this.iHash.update(a),this.oHash=t.create();for(let t=0;t<a.length;t++)a[t]^=106;this.oHash.update(a),a.fill(0)}update(t){return n.default.exists(this),this.iHash.update(t),this}digestInto(t){n.default.exists(this),n.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:a}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.hmac=(t,e,r)=>new o(t,e).update(r).digest(),e.hmac.create=(t,e)=>new o(t,e)},2623:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const n=r(915),i=r(9175),o=(t,e,r)=>t&e^t&r^e&r,a=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class c extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[t,e,r,n,i,o,a,s]}set(t,e,r,n,i,o,a,s){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(t,e){for(let r=0;r<16;r++,e+=4)u[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=u[t-15],r=u[t-2],n=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;u[t]=o+u[t-7]+n+u[t-16]|0}let{A:r,B:n,C:s,D:c,E:f,F:h,G:l,H:d}=this;for(let t=0;t<64;t++){const e=d+((0,i.rotr)(f,6)^(0,i.rotr)(f,11)^(0,i.rotr)(f,25))+((p=f)&h^~p&l)+a[t]+u[t]|0,g=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+o(r,n,s)|0;d=l,l=h,h=f,f=c+e|0,c=s,s=n,n=r,r=e+g|0}var p;r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,h=h+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,n,s,c,f,h,l,d)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends c{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)((()=>new c)),e.sha224=(0,i.wrapConstructor)((()=>new f))},9175:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const n=r(9301);if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function o(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function a(t){if("string"==typeof t&&(t=o(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}e.bytesToHex=function(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=i[t[r]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e},e.nextTick=async()=>{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o<t;o++){n(o);const t=Date.now()-i;t>=0&&t<r||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=o,e.toBytes=a,e.concatBytes=function(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r},e.Hash=class{clone(){return this._cloneInto()}},e.checkOpts=function(t,e){if(void 0!==e&&("object"!=typeof e||(r=e,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new TypeError("Options should be object or undefined");var r;return Object.assign(t,e)},e.wrapConstructor=function(t){const e=e=>t().update(a(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(a(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(n.crypto.web)return n.crypto.web.getRandomValues(new Uint8Array(t));if(n.crypto.node)return new Uint8Array(n.crypto.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}},9598:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const n=r(4923),i=BigInt(0),o=BigInt(1),a=BigInt(2),s=BigInt(3),u=BigInt(8),c=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});e.CURVE=c;const f=(t,e)=>(t+e/a)/e,h={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=c,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=r,s=BigInt("0x100000000000000000000000000000000"),u=f(a*t,e),h=f(-n*t,e);let l=I(t-u*r-h*i,e),d=I(-u*n-h*a,e);const p=l>s,g=d>s;if(p&&(l=e-l),g&&(d=e-d),l>s||d>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:g,k2:d}}};function l(t){const{a:e,b:r}=c,n=I(t*t),i=I(n*t);return I(i+e*t+r)}const d=c.a===i;class p extends Error{constructor(t){super(t)}}function g(t){if(!(t instanceof y))throw new TypeError("JacobianPoint expected")}class y{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof b))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(b.ZERO)?y.ZERO:new y(t.x,t.y,o)}static toAffineBatch(t){const e=function(t,e=c.P){const r=new Array(t.length),n=L(t.reduce(((t,n,o)=>n===i?t:(r[o]=t,I(t*n,e))),o),e);return t.reduceRight(((t,n,o)=>n===i?t:(r[o]=I(t*r[o],e),I(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return y.toAffineBatch(t).map(y.fromAffine)}equals(t){g(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:a}=t,s=I(n*n),u=I(a*a),c=I(e*u),f=I(i*s),h=I(I(r*a)*u),l=I(I(o*n)*s);return c===f&&h===l}negate(){return new y(this.x,I(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=I(t*t),i=I(e*e),o=I(i*i),c=t+i,f=I(a*(I(c*c)-n-o)),h=I(s*n),l=I(h*h),d=I(l-a*f),p=I(h*(f-d)-u*o),g=I(a*e*r);return new y(d,p,g)}add(t){g(t);const{x:e,y:r,z:n}=this,{x:o,y:s,z:u}=t;if(o===i||s===i)return this;if(e===i||r===i)return t;const c=I(n*n),f=I(u*u),h=I(e*f),l=I(o*c),d=I(I(r*u)*f),p=I(I(s*n)*c),m=I(l-h),w=I(p-d);if(m===i)return w===i?this.double():y.ZERO;const b=I(m*m),v=I(m*b),_=I(h*b),S=I(w*w-v-a*_),A=I(w*(_-S)-d*v),T=I(n*u*m);return new y(S,A,T)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=y.ZERO;if("bigint"==typeof t&&t===i)return e;let r=x(t);if(r===o)return this;if(!d){let t=e,n=this;for(;r>i;)r&o&&(t=t.add(n)),n=n.double(),r>>=o;return t}let{k1neg:n,k1:a,k2neg:s,k2:u}=h.splitScalar(r),c=e,f=e,l=this;for(;a>i||u>i;)a&o&&(c=c.add(l)),u&o&&(f=f.add(l)),l=l.double(),a>>=o,u>>=o;return n&&(c=c.negate()),s&&(f=f.negate()),f=new y(I(f.x*h.beta),f.y,f.z),c.add(f)}precomputeWindow(t){const e=d?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(y.BASE)&&(e=b.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&w.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=y.normalizeZ(n),w.set(e,n)));let i=y.ZERO,a=y.BASE;const s=1+(d?128/r:256/r),u=2**(r-1),c=BigInt(2**r-1),f=2**r,h=BigInt(r);for(let e=0;e<s;e++){const r=e*u;let s=Number(t&c);t>>=h,s>u&&(s-=f,t+=o);const l=r,d=r+Math.abs(s)-1,p=e%2!=0,g=s<0;0===s?a=a.add(m(p,n[l])):i=i.add(m(g,n[d]))}return{p:i,f:a}}multiply(t,e){let r,n,i=x(t);if(d){const{k1neg:t,k1:o,k2neg:a,k2:s}=h.splitScalar(i);let{p:u,f:c}=this.wNAF(o,e),{p:f,f:l}=this.wNAF(s,e);u=m(t,u),f=m(a,f),f=new y(I(f.x*h.beta),f.y,f.z),r=u.add(f),n=c.add(l)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return y.normalizeZ([r,n])[0]}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(y.ZERO);null==t&&(t=i?u:L(n));const a=t,s=I(a*a),c=I(s*a),f=I(e*s),h=I(r*c),l=I(n*a);if(i)return b.ZERO;if(l!==o)throw new Error("invZ was invalid");return new b(f,h)}}function m(t,e){const r=e.negate();return t?r:e}y.BASE=new y(c.Gx,c.Gy,o),y.ZERO=new y(i,o,i);const w=new WeakMap;class b{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}hasEvenY(){return this.y%a===i}static fromCompressedHex(t){const e=32===t.length,r=N(e?t:t.subarray(1));if(!K(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=c,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),f=BigInt(88),h=t*t*t%e,l=h*h*t%e,d=F(l,s)*l%e,p=F(d,s)*l%e,g=F(p,a)*h%e,y=F(g,n)*g%e,m=F(y,i)*y%e,w=F(m,u)*m%e,b=F(w,f)*w%e,v=F(b,u)*m%e,_=F(v,s)*l%e,S=F(_,o)*y%e,A=F(S,r)*h%e,T=F(A,a);if(T*T%e!==t)throw new Error("Cannot find square root");return T}(l(r));const i=(n&o)===o;e?i&&(n=I(-n)):!(1&~t[0])!==i&&(n=I(-n));const u=new b(r,n);return u.assertValidity(),u}static fromUncompressedHex(t){const e=N(t.subarray(1,33)),r=N(t.subarray(33,65)),n=new b(e,r);return n.assertValidity(),n}static fromHex(t){const e=B(t),r=e.length,n=e[0];if(32===r)return this.fromCompressedHex(e);if(33===r&&(2===n||3===n))return this.fromCompressedHex(e);if(65===r&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return b.BASE.multiply(q(t))}static fromSignature(t,e,r){const{r:n,s:i}=G(e);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=D(B(t)),{n:a}=c,s=2===r||3===r?n+a:n,u=L(s,a),f=I(-o*u,a),h=I(i*u,a),l=1&r?"03":"02",d=b.fromHex(l+C(s)),p=b.BASE.multiplyAndAddUnsafe(d,f,h);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(t=!1){return R(this.toHex(t))}toHex(t=!1){const e=C(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${C(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!K(e)||!K(r))throw new Error(t);const n=I(r*r);if(I(n-l(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new b(this.x,I(-this.y))}double(){return y.fromAffine(this).double().toAffine()}add(t){return y.fromAffine(this).add(y.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return y.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=y.fromAffine(this),a=e===i||e===o||this!==b.BASE?n.multiplyUnsafe(e):n.multiply(e),s=y.fromAffine(t).multiplyUnsafe(r),u=a.add(s);return u.equals(y.ZERO)?void 0:u.toAffine()}}function v(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function _(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${E(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:N(r),left:t.subarray(e+2)}}e.Point=b,b.BASE=new b(c.Gx,c.Gy),b.ZERO=new b(i,i);class S{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?E(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new S(M(n.slice(0,64)),M(n.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${E(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=_(t.subarray(2)),{data:n,left:i}=_(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${E(i)}`);return{r:e,s:n}}(e?t:R(t));return new S(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!W(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!W(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=c.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new S(this.r,I(-this.s,c.n)):this}toDERRawBytes(){return R(this.toDERHex())}toDERHex(){const t=v(P(this.s)),e=v(P(this.r)),r=t.length/2,n=e.length/2,i=P(r),o=P(n);return`30${P(n+r+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return R(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}function A(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}e.Signature=S;const T=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function E(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=T[t[r]];return e}const k=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function C(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(i<=t&&t<k))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function O(t){const e=R(C(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function P(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function M(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function R(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function N(t){return M(E(t))}function B(t){return t instanceof Uint8Array?Uint8Array.from(t):R(t)}function x(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&W(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function I(t,e=c.P){const r=t%e;return r>=i?r:e+r}function F(t,e){const{P:r}=c;let n=t;for(;e-- >i;)n*=n,n%=r;return n}function L(t,e=c.P){if(t===i||e<=i)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=I(t,e),n=e,a=i,s=o,u=o,f=i;for(;r!==i;){const t=n/r,e=n%r,i=a-u*t,o=s-f*t;n=r,r=e,a=u,s=f,u=i,f=o}if(n!==o)throw new Error("invert: does not exist");return I(a,e)}function D(t,e=!1){const r=function(t){const e=8*t.length-256,r=N(t);return e>0?r>>BigInt(e):r}(t);if(e)return r;const{n}=c;return r>=n?r-n:r}let U,V;class j{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return e.utils.hmacSha256(this.k,...t)}hmacSync(...t){return V(this.k,...t)}checkSync(){if("function"!=typeof V)throw new p("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();e.push(r),t+=this.v.length}return A(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();e.push(r),t+=this.v.length}return A(...e)}}function W(t){return i<t&&t<c.n}function K(t){return i<t&&t<c.P}function H(t,e,r,n=!0){const{n:a}=c,s=D(t,!0);if(!W(s))return;const u=L(s,a),f=b.BASE.multiply(s),h=I(f.x,a);if(h===i)return;const l=I(u*I(e+r*h,a),a);if(l===i)return;let d=new S(h,l),p=(f.x===d.r?0:2)|Number(f.y&o);return n&&d.hasHighS()&&(d=d.normalizeS(),p^=1),{sig:d,recovery:p}}function q(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=M(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=N(t)}if(!W(e))throw new Error("Expected private key: 0 < key < n");return e}function z(t){return t instanceof b?(t.assertValidity(),t):b.fromHex(t)}function G(t){if(t instanceof S)return t.assertValidity(),t;try{return S.fromDER(t)}catch(e){return S.fromCompact(t)}}function $(t){const e=t instanceof Uint8Array,r="string"==typeof t,n=(e||r)&&t.length;return e?33===n||65===n:r?66===n||130===n:t instanceof b}function X(t){return N(t.length>32?t.slice(0,32):t)}function J(t){const e=X(t),r=I(e,c.n);return Y(r<i?e:r)}function Y(t){return O(t)}function Z(t,r,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=B(t),o=q(r),a=[Y(o),J(i)];if(null!=n){!0===n&&(n=e.utils.randomBytes(32));const t=B(n);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");a.push(t)}return{seed:A(...a),m:X(i),d:o}}function Q(t,e){const{sig:r,recovery:n}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),a=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}e.getPublicKey=function(t,e=!1){return b.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,r,n=!1){return b.fromSignature(t,e,r).toRawBytes(n)},e.getSharedSecret=function(t,e,r=!1){if($(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!$(e))throw new TypeError("getSharedSecret: second arg must be public key");const n=z(e);return n.assertValidity(),n.multiply(q(t)).toRawBytes(r)},e.sign=async function(t,e,r={}){const{seed:n,m:i,d:o}=Z(t,e,r.extraEntropy),a=new j(32,32);let s;for(await a.reseed(n);!(s=H(await a.generate(),i,o,r.canonical));)await a.reseed();return Q(s,r)},e.signSync=function(t,e,r={}){const{seed:n,m:i,d:o}=Z(t,e,r.extraEntropy),a=new j(32,32);let s;for(a.reseedSync(n);!(s=H(a.generateSync(),i,o,r.canonical));)a.reseedSync();return Q(s,r)};const tt={strict:!0};function et(t){return I(N(t),c.n)}e.verify=function(t,e,r,n=tt){let i;try{i=G(t),e=B(e)}catch(t){return!1}const{r:o,s:a}=i;if(n.strict&&i.hasHighS())return!1;const s=D(e);let u;try{u=z(r)}catch(t){return!1}const{n:f}=c,h=L(a,f),l=I(s*h,f),d=I(o*h,f),p=b.BASE.multiplyAndAddUnsafe(u,l,d);return!!p&&I(p.x,f)===o};class rt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=B(t);if(64!==e.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${e.length}`);const r=N(e.subarray(0,32)),n=N(e.subarray(32,64));return new rt(r,n)}assertValidity(){const{r:t,s:e}=this;if(!K(t)||!W(e))throw new Error("Invalid signature")}toHex(){return C(this.r)+C(this.s)}toRawBytes(){return R(this.toHex())}}class nt{constructor(t,r,n=e.utils.randomBytes()){if(null==t)throw new TypeError(`sign: Expected valid message, not "${t}"`);this.m=B(t);const{x:i,scalar:o}=this.getScalar(q(r));if(this.px=i,this.d=o,this.rand=B(n),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=b.fromPrivateKey(t),r=e.hasEvenY()?t:c.n-t;return{point:e,scalar:r,x:e.toRawX()}}initNonce(t,e){return O(t^N(e))}finalizeNonce(t){const e=I(N(t),c.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:r,x:n,scalar:o}=this.getScalar(e);return{R:r,rx:n,k:o}}finalizeSig(t,e,r,n){return new rt(t.x,I(e+r*n,c.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:t,d:r,px:n,rand:i}=this,o=e.utils.taggedHash,a=this.initNonce(r,await o(ct.aux,i)),{R:s,rx:u,k:c}=this.finalizeNonce(await o(ct.nonce,a,n,t)),f=et(await o(ct.challenge,u,n,t)),h=this.finalizeSig(s,c,f,r);return await at(h,t,n)||this.error(),h}calcSync(){const{m:t,d:r,px:n,rand:i}=this,o=e.utils.taggedHashSync,a=this.initNonce(r,o(ct.aux,i)),{R:s,rx:u,k:c}=this.finalizeNonce(o(ct.nonce,a,n,t)),f=et(o(ct.challenge,u,n,t)),h=this.finalizeSig(s,c,f,r);return st(h,t,n)||this.error(),h}}function it(t,e,r){const n=t instanceof rt,i=n?t:rt.fromHex(t);return n&&i.assertValidity(),{...i,m:B(e),P:z(r)}}function ot(t,e,r,n){const i=b.BASE.multiplyAndAddUnsafe(e,q(r),I(-n,c.n));return!(!i||!i.hasEvenY()||i.x!==t)}async function at(t,r,n){try{const{r:i,s:o,m:a,P:s}=it(t,r,n),u=et(await e.utils.taggedHash(ct.challenge,O(i),s.toRawX(),a));return ot(i,s,o,u)}catch(t){return!1}}function st(t,r,n){try{const{r:i,s:o,m:a,P:s}=it(t,r,n),u=et(e.utils.taggedHashSync(ct.challenge,O(i),s.toRawX(),a));return ot(i,s,o,u)}catch(t){if(t instanceof p)throw t;return!1}}e.schnorr={Signature:rt,getPublicKey:function(t){return b.fromPrivateKey(t).toRawX()},sign:async function(t,e,r){return new nt(t,e,r).calc()},verify:at,signSync:function(t,e,r){return new nt(t,e,r).calcSync()},verifySync:st},b.BASE._setWindowSize(8);const ut={node:n,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ct={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},ft={};e.utils={bytesToHex:E,hexToBytes:R,concatBytes:A,mod:I,invert:L,isValidPrivateKey(t){try{return q(t),!0}catch(t){return!1}},_bigintTo32Bytes:O,_normalizePrivateKey:q,hashToPrivateKey:t=>{if((t=B(t)).length<40||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return O(I(N(t),c.n-o)+o)},randomBytes:(t=32)=>{if(ut.web)return ut.web.getRandomValues(new Uint8Array(t));if(ut.node){const{randomBytes:e}=ut.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(40)),precompute(t=8,e=b.BASE){const r=e===b.BASE?e:new b(e.x,e.y);return r._setWindowSize(t),r.multiply(s),r},sha256:async(...t)=>{if(ut.web){const e=await ut.web.subtle.digest("SHA-256",A(...t));return new Uint8Array(e)}if(ut.node){const{createHash:e}=ut.node,r=e("sha256");return t.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(ut.web){const r=await ut.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=A(...e),i=await ut.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(ut.node){const{createHmac:r}=ut.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...r)=>{let n=ft[t];if(void 0===n){const r=await e.utils.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=A(r,r),ft[t]=n}return e.utils.sha256(n,...r)},taggedHashSync:(t,...e)=>{if("function"!=typeof U)throw new p("sha256Sync is undefined, you need to set it");let r=ft[t];if(void 0===r){const e=U(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=A(e,e),ft[t]=r}return U(r,...e)},_JacobianPoint:y},Object.defineProperties(e.utils,{sha256Sync:{configurable:!1,get:()=>U,set(t){U||(U=t)}},hmacSha256Sync:{configurable:!1,get:()=>V,set(t){V||(V=t)}}})},5741:(t,e,r)=>{"use strict";function n(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function s(t){n(a,i,o,s,u,"next",t)}function u(t){n(a,i,o,s,u,"throw",t)}s(void 0)}))}}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function s(t,e){return s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},s(t,e)}function u(t,e,r){return u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&s(i,r.prototype),i},u.apply(null,arguments)}function c(t){var e="function"==typeof Map?new Map:void 0;return c=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,t)},c(t)}r.d(e,{Rx:()=>i,Xx:()=>c,lQ:()=>o})},6327:(t,e,r)=>{"use strict";var n,i;r.d(e,{J_:()=>i,n_:()=>n,zB:()=>o}),function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(n||(n={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(i||(i={}));var o="https://hub.blockstack.org"},9725:(t,e,r)=>{"use strict";r.d(e,{C:()=>a});var n=r(5741);function i(t,e){return t(e={exports:{}},e.exports),e.exports}const o=i((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof y?e:y,o=Object.create(i.prototype),a=new O(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?p:l,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",d="executing",p="completed",g={};function y(){}function m(){}function w(){}var b={};b[o]=function(){return this};var v=Object.getPrototypeOf,_=v&&v(v(P([])));_&&_!==r&&n.call(_,o)&&(b=_);var S=w.prototype=y.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(i,o,a,s){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:M}}function M(){return{value:e,done:!0}}return m.prototype=S.constructor=w,w.constructor=m,m.displayName=u(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},A(T.prototype),T.prototype[a]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new T(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(S),u(S,s,"Generator"),S[o]=function(){return this},S.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function a(t,e){return s.apply(this,arguments)}function s(){return(s=(0,n.Rx)(o.mark((function t(e,r){var n,i,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={referrer:"no-referrer",referrerPolicy:"no-referrer"},i=Object.assign(n,r),t.next=4,fetch(e,i);case 4:return a=t.sent,t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}r(6547)},9261:()=>{},668:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AppConfig:()=>S,BLOCKSTACK_APP_PRIVATE_KEY_LABEL:()=>u,BLOCKSTACK_HANDLER:()=>n,BLOCKSTACK_STORAGE_LABEL:()=>i,ContractCallArgumentType:()=>cr,DEFAULT_BLOCKSTACK_HOST:()=>o,DEFAULT_CORE_NODE:()=>c,DEFAULT_PROFILE:()=>a,DEFAULT_SCOPE:()=>s,LOCALSTORAGE_SESSION_KEY:()=>h,NAME_LOOKUP_PATH:()=>f,TransactionTypes:()=>sr,UserSession:()=>He,authenticate:()=>gr,decryptPrivateKey:()=>ce,defaultAuthURL:()=>or,doPublicKeysMatchIssuer:()=>be,doPublicKeysMatchUsername:()=>ve,doSignaturesMatchPublicKeys:()=>we,fetchAppManifest:()=>ye,getAddressFromDID:()=>I,getAuthRequestFromURL:()=>ge,getDIDType:()=>x,getOrCreateUserSession:()=>pr,getStacksProvider:()=>Ye,getUserData:()=>yr,isExpirationDateValid:()=>Ae,isIssuanceDateValid:()=>Se,isManifestUriValid:()=>Te,isMobile:()=>lr,isRedirectUriValid:()=>Ee,isStacksWalletInstalled:()=>Ze,lookupProfile:()=>Je,makeAuthRequest:()=>ae,makeAuthResponse:()=>he,makeContractCallToken:()=>Qa,makeContractDeployToken:()=>ts,makeDIDFromAddress:()=>N,makeDIDFromPublicKey:()=>B,makeSTXTransferToken:()=>es,openContractCall:()=>is,openContractDeploy:()=>os,openSTXTransfer:()=>as,shouldUsePopup:()=>dr,showBlockstackConnect:()=>cs,showConnect:()=>us,verifyAuthRequest:()=>ke,verifyAuthRequestAndLoadManifest:()=>Oe,verifyAuthResponse:()=>Me});for(var n="blockstack",i="blockstack",o="https://browser.blockstack.org/auth",a={"@type":"Person","@context":"http://schema.org"},s=["store_write"],u="blockstack-transit-private-key",c="https://core.blockstack.org",f="/v1/names",h="blockstack-session",l=["debug","info","warn","error","none"],d={},p=0;p<l.length;p++)d[l[p]]=p;var g=function(){function t(){}return t.error=function(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))},t.warn=function(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))},t.info=function(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))},t.debug=function(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))},t.logMessage=function(t,e){return"["+t.toUpperCase()+"] "+e},t.shouldLog=function(t){return d.debug<=d[t]},t}(),y="blockstack";function m(){return new Date((new Date).setMonth((new Date).getMonth()+1))}function w(t,e){void 0!==t&&""!==t||(t="0.0.0"),void 0!==e&&""!==t||(e="0.0.0");for(var r=t.split(".").map((function(t){return parseInt(t,10)})),n=e.split(".").map((function(t){return parseInt(t,10)})),i=0;i<e.length;i++)if(i>=t.length&&n.push(0),r[i]<n[i])return!1;return!0}function b(){var t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function v(t,e){try{var n;if("undefined"!=typeof URL)n=function(t){return new URL(t)};else try{var i=r(8835).URL;n=function(t){return new i(t)}}catch(t){throw console.log(t),new Error("Global URL class is not available")}var o=n(t),a=n(e),s=0|parseInt(o.port||"0",10)||("https:"===o.protocol?443:80),u=0|parseInt(a.port||"0",10)||("https:"===a.protocol?443:80),c={scheme:o.protocol===a.protocol,hostname:o.hostname===a.hostname,port:s===u,absolute:(t.includes("http://")||t.includes("https://"))&&(e.includes("http://")||e.includes("https://"))};return c.scheme&&c.hostname&&c.port&&c.absolute}catch(t){return console.log(t),console.log("Parsing error in same URL origin check"),!1}}function _(t,e){var n=void 0===e?{}:e,i=n.throwIfUnavailable,o=n.usageDesc,a=n.returnEmptyObject,s=void 0;try{if(s=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}()){var u=s[t];if(u)return u}}catch(e){g.error("Error getting object '"+t+"' from global scope '"+s+"': "+e)}if(i){var c=function(t,e,r){return r?"Use of '"+r+"' requires `"+e+"` which is unavailable on the '"+t+"' object within the currently executing environment.":"`"+e+"` is unavailable on the '"+t+"' object within the currently executing environment."}(s,t.toString(),o);throw g.error(c),new Error(c)}if(a)return{}}var S=function(){function t(t,e,r,n,i,a){var u;void 0===t&&(t=s.slice()),void 0===e&&(e=null==(u=_("location",{returnEmptyObject:!0}))?void 0:u.origin),void 0===r&&(r=""),void 0===n&&(n="/manifest.json"),void 0===i&&(i=void 0),void 0===a&&(a=o),this.appDomain=e,this.scopes=t,this.redirectPath=r,this.manifestPath=n,this.coreNode=i,this.authenticatorURL=a}var e=t.prototype;return e.redirectURI=function(){return""+this.appDomain+this.redirectPath},e.manifestURI=function(){return""+this.appDomain+this.manifestPath},t}(),A=r(5741),T={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(T);var E=function(t){function e(e){var r;r=t.call(this)||this;var n=e.message,i="Error Code: "+e.code,o=r.stack;if(o)i+="Stack Trace:\n"+o;else try{throw new Error}catch(t){o=t.stack}return n+="\nIf you believe this exception is caused by a bug in blockstack.js,\n please file a bug report: https://github.com/blockstack/blockstack.js/issues\n\n"+i,r.message=n,r.code=e.code,r.parameter=e.parameter?e.parameter:void 0,r}return(0,A.lQ)(e,t),e.prototype.toString=function(){return t.prototype.toString.call(this)+"\n code: "+this.code+" param: "+(this.parameter?this.parameter:"n/a")},e}((0,A.Xx)(Error)),k=function(t){function e(e,r){var n;return void 0===r&&(r=""),(n=t.call(this,{code:T.MISSING_PARAMETER,message:r,parameter:e})||this).name="MissingParametersError",n}return(0,A.lQ)(e,t),e}(E),C=function(t){function e(e){var r;return void 0===e&&(e=""),(r=t.call(this,{code:T.INVALID_DID_ERROR,message:e})||this).name="InvalidDIDError",r}return(0,A.lQ)(e,t),e}(E),O=function(t){function e(e){var r,n="Failed to login: "+e;return(r=t.call(this,{code:T.LOGIN_FAILED_ERROR,message:n})||this).message=n,r.name="LoginFailedError",r}return(0,A.lQ)(e,t),e}(E),P=function(t){function e(e){var r;return void 0===e&&(e="Unable to decrypt cipher object."),(r=t.call(this,{code:T.FAILED_DECRYPTION_ERROR,message:e})||this).message=e,r.name="FailedDecryptionError",r}return(0,A.lQ)(e,t),e}(E),M=function(t){function e(e){var r;return(r=t.call(this,{code:T.INVALID_STATE,message:e})||this).message=e,r.name="InvalidStateError",r}return(0,A.lQ)(e,t),e}(E),R=function(t){function e(e){var r;return(r=t.call(this,{code:T.INVALID_STATE,message:e})||this).message=e,r.name="NoSessionDataError",r}return(0,A.lQ)(e,t),e}(E);function N(t){return"did:btc-addr:"+t}function B(t){return"did:ecdsa-pub:"+t}function x(t){var e=t.split(":");if(3!==e.length)throw new C("Decentralized IDs must have 3 parts");if("did"!==e[0].toLowerCase())throw new C('Decentralized IDs must start with "did"');return e[1].toLowerCase()}function I(t){if(t)return"btc-addr"===x(t)?t.split(":")[2]:void 0}function F(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function L(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){F(o,n,i,a,s,"next",t)}function s(t){F(o,n,i,a,s,"throw",t)}a(void 0)}))}}function D(){return D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},D.apply(this,arguments)}function U(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function V(t,e){return t(e={exports:{}},e.exports),e.exports}var j=V((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof y?e:y,o=Object.create(i.prototype),a=new O(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?p:l,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",d="executing",p="completed",g={};function y(){}function m(){}function w(){}var b={};b[o]=function(){return this};var v=Object.getPrototypeOf,_=v&&v(v(P([])));_&&_!==r&&n.call(_,o)&&(b=_);var S=w.prototype=y.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(i,o,a,s){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:M}}function M(){return{value:e,done:!0}}return m.prototype=S.constructor=w,w.constructor=m,m.displayName=u(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},A(T.prototype),T.prototype[a]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new T(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(S),u(S,s,"Generator"),S[o]=function(){return this},S.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));const W=j;r(6547);var K=r(9057),H=r(3209),q=r.n(H),z=r(1757),G=r(2802);function $(t){var e=new G.sha256;return e.update(t),e.digest()}function X(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function J(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){X(o,n,i,a,s,"next",t)}function s(t){X(o,n,i,a,s,"throw",t)}a(void 0)}))}}function Y(t,e){return t(e={exports:{}},e.exports),e.exports}r(8287).Buffer;var Z=Y((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof y?e:y,o=Object.create(i.prototype),a=new O(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?p:l,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",d="executing",p="completed",g={};function y(){}function m(){}function w(){}var b={};b[o]=function(){return this};var v=Object.getPrototypeOf,_=v&&v(v(P([])));_&&_!==r&&n.call(_,o)&&(b=_);var S=w.prototype=y.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(i,o,a,s){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=f(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:M}}function M(){return{value:e,done:!0}}return m.prototype=S.constructor=w,w.constructor=m,m.displayName=u(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},A(T.prototype),T.prototype[a]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new T(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(S),u(S,s,"Generator"),S[o]=function(){return this},S.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));const Q=Z;function tt(){return et.apply(this,arguments)}function et(){return(et=J(Q.mark((function t(){var e;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"==typeof crypto||void 0===crypto.subtle){t.next=4;break}return t.abrupt("return",{lib:crypto.subtle,name:"subtleCrypto"});case 4:return t.prev=4,e=r(1046),t.abrupt("return",{lib:e,name:"nodeCrypto"});case 9:throw t.prev=9,t.t0=t.catch(4),new Error('Crypto lib not found. Either the WebCrypto "crypto.subtle" or Node.js "crypto" module must be available.');case 12:case"end":return t.stop()}}),t,null,[[4,9]])})))).apply(this,arguments)}const rt=new Array(16),nt=wt([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]),it=wt([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]),ot=wt([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]),at=wt([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]),st=mt([0,1518500249,1859775393,2400959708,2840853838]),ut=mt([1352829926,1548603684,1836072691,2053994217,0]);function ct(t,e){return t<<e|t>>>32-e}function ft(t,e,r,n,i,o,a,s){return ct(t+(e^r^n)+o+a|0,s)+i|0}function ht(t,e,r,n,i,o,a,s){return ct(t+(e&r|~e&n)+o+a|0,s)+i|0}function lt(t,e,r,n,i,o,a,s){return ct(t+((e|~r)^n)+o+a|0,s)+i|0}function dt(t,e,r,n,i,o,a,s){return ct(t+(e&n|r&~n)+o+a|0,s)+i|0}function pt(t,e,r,n,i,o,a,s){return ct(t+(e^(r|~n))+o+a|0,s)+i|0}function gt(t,e,r){return e=+e,t[3+(r>>>=0)]=e>>>24,t[r+2]=e>>>16,t[r+1]=e>>>8,t[r]=255&e,r+4}function yt(t,e,r){return e=+e,t[r>>>=0]=255&e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,r+4}function mt(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function wt(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function bt(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}const vt=class{constructor(){this._block=bt(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const e=this._block;let r=0;for(;this._blockOffset+t.length-r>=this._blockSize;){for(let n=this._blockOffset;n<this._blockSize;)e[n++]=t[r++];this._update(),this._blockOffset=0}for(;r<t.length;)e[this._blockOffset++]=t[r++];for(let e=0,r=8*t.length;r>0;++e)this._length[e]+=r,r=this._length[e]/4294967296|0,r>0&&(this._length[e]-=4294967296*r);return this}_update(){const t=rt;for(let n=0;n<16;++n)t[n]=(r=4*n,(e=this._block)[r>>>=0]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24);var e,r;let n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,l=0|this._e;for(let e=0;e<80;e+=1){let r,d;e<16?(r=ft(n,i,o,a,s,t[nt[e]],st[0],ot[e]),d=pt(u,c,f,h,l,t[it[e]],ut[0],at[e])):e<32?(r=ht(n,i,o,a,s,t[nt[e]],st[1],ot[e]),d=dt(u,c,f,h,l,t[it[e]],ut[1],at[e])):e<48?(r=lt(n,i,o,a,s,t[nt[e]],st[2],ot[e]),d=lt(u,c,f,h,l,t[it[e]],ut[2],at[e])):e<64?(r=dt(n,i,o,a,s,t[nt[e]],st[3],ot[e]),d=ht(u,c,f,h,l,t[it[e]],ut[3],at[e])):(r=pt(n,i,o,a,s,t[nt[e]],st[4],ot[e]),d=ft(u,c,f,h,l,t[it[e]],ut[4],at[e])),n=s,s=a,a=ct(o,10),o=i,i=r,u=l,l=h,h=ct(f,10),f=c,c=d}const d=this._b+o+h|0;this._b=this._c+a+l|0,this._c=this._d+s+u|0,this._d=this._e+n+c|0,this._e=this._a+i+f|0,this._a=d}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,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),gt(this._block,this._length[0],56),gt(this._block,this._length[1],60),this._update();const t=bt(20);yt(t,this._a,0),yt(t,this._b,4),yt(t,this._c,8),yt(t,this._d,12),yt(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}};var _t=r(8287).Buffer,St=function(){function t(){}return t.prototype.digest=function(t){var e=new vt;e.update(t);var r=e.digest();return Array.isArray(r)?_t.from(r):_t.from(r.buffer)},t}(),At=function(){function t(t){this.nodeCryptoCreateHash=t}return t.prototype.digest=function(t){try{return this.nodeCryptoCreateHash("rmd160").update(t).digest()}catch(e){try{return this.nodeCryptoCreateHash("ripemd160").update(t).digest()}catch(r){return console.log(e),console.log("Node.js `crypto.createHash` exists but failing to digest for ripemd160, falling back to js implementation"),(new St).digest(t)}}},t}();function Tt(t){return(e=function(t){try{var e=r(1046);return!!e&&(!t||t(e))}catch(t){return!1}}((function(t){return"function"==typeof t.createHash&&t.createHash})),e?new At(e):new St).digest(t);var e}var Et=r(8287).Buffer;function kt(t){return t||(t=32),q()(t)}function Ct(t){var e=Tt($(Et.isBuffer(t)?t:Et.from(t,"hex")));return z.hl.toBase58Check(e,z.o8.bitcoin.pubKeyHash)}function Ot(t){var e=Et.isBuffer(t)?t:Et.from(t,"hex");return z.Jc.fromPrivateKey(e).publicKey.toString("hex")}function Pt(t,e){var r={network:e||z.o8.bitcoin,compressed:!0};if(66===t.length){if("01"!==t.slice(64))throw new Error("Improperly formatted private-key hex string. 66-length hex usually indicates compressed key, but last byte must be == 1");return z.Jc.fromPrivateKey(Et.from(t.slice(0,64),"hex"),r)}if(64===t.length)return r.compressed=!1,z.Jc.fromPrivateKey(Et.from(t,"hex"),r);throw new Error("Improperly formatted private-key hex string: length should be 64 or 66.")}function Mt(t){var e=Tt($(t.publicKey));return z.hl.toBase58Check(e,t.network.pubKeyHash)}var Rt=r(6729),Nt=r(8287).Buffer,Bt=function(){function t(t){this.createHmac=t}return t.prototype.digest=function(){var t=J(Q.mark((function t(e,r){var n;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.createHmac("sha256",e).update(r).digest(),t.abrupt("return",Promise.resolve(n));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),xt=function(){function t(t){this.subtleCrypto=t}return t.prototype.digest=function(){var t=J(Q.mark((function t(e,r){var n,i;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.subtleCrypto.importKey("raw",e,{name:"HMAC",hash:"SHA-256"},!0,["sign"]);case 2:return n=t.sent,t.next=5,this.subtleCrypto.sign({name:"HMAC",hash:"SHA-256"},n,r);case 5:return i=t.sent,t.abrupt("return",Nt.from(i));case 7:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}();function It(){return Ft.apply(this,arguments)}function Ft(){return(Ft=J(Q.mark((function t(){var e;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,tt();case 2:if("subtleCrypto"!==(e=t.sent).name){t.next=7;break}return t.abrupt("return",new xt(e.lib));case 7:return t.abrupt("return",new Bt(e.lib.createHmac));case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Lt=r(8287).Buffer,Dt=function(){function t(t,e){this.createCipher=t,this.createDecipher=e}var e=t.prototype;return e.encrypt=function(){var t=J(Q.mark((function t(e,r,n,i){var o,a;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("aes-128-cbc"===e||"aes-256-cbc"===e){t.next=2;break}throw new Error('Unsupported cipher algorithm "'+e+'"');case 2:return o=this.createCipher(e,r,n),a=Lt.concat([o.update(i),o.final()]),t.abrupt("return",Promise.resolve(a));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,i){return t.apply(this,arguments)}}(),e.decrypt=function(){var t=J(Q.mark((function t(e,r,n,i){var o,a;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("aes-128-cbc"===e||"aes-256-cbc"===e){t.next=2;break}throw new Error('Unsupported cipher algorithm "'+e+'"');case 2:return o=this.createDecipher(e,r,n),a=Lt.concat([o.update(i),o.final()]),t.abrupt("return",Promise.resolve(a));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,i){return t.apply(this,arguments)}}(),t}(),Ut=function(){function t(t){this.subtleCrypto=t}var e=t.prototype;return e.encrypt=function(){var t=J(Q.mark((function t(e,r,n,i){var o,a,s,u;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("aes-128-cbc"!==e){t.next=5;break}o="AES-CBC",a=128,t.next=11;break;case 5:if("aes-256-cbc"!==e){t.next=10;break}o="AES-CBC",a=256,t.next=11;break;case 10:throw new Error('Unsupported cipher algorithm "'+e+'"');case 11:return t.next=13,this.subtleCrypto.importKey("raw",r,{name:o,length:a},!1,["encrypt"]);case 13:return s=t.sent,t.next=16,this.subtleCrypto.encrypt({name:o,iv:n},s,i);case 16:return u=t.sent,t.abrupt("return",Lt.from(u));case 18:case"end":return t.stop()}}),t,this)})));return function(e,r,n,i){return t.apply(this,arguments)}}(),e.decrypt=function(){var t=J(Q.mark((function t(e,r,n,i){var o,a,s,u;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("aes-128-cbc"!==e){t.next=5;break}o="AES-CBC",a=128,t.next=11;break;case 5:if("aes-256-cbc"!==e){t.next=10;break}o="AES-CBC",a=256,t.next=11;break;case 10:throw new Error('Unsupported cipher algorithm "'+e+'"');case 11:return t.next=13,this.subtleCrypto.importKey("raw",r,{name:o,length:a},!1,["decrypt"]);case 13:return s=t.sent,t.next=16,this.subtleCrypto.decrypt({name:o,iv:n},s,i);case 16:return u=t.sent,t.abrupt("return",Lt.from(u));case 18:case"end":return t.stop()}}),t,this)})));return function(e,r,n,i){return t.apply(this,arguments)}}(),t}();function Vt(){return jt.apply(this,arguments)}function jt(){return(jt=J(Q.mark((function t(){var e;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,tt();case 2:if("subtleCrypto"!==(e=t.sent).name){t.next=7;break}return t.abrupt("return",new Ut(e.lib));case 7:return t.abrupt("return",new Dt(e.lib.createCipheriv,e.lib.createDecipheriv));case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Wt=r(8287).Buffer,Kt=new Rt.ec("secp256k1");function Ht(t,e,r){return qt.apply(this,arguments)}function qt(){return(qt=J(Q.mark((function t(e,r,n){var i,o;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Vt();case 2:return i=t.sent,t.next=5,i.encrypt("aes-256-cbc",r,e,n);case 5:return o=t.sent,t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zt(t,e,r){return Gt.apply(this,arguments)}function Gt(){return(Gt=J(Q.mark((function t(e,r,n){var i,o;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Vt();case 2:return i=t.sent,t.next=5,i.decrypt("aes-256-cbc",r,e,n);case 5:return o=t.sent,t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t,e){return Xt.apply(this,arguments)}function Xt(){return Xt=J(Q.mark((function t(e,r){var n;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,It();case 2:return n=t.sent,t.abrupt("return",n.digest(e,r));case 4:case"end":return t.stop()}}),t)}))),Xt.apply(this,arguments)}function Jt(t,e){if(t.length!==e.length)return!1;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 0===r}function Yt(t){var e,r,n=(e=t,(r=new G.sha512).update(e),r.digest());return{encryptionKey:n.slice(0,32),hmacKey:n.slice(32)}}function Zt(t){var e=t.toArrayLike(Wt,"be",32);if(32!==e.byteLength)throw new Error("Generated a 32-byte BN for encryption. Failing.");return e}function Qt(t,e,r,n){return te.apply(this,arguments)}function te(){return(te=J(Q.mark((function t(e,r,n,i){var o,a,s,u,c,f,h,l,d,p,g,y;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Kt.keyFromPublic(e,"hex").getPublic(),a=Kt.genKeyPair(),s=Wt.from(a.getPublic().encodeCompressed()),u=a.derive(o),c=Zt(u),f=Yt(c),h=q()(16),t.next=9,Ht(h,f.encryptionKey,r);case 9:return l=t.sent,d=Wt.concat([h,s,l]),t.next=13,$t(f.hmacKey,d);case 13:if(p=t.sent,i&&"hex"!==i){t.next=18;break}g=l.toString("hex"),t.next=23;break;case 18:if("base64"!==i){t.next=22;break}g=l.toString("base64"),t.next=23;break;case 22:throw new Error('Unexpected cipherTextEncoding "'+i+'"');case 23:return y={iv:h.toString("hex"),ephemeralPK:s.toString("hex"),cipherText:g,mac:p.toString("hex"),wasString:!!n},i&&"hex"!==i&&(y.cipherTextEncoding=i),t.abrupt("return",y);case 26:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ee(t,e){return re.apply(this,arguments)}function re(){return(re=J(Q.mark((function t(e,r){var n,i,o,a,s,u,c,f,h,l;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Kt.keyFromPrivate(e,"hex"),i=null,t.prev=2,i=Kt.keyFromPublic(r.ephemeralPK,"hex").getPublic(),t.next=9;break;case 6:throw t.prev=6,t.t0=t.catch(2),new P("Unable to get public key from cipher object. You might be trying to decrypt an unencrypted object.");case 9:if(o=n.derive(i),a=Zt(o),s=Yt(a),u=Wt.from(r.iv,"hex"),r.cipherTextEncoding&&"hex"!==r.cipherTextEncoding){t.next=17;break}c=Wt.from(r.cipherText,"hex"),t.next=22;break;case 17:if("base64"!==r.cipherTextEncoding){t.next=21;break}c=Wt.from(r.cipherText,"base64"),t.next=22;break;case 21:throw new Error('Unexpected cipherTextEncoding "'+r.cipherText+'"');case 22:return f=Wt.concat([u,Wt.from(i.encodeCompressed()),c]),t.next=25,$t(s.hmacKey,f);case 25:if(h=t.sent,Jt(Wt.from(r.mac,"hex"),h)){t.next=29;break}throw new P("Decryption failed: failure in MAC check");case 29:return t.next=31,zt(u,s.encryptionKey,c);case 31:if(l=t.sent,!r.wasString){t.next=36;break}return t.abrupt("return",l.toString());case 36:return t.abrupt("return",l);case 37:case"end":return t.stop()}}),t,null,[[2,6]])})))).apply(this,arguments)}function ne(t,e){var r=e instanceof Wt?e:Wt.from(e),n=Kt.keyFromPrivate(t,"hex"),i=Ot(t),o=$(r);return{signature:n.sign(o).toDER("hex"),publicKey:i}}var ie=r(8287).Buffer,oe="1.3.1";function ae(t,e,r,n,i,o,a){void 0===n&&(n=s.slice()),void 0===o&&(o=m().getTime()),void 0===a&&(a={});var u=function(t){var e=_("location",{throwIfUnavailable:!0,usageDesc:"makeAuthRequest(["+t+"=undefined])"});return null==e?void 0:e.origin};e||(e=u("redirectURI")+"/"),r||(r=u("manifestURI")+"/manifest.json"),i||(i=u("appDomain"));var c=Object.assign({},a,{jti:b(),iat:Math.floor((new Date).getTime()/1e3),exp:Math.floor(o/1e3),iss:null,public_keys:[],domain_name:i,manifest_uri:r,redirect_uri:e,version:oe,do_not_include_profile:!0,supports_hub_url:!0,scopes:n}),f=K.SECP256K1Client.derivePublicKey(t);c.public_keys=[f];var h=Ct(f);return c.iss=N(h),new K.TokenSigner("ES256k",t).sign(c)}function se(t,e){return ue.apply(this,arguments)}function ue(){return(ue=L(W.mark((function t(e,r){var n,i;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Qt(e,ie.from(r),!0);case 2:return n=t.sent,i=JSON.stringify(n),t.abrupt("return",ie.from(i).toString("hex"));case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ce(t,e){return fe.apply(this,arguments)}function fe(){return(fe=L(W.mark((function t(e,r){var n,i,o;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=ie.from(r,"hex").toString(),i=JSON.parse(n),t.next=4,ee(e,i);case 4:if("string"==typeof(o=t.sent)){t.next=9;break}throw new Error("Unable to correctly decrypt private key");case 9:return t.abrupt("return",o);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function he(t,e,r,n,i,o,a,s,u,c,f){return le.apply(this,arguments)}function le(){return(le=L(W.mark((function t(e,r,n,i,o,a,s,u,c,f,h){var l,d,p,g,y,w,v;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r={}),void 0===n&&(n=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=m().getTime()),void 0===u&&(u=null),void 0===c&&(c=null),void 0===f&&(f=null),void 0===h&&(h=null),l=K.SECP256K1Client.derivePublicKey(e),d=Ct(l),p=a,g=o,y={},null==a){t.next=26;break}if(null==u){t.next=23;break}return t.next=18,se(u,a);case 18:if(p=t.sent,null==o){t.next=23;break}return t.next=22,se(u,o);case 22:g=t.sent;case 23:y={email:(null==i?void 0:i.email)?i.email:null,profile_url:(null==i?void 0:i.profileUrl)?i.profileUrl:null,hubUrl:c,blockstackAPIUrl:f,associationToken:h,version:oe},t.next=26;break;case 26:return w=Object.assign({},{jti:b(),iat:Math.floor((new Date).getTime()/1e3),exp:Math.floor(s/1e3),iss:N(d),private_key:p,public_keys:[l],profile:r,username:n,core_token:g},y),v=new K.TokenSigner("ES256k",e),t.abrupt("return",v.sign(w));case 29:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var de=r(9725),pe=r(6663);function ge(){var t=_("location",{throwIfUnavailable:!0,usageDesc:"getAuthRequestFromURL"});if(null==t?void 0:t.search){var e=(0,pe.parse)(null==t?void 0:t.search);return e.authRequest?e.authRequest.split(y+":").join(""):null}return null}function ye(t){return me.apply(this,arguments)}function me(){return(me=L(W.mark((function t(e){var r,n,i,o,a;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("Invalid auth request");case 2:if("string"!=typeof(r=(0,K.decodeToken)(e).payload)){t.next=5;break}throw new Error("Unexpected token payload type of string");case 5:return n=r.manifest_uri,t.prev=6,t.next=9,(0,de.C)(n);case 9:return i=t.sent,t.next=12,i.text();case 12:return o=t.sent,a=JSON.parse(o),t.abrupt("return",D({},a,{manifestURI:n}));case 17:throw t.prev=17,t.t0=t.catch(6),console.log(t.t0),new Error("Could not fetch manifest.json");case 21:case"end":return t.stop()}}),t,null,[[6,17]])})))).apply(this,arguments)}function we(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");var r=e.public_keys;if(1!==r.length)throw new Error("Multiple public keys are not supported");var n=r[0];try{return new K.TokenVerifier("ES256k",n).verify(t)}catch(t){return!1}}function be(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");var r=e.public_keys,n=I(e.iss);if(1!==r.length)throw new Error("Multiple public keys are not supported");return Ct(r[0])===n}function ve(t,e){return _e.apply(this,arguments)}function _e(){return(_e=L(W.mark((function t(e,r){var n,i,o,a,s,u,c,f;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"string"!=typeof(n=(0,K.decodeToken)(e).payload)){t.next=4;break}throw new Error("Unexpected token payload type of string");case 4:if(n.username){t.next=6;break}return t.abrupt("return",!0);case 6:if(null!==n.username){t.next=8;break}return t.abrupt("return",!0);case 8:if(null!==r){t.next=10;break}return t.abrupt("return",!1);case 10:return i=n.username,o=r.replace(/\/$/,"")+"/"+i,t.next=14,(0,de.C)(o);case 14:return a=t.sent,t.next=17,a.text();case 17:if(s=t.sent,!(u=JSON.parse(s)).hasOwnProperty("address")){t.next=29;break}if(c=u.address,f=I(n.iss),c!==f){t.next=26;break}return t.abrupt("return",!0);case 26:case 29:return t.abrupt("return",!1);case 27:t.next=30;break;case 30:t.next=37;break;case 32:return t.prev=32,t.t0=t.catch(0),console.log(t.t0),console.log("Error checking `doPublicKeysMatchUsername`"),t.abrupt("return",!1);case 37:case"end":return t.stop()}}),t,null,[[0,32]])})))).apply(this,arguments)}function Se(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");if(e.iat){if("number"!=typeof e.iat)return!1;var r=new Date(1e3*e.iat);return!((new Date).getTime()<r.getTime())}return!0}function Ae(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");if(e.exp){if("number"!=typeof e.exp)return!1;var r=new Date(1e3*e.exp);return!((new Date).getTime()>r.getTime())}return!0}function Te(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");return v(e.domain_name,e.manifest_uri)}function Ee(t){var e=(0,K.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");return v(e.domain_name,e.redirect_uri)}function ke(t){return Ce.apply(this,arguments)}function Ce(){return(Ce=L(W.mark((function t(e){var r;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("none"!==(0,K.decodeToken)(e).header.alg){t.next=2;break}throw new Error("Token must be signed in order to be verified");case 2:return t.next=4,Promise.all([Ae(e),Se(e),we(e),be(e),Te(e),Ee(e)]);case 4:return r=t.sent,t.abrupt("return",r.every((function(t){return t})));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oe(t){return Pe.apply(this,arguments)}function Pe(){return(Pe=L(W.mark((function t(e){return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ke(e);case 2:if(t.sent){t.next=5;break}throw new Error("Token is an invalid auth request");case 5:return t.abrupt("return",ye(e));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(t,e){return Re.apply(this,arguments)}function Re(){return(Re=L(W.mark((function t(e,r){var n;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Ae(e),Se(e),we(e),be(e),ve(e,r)]);case 2:return n=t.sent,t.abrupt("return",n.every((function(t){return t})));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ne=r(6327),Be=r(8287).Buffer;function xe(){return(xe=J(Q.mark((function t(e,r){var n,i,o,a,s,u,c,f;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=Object.assign({},r)).publicKey){t.next=5;break}if(n.privateKey){t.next=4;break}throw new Error("Either public key or private key must be supplied for encryption.");case 4:n.publicKey=Ot(n.privateKey);case 5:return o="boolean"==typeof n.wasString?n.wasString:"string"==typeof e,a="string"==typeof e?Be.from(e):e,t.next=9,Qt(n.publicKey,a,o,n.cipherTextEncoding);case 9:return s=t.sent,u=JSON.stringify(s),n.sign&&("string"==typeof n.sign?i=n.sign:i||(i=n.privateKey),c=ne(i,u),f={signature:c.signature,publicKey:c.publicKey,cipherText:u},u=JSON.stringify(f)),t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ie="1.0.0",Fe=function(){function t(t){this.version=Ie,this.userData=t.userData,this.transitKey=t.transitKey,this.etags=t.etags?t.etags:{}}return t.fromJSON=function(e){if(e.version!==Ie)throw new M("JSON data version "+e.version+" not supported by SessionData");return new t({coreNode:e.coreNode,userData:e.userData,transitKey:e.transitKey,etags:e.etags})},t.prototype.toString=function(){return JSON.stringify(this)},t}(),Le=function(){function t(t){if(t){var e=new Fe(t);this.setSessionData(e)}}var e=t.prototype;return e.getSessionData=function(){throw new Error("Abstract class")},e.setSessionData=function(t){throw new Error("Abstract class")},e.deleteSessionData=function(){throw new Error("Abstract class")},t}(),De=function(t){function e(e){var r;return(r=t.call(this,e)||this).sessionData||r.setSessionData(new Fe({})),r}U(e,t);var r=e.prototype;return r.getSessionData=function(){if(!this.sessionData)throw new R("No session data was found.");return this.sessionData},r.setSessionData=function(t){return this.sessionData=t,!0},r.deleteSessionData=function(){return this.setSessionData(new Fe({})),!0},e}(Le),Ue=function(t){function e(e){var r;if(r=t.call(this,e)||this,e&&e.storeOptions&&e.storeOptions.localStorageKey&&"string"==typeof e.storeOptions.localStorageKey?r.key=e.storeOptions.localStorageKey:r.key=h,!localStorage.getItem(r.key)){var n=new Fe({});r.setSessionData(n)}return r}U(e,t);var r=e.prototype;return r.getSessionData=function(){var t=localStorage.getItem(this.key);if(!t)throw new R("No session data was found in localStorage");var e=JSON.parse(t);return Fe.fromJSON(e)},r.setSessionData=function(t){return localStorage.setItem(this.key,t.toString()),!0},r.deleteSessionData=function(){return localStorage.removeItem(this.key),this.setSessionData(new Fe({})),!0},e}(Le),Ve=r(8287).Buffer;function je(t,e){var r;void 0===e&&(e=null),r=e?function(t,e){var r=(0,K.decodeToken)(t),n=r.payload;if("string"==typeof n)throw new Error("Unexpected token payload type of string");if(!n.hasOwnProperty("subject")||!n.subject)throw new Error("Token doesn't have a subject");if(!n.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!n.hasOwnProperty("issuer")||!n.issuer)throw new Error("Token doesn't have an issuer");if(!n.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!n.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");var i=n.issuer.publicKey,o=Ve.from(i,"hex"),a=Mt(z.Jc.fromPublicKey(o,{compressed:!0})),s=Mt(z.Jc.fromPublicKey(o,{compressed:!1}));if(e===i);else if(e===a);else if(e!==s)throw new Error("Token issuer public key does not match the verifying value");var u=new K.TokenVerifier(r.header.alg,i);if(!u)throw new Error("Invalid token verifier");if(!u.verify(t))throw new Error("Token verification failed");return r}(t,e):(0,K.decodeToken)(t);var n={};if(r.hasOwnProperty("payload")){var i=r.payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");i.hasOwnProperty("claim")&&(n=i.claim)}return n}var We=r(966),Ke="_blockstackDidCheckEchoReply";var He=function(){function t(t){var e=!0;if("undefined"==typeof window&&"undefined"==typeof self&&(e=!1),t&&t.appConfig)this.appConfig=t.appConfig;else{if(!e)throw new k("You need to specify options.appConfig");this.appConfig=new S}t&&t.sessionStore?this.store=t.sessionStore:this.store=e?t?new Ue(t.sessionOptions):new Ue:t?new De(t.sessionOptions):new De}var e=t.prototype;return e.makeAuthRequest=function(t,e,r,n,i,o,a){void 0===o&&(o=new Date((new Date).setHours((new Date).getHours()+1)).getTime()),void 0===a&&(a={});var s=this.appConfig;if(!s)throw new M("Missing AppConfig");return ae(t=t||this.generateAndStoreTransitKey(),e=e||s.redirectURI(),r=r||s.manifestURI(),n=n||s.scopes,i=i||s.appDomain,o,a)},e.generateAndStoreTransitKey=function(){var t=this.store.getSessionData(),e=z.Jc.makeRandom({rng:kt}).privateKey.toString("hex");return t.transitKey=e,this.store.setSessionData(t),e},e.getAuthResponseToken=function(){var t,e=null==(t=_("location",{throwIfUnavailable:!0,usageDesc:"getAuthResponseToken"}))?void 0:t.search;if(e){var r=(0,pe.parse)(e);return r.authResponse?r.authResponse:""}return""},e.isSignInPending=function(){try{if(function(){var t;if("undefined"!=typeof self)t=self;else{if("undefined"==typeof window)return!1;t=window}if(!t.location||!t.localStorage)return!1;var e=t[Ke];if("boolean"==typeof e)return e;var r,n=(r=t.location.search)?(/^[?#]/.test(r)?r.slice(1):r).split("&").reduce((function(t,e){var r=e.split("="),n=r[0],i=r[1];return t[n]=i?decodeURIComponent(i.replace(/\+/g," ")):"",t}),{}):{},i=n.echoReply;if(i){t[Ke]=!0;var o="echo-reply-"+i;return t.localStorage.setItem(o,"success"),t.setTimeout((function(){var e=n.authContinuation;t.location.href=e}),10),!0}return!1}())return g.info("protocolEchoReply detected from isSignInPending call, the page is about to redirect."),!0}catch(t){g.error("Error checking for protocol echo reply isSignInPending: "+t)}return!!this.getAuthResponseToken()},e.isUserSignedIn=function(){return!!this.store.getSessionData().userData},e.handlePendingSignIn=function(){var t=L(W.mark((function t(e){var r,n,i,o,s,u,c,h,l,d,p,y,m,b,v;return W.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=this.getAuthResponseToken()),!(r=this.store.getSessionData()).userData){t.next=4;break}throw new O("Existing user session found.");case 4:if(n=this.store.getSessionData().transitKey,(i=this.appConfig&&this.appConfig.coreNode)||(o=new We.StacksMainnet,i=o.bnsLookupUrl),"string"!=typeof(s=(0,K.decodeToken)(e).payload)){t.next=10;break}throw new Error("Unexpected token payload type of string");case 10:return u=""+i+f,t.next=13,Me(e,u);case 13:if(t.sent){t.next=16;break}throw new O("Invalid authentication response.");case 16:if(c=s.private_key,h=s.core_token,!w(s.version,"1.1.0")){t.next=50;break}if(void 0===n||null==n){t.next=49;break}if(void 0===s.private_key||null===s.private_key){t.next=37;break}return t.prev=21,t.next=24,ce(n,s.private_key);case 24:c=t.sent,t.next=37;break;case 27:t.prev=27,t.t0=t.catch(21),g.warn("Failed decryption of appPrivateKey, will try to use as given"),t.prev=30,Pt(s.private_key),t.next=37;break;case 34:throw t.prev=34,t.t1=t.catch(30),new O("Failed decrypting appPrivateKey. Usually means that the transit key has changed during login.");case 37:if(null==h){t.next=47;break}return t.prev=38,t.next=41,ce(n,h);case 41:h=t.sent,t.next=47;break;case 44:t.prev=44,t.t2=t.catch(38),g.info("Failed decryption of coreSessionToken, will try to use as given");case 47:t.next=50;break;case 49:throw new O("Authenticating with protocol > 1.1.0 requires transit key, and none found.");case 50:if(l=Ne.zB,w(s.version,"1.2.0")&&null!==s.hubUrl&&void 0!==s.hubUrl&&(l=s.hubUrl),w(s.version,"1.3.0")&&null!==s.associationToken&&void 0!==s.associationToken&&(d=s.associationToken),p={username:s.username,profile:s.profile,email:s.email,decentralizedID:s.iss,identityAddress:I(s.iss),appPrivateKey:c,coreSessionToken:h,authResponseToken:e,hubUrl:l,coreNode:s.blockstackAPIUrl,gaiaAssociationToken:d},y=s.profile_url,p.profile||!y){t.next=70;break}return t.next=58,(0,de.C)(y);case 58:if((m=t.sent).ok){t.next=63;break}p.profile=Object.assign({},a),t.next=68;break;case 63:return t.next=65,m.text();case 65:b=t.sent,v=JSON.parse(b),p.profile=je(v[0].token);case 68:t.next=71;break;case 70:p.profile=s.profile;case 71:return r.userData=p,this.store.setSessionData(r),t.abrupt("return",p);case 74:case"end":return t.stop()}}),t,this,[[21,27],[30,34],[38,44]])})));return function(e){return t.apply(this,arguments)}}(),e.loadUserData=function(){var t=this.store.getSessionData().userData;if(!t)throw new M("No user data found. Did the user sign in?");return t},e.encryptContent=function(t,e){var r=Object.assign({},e);return r.privateKey||(r.privateKey=this.loadUserData().appPrivateKey),function(t,e){return xe.apply(this,arguments)}(t,r)},e.decryptContent=function(t,e){var r=Object.assign({},e);return r.privateKey||(r.privateKey=this.loadUserData().appPrivateKey),function(t,e){var r=Object.assign({},e);if(!r.privateKey)throw new Error("Private key is required for decryption.");try{var n=JSON.parse(t);return ee(r.privateKey,n)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted content JSON. The content may not be encrypted. If using getFile, try passing { decrypt: false }."):t}}(t,r)},e.signUserOut=function(t){this.store.deleteSessionData(),t&&"undefined"!=typeof location&&location.href&&(location.href=t)},t}();function qe(t,e){var r;return e.proof&&e.proof.url&&(r=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:r}}var ze=r(4564),Ge=r(4366),$e={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}},Xe=function(t){var e,r;function n(e){var r;return void 0===e&&(e={}),(r=t.call(this,e)||this)._profile=Object.assign({},{"@type":"Person"},r._profile),r}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,n.validateSchema=function(t,e){return(0,Ge.validate)($e,t)},n.fromToken=function(t,e){return void 0===e&&(e=null),new n(je(t,e))},n.fromLegacyFormat=function(t){return new n(function(t){var e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});var r=[];t.avatar&&t.avatar.url&&r.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&r.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),r.length&&(e.image=r),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);var n=[];t.bitcoin&&t.bitcoin.address&&n.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&n.push(qe("twitter",t.twitter)),t.facebook&&t.facebook.username&&n.push(qe("facebook",t.facebook)),t.github&&t.github.username&&n.push(qe("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&n.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&n.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=n}return e}(t))};var i=n.prototype;return i.toJSON=function(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}},i.profile=function(){return Object.assign({},this._profile)},i.name=function(){return function(t){if(!t)return null;var e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=" "+t.familyName)),e}(this.profile())},i.givenName=function(){return function(t){if(!t)return null;var e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())},i.familyName=function(){return function(t){if(!t)return null;var e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())},i.description=function(){return function(t){if(!t)return null;var e=null;return t.description&&(e=t.description),e}(this.profile())},i.avatarUrl=function(){return function(t){if(!t)return null;var e=null;return t.image&&t.image.map((function(t){return"avatar"===t.name?e=t.contentUrl:null})),e}(this.profile())},i.verifiedAccounts=function(t){return function(t,e){if(!t)return null;var r=[];return t.hasOwnProperty("account")&&e&&t.account.map((function(t){var n=!1,i=null;return e.map((function(e){return e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(n=!0,i=e.proofUrl,0))})),n?(t.proofUrl=i,r.push(t),t):null})),r}(this.profile(),t)},i.address=function(){return function(t){if(!t)return null;var e=null;if(t.hasOwnProperty("address")){var r=[];t.address.hasOwnProperty("streetAddress")&&r.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&r.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&r.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&r.push(t.address.addressCountry),r.length&&(e=r.join(", "))}return e}(this.profile())},i.birthDate=function(){return function(t){if(!t)return null;var e=null;if(t.hasOwnProperty("birthDate")){var r=new Date(t.birthDate);e=["January","February","March","April","May","June","July","August","September","October","November","December"][r.getMonth()]+" "+r.getDate()+", "+r.getFullYear()}return e}(this.profile())},i.connections=function(){return function(t){if(!t)return null;var e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())},i.organizations=function(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t},n}(function(){function t(t){void 0===t&&(t={}),this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}var e=t.prototype;return e.toJSON=function(){return Object.assign({},this._profile)},e.toToken=function(t){return function(t,e,r,n,i,o,a){if(void 0===i&&(i="ES256K"),void 0===o&&(o=new Date),void 0===a&&(a=new Date((new Date).setFullYear((new Date).getFullYear()+1))),"ES256K"!==i)throw new Error("Signing algorithm not supported");var s=K.SECP256K1Client.derivePublicKey(e);r||(r={publicKey:s}),n||(n={publicKey:s});var u=new K.TokenSigner(i,e),c={jti:b(),iat:o.toISOString(),exp:a.toISOString(),subject:r,issuer:n,claim:t};return u.sign(c)}(this.toJSON(),t)},t.validateSchema=function(t,e){return void 0===e&&(e=!1),$e.strict=e,(0,Ge.validate)($e,t)},t.fromToken=function(e,r){return void 0===r&&(r=null),new t(je(e,r))},t.makeZoneFile=function(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");var r=e.split("://")[0],n=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:r+"://"+n[0]+("/"+n.slice(1).join("/"))}]};return(0,ze.t9)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)},t}());function Je(t){if(!t.username)return Promise.reject();var e,r=t.network?t.network:new We.StacksMainnet;if(t.zoneFileLookupURL){var n=t.zoneFileLookupURL.replace(/\/$/,"")+"/"+t.username;e=(0,de.C)(n).then((function(t){return t.json()}))}else e=r.getNameInfo(t.username);return e.then((function(t){if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return e=t.zonefile,r=t.address,new Promise((function(t,n){var i=null;try{(i=(0,ze.CC)(e)).hasOwnProperty("$origin")||(i=null)}catch(t){n(t)}var o=null;if(i&&Object.keys(i).length>0)o=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;var e=t.uri[0];if(!e.hasOwnProperty("target"))return null;var r=e.target;return r.startsWith("https")||r.startsWith("http")||(r="https://"+r),r}(i),o?(0,de.C)(o).then((function(t){return t.text()})).then((function(t){return JSON.parse(t)})).then((function(e){var n=je(e[0].token,r);t(n)})).catch((function(t){g.error("resolveZoneFileToProfile: error fetching token file "+o+": "+t),n(t)})):(g.debug("Token file url not found. Resolving to blank profile."),t({}));else{var a=null;try{a=JSON.parse(e),a=Xe.fromLegacyFormat(a).profile()}catch(t){n(t)}t(a)}}));var e,r;throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}function Ye(){return window.StacksProvider||window.BlockstackProvider}function Ze(){return!!Ye()}function Qe(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function tr(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){Qe(o,n,i,a,s,"next",t)}function s(t){Qe(o,n,i,a,s,"throw",t)}a(void 0)}))}}function er(){return er=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},er.apply(this,arguments)}function rr(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}var nr=r(7452),ir=r.n(nr),or="https://app.blockstack.org",ar="5.5.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=ar);var sr,ur,cr,fr,hr,lr=function(){var t=navigator.userAgent;return!!/android/i.test(t)||!!/iPad|iPhone|iPod/.test(t)||/windows phone/i.test(t)},dr=function(){return!lr()},pr=function(t){if(!t){var e=new S(["store_write"],document.location.href);t=new He({appConfig:e})}return t},gr=function(t){var e=Ye();if(!e)throw new Error("Unable to authenticate without Stacks Wallet extension");var r=t.redirectTo,n=void 0===r?"/":r,i=t.manifestPath,o=t.finished,a=t.onFinish,s=t.onCancel,u=t.sendToSignIn,c=void 0!==u&&u,f=t.userSession,h=t.appDetails,l=pr(f);l.isUserSignedIn()&&l.signUserOut();var d=l.generateAndStoreTransitKey(),p=l.makeAuthRequest(d,""+document.location.origin+n,""+document.location.origin+i,l.appConfig.scopes,void 0,void 0,{sendToSignIn:c,appDetails:h,connectVersion:ar});e.authenticationRequest(p).then(function(){var t=tr(ir().mark((function t(e){var r;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l.handlePendingSignIn(e);case 2:null==(r=a||o)||r({authResponse:e,userSession:l});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){console.error("[Connect] Error during auth request",t),null==s||s()}))},yr=function(){var t=tr(ir().mark((function t(e){return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=pr(e)).isUserSignedIn()){t.next=3;break}return t.abrupt("return",e.loadUserData());case 3:if(!e.isSignInPending()){t.next=5;break}return t.abrupt("return",e.handlePendingSignIn());case 5:return t.abrupt("return",null);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();(ur=sr||(sr={})).ContractCall="contract_call",ur.ContractDeploy="smart_contract",ur.STXTransfer="token_transfer",(fr=cr||(cr={})).BUFFER="buffer",fr.UINT="uint",fr.INT="int",fr.PRINCIPAL="principal",fr.BOOL="bool",function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(hr||(hr={}));var mr,wr,br,vr,_r,Sr,Ar,Tr,Er,kr,Cr,Or,Pr,Mr,Rr,Nr,Br,xr,Ir,Fr,Lr,Dr,Ur=hr.Mainnet,Vr=128;(Sr=mr||(mr={}))[Sr.Address=0]="Address",Sr[Sr.Principal=1]="Principal",Sr[Sr.LengthPrefixedString=2]="LengthPrefixedString",Sr[Sr.MemoString=3]="MemoString",Sr[Sr.AssetInfo=4]="AssetInfo",Sr[Sr.PostCondition=5]="PostCondition",Sr[Sr.PublicKey=6]="PublicKey",Sr[Sr.LengthPrefixedList=7]="LengthPrefixedList",Sr[Sr.Payload=8]="Payload",Sr[Sr.MessageSignature=9]="MessageSignature",Sr[Sr.TransactionAuthField=10]="TransactionAuthField",function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase"}(wr||(wr={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(br||(br={})),(_r=vr||(vr={}))[_r.Mainnet=0]="Mainnet",_r[_r.Testnet=128]="Testnet",vr.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Ar||(Ar={})),(Dr=Tr||(Tr={}))[Dr.STX=0]="STX",Dr[Dr.Fungible=1]="Fungible",Dr[Dr.NonFungible=2]="NonFungible",(Lr=Er||(Er={}))[Lr.Standard=4]="Standard",Lr[Lr.Sponsored=5]="Sponsored",(Fr=kr||(kr={}))[Fr.SerializeP2PKH=0]="SerializeP2PKH",Fr[Fr.SerializeP2SH=1]="SerializeP2SH",Fr[Fr.SerializeP2WPKH=2]="SerializeP2WPKH",Fr[Fr.SerializeP2WSH=3]="SerializeP2WSH",(Ir=Cr||(Cr={}))[Ir.MainnetSingleSig=22]="MainnetSingleSig",Ir[Ir.MainnetMultiSig=20]="MainnetMultiSig",Ir[Ir.TestnetSingleSig=26]="TestnetSingleSig",Ir[Ir.TestnetMultiSig=21]="TestnetMultiSig",function(t){t[t.Compressed=0]="Compressed",t[t.Uncompressed=1]="Uncompressed"}(Or||(Or={})),function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Pr||(Pr={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(Mr||(Mr={})),(xr=Rr||(Rr={}))[xr.Origin=1]="Origin",xr[xr.Standard=2]="Standard",xr[xr.Contract=3]="Contract",function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Nr||(Nr={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(Br||(Br={}));var jr=r(8782),Wr=r.n(jr);function Kr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Hr(t,e,r){return e&&Kr(t.prototype,e),r&&Kr(t,r),t}function qr(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function zr(t){return zr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},zr(t)}function Gr(t,e){return Gr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Gr(t,e)}function $r(t,e,r){return $r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&Gr(i,r.prototype),i},$r.apply(null,arguments)}function Xr(t){var e="function"==typeof Map?new Map:void 0;return Xr=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return $r(t,arguments,zr(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Gr(n,t)},Xr(t)}function Jr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Zr(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Yr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var Qr=function(t){function e(e){var r;return(r=t.call(this,e)||this).message=e,r.name=r.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(Jr(r),r.constructor),r}return qr(e,t),e}(Xr(Error)),tn=function(t){function e(e){var r;return(r=t.call(this,e)||this).message=e,r.name=r.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(Jr(r),r.constructor),r}return qr(e,t),e}(Xr(Error)),en=function(t){function e(e){var r;return(r=t.call(this,e)||this).message=e,r.name=r.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(Jr(r),r.constructor),r}return qr(e,t),e}(Xr(Error)),rn=r(2591);r(4945);const nn=function(t,e){return t===e||t!=t&&e!=e},on=function(t,e){for(var r=t.length;r--;)if(nn(t[r][0],e))return r;return-1};var an=Array.prototype.splice;function sn(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}sn.prototype.clear=function(){this.__data__=[],this.size=0},sn.prototype.delete=function(t){var e=this.__data__,r=on(e,t);return!(r<0||(r==e.length-1?e.pop():an.call(e,r,1),--this.size,0))},sn.prototype.get=function(t){var e=this.__data__,r=on(e,t);return r<0?void 0:e[r][1]},sn.prototype.has=function(t){return on(this.__data__,t)>-1},sn.prototype.set=function(t,e){var r=this.__data__,n=on(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};const un=sn,cn="object"==typeof global&&global&&global.Object===Object&&global;var fn="object"==typeof self&&self&&self.Object===Object&&self;const hn=cn||fn||Function("return this")(),ln=hn.Symbol;var dn=Object.prototype,pn=dn.hasOwnProperty,gn=dn.toString,yn=ln?ln.toStringTag:void 0;var mn=Object.prototype.toString;var wn=ln?ln.toStringTag:void 0;const bn=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":wn&&wn in Object(t)?function(t){var e=pn.call(t,yn),r=t[yn];try{t[yn]=void 0;var n=!0}catch(t){}var i=gn.call(t);return n&&(e?t[yn]=r:delete t[yn]),i}(t):function(t){return mn.call(t)}(t)},vn=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},_n=function(t){if(!vn(t))return!1;var e=bn(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Sn=hn["__core-js_shared__"];var An,Tn=(An=/[^.]+$/.exec(Sn&&Sn.keys&&Sn.keys.IE_PROTO||""))?"Symbol(src)_1."+An:"";var En=Function.prototype.toString;const kn=function(t){if(null!=t){try{return En.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var Cn=/^\[object .+?Constructor\]$/,On=Function.prototype,Pn=Object.prototype,Mn=On.toString,Rn=Pn.hasOwnProperty,Nn=RegExp("^"+Mn.call(Rn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Bn=function(t){return!(!vn(t)||(e=t,Tn&&Tn in e))&&(_n(t)?Nn:Cn).test(kn(t));var e},xn=function(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Bn(r)?r:void 0},In=xn(hn,"Map"),Fn=xn(Object,"create");var Ln=Object.prototype.hasOwnProperty;var Dn=Object.prototype.hasOwnProperty;function Un(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Un.prototype.clear=function(){this.__data__=Fn?Fn(null):{},this.size=0},Un.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Un.prototype.get=function(t){var e=this.__data__;if(Fn){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Ln.call(e,t)?e[t]:void 0},Un.prototype.has=function(t){var e=this.__data__;return Fn?void 0!==e[t]:Dn.call(e,t)},Un.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Fn&&void 0===e?"__lodash_hash_undefined__":e,this};const Vn=Un,jn=function(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map};function Wn(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(In||un),string:new Vn}},Wn.prototype.delete=function(t){var e=jn(this,t).delete(t);return this.size-=e?1:0,e},Wn.prototype.get=function(t){return jn(this,t).get(t)},Wn.prototype.has=function(t){return jn(this,t).has(t)},Wn.prototype.set=function(t,e){var r=jn(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};const Kn=Wn;function Hn(t){var e=this.__data__=new un(t);this.size=e.size}Hn.prototype.clear=function(){this.__data__=new un,this.size=0},Hn.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Hn.prototype.get=function(t){return this.__data__.get(t)},Hn.prototype.has=function(t){return this.__data__.has(t)},Hn.prototype.set=function(t,e){var r=this.__data__;if(r instanceof un){var n=r.__data__;if(!In||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Kn(n)}return r.set(t,e),this.size=r.size,this};const qn=Hn,zn=function(){try{var t=xn(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Gn=function(t,e,r){"__proto__"==e&&zn?zn(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var $n=Object.prototype.hasOwnProperty;const Xn=function(t,e,r){var n=t[e];$n.call(t,e)&&nn(n,r)&&(void 0!==r||e in t)||Gn(t,e,r)},Jn=function(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],u=n?n(r[s],t[s],s,r,t):void 0;void 0===u&&(u=t[s]),i?Gn(r,s,u):Xn(r,s,u)}return r},Yn=function(t){return null!=t&&"object"==typeof t},Zn=function(t){return Yn(t)&&"[object Arguments]"==bn(t)};var Qn=Object.prototype,ti=Qn.hasOwnProperty,ei=Qn.propertyIsEnumerable;const ri=Zn(function(){return arguments}())?Zn:function(t){return Yn(t)&&ti.call(t,"callee")&&!ei.call(t,"callee")},ni=Array.isArray;var ii="object"==typeof exports&&exports&&!exports.nodeType&&exports,oi=ii&&"object"==typeof module&&module&&!module.nodeType&&module,ai=oi&&oi.exports===ii?hn.Buffer:void 0;const si=(ai?ai.isBuffer:void 0)||function(){return!1};var ui=/^(?:0|[1-9]\d*)$/;const ci=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ui.test(t))&&t>-1&&t%1==0&&t<e},fi=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var hi={};hi["[object Float32Array]"]=hi["[object Float64Array]"]=hi["[object Int8Array]"]=hi["[object Int16Array]"]=hi["[object Int32Array]"]=hi["[object Uint8Array]"]=hi["[object Uint8ClampedArray]"]=hi["[object Uint16Array]"]=hi["[object Uint32Array]"]=!0,hi["[object Arguments]"]=hi["[object Array]"]=hi["[object ArrayBuffer]"]=hi["[object Boolean]"]=hi["[object DataView]"]=hi["[object Date]"]=hi["[object Error]"]=hi["[object Function]"]=hi["[object Map]"]=hi["[object Number]"]=hi["[object Object]"]=hi["[object RegExp]"]=hi["[object Set]"]=hi["[object String]"]=hi["[object WeakMap]"]=!1;const li=function(t){return function(e){return t(e)}};var di="object"==typeof exports&&exports&&!exports.nodeType&&exports,pi=di&&"object"==typeof module&&module&&!module.nodeType&&module,gi=pi&&pi.exports===di&&cn.process;const yi=function(){try{return pi&&pi.require&&pi.require("util").types||gi&&gi.binding&&gi.binding("util")}catch(t){}}();var mi=yi&&yi.isTypedArray;const wi=mi?li(mi):function(t){return Yn(t)&&fi(t.length)&&!!hi[bn(t)]};var bi=Object.prototype.hasOwnProperty;const vi=function(t,e){var r=ni(t),n=!r&&ri(t),i=!r&&!n&&si(t),o=!r&&!n&&!i&&wi(t),a=r||n||i||o,s=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=s.length;for(var c in t)!e&&!bi.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ci(c,u))||s.push(c);return s};var _i=Object.prototype;const Si=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_i)},Ai=function(t,e){return function(r){return t(e(r))}},Ti=Ai(Object.keys,Object);var Ei=Object.prototype.hasOwnProperty;const ki=function(t){return null!=t&&fi(t.length)&&!_n(t)},Ci=function(t){return ki(t)?vi(t):function(t){if(!Si(t))return Ti(t);var e=[];for(var r in Object(t))Ei.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)};var Oi=Object.prototype.hasOwnProperty;const Pi=function(t){if(!vn(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=Si(t),r=[];for(var n in t)("constructor"!=n||!e&&Oi.call(t,n))&&r.push(n);return r},Mi=function(t){return ki(t)?vi(t,!0):Pi(t)};var Ri="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ni=Ri&&"object"==typeof module&&module&&!module.nodeType&&module,Bi=Ni&&Ni.exports===Ri?hn.Buffer:void 0,xi=Bi?Bi.allocUnsafe:void 0;const Ii=function(){return[]};var Fi=Object.prototype.propertyIsEnumerable,Li=Object.getOwnPropertySymbols;const Di=Li?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o}(Li(t),(function(e){return Fi.call(t,e)})))}:Ii,Ui=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t},Vi=Ai(Object.getPrototypeOf,Object),ji=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Ui(e,Di(t)),t=Vi(t);return e}:Ii,Wi=function(t,e,r){var n=e(t);return ni(t)?n:Ui(n,r(t))},Ki=function(t){return Wi(t,Ci,Di)},Hi=function(t){return Wi(t,Mi,ji)},qi=xn(hn,"DataView"),zi=xn(hn,"Promise"),Gi=xn(hn,"Set"),$i=xn(hn,"WeakMap");var Xi="[object Map]",Ji="[object Promise]",Yi="[object Set]",Zi="[object WeakMap]",Qi="[object DataView]",to=kn(qi),eo=kn(In),ro=kn(zi),no=kn(Gi),io=kn($i),oo=bn;(qi&&oo(new qi(new ArrayBuffer(1)))!=Qi||In&&oo(new In)!=Xi||zi&&oo(zi.resolve())!=Ji||Gi&&oo(new Gi)!=Yi||$i&&oo(new $i)!=Zi)&&(oo=function(t){var e=bn(t),r="[object Object]"==e?t.constructor:void 0,n=r?kn(r):"";if(n)switch(n){case to:return Qi;case eo:return Xi;case ro:return Ji;case no:return Yi;case io:return Zi}return e});const ao=oo;var so=Object.prototype.hasOwnProperty;const uo=hn.Uint8Array,co=function(t){var e=new t.constructor(t.byteLength);return new uo(e).set(new uo(t)),e};var fo=/\w*$/;var ho=ln?ln.prototype:void 0,lo=ho?ho.valueOf:void 0;const po=function(t,e,r){var n,i,o,a=t.constructor;switch(e){case"[object ArrayBuffer]":return co(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return function(t,e){var r=e?co(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var r=e?co(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(o=new(i=t).constructor(i.source,fo.exec(i))).lastIndex=i.lastIndex,o;case"[object Symbol]":return n=t,lo?Object(lo.call(n)):{}}};var go=Object.create;const yo=function(){function t(){}return function(e){if(!vn(e))return{};if(go)return go(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var mo=yi&&yi.isMap;const wo=mo?li(mo):function(t){return Yn(t)&&"[object Map]"==ao(t)};var bo=yi&&yi.isSet;const vo=bo?li(bo):function(t){return Yn(t)&&"[object Set]"==ao(t)};var _o="[object Arguments]",So="[object Function]",Ao="[object Object]",To={};To[_o]=To["[object Array]"]=To["[object ArrayBuffer]"]=To["[object DataView]"]=To["[object Boolean]"]=To["[object Date]"]=To["[object Float32Array]"]=To["[object Float64Array]"]=To["[object Int8Array]"]=To["[object Int16Array]"]=To["[object Int32Array]"]=To["[object Map]"]=To["[object Number]"]=To[Ao]=To["[object RegExp]"]=To["[object Set]"]=To["[object String]"]=To["[object Symbol]"]=To["[object Uint8Array]"]=To["[object Uint8ClampedArray]"]=To["[object Uint16Array]"]=To["[object Uint32Array]"]=!0,To["[object Error]"]=To[So]=To["[object WeakMap]"]=!1;const Eo=function t(e,r,n,i,o,a){var s,u=1&r,c=2&r,f=4&r;if(n&&(s=o?n(e,i,o,a):n(e)),void 0!==s)return s;if(!vn(e))return e;var h=ni(e);if(h){if(s=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&so.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(e),!u)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(e,s)}else{var l=ao(e),d=l==So||"[object GeneratorFunction]"==l;if(si(e))return function(t,e){if(e)return t.slice();var r=t.length,n=xi?xi(r):new t.constructor(r);return t.copy(n),n}(e,u);if(l==Ao||l==_o||d&&!o){if(s=c||d?{}:function(t){return"function"!=typeof t.constructor||Si(t)?{}:yo(Vi(t))}(e),!u)return c?function(t,e){return Jn(t,ji(t),e)}(e,function(t,e){return t&&Jn(e,Mi(e),t)}(s,e)):function(t,e){return Jn(t,Di(t),e)}(e,function(t,e){return t&&Jn(e,Ci(e),t)}(s,e))}else{if(!To[l])return o?e:{};s=po(e,l,u)}}a||(a=new qn);var p=a.get(e);if(p)return p;a.set(e,s),vo(e)?e.forEach((function(i){s.add(t(i,r,n,i,e,a))})):wo(e)&&e.forEach((function(i,o){s.set(o,t(i,r,n,o,e,a))}));var g=h?void 0:(f?c?Hi:Ki:c?Mi:Ci)(e);return function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););}(g||e,(function(i,o){g&&(i=e[o=i]),Xn(s,o,t(i,r,n,o,e,a))})),s};var ko=r(3705).Buffer,Co=function(){function t(){this._value=[]}var e=t.prototype;return e.appendHexString=function(t){this.value.push(ko.from(t,"hex"))},e.push=function(t){return this._value.push(t)},e.appendByte=function(t){if(!Number.isInteger(t)||t<0||t>255)throw new Error("Value "+t+" is not a valid byte");this.value.push(ko.from([t]))},e.concatBuffer=function(){return ko.concat(this.value)},Hr(t,[{key:"value",get:function(){return this._value}}]),t}(),Oo=function(t,e){return t.padStart(e,"0")},Po=function(t,e){return void 0===e&&(e=8),t.toString(16).padStart(2*e,"0")},Mo=function(t){return parseInt(t,16)},Ro=function(t,e){return!!t&&ko.from(t).length>e};function No(t){return Eo(t,5)}var Bo,xo=function(t){function e(){var e;return e=t.call(this)||this,Object.assign(Jr(e),{_ah:573645204,_al:4230739756,_bh:2673172387,_bl:3360449730,_ch:596883563,_cl:1867755857,_dh:2520282905,_dl:1497426621,_eh:2519219938,_el:2827943907,_fh:3193839141,_fl:1401305490,_gh:721525244,_gl:746961066,_hh:246885852,_hl:2177182882}),e}return qr(e,t),e.prototype.digest=function(e){var r=t.prototype.digest.call(this).slice(0,32);return e?r.toString(e):r},e}(G.sha512),Io=function(t){return(new xo).update(t).digest("hex")},Fo=function(t){var e=(new G.sha256).update(t).digest();return ko.from((new vt).update(e).digest())},Lo=r(3705).Buffer,Do=function(){function t(){}return t.deserialize=function(t){var e=new this;return e.deserialize(t),e},t}();function Uo(t){if(65!=Lo.from(t,"hex").byteLength)throw Error("Invalid signature");return{type:mr.MessageSignature,data:t}}function Vo(){return{type:mr.MessageSignature,data:Lo.alloc(65,0).toString("hex")}}function jo(t){var e=new Co;return e.appendHexString(t.data),e.concatBuffer()}function Wo(t){return Uo(t.readBuffer(65).toString("hex"))}function Ko(t,e){return{pubKeyEncoding:t,type:mr.TransactionAuthField,contents:e}}function Ho(t){var e=t.readUInt8Enum(Bo,(function(t){throw new tn("Could not read "+t+" as AuthFieldType")}));switch(e){case Bo.PublicKeyCompressed:return Ko(Or.Compressed,sa(t));case Bo.PublicKeyUncompressed:return Ko(Or.Uncompressed,sa(t));case Bo.SignatureCompressed:return Ko(Or.Compressed,Wo(t));case Bo.SignatureUncompressed:return Ko(Or.Uncompressed,Wo(t));default:throw new Error("Unknown auth field type: "+JSON.stringify(e))}}function qo(t){return"signature"in t}function zo(t){var e=No(t);return e.nonce=new(Wr())(0),e.fee=new(Wr())(0),qo(e)?e.signature=Vo():e.fields=[],e}function Go(t){return qo(t)?function(t){var e=new Co;return e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(t.nonce.toArrayLike(Lo,"be",8)),e.push(t.fee.toArrayLike(Lo,"be",8)),e.appendByte(t.keyEncoding),e.push(jo(t.signature)),e.concatBuffer()}(t):function(t){var e=new Co;e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(t.nonce.toArrayLike(Lo,"be",8)),e.push(t.fee.toArrayLike(Lo,"be",8));var r=Da(t.fields);e.push(Ua(r));var n=Lo.alloc(2);return n.writeUInt16BE(t.signaturesRequired,0),e.push(n),e.concatBuffer()}(t)}function $o(t){var e=t.readUInt8Enum(kr,(function(t){throw new tn("Could not parse "+t+" as AddressHashMode")}));return e===kr.SerializeP2PKH||e===kr.SerializeP2WPKH?function(t,e){return{hashMode:t,signer:e.readBuffer(20).toString("hex"),nonce:new(Wr())(e.readBuffer(8).toString("hex"),16),fee:new(Wr())(e.readBuffer(8).toString("hex"),16),keyEncoding:e.readUInt8Enum(Or,(function(t){throw new tn("Could not parse "+t+" as PubKeyEncoding")})),signature:Wo(e)}}(e,t):function(t,e){return{hashMode:t,signer:e.readBuffer(20).toString("hex"),nonce:new(Wr())(e.readBuffer(8).toString("hex"),16),fee:new(Wr())(e.readBuffer(8).toString("hex"),16),fields:Va(e,mr.TransactionAuthField).values,signaturesRequired:e.readUInt16BE()}}(e,t)}function Xo(t,e,r,n){var i=t+Lo.from([e]).toString("hex")+r.toArrayLike(Lo,"be",8).toString("hex")+n.toArrayLike(Lo,"be",8).toString("hex");if(49!==Lo.from(i,"hex").byteLength)throw Error("Invalid signature hash length");return Io(Lo.from(i,"hex"))}function Jo(t,e,r){var n,i=t+((n=(oa(e)?Or.Compressed:Or.Uncompressed).toString(16)).length%2==0?n:"0"+n)+r.data,o=Lo.from(i,"hex");if(o.byteLength>98)throw Error("Invalid signature hash length");return Io(o)}function Yo(t,e,r,n,i){var o=Xo(t,e,r,n),a=function(t,e){var r=new Rt.ec("secp256k1").keyFromPrivate(t.data.toString("hex").slice(0,64),"hex").sign(e,"hex",{canonical:!0}),n=Oo(r.r.toString("hex"),64),i=Oo(r.s.toString("hex"),64);if(void 0===r.recoveryParam||null===r.recoveryParam)throw new Error('"signature.recoveryParam" is not set');return Uo(Po(r.recoveryParam,1)+n+i)}(i,o),s=function(t){return function(t){var e=function(t){var e,r="string"==typeof t?na.from(t,"hex"):t;if(33===r.length){if(1!==r[r.length-1])throw new Error("Improperly formatted private-key. 33 byte length usually indicates compressed key, but last byte must be == 0x01");e=!0}else{if(32!==r.length)throw new Error("Improperly formatted private-key hex string: length should be 32 or 33 bytes, provided with length "+r.length);e=!1}return{data:r,compressed:e}}(t);return ia(new Rt.ec("secp256k1").keyFromPrivate(e.data.toString("hex").slice(0,64),"hex").getPublic(e.compressed,"hex"))}(t.data)}(i);return{nextSig:a,nextSigHash:Jo(o,s,a)}}function Zo(){var t,e,r,n,i,o=(t=kr.SerializeP2PKH,e="",r=new(Wr())(0),n=new(Wr())(0),i=function(t,e,r,n){if(0===n.length)throw Error("Invalid number of public keys");if((e===kr.SerializeP2PKH||e===kr.SerializeP2WPKH)&&1!==n.length)throw Error("Invalid number of public keys or signatures");if(e===kr.SerializeP2WPKH||e===kr.SerializeP2WSH)for(var i=0;i<n.length;i++)if(!oa(n[i]))throw Error("Public keys must be compressed for segwit");switch(e){case kr.SerializeP2PKH:return Ca(0,(o=n[0].data,Fo(o).toString("hex")));case kr.SerializeP2SH:return Ca(0,function(t,e){if(e.length>15)throw Error("P2SH multisig address can only contain up to 15 public keys");var r=new Co;r.appendByte(81),e.forEach((function(t){r.appendByte(t.length),r.push(t)})),r.appendByte(80+e.length),r.appendByte(174);var n=r.concatBuffer();return Fo(n).toString("hex")}(0,n.map(aa)));default:throw Error("Not yet implemented: address construction using public keys for hash mode: "+e)}var o}(0,t,0,[ia(e)]).hash160,{hashMode:t,signer:i,nonce:r,fee:n,keyEncoding:oa(ia(e))?Or.Compressed:Or.Uncompressed,signature:Vo()});return o.signer=(mr.Address,Cr.MainnetSingleSig,"0".repeat(40)),o.keyEncoding=Or.Compressed,o.signature=Vo(),o}function Qo(t,e,r){return qo(t)?function(t,e,r){var n=function(t,e,r,n,i,o){var a=Xo(t,e,r,n),s=ia(function(t,e,r){void 0===r&&(r=Or.Compressed);var n=new Rt.ec("secp256k1"),i=n.keyFromPrivate(t,"hex").getPrivate().toString(10),o=function(t){if(t.length<129)throw new Error("Invalid signature");var e=t.substr(0,2),r=t.substr(2,64),n=t.substr(66,64);return{recoveryParam:Mo(e),r,s:n}}(e.data),a=n.recoverPubKey(i,o,o.recoveryParam,"hex");return r==Or.Uncompressed?a.encode("hex"):a.encodeCompressed("hex")}(a,o,i));return{pubKey:s,nextSigHash:Jo(a,s,o)}}(e,r,t.fee,t.nonce,t.keyEncoding,t.signature);return n.nextSigHash}(t,e,r):""}!function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}(Bo||(Bo={}));var ta,ea,ra=function(t){function e(e,r,n){var i;return(i=t.call(this)||this).authType=e,i.spendingCondition=r,i.sponsorSpendingCondition=n,i}qr(e,t);var r=e.prototype;return r.intoInitialSighashAuth=function(){if(this.spendingCondition)switch(this.authType){case Er.Standard:return new e(Er.Standard,zo(this.spendingCondition));case Er.Sponsored:return new e(Er.Sponsored,zo(this.spendingCondition),Zo());default:throw new en("Unexpected authorization type for signing")}throw new Error("Authorization missing SpendingCondition")},r.setFee=function(t){switch(this.authType){case Er.Standard:this.spendingCondition.fee=t;break;case Er.Sponsored:this.sponsorSpendingCondition.fee=t}},r.getFee=function(){switch(this.authType){case Er.Standard:return this.spendingCondition.fee;case Er.Sponsored:return this.sponsorSpendingCondition.fee;default:return 0}},r.setNonce=function(t){this.spendingCondition.nonce=t},r.setSponsorNonce=function(t){this.sponsorSpendingCondition.nonce=t},r.setSponsor=function(t){this.sponsorSpendingCondition=t},r.verifyOrigin=function(t){switch(this.authType){case Er.Standard:case Er.Sponsored:return Qo(this.spendingCondition,t,Er.Standard);default:throw new en("Invalid origin auth type")}},r.serialize=function(){var t=new Co;if(void 0===this.authType)throw new Qr('"authType" is undefined');switch(t.appendByte(this.authType),this.authType){case Er.Standard:if(void 0===this.spendingCondition)throw new Qr('"spendingCondition" is undefined');t.push(Go(this.spendingCondition));break;case Er.Sponsored:if(void 0===this.spendingCondition)throw new Qr('"spendingCondition" is undefined');if(void 0===this.sponsorSpendingCondition)throw new Qr('"spendingCondition" is undefined');t.push(Go(this.spendingCondition)),t.push(Go(this.sponsorSpendingCondition));break;default:throw new Qr("Unexpected transaction AuthType while serializing: "+JSON.stringify(this.authType))}return t.concatBuffer()},r.deserialize=function(t){switch(this.authType=t.readUInt8Enum(Er,(function(t){throw new tn("Could not parse "+t+" as AuthType")})),this.authType){case Er.Standard:this.spendingCondition=$o(t);break;case Er.Sponsored:this.spendingCondition=$o(t),this.sponsorSpendingCondition=$o(t);break;default:throw new tn("Unexpected transaction AuthType while deserializing: "+JSON.stringify(this.authType))}},e}(Do),na=r(3705).Buffer;function ia(t){return{type:mr.PublicKey,data:na.from(t,"hex")}}function oa(t){return!t.data.toString("hex").startsWith("04")}function aa(t){var e=new Co;return e.push(t.data),e.concatBuffer()}function sa(t){var e,r=t.readUInt8(),n=4!==r?32:64;return e=na.concat([na.from([r]),t.readBuffer(n)]),{type:mr.PublicKey,data:e}}r(3705).Buffer,(ea=ta||(ta={}))[ea.Int=0]="Int",ea[ea.UInt=1]="UInt",ea[ea.Buffer=2]="Buffer",ea[ea.BoolTrue=3]="BoolTrue",ea[ea.BoolFalse=4]="BoolFalse",ea[ea.PrincipalStandard=5]="PrincipalStandard",ea[ea.PrincipalContract=6]="PrincipalContract",ea[ea.ResponseOk=7]="ResponseOk",ea[ea.ResponseErr=8]="ResponseErr",ea[ea.OptionalNone=9]="OptionalNone",ea[ea.OptionalSome=10]="OptionalSome",ea[ea.List=11]="List",ea[ea.Tuple=12]="Tuple",ea[ea.StringASCII=13]="StringASCII",ea[ea.StringUTF8=14]="StringUTF8";var ua=r(3705).Buffer;function ca(t,e){if(ua.byteLength(e.content)>=128)throw new Error("Contract name must be less than 128 bytes");return{type:ta.PrincipalContract,address:t,contractName:e}}var fa=r(7575),ha=r(3705).Buffer;function la(t,e){var r=ha.from([t]);return ha.concat([r,e])}function da(t,e){var r=new Co,n=ha.from(t.data,e),i=ha.alloc(4);return i.writeUInt32BE(n.length,0),r.push(i),r.push(n),la(t.type,r.concatBuffer())}function pa(t){switch(t.type){case ta.BoolTrue:case ta.BoolFalse:return function(t){return ha.from([t.type])}(t);case ta.OptionalNone:case ta.OptionalSome:return(e=t).type===ta.OptionalNone?ha.from([e.type]):la(e.type,pa(e.value));case ta.Buffer:return function(t){var e=ha.alloc(4);return e.writeUInt32BE(t.buffer.length,0),la(t.type,ha.concat([e,t.buffer]))}(t);case ta.Int:case ta.UInt:return function(t){var e=t.value.toArrayLike(ha,"be",16);return la(t.type,e)}(t);case ta.PrincipalStandard:return function(t){return la(t.type,Oa(t.address))}(t);case ta.PrincipalContract:return function(t){return la(t.type,ha.concat([Oa(t.address),Na(t.contractName)]))}(t);case ta.ResponseOk:case ta.ResponseErr:return function(t){return la(t.type,pa(t.value))}(t);case ta.List:return function(t){var e=new Co,r=ha.alloc(4);r.writeUInt32BE(t.list.length,0),e.push(r);for(var n,i=Zr(t.list);!(n=i()).done;){var o=pa(n.value);e.push(o)}return la(t.type,e.concatBuffer())}(t);case ta.Tuple:return function(t){var e=new Co,r=ha.alloc(4);r.writeUInt32BE(Object.keys(t.data).length,0),e.push(r);for(var n,i=Zr(Object.keys(t.data).sort((function(t,e){var r=ha.from(t),n=ha.from(e);return r.compare(n)})));!(n=i()).done;){var o=n.value,a=Ra(o);e.push(Na(a));var s=pa(t.data[o]);e.push(s)}return la(t.type,e.concatBuffer())}(t);case ta.StringASCII:return function(t){return da(t,"ascii")}(t);case ta.StringUTF8:return function(t){return da(t,"utf8")}(t);default:throw new Qr("Unable to serialize. Invalid Clarity Value.")}var e}r(3705).Buffer;var ga=r(3705).Buffer,ya=new Map;function ma(t,e){var r=ya.get(t);if(void 0!==r)return r(e);var n=function(t){var e=Object.values(t).filter((function(t){return"number"==typeof t})),r=new Set(e);return function(t){return r.has(t)}}(t);return ya.set(t,n),ma(t,e)}var wa=function(){function t(t){ga.isBuffer(t)?this.smartBuffer=new fa.I({buff:t}):this.smartBuffer=new fa.I(t)}t.fromBuffer=function(e){return new t({buff:e})};var e=t.prototype;return e.readBuffer=function(t){return this.smartBuffer.readBuffer(t)},e.readUInt32BE=function(t){return this.smartBuffer.readUInt32BE(t)},e.readUInt8=function(){return this.smartBuffer.readUInt8()},e.readUInt16BE=function(){return this.smartBuffer.readUInt16BE()},e.readBigUIntLE=function(t){var e=ga.from(this.smartBuffer.readBuffer(t)).reverse().toString();return BigInt("0x"+e)},e.readBigUIntBE=function(t){var e=this.smartBuffer.readBuffer(t).toString("hex");return BigInt("0x"+e)},e.readBigUInt64BE=function(){return this.smartBuffer.readBigUInt64BE()},e.readString=function(t,e){return this.smartBuffer.readString(t,e)},e.readUInt8Enum=function(t,e){var r=this.smartBuffer.readUInt8();if(ma(t,r))return r;throw e(r)},Hr(t,[{key:"readOffset",get:function(){return this.smartBuffer.readOffset},set:function(t){this.smartBuffer.readOffset=t}},{key:"internalBuffer",get:function(){return this.smartBuffer.internalBuffer}}]),t}(),ba=r(3705).Buffer;const va=function t(e){var r,n,i,o,a=ba.isBuffer(e)?new wa(e):e;switch(a.readUInt8Enum(ta,(function(t){throw new tn("Cannot recognize Clarity Type: "+t)}))){case ta.Int:return function(t){var e=new(Wr())(t).toTwos(Vr);if(e.bitLength()>Vr)throw new Error("Cannot construct clarity integer from value greater than INT_SIZE bits");return{type:ta.Int,value:e}}(a.readBuffer(16));case ta.UInt:return function(t){var e=new(Wr())(t).toTwos(Vr);if(e.isNeg())throw new Error("Cannot construct unsigned clarity integer from negative value");if(e.bitLength()>Vr)throw new Error("Cannot construct unsigned clarity integer from value greater than 128 bits");return{type:ta.UInt,value:e}}(a.readBuffer(16));case ta.Buffer:var s=a.readUInt32BE();return function(t){if(t.length>1e6)throw new Error("Cannot construct clarity buffer that is greater than 1MB");return{type:ta.Buffer,buffer:t}}(a.readBuffer(s));case ta.BoolTrue:return{type:ta.BoolTrue};case ta.BoolFalse:return{type:ta.BoolFalse};case ta.PrincipalStandard:return o=Pa(a),{type:ta.PrincipalStandard,address:o};case ta.PrincipalContract:return ca(Pa(a),Ba(a));case ta.ResponseOk:return i=t(a),{type:ta.ResponseOk,value:i};case ta.ResponseErr:return function(t){return{type:ta.ResponseErr,value:t}}(t(a));case ta.OptionalNone:return{type:ta.OptionalNone};case ta.OptionalSome:return function(t){return{type:ta.OptionalSome,value:t}}(t(a));case ta.List:for(var u=a.readUInt32BE(),c=[],f=0;f<u;f++)c.push(t(a));return n=c,{type:ta.List,list:n};case ta.Tuple:for(var h=a.readUInt32BE(),l={},d=0;d<h;d++){var p=Ba(a).content;if(void 0===p)throw new tn('"content" is undefined');l[p]=t(a)}return function(t){for(var e in t)if(!(/^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/.test(r=e)&&r.length<128))throw new Error('"'+e+'" is not a valid Clarity name');var r;return{type:ta.Tuple,data:t}}(l);case ta.StringASCII:var g=a.readUInt32BE();return r=a.readBuffer(g).toString("ascii"),{type:ta.StringASCII,data:r};case ta.StringUTF8:var y=a.readUInt32BE();return function(t){return{type:ta.StringUTF8,data:t}}(a.readBuffer(y).toString("utf8"));default:throw new tn("Unable to deserialize Clarity Value from buffer. Could not find valid Clarity Type.")}};var _a=r(3705).Buffer;function Sa(t){var e=new Co;switch(e.appendByte(t.payloadType),t.payloadType){case wr.TokenTransfer:e.push(pa(t.recipient)),e.push(t.amount.toArrayLike(_a,"be",8)),e.push(Ea(t.memo));break;case wr.ContractCall:e.push(Ea(t.contractAddress)),e.push(Ea(t.contractName)),e.push(Ea(t.functionName));var r=_a.alloc(4);r.writeUInt32BE(t.functionArgs.length,0),e.push(r),t.functionArgs.forEach((function(t){e.push(pa(t))}));break;case wr.SmartContract:e.push(Ea(t.contractName)),e.push(Ea(t.codeBody));break;case wr.PoisonMicroblock:break;case wr.Coinbase:e.push(t.coinbaseBuffer)}return e.concatBuffer()}function Aa(t){switch(t.readUInt8Enum(wr,(function(t){throw new Error("Cannot recognize PayloadType: "+t)}))){case wr.TokenTransfer:return f=va(t),h=new(Wr())(t.readBuffer(8)),l=Ia(t),"string"==typeof f&&(f=function(t){if(t.includes(".")){var e=t.split(".");return r=e[0],n=e[1],ca(ka(r),Ra(n))}var r,n,i;return i=ka(t),{type:ta.PrincipalStandard,address:i}}(f)),"string"==typeof l&&(l=xa(l)),{type:mr.Payload,payloadType:wr.TokenTransfer,recipient:f,amount:h,memo:null!=(d=l)?d:xa("")};case wr.ContractCall:for(var e=Pa(t),r=Ba(t),n=Ba(t),i=[],o=t.readUInt32BE(),a=0;a<o;a++){var s=va(t);i.push(s)}return function(t,e,r,n){return"string"==typeof t&&(t=ka(t)),"string"==typeof e&&(e=Ra(e)),"string"==typeof r&&(r=Ra(r)),{type:mr.Payload,payloadType:wr.ContractCall,contractAddress:t,contractName:e,functionName:r,functionArgs:n}}(e,r,n,i);case wr.SmartContract:return u=Ba(t),c=Ba(t,4,1e5),"string"==typeof u&&(u=Ra(u)),"string"==typeof c&&(c=Ra(c,4,1e5)),{type:mr.Payload,payloadType:wr.SmartContract,contractName:u,codeBody:c};case wr.PoisonMicroblock:return{type:mr.Payload,payloadType:wr.PoisonMicroblock};case wr.Coinbase:return function(t){if(32!=t.byteLength)throw Error("Coinbase buffer size must be 32 bytes");return{type:mr.Payload,payloadType:wr.Coinbase,coinbaseBuffer:t}}(t.readBuffer(32))}var u,c,f,h,l,d}var Ta=r(3705).Buffer;function Ea(t){switch(t.type){case mr.Address:return Oa(t);case mr.Principal:return Ma(t);case mr.LengthPrefixedString:return Na(t);case mr.MemoString:return e=t,r=new Co,n=Ta.from(e.content).toString("hex").padEnd(68,"0"),r.push(Ta.from(n,"hex")),r.concatBuffer();case mr.AssetInfo:return Fa(t);case mr.PostCondition:return Wa(t);case mr.PublicKey:return aa(t);case mr.LengthPrefixedList:return Ua(t);case mr.Payload:return Sa(t);case mr.TransactionAuthField:return function(t){var e,r=new Co;switch(t.contents.type){case mr.PublicKey:t.pubKeyEncoding==Or.Compressed?(r.appendByte(Bo.PublicKeyCompressed),r.push(aa(t.contents))):(r.appendByte(Bo.PublicKeyUncompressed),r.push(aa((e=t.contents.data,ia(new Rt.ec("secp256k1").keyFromPublic(e).getPublic(!0,"hex"))))));break;case mr.MessageSignature:t.pubKeyEncoding==Or.Compressed?r.appendByte(Bo.SignatureCompressed):r.appendByte(Bo.SignatureUncompressed),r.push(jo(t.contents))}return r.concatBuffer()}(t);case mr.MessageSignature:return jo(t)}var e,r,n}function ka(t){var e=(0,rn.ns)(t);return{type:mr.Address,version:e[0],hash160:e[1]}}function Ca(t,e){return{type:mr.Address,version:t,hash160:e}}function Oa(t){var e=new Co;return e.appendHexString(Po(t.version,1)),e.appendHexString(t.hash160),e.concatBuffer()}function Pa(t){var e=Mo(t.readBuffer(1).toString("hex")),r=t.readBuffer(20).toString("hex");return{type:mr.Address,version:e,hash160:r}}function Ma(t){var e=new Co;return e.push(Ta.from([t.prefix])),e.push(Oa(t.address)),t.prefix===Rr.Contract&&e.push(Na(t.contractName)),e.concatBuffer()}function Ra(t,e,r){var n=e||1,i=r||128;if(Ro(t,i))throw new Error("String length exceeds maximum bytes "+i.toString());return{type:mr.LengthPrefixedString,content:t,lengthPrefixBytes:n,maxLengthBytes:i}}function Na(t){var e=new Co,r=Ta.from(t.content),n=r.byteLength;return e.appendHexString(Po(n,t.lengthPrefixBytes)),e.push(r),e.concatBuffer()}function Ba(t,e,r){e=e||1;var n=Mo(t.readBuffer(e).toString("hex"));return Ra(t.readBuffer(n).toString(),e,null!=r?r:128)}function xa(t){if(t&&Ro(t,34))throw new Error("Memo exceeds maximum length of "+34..toString()+" bytes");return{type:mr.MemoString,content:t}}function Ia(t){var e=t.readBuffer(34).toString();return{type:mr.MemoString,content:e}}function Fa(t){var e=new Co;return e.push(Oa(t.address)),e.push(Na(t.contractName)),e.push(Na(t.assetName)),e.concatBuffer()}function La(t){return{type:mr.AssetInfo,address:Pa(t),contractName:Ba(t),assetName:Ba(t)}}function Da(t,e){return{type:mr.LengthPrefixedList,lengthPrefixBytes:e||4,values:t}}function Ua(t){var e=t.values,r=new Co;r.appendHexString(Po(e.length,t.lengthPrefixBytes));for(var n=0;n<e.length;n++)r.push(Ea(e[n]));return r.concatBuffer()}function Va(t,e,r){for(var n=Mo(t.readBuffer(r||4).toString("hex")),i=[],o=0;o<n;o++)switch(e){case mr.Address:i.push(Pa(t));break;case mr.LengthPrefixedString:i.push(Ba(t));break;case mr.MemoString:i.push(Ia(t));break;case mr.AssetInfo:i.push(La(t));break;case mr.PostCondition:i.push(Ka(t));break;case mr.PublicKey:i.push(sa(t));break;case mr.TransactionAuthField:i.push(Ho(t))}return Da(i,r)}var ja=r(3705).Buffer;function Wa(t){var e=new Co;return e.appendByte(t.conditionType),e.push(Ma(t.principal)),t.conditionType!==Tr.Fungible&&t.conditionType!==Tr.NonFungible||e.push(Fa(t.assetInfo)),t.conditionType===Tr.NonFungible&&e.push(pa(t.assetName)),e.appendByte(t.conditionCode),t.conditionType!==Tr.STX&&t.conditionType!==Tr.Fungible||e.push(t.amount.toArrayLike(ja,"be",8)),e.concatBuffer()}function Ka(t){var e,r,n,i=t.readUInt8Enum(Tr,(function(t){throw new tn("Could not read "+t+" as PostConditionType")})),o=function(t){var e=t.readUInt8Enum(Rr,(function(t){throw new tn("Unexpected Principal payload type: ${n}")})),r=Pa(t);if(e===Rr.Standard)return{type:mr.Principal,prefix:e,address:r};var n=Ba(t);return{type:mr.Principal,prefix:e,address:r,contractName:n}}(t);switch(i){case Tr.STX:return e=t.readUInt8Enum(Pr,(function(t){throw new tn("Could not read "+t+" as FungibleConditionCode")})),n=new(Wr())(t.readBuffer(8).toString("hex"),16),{type:mr.PostCondition,conditionType:Tr.STX,principal:o,conditionCode:e,amount:n};case Tr.Fungible:return r=La(t),e=t.readUInt8Enum(Pr,(function(t){throw new tn("Could not read "+t+" as FungibleConditionCode")})),n=new(Wr())(t.readBuffer(8).toString("hex"),16),{type:mr.PostCondition,conditionType:Tr.Fungible,principal:o,conditionCode:e,amount:n,assetInfo:r};case Tr.NonFungible:r=La(t);var a=va(t);return e=t.readUInt8Enum(Mr,(function(t){throw new tn("Could not read "+t+" as FungibleConditionCode")})),{type:mr.PostCondition,conditionType:Tr.NonFungible,principal:o,conditionCode:e,assetInfo:r,assetName:a}}}var Ha=r(3705).Buffer,qa=function(){function t(t,e,r,n,i,o,a){if(this.version=t,this.auth=e,this.payload=r,this.chainId=null!=a?a:Ur,this.postConditionMode=null!=i?i:Ar.Deny,this.postConditions=null!=n?n:Da([]),o)this.anchorMode=o;else switch(r.payloadType){case wr.Coinbase:case wr.PoisonMicroblock:this.anchorMode=br.OnChainOnly;break;case wr.ContractCall:case wr.SmartContract:case wr.TokenTransfer:this.anchorMode=br.Any}}var e=t.prototype;return e.signBegin=function(){var t=No(this);return t.auth=t.auth.intoInitialSighashAuth(),t.txid()},e.verifyBegin=function(){var t=No(this);return t.auth=t.auth.intoInitialSighashAuth(),t.txid()},e.createTxWithSignature=function(t){var e="string"==typeof t?t:t.toString("hex"),r=No(this);if(!r.auth.spendingCondition)throw new Error("Cannot set signature on transaction without spending condition");return r.auth.spendingCondition.signature=Uo(e),r},e.verifyOrigin=function(){return this.auth.verifyOrigin(this.verifyBegin())},e.signNextOrigin=function(t,e){if(void 0===this.auth.spendingCondition)throw new Error('"auth.spendingCondition" is undefined');if(void 0===this.auth.authType)throw new Error('"auth.authType" is undefined');return this.signAndAppend(this.auth.spendingCondition,t,Er.Standard,e)},e.signNextSponsor=function(t,e){if(void 0===this.auth.sponsorSpendingCondition)throw new Error('"auth.spendingCondition" is undefined');if(void 0===this.auth.authType)throw new Error('"auth.authType" is undefined');return this.signAndAppend(this.auth.sponsorSpendingCondition,t,Er.Sponsored,e)},e.appendPubkey=function(t){var e=this.auth.spendingCondition;if(!e||qo(e))throw new Error("Can't append public key to a singlesig condition");var r=oa(t);e.fields.push(Ko(r?Or.Compressed:Or.Uncompressed,t))},e.signAndAppend=function(t,e,r,n){var i=Yo(e,r,t.fee,t.nonce,n),o=i.nextSig,a=i.nextSigHash;if(qo(t))t.signature=o;else{var s=n.data.toString("hex").endsWith("01");t.fields.push(Ko(s?Or.Compressed:Or.Uncompressed,o))}return a},e.txid=function(){var t=this.serialize();return Io(t)},e.setSponsor=function(t){if(this.auth.authType!=Er.Sponsored)throw new en("Cannot sponsor sign a non-sponsored transaction");this.auth.setSponsor(t)},e.setFee=function(t){this.auth.setFee(t)},e.setNonce=function(t){this.auth.setNonce(t)},e.setSponsorNonce=function(t){this.auth.setSponsorNonce(t)},e.serialize=function(){if(void 0===this.version)throw new Qr('"version" is undefined');if(void 0===this.chainId)throw new Qr('"chainId" is undefined');if(void 0===this.auth)throw new Qr('"auth" is undefined');if(void 0===this.anchorMode)throw new Qr('"anchorMode" is undefined');if(void 0===this.payload)throw new Qr('"payload" is undefined');var t=new Co;t.appendByte(this.version);var e=Ha.alloc(4);return e.writeUInt32BE(this.chainId,0),t.push(e),t.push(this.auth.serialize()),t.appendByte(this.anchorMode),t.appendByte(this.postConditionMode),t.push(Ua(this.postConditions)),t.push(Sa(this.payload)),t.concatBuffer()},t}(),za=r(3705).Buffer,Ga=function(t){var e=t;if(!e){var r=new S(["store_write"],document.location.href);e=new He({appConfig:r})}return e},$a=function(t){var e=Ga(t).loadUserData().appPrivateKey;return{privateKey:e,publicKey:K.SECP256K1Client.derivePublicKey(e)}};function Xa(t){var e,r,n=t.stxAddress,i=t.userSession,o=t.network;if(n)return n;if(i&&o){var a=null==i||null==(e=i.loadUserData().profile)?void 0:e.stxAddress,s=((r={})[hr.Mainnet]="mainnet",r[hr.Testnet]="testnet",r);return null==a?void 0:a[s[o.chainId]]}}function Ja(t){var e=er({},t,{network:t.network||new We.StacksTestnet,userSession:Ga(t.userSession)});return er({stxAddress:Xa(e)},e)}var Ya=function(){var t=tr(ir().mark((function t(e,r){var n,i;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=e.postConditions)&&"string"!=typeof n[0]&&(n=n.map((function(t){return Wa(t).toString("hex")}))),i=new K.TokenSigner("ES256k",r),t.abrupt("return",i.signAsync(er({},e,{postConditions:n})));case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),Za=function(t){var e=t.token,r=t.options,n=Ye();if(!n)throw new Error("Stacks Wallet not installed.");n.transactionRequest(e).then((function(t){var e=r.finished||r.onFinish,n=t.txRaw,i=za.from(n.replace(/^0x/,""),"hex"),o=function(t){var e,r=(e="string"==typeof t?"0x"===t.slice(0,2).toLowerCase()?new wa(Ha.from(t.slice(2),"hex")):new wa(Ha.from(t,"hex")):Ha.isBuffer(t)?new wa(t):t).readUInt8Enum(vr,(function(t){throw new Error("Could not parse "+t+" as TransactionVersion")})),n=e.readUInt32BE(),i=ra.deserialize(e),o=e.readUInt8Enum(br,(function(t){throw new Error("Could not parse "+t+" as AnchorMode")})),a=e.readUInt8Enum(Ar,(function(t){throw new Error("Could not parse "+t+" as PostConditionMode")})),s=Va(e,mr.PostCondition),u=Aa(e);return new qa(r,i,u,s,a,o,n)}(new wa(i));if("sponsored"in r&&r.sponsored){var a=r.onFinish||r.finished;null==a||a(er({},t,{stacksTransaction:o}))}else null==e||e(er({},t,{stacksTransaction:o}))})).catch((function(t){console.error("[Connect] Error during transaction request",t),null==r.onCancel||r.onCancel()}))},Qa=function(){var t=tr(ir().mark((function t(e){var r,n,i,o,a,s,u,c,f;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.functionArgs,n=e.appDetails,i=e.userSession,o=rr(e,["functionArgs","appDetails","userSession"]),a=$a(i),s=a.privateKey,u=a.publicKey,c=r.map((function(t){return"string"==typeof t?t:pa(t).toString("hex")})),f=er({},o,{functionArgs:c,txType:sr.ContractCall,publicKey:u}),n&&(f.appDetails=n),t.abrupt("return",Ya(f,s));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ts=function(){var t=tr(ir().mark((function t(e){var r,n,i,o,a,s,u;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appDetails,n=e.userSession,i=rr(e,["appDetails","userSession"]),o=$a(n),a=o.privateKey,s=o.publicKey,u=er({},i,{publicKey:s,txType:sr.ContractDeploy}),r&&(u.appDetails=r),t.abrupt("return",Ya(u,a));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),es=function(){var t=tr(ir().mark((function t(e){var r,n,i,o,a,s,u,c;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.amount,n=e.appDetails,i=e.userSession,o=rr(e,["amount","appDetails","userSession"]),a=$a(i),s=a.privateKey,u=a.publicKey,c=er({},o,{amount:r.toString(10),publicKey:u,txType:sr.STXTransfer}),n&&(c.appDetails=n),t.abrupt("return",Ya(c,s));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();function rs(t,e){return ns.apply(this,arguments)}function ns(){return(ns=tr(ir().mark((function t(e,r){var n;return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r(er({},Ja(e),e));case 2:return n=t.sent,t.abrupt("return",Za({token:n,options:e}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function is(t){return rs(t,Qa)}function os(t){return rs(t,ts)}function as(t){return rs(t,es)}var ss=r(9261),us=function(t){if(Ye())gr(t);else{(0,ss.defineCustomElements)();var e=document.createElement("connect-modal");e.authOptions=t,document.body.appendChild(e),document.addEventListener("keydown",(function t(r){"Escape"===r.key&&(document.removeEventListener("keydown",t),e.remove())}))}},cs=function(t){return us(t)}},8782:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4300).Buffer}catch(t){}function s(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=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.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<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.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 o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f<s;f+=n)u=c(t,f,f+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],h=[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],l=[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 d(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],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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 c=h[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:f[c-g.length]+g+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(!(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(!(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(!(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.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;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.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<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.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 o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,g=d>>>13,y=0|a[2],m=8191&y,w=y>>>13,b=0|a[3],v=8191&b,_=b>>>13,S=0|a[4],A=8191&S,T=S>>>13,E=0|a[5],k=8191&E,C=E>>>13,O=0|a[6],P=8191&O,M=O>>>13,R=0|a[7],N=8191&R,B=R>>>13,x=0|a[8],I=8191&x,F=x>>>13,L=0|a[9],D=8191&L,U=L>>>13,V=0|s[0],j=8191&V,W=V>>>13,K=0|s[1],H=8191&K,q=K>>>13,z=0|s[2],G=8191&z,$=z>>>13,X=0|s[3],J=8191&X,Y=X>>>13,Z=0|s[4],Q=8191&Z,tt=Z>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(c+(n=Math.imul(h,j))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(l,j)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,W))+Math.imul(g,j)|0,o=Math.imul(g,W);var mt=(c+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(l,H)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,j),i=(i=Math.imul(m,W))+Math.imul(w,j)|0,o=Math.imul(w,W),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,q)|0;var wt=(c+(n=n+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,W))+Math.imul(_,j)|0,o=Math.imul(_,W),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,q)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,q)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,$)|0;var bt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,W))+Math.imul(T,j)|0,o=Math.imul(T,W),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Y)|0;var vt=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(k,j),i=(i=Math.imul(k,W))+Math.imul(C,j)|0,o=Math.imul(C,W),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,q)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,q)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(P,j),i=(i=Math.imul(P,W))+Math.imul(M,j)|0,o=Math.imul(M,W),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,q)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,q)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,$)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var St=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(N,j),i=(i=Math.imul(N,W))+Math.imul(B,j)|0,o=Math.imul(B,W),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,q)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,q)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0;var At=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,W))+Math.imul(F,j)|0,o=Math.imul(F,W),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ct)|0;var Tt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,W))+Math.imul(U,j)|0,o=Math.imul(U,W),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(F,H)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,$)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ht)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,gt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,H),i=(i=Math.imul(D,q))+Math.imul(U,H)|0,o=Math.imul(U,q),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,$)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;c=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,G),i=(i=Math.imul(D,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(v,ht)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0;var Ct=(c+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,gt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Pt=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,at)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,lt)|0;var Mt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,ct)|0,n=n+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,lt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0;var Rt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,lt)|0;var Nt=(c+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;c=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var Bt=(c+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(F,pt)|0))<<13)|0;c=((o=o+Math.imul(F,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var xt=(c+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,gt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,gt))+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,u[0]=yt,u[1]=mt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Tt,u[9]=Et,u[10]=kt,u[11]=Ct,u[12]=Ot,u[13]=Pt,u[14]=Mt,u[15]=Rt,u[16]=Nt,u[17]=Bt,u[18]=xt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new y).mulp(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.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?d(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,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},y.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},y.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},y.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=r[f+d],g=n[f+d],y=r[f+d+a],m=n[f+d+a],w=h*y-l*m;m=h*m+l*y,y=w,r[f+d]=p+y,n[f+d]=g+m,r[f+d+a]=p-y,n[f+d+a]=g-m,d!==s&&(w=u*h-c*l,l=u*l+c*h,h=w)}},y.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},y.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},y.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(!(-8192&o))},y.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},y.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),h=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,f,h,n,i);for(var d=0;d<n;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),g(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=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<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},o.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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.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 o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;!(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,g=1;!(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.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,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;!(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;!(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.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 o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._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 T(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,w),i(_,w),i(S,w),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return m[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(!(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var g=d,y=0;0!==g.cmp(s);y++)g=g.redSqr();n(y<p);var m=this.pow(h,new o(1).iushln(p-y-1));l=l.redMul(m),h=m.redSqr(),d=d.redMul(h),p=y}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===f)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,A),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.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),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)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(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),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3705:(t,e,r)=>{"use strict";var n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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 h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return l(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(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return d(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 u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||K(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.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 f(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 h(t){return f(t),s(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(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 U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(i)return n?-1:U(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(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 w(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),K(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(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):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,a=1,s=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;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){h=!1;break}if(h)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(K(s))return a;t[r+a]=s}return a}function _(t,e,r,n){return j(U(e,t.length-r),t,r,n)}function S(t,e,r,n){return j(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return S(t,e,r,n)}function T(t,e,r,n){return j(V(e),t,r,n)}function E(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=(r=t.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],f=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(W(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(W(o,Uint8Array)&&(o=u.from(o)),!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?C(this,0,t):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(W(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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 o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r),h=0;h<s;++h)if(c[h]!==f[h]){o=c[h],a=f[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=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 o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=H[t[o]];return i}function N(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(t,e,r,n,o){return e=+e,r>>>=0,o||I(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||I(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.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<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(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 t>>>=0,e||B(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||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(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 t>>>=0,e||B(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 t>>>=0,e||B(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 t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(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||x(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a|0)-s&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);x(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),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||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeFloatLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var o=i-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:u.from(t,n),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var D=/[^+/0-9A-Za-z-_]/g;function U(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}var H=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}()},1243:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;var n=r(5524),i=r(3387);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};var o={};o[0]=e.versions.mainnet.p2pkh,o[5]=e.versions.mainnet.p2sh,o[111]=e.versions.testnet.p2pkh,o[196]=e.versions.testnet.p2sh;var a={};function s(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return"S"+n.c32checkEncode(t,e)}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return n.c32checkDecode(t.slice(1))}a[e.versions.mainnet.p2pkh]=0,a[e.versions.mainnet.p2sh]=5,a[e.versions.testnet.p2pkh]=111,a[e.versions.testnet.p2sh]=196,e.c32address=s,e.c32addressDecode=u,e.b58ToC32=function(t,e){void 0===e&&(e=-1);var r,n=i.decode(t),a=n.data.toString("hex"),u=parseInt(n.prefix.toString("hex"),16);return e<0?(r=u,void 0!==o[u]&&(r=o[u])):r=e,s(r,a)},e.c32ToB58=function(t,e){void 0===e&&(e=-1);var r,n=u(t),o=n[0],s=n[1];e<0?(r=o,void 0!==a[o]&&(r=a[o])):r=e;var c=r.toString(16);return 1===c.length&&(c="0"+c),i.encode(s,c)}},3387:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;var n=r(3705),i=r(1189),o=r(5364),a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e,r){if(void 0===e&&(e="00"),void 0===r&&(r="hex"),"string"==typeof t&&(t=new n.Buffer(t,r)),!(t instanceof n.Buffer))throw new TypeError('"data" argument must be an Array of Buffers');e instanceof n.Buffer||(e=new n.Buffer(e,r));var s=n.Buffer.concat([e,t]);return s=i.hashSha256(s),s=i.hashSha256(s),s=n.Buffer.concat([e,t,s.slice(0,4)]),o(a).encode(s)},e.decode=function(t,e){var r=new n.Buffer(o(a).decode(t)),s=r.slice(0,1),u=r.slice(1,-4),c=n.Buffer.concat([s,u]);return c=i.hashSha256(c),c=i.hashSha256(c),r.slice(-4).forEach((function(t,e){if(t!==c[e])throw new Error("Invalid checksum")})),e&&(s=s.toString(e),u=u.toString(e)),{prefix:s,data:u}}},5524:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;var n=r(3705),i=r(4986),o=r(1189);function a(t){return o.hashSha256(o.hashSha256(n.Buffer.from(t,"hex"))).slice(0,4).toString("hex")}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e="0"+e);var r=t.toString(16);1===r.length&&(r="0"+r);var n=a(""+r+e),o=i.c32encode(""+e+n);return""+i.c32[t]+o},e.c32checkDecode=function(t){t=i.c32normalize(t);var e=i.c32decode(t.slice(1)),r=t[0],n=i.c32.indexOf(r),o=e.slice(-8),s=n.toString(16);if(1===s.length&&(s="0"+s),a(""+s+e.substring(0,e.length-8))!==o)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},4986:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;var n=r(3705);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,r){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t="0"+t);for(var o=[],a=0,s=(t=t.toLowerCase()).length-1;s>=0;s--)if(a<4){var u=i.indexOf(t[s])>>a,c=0;0!==s&&(c=i.indexOf(t[s-1]));var f=1+a,h=c%(1<<f)<<5-f,l=e.c32[u+h];a=f,o.unshift(l)}else a=0;var d=0;for(s=0;s<o.length&&"0"===o[s];s++)d++;o=o.slice(d);var p=n.Buffer.from(t,"hex").toString().match(/^\u0000*/),g=p?p[0].length:0;for(s=0;s<g;s++)o.unshift(e.c32[0]);if(r){var y=r-o.length;for(s=0;s<y;s++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,r){if(!(t=o(t)).match("^["+e.c32+"]*$"))throw new Error("Not a c32-encoded string");for(var n=t.match("^"+e.c32[0]+"*"),a=n?n[0].length:0,s=[],u=0,c=0,f=t.length-1;f>=0;f--){4===c&&(s.unshift(i[u]),c=0,u=0);var h=(e.c32.indexOf(t[f])<<c)+u,l=i[h%16];if((u=h>>4)>1<<(c+=1))throw new Error("Panic error in decoding.");s.unshift(l)}s.unshift(i[u]),s.length%2==1&&s.unshift("0");var d=0;for(f=0;f<s.length&&"0"===s[f];f++)d++;var p=(s=s.slice(d-d%2)).join("");for(f=0;f<a;f++)p="00"+p;if(r){var g=2*r-p.length;for(f=0;f<g;f+=2)p="00"+p}return p}},2591:(t,e,r)=>{"use strict";e.ns=void 0;r(4986),r(5524);var n=r(1243);Object.defineProperty(e,"ns",{enumerable:!0,get:function(){return n.c32addressDecode}})},966:(t,e,r)=>{"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}r.r(e),r.d(e,{StacksMainnet:()=>a,StacksMocknet:()=>u,StacksTestnet:()=>s});var i=r(6327),o=r(9725),a=function(){function t(){var t=this;this.version=i.J_.Mainnet,this.chainId=i.n_.Mainnet,this.coreApiUrl="https://stacks-node-api.mainnet.stacks.co",this.bnsLookupUrl="https://core.blockstack.org",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=function(){return t.version===i.J_.Mainnet},this.getBroadcastApiUrl=function(){return""+t.coreApiUrl+t.broadcastEndpoint},this.getTransferFeeEstimateApiUrl=function(){return""+t.coreApiUrl+t.transferFeeEstimateEndpoint},this.getAccountApiUrl=function(e){return""+t.coreApiUrl+t.accountEndpoint+"/"+e+"?proof=0"},this.getAbiApiUrl=function(e,r){return""+t.coreApiUrl+t.contractAbiEndpoint+"/"+e+"/"+r},this.getReadOnlyFunctionCallApiUrl=function(e,r,n){return""+t.coreApiUrl+t.readOnlyFunctionCallEndpoint+"/"+e+"/"+r+"/"+encodeURIComponent(n)},this.getInfoUrl=function(){return t.coreApiUrl+"/v2/info"},this.getBlockTimeInfoUrl=function(){return t.coreApiUrl+"/extended/v1/info/network_block_times"},this.getPoxInfoUrl=function(){return t.coreApiUrl+"/v2/pox"},this.getStackerInfoUrl=function(e,r){return""+t.coreApiUrl+t.readOnlyFunctionCallEndpoint+"\n "+e+"/"+r+"/get-stacker-info"}}return t.prototype.getNameInfo=function(t){var e=this.bnsLookupUrl+"/v1/names/"+t;return(0,o.C)(e).then((function(t){if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error("Bad response status: "+t.status);return t.json()})).then((function(t){return t.address?Object.assign({},t,{address:t.address}):t}))},t}(),s=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).version=i.J_.Testnet,e.chainId=i.n_.Testnet,e.coreApiUrl="https://stacks-node-api.testnet.stacks.co",e}return n(e,t),e}(a),u=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).version=i.J_.Testnet,e.chainId=i.n_.Testnet,e.coreApiUrl="http://localhost:3999",e}return n(e,t),e}(a)},4760:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AddressHashMode:()=>X,AddressVersion:()=>J,AnchorMode:()=>U,AnchorModeNames:()=>j,AssetType:()=>et,AuthFieldType:()=>$n,AuthType:()=>$,BytesReader:()=>kn,CLARITY_INT_BYTE_SIZE:()=>O,CLARITY_INT_SIZE:()=>C,COINBASE_BYTES_LENGTH:()=>P,COMPRESSED_PUBKEY_LENGTH_BYTES:()=>N,ChainID:()=>T,Cl:()=>n,ClarityAbiTypeId:()=>Fo,ClarityType:()=>Yr,ClarityVersion:()=>D,DEFAULT_CHAIN_ID:()=>E,DEFAULT_CORE_NODE_API_URL:()=>I,DEFAULT_TRANSACTION_VERSION:()=>q,FungibleConditionCode:()=>Z,MAX_STRING_LENGTH_BYTES:()=>k,MEMO_MAX_LENGTH_BYTES:()=>x,NonFungibleConditionCode:()=>Q,PayloadType:()=>L,Pc:()=>i,PostConditionMode:()=>z,PostConditionPrincipalID:()=>tt,PostConditionType:()=>G,PubKeyEncoding:()=>Y,RECOVERABLE_ECDSA_SIG_LENGTH_BYTES:()=>R,STRUCTURED_DATA_PREFIX:()=>Ds,StacksMessageType:()=>F,StacksTransaction:()=>na,TransactionSigner:()=>ra,TransactionVersion:()=>H,TxRejectedReason:()=>rt,UNCOMPRESSED_PUBKEY_LENGTH_BYTES:()=>B,VRF_PROOF_BYTES_LENGTH:()=>M,abiFunctionToString:()=>Xo,addressFromHashMode:()=>oi,addressFromPublicKeys:()=>ai,addressFromVersionHash:()=>Sr,addressHashModeToVersion:()=>_r,addressToString:()=>Ar,anchorModeFromNameOrValue:()=>K,boolCV:()=>ln,broadcastRawTransaction:()=>fa,broadcastTransaction:()=>ca,bufferCV:()=>un,bufferCVFromString:()=>cn,callReadOnlyFunction:()=>Ca,cloneDeep:()=>Ni,codeBodyString:()=>di,compressPublicKey:()=>xr,contractPrincipalCV:()=>mn,contractPrincipalCVFromAddress:()=>wn,contractPrincipalCVFromStandard:()=>bn,createAddress:()=>Gr,createAssetInfo:()=>zr,createContractPrincipal:()=>Xr,createEmptyAddress:()=>ii,createFungiblePostCondition:()=>ta,createLPList:()=>bi,createLPString:()=>qr,createMemoString:()=>pi,createMessageSignature:()=>vr,createMultiSigSpendingCondition:()=>Xi,createNonFungiblePostCondition:()=>ea,createSTXPostCondition:()=>Qo,createSingleSigSpendingCondition:()=>$i,createSponsoredAuth:()=>ho,createStacksPrivateKey:()=>Lr,createStacksPublicKey:()=>kr,createStandardAuth:()=>fo,createStandardPrincipal:()=>Jr,createTransactionAuthField:()=>Zn,cvToHex:()=>Wi,cvToJSON:()=>Bo,cvToString:()=>Ro,cvToValue:()=>No,decodeStructuredDataSignature:()=>Ws,deserializeAddress:()=>ui,deserializeAssetInfo:()=>wi,deserializeAuthorization:()=>_o,deserializeCV:()=>Ln,deserializeLPList:()=>_i,deserializeLPString:()=>li,deserializeMemoString:()=>yi,deserializeMessageSignature:()=>Yn,deserializeMultiSigSpendingCondition:()=>no,deserializePostCondition:()=>Ai,deserializePrincipal:()=>fi,deserializePublicKey:()=>Fr,deserializeSingleSigSpendingCondition:()=>ro,deserializeSpendingCondition:()=>oo,deserializeStacksMessage:()=>ni,deserializeTransaction:()=>ia,deserializeTransactionAuthField:()=>Qn,emptyMessageSignature:()=>Gi,encodeAbiClarityValue:()=>zo,encodeClarityValue:()=>Go,encodeStructuredData:()=>js,estimateContractDeploy:()=>ga,estimateContractFunctionCall:()=>wa,estimateTransaction:()=>ua,estimateTransactionByteLength:()=>Ma,estimateTransactionFeeWithFallback:()=>Ra,estimateTransfer:()=>aa,estimateTransferUnsafe:()=>sa,exceedsMaxLengthBytes:()=>Ri,falseCV:()=>hn,getAbi:()=>ha,getAddressFromPrivateKey:()=>Tr,getAddressFromPublicKey:()=>Er,getCVTypeString:()=>xo,getContractMapEntry:()=>Oa,getFee:()=>yo,getNonce:()=>oa,getPublicKey:()=>jr,getTypeString:()=>$o,getTypeUnion:()=>qo,hash160:()=>xi,hashP2PKH:()=>Li,hashP2SH:()=>Ui,hashP2WPKH:()=>Di,hashP2WSH:()=>Vi,hashStructuredData:()=>Us,hexToCV:()=>Ki,intCV:()=>an,intoInitialSighashAuth:()=>lo,isClarityAbiBuffer:()=>Do,isClarityAbiList:()=>Ho,isClarityAbiOptional:()=>Wo,isClarityAbiPrimitive:()=>Lo,isClarityAbiResponse:()=>jo,isClarityAbiStringAscii:()=>Uo,isClarityAbiStringUtf8:()=>Vo,isClarityAbiTuple:()=>Ko,isClarityName:()=>ji,isClarityType:()=>Io,isCoinbasePayload:()=>Wn,isCompressed:()=>Mr,isContractCallPayload:()=>Un,isNonSequentialMultiSig:()=>Zi,isPoisonPayload:()=>jn,isSequentialMultiSig:()=>Yi,isSingleSig:()=>Ji,isSmartContractPayload:()=>Vn,isTokenTransferPayload:()=>Dn,leftPadHex:()=>Oi,leftPadHexToLength:()=>Pi,listCV:()=>Sn,makeContractCall:()=>va,makeContractDeploy:()=>ya,makeContractFungiblePostCondition:()=>Ta,makeContractNonFungiblePostCondition:()=>ka,makeContractSTXPostCondition:()=>Sa,makeRandomPrivKey:()=>Dr,makeSTXTokenTransfer:()=>pa,makeSigHashPreSign:()=>ao,makeStandardFungiblePostCondition:()=>Aa,makeStandardNonFungiblePostCondition:()=>Ea,makeStandardSTXPostCondition:()=>_a,makeUnsignedContractCall:()=>ba,makeUnsignedContractDeploy:()=>ma,makeUnsignedSTXTokenTransfer:()=>da,nextSignature:()=>uo,nextVerification:()=>co,noneCV:()=>Zr,omit:()=>Bi,optionalCVOf:()=>tn,parseAssetInfoString:()=>Hr,parsePrincipalString:()=>$r,parseReadOnlyResponse:()=>Hi,parseToCV:()=>Zo,principalCV:()=>pn,principalToString:()=>dn,privateKeyToString:()=>Wr,pubKeyfromPrivKey:()=>Br,publicKeyFromBytes:()=>Pr,publicKeyFromSignatureRsv:()=>Or,publicKeyFromSignatureVrs:()=>Cr,publicKeyToAddress:()=>Kr,publicKeyToString:()=>Rr,randomBytes:()=>Ci,responseErrorCV:()=>vn,responseOkCV:()=>_n,rightPadHexToLength:()=>Mi,serializeAddress:()=>si,serializeAssetInfo:()=>mi,serializeAuthorization:()=>vo,serializeCV:()=>ki,serializeLPList:()=>vi,serializeLPString:()=>hi,serializeMemoString:()=>gi,serializeMessageSignature:()=>ti,serializeMultiSigSpendingCondition:()=>eo,serializePayload:()=>Xn,serializePostCondition:()=>Si,serializePrincipal:()=>ci,serializePublicKey:()=>Nr,serializeSingleSigSpendingCondition:()=>to,serializeSpendingCondition:()=>io,serializeStacksMessage:()=>ri,serializeTransactionAuthField:()=>ei,setFee:()=>go,setNonce:()=>mo,setSponsor:()=>bo,setSponsorNonce:()=>wo,signMessageHashRsv:()=>Vr,signStructuredData:()=>Ks,signWithKey:()=>Ur,someCV:()=>Qr,sponsorTransaction:()=>Pa,standardPrincipalCV:()=>gn,standardPrincipalCVFromAddress:()=>yn,stringAsciiCV:()=>xn,stringCV:()=>Fn,stringUtf8CV:()=>In,trueCV:()=>fn,tupleCV:()=>An,txidFromBytes:()=>Fi,txidFromData:()=>Ii,uintCV:()=>sn,uncompressPublicKey:()=>Ir,validateContractCall:()=>Yo,validateStacksAddress:()=>qi,validateTxId:()=>zi,verifyOrigin:()=>po,verifySignature:()=>ar,whenMessageType:()=>V});var n={};r.r(n),r.d(n,{address:()=>gs,bool:()=>hs,buffer:()=>_s,bufferFromAscii:()=>As,bufferFromHex:()=>Ss,bufferFromUtf8:()=>Ts,contractPrincipal:()=>ys,deserialize:()=>Rs,error:()=>Os,int:()=>ls,list:()=>ws,none:()=>Es,ok:()=>Cs,parse:()=>fs,prettyPrint:()=>La,principal:()=>ps,serialize:()=>Ms,some:()=>ks,standardPrincipal:()=>ms,stringAscii:()=>bs,stringUtf8:()=>vs,stringify:()=>Fa,tuple:()=>Ps,uint:()=>ds});var i={};function o(t,e,r){return h(a(t,e),r)}function a(t,e){let r=t;if("number"==typeof r){if(!Number.isInteger(r))throw new RangeError("Invalid value. Values of type 'number' must be an integer.");if(r>Number.MAX_SAFE_INTEGER)throw new RangeError(`Invalid value. Values of type 'number' must be less than or equal to ${Number.MAX_SAFE_INTEGER}. For larger values, try using a BigInt instead.`);return BigInt(r)}if("string"==typeof r)if(r.toLowerCase().startsWith("0x")){let t=r.slice(2);t=t.padStart(t.length+t.length%2,"0"),r=p(t)}else try{return BigInt(r)}catch(t){if(t instanceof SyntaxError)throw new RangeError(`Invalid value. String integer '${r}' is not finite.`)}if("bigint"==typeof r)return r;if(r instanceof Uint8Array){if(e){const t=function(t,e){return function(t,e){return t&BigInt(1)<<e}(t,e-BigInt(1))?t-(BigInt(1)<<e):t}(BigInt(`0x${d(r)}`),BigInt(8*r.byteLength));return BigInt(t.toString())}return BigInt(`0x${d(r)}`)}if(null!=r&&"object"==typeof r&&"BN"===r.constructor.name)return BigInt(r.toString());throw new TypeError("Invalid value type. Must be a number, bigint, integer-string, hex-string, or Uint8Array.")}function s(t){return t.startsWith("0x")?t:`0x${t}`}function u(t){if("string"!=typeof t)throw new TypeError("hexToBigInt: expected string, got "+typeof t);return BigInt(`0x${t}`)}function c(t,e=8){return("bigint"==typeof t?t:a(t,!1)).toString(16).padStart(2*e,"0")}function f(t){return parseInt(t,16)}function h(t,e=16){return p(c(t,e))}r.r(i),r.d(i,{principal:()=>Ns});const l=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function d(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const r of t)e+=l[r];return e}function p(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);const e=(t=t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t).length%2?`0${t}`:t,r=new Uint8Array(e.length/2);for(let t=0;t<r.length;t++){const n=2*t,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[t]=o}return r}function g(t){return(new TextEncoder).encode(t)}function y(t){return(new TextDecoder).decode(t)}function m(t){const e=[];for(let r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return new Uint8Array(e)}function w(t){return String.fromCharCode.apply(null,t)}function b(t){return!Number.isInteger(t)||t<0||t>255}function v(t){if(t.some(b))throw new Error("Some values are invalid bytes.");return new Uint8Array(t)}function _(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function S(t){return _(...t.map((t=>"number"==typeof t?v([t]):t instanceof Array?v(t):t)))}function A(t,e,r=0){return t[r+3]=e,e>>>=8,t[r+2]=e,e>>>=8,t[r+1]=e,e>>>=8,t[r]=e,t}var T;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(T||(T={}));const E=T.Mainnet,k=128,C=128,O=16,P=32,M=80,R=65,N=32,B=64,x=34,I="https://api.mainnet.hiro.so";var F,L,D,U;function V(t){return e=>e[t]}!function(t){t[t.Address=0]="Address",t[t.Principal=1]="Principal",t[t.LengthPrefixedString=2]="LengthPrefixedString",t[t.MemoString=3]="MemoString",t[t.AssetInfo=4]="AssetInfo",t[t.PostCondition=5]="PostCondition",t[t.PublicKey=6]="PublicKey",t[t.LengthPrefixedList=7]="LengthPrefixedList",t[t.Payload=8]="Payload",t[t.MessageSignature=9]="MessageSignature",t[t.StructuredDataSignature=10]="StructuredDataSignature",t[t.TransactionAuthField=11]="TransactionAuthField"}(F||(F={})),function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.VersionedSmartContract=6]="VersionedSmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase",t[t.CoinbaseToAltRecipient=5]="CoinbaseToAltRecipient",t[t.TenureChange=7]="TenureChange",t[t.NakamotoCoinbase=8]="NakamotoCoinbase"}(L||(L={})),function(t){t[t.Clarity1=1]="Clarity1",t[t.Clarity2=2]="Clarity2",t[t.Clarity3=3]="Clarity3"}(D||(D={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(U||(U={}));const j=["onChainOnly","offChainOnly","any"],W={[j[0]]:U.OnChainOnly,[j[1]]:U.OffChainOnly,[j[2]]:U.Any,[U.OnChainOnly]:U.OnChainOnly,[U.OffChainOnly]:U.OffChainOnly,[U.Any]:U.Any};function K(t){if(t in W)return W[t];throw new Error(`Invalid anchor mode "${t}", must be one of: ${j.join(", ")}`)}var H;!function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(H||(H={}));const q=H.Mainnet;var z,G,$,X,J,Y,Z,Q,tt,et,rt;function nt(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function it(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}!function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(z||(z={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(G||(G={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}($||($={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH",t[t.SerializeP2SHNonSequential=5]="SerializeP2SHNonSequential",t[t.SerializeP2WSHNonSequential=7]="SerializeP2WSHNonSequential"}(X||(X={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(J||(J={})),function(t){t[t.Compressed=0]="Compressed",t[t.Uncompressed=1]="Uncompressed"}(Y||(Y={})),function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Z||(Z={})),function(t){t[t.Sends=16]="Sends",t[t.DoesNotSend=17]="DoesNotSend"}(Q||(Q={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(tt||(tt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(et||(et={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.TooMuchChaining="TooMuchChaining",t.ConflictingNonceInMempool="ConflictingNonceInMempool",t.BadTransactionVersion="BadTransactionVersion",t.TransferRecipientCannotEqualSender="TransferRecipientCannotEqualSender",t.TransferAmountMustBePositive="TransferAmountMustBePositive",t.ServerFailureDatabase="ServerFailureDatabase",t.EstimatorError="EstimatorError",t.TemporarilyBlacklisted="TemporarilyBlacklisted",t.ServerFailureOther="ServerFailureOther"}(rt||(rt={}));const ot={number:nt,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:it,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");nt(t.outputLen),nt(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){it(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}},at=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),st=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function ut(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));class ct{clone(){return this._cloneInto()}}function ft(t){const e=e=>t().update(ut(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class ht extends ct{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=at(this.buffer)}update(t){ot.exists(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=ut(t)).length;for(let o=0;o<i;){const a=Math.min(n-this.pos,i-o);if(a!==n)r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=at(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){ot.exists(this),ot.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,a,n),t.setUint32(e+c,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=at(t),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=s/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)a.setUint32(4*t,c[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return t.length=n,t.pos=a,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const lt=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),dt=Uint8Array.from({length:16},((t,e)=>e)),pt=dt.map((t=>(9*t+5)%16));let gt=[dt],yt=[pt];for(let t=0;t<4;t++)for(let e of[gt,yt])e.push(e[t].map((t=>lt[t])));const mt=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((t=>new Uint8Array(t))),wt=gt.map(((t,e)=>t.map((t=>mt[e][t])))),bt=yt.map(((t,e)=>t.map((t=>mt[e][t])))),vt=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),_t=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),St=(t,e)=>t<<e|t>>>32-e;function At(t,e,r,n){return 0===t?e^r^n:1===t?e&r|~e&n:2===t?(e|~r)^n:3===t?e&n|r&~n:e^(r|~n)}const Tt=new Uint32Array(16);class Et extends ht{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:e,h2:r,h3:n,h4:i}=this;return[t,e,r,n,i]}set(t,e,r,n,i){this.h0=0|t,this.h1=0|e,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(t,e){for(let r=0;r<16;r++,e+=4)Tt[r]=t.getUint32(e,!0);let r=0|this.h0,n=r,i=0|this.h1,o=i,a=0|this.h2,s=a,u=0|this.h3,c=u,f=0|this.h4,h=f;for(let t=0;t<5;t++){const e=4-t,l=vt[t],d=_t[t],p=gt[t],g=yt[t],y=wt[t],m=bt[t];for(let e=0;e<16;e++){const n=St(r+At(t,i,a,u)+Tt[p[e]]+l,y[e])+f|0;r=f,f=u,u=0|St(a,10),a=i,i=n}for(let t=0;t<16;t++){const r=St(n+At(e,o,s,c)+Tt[g[t]]+d,m[t])+h|0;n=h,h=c,c=0|St(s,10),s=o,o=r}}this.set(this.h1+a+c|0,this.h2+u+h|0,this.h3+f+n|0,this.h4+r+o|0,this.h0+i+s|0)}roundClean(){Tt.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const kt=ft((()=>new Et)),Ct=(t,e,r)=>t&e^t&r^e&r,Ot=new Uint32Array([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]),Pt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mt=new Uint32Array(64);class Rt extends ht{constructor(){super(64,32,8,!1),this.A=0|Pt[0],this.B=0|Pt[1],this.C=0|Pt[2],this.D=0|Pt[3],this.E=0|Pt[4],this.F=0|Pt[5],this.G=0|Pt[6],this.H=0|Pt[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[t,e,r,n,i,o,a,s]}set(t,e,r,n,i,o,a,s){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(t,e){for(let r=0;r<16;r++,e+=4)Mt[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Mt[t-15],r=Mt[t-2],n=st(e,7)^st(e,18)^e>>>3,i=st(r,17)^st(r,19)^r>>>10;Mt[t]=i+Mt[t-7]+n+Mt[t-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(st(a,6)^st(a,11)^st(a,25))+((f=a)&s^~f&u)+Ot[t]+Mt[t]|0,h=(st(r,2)^st(r,13)^st(r,22))+Ct(r,n,i)|0;c=u,u=s,s=a,a=o+e|0,o=i,i=n,n=r,r=e+h|0}var f;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,a,s,u,c)}roundClean(){Mt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Nt extends Rt{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const Bt=ft((()=>new Rt)),xt=(ft((()=>new Nt)),BigInt(2**32-1)),It=BigInt(32);function Ft(t,e=!1){return e?{h:Number(t&xt),l:Number(t>>It&xt)}:{h:0|Number(t>>It&xt),l:0|Number(t&xt)}}const Lt=function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:a}=Ft(t[i],e);[r[i],n[i]]=[o,a]}return[r,n]},Dt=(t,e,r)=>t>>>r,Ut=(t,e,r)=>t<<32-r|e>>>r,Vt=(t,e,r)=>t>>>r|e<<32-r,jt=(t,e,r)=>t<<32-r|e>>>r,Wt=(t,e,r)=>t<<64-r|e>>>r-32,Kt=(t,e,r)=>t>>>r-32|e<<64-r,Ht=function(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},qt=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),zt=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Gt=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),$t=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Xt=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,Jt=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),[Yt,Zt]=Lt(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),Qt=new Uint32Array(80),te=new Uint32Array(80);class ee extends ht{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:c,Fh:f,Fl:h,Gh:l,Gl:d,Hh:p,Hl:g}=this;return[t,e,r,n,i,o,a,s,u,c,f,h,l,d,p,g]}set(t,e,r,n,i,o,a,s,u,c,f,h,l,d,p,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|l,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(t,e){for(let r=0;r<16;r++,e+=4)Qt[r]=t.getUint32(e),te[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Qt[t-15],r=0|te[t-15],n=Vt(e,r,1)^Vt(e,r,8)^Dt(e,r,7),i=jt(e,r,1)^jt(e,r,8)^Ut(e,r,7),o=0|Qt[t-2],a=0|te[t-2],s=Vt(o,a,19)^Wt(o,a,61)^Dt(o,a,6),u=jt(o,a,19)^Kt(o,a,61)^Ut(o,a,6),c=Gt(i,u,te[t-7],te[t-16]),f=$t(c,n,s,Qt[t-7],Qt[t-16]);Qt[t]=0|f,te[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:a,Cl:s,Dh:u,Dl:c,Eh:f,El:h,Fh:l,Fl:d,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let t=0;t<80;t++){const e=Vt(f,h,14)^Vt(f,h,18)^Wt(f,h,41),w=jt(f,h,14)^jt(f,h,18)^Kt(f,h,41),b=f&l^~f&p,v=Jt(m,w,h&d^~h&g,Zt[t],te[t]),_=Xt(v,y,e,b,Yt[t],Qt[t]),S=0|v,A=Vt(r,n,28)^Wt(r,n,34)^Wt(r,n,39),T=jt(r,n,28)^Kt(r,n,34)^Kt(r,n,39),E=r&i^r&a^i&a,k=n&o^n&s^o&s;y=0|p,m=0|g,p=0|l,g=0|d,l=0|f,d=0|h,({h:f,l:h}=Ht(0|u,0|c,0|_,0|S)),u=0|a,c=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const C=qt(S,T,k);r=zt(C,_,A,E),n=0|C}({h:r,l:n}=Ht(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=Ht(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=Ht(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:c}=Ht(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=Ht(0|this.Eh,0|this.El,0|f,0|h)),({h:l,l:d}=Ht(0|this.Fh,0|this.Fl,0|l,0|d)),({h:p,l:g}=Ht(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=Ht(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(r,n,i,o,a,s,u,c,f,h,l,d,p,g,y,m)}roundClean(){Qt.fill(0),te.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class re extends ee{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class ne extends ee{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class ie extends ee{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}ft((()=>new ee)),ft((()=>new re));const oe=ft((()=>new ne));ft((()=>new ie));var ae=r(495),se=r.t(ae,2);const ue=BigInt(0),ce=BigInt(1),fe=BigInt(2),he=BigInt(3),le=BigInt(8),de=Object.freeze({a:ue,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:ce,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),pe=(t,e)=>(t+e/fe)/e,ge={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=de,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ce*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=pe(o*t,e),u=pe(-n*t,e);let c=He(t-s*r-u*i,e),f=He(-s*n-u*o,e);const h=c>a,l=f>a;if(h&&(c=e-c),l&&(f=e-f),c>a||f>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:l,k2:f}}},ye=32,me=32,we=32,be=ye+1,ve=2*ye+1;function _e(t){const{a:e,b:r}=de,n=He(t*t),i=He(n*t);return He(i+e*t+r)}const Se=de.a===ue;class Ae extends Error{constructor(t){super(t)}}function Te(t){if(!(t instanceof Ee))throw new TypeError("JacobianPoint expected")}class Ee{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof Oe))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(Oe.ZERO)?Ee.ZERO:new Ee(t.x,t.y,ce)}static toAffineBatch(t){const e=function(t,e=de.P){const r=new Array(t.length),n=ze(t.reduce(((t,n,i)=>n===ue?t:(r[i]=t,He(t*n,e))),ce),e);return t.reduceRight(((t,n,i)=>n===ue?t:(r[i]=He(t*r[i],e),He(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return Ee.toAffineBatch(t).map(Ee.fromAffine)}equals(t){Te(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:a}=t,s=He(n*n),u=He(a*a),c=He(e*u),f=He(i*s),h=He(He(r*a)*u),l=He(He(o*n)*s);return c===f&&h===l}negate(){return new Ee(this.x,He(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=He(t*t),i=He(e*e),o=He(i*i),a=t+i,s=He(fe*(He(a*a)-n-o)),u=He(he*n),c=He(u*u),f=He(c-fe*s),h=He(u*(s-f)-le*o),l=He(fe*e*r);return new Ee(f,h,l)}add(t){Te(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:a}=t;if(i===ue||o===ue)return this;if(e===ue||r===ue)return t;const s=He(n*n),u=He(a*a),c=He(e*u),f=He(i*s),h=He(He(r*a)*u),l=He(He(o*n)*s),d=He(f-c),p=He(l-h);if(d===ue)return p===ue?this.double():Ee.ZERO;const g=He(d*d),y=He(d*g),m=He(c*g),w=He(p*p-y-fe*m),b=He(p*(m-w)-h*y),v=He(n*a*d);return new Ee(w,b,v)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=Ee.ZERO;if("bigint"==typeof t&&t===ue)return e;let r=Ke(t);if(r===ce)return this;if(!Se){let t=e,n=this;for(;r>ue;)r&ce&&(t=t.add(n)),n=n.double(),r>>=ce;return t}let{k1neg:n,k1:i,k2neg:o,k2:a}=ge.splitScalar(r),s=e,u=e,c=this;for(;i>ue||a>ue;)i&ce&&(s=s.add(c)),a&ce&&(u=u.add(c)),c=c.double(),i>>=ce,a>>=ce;return n&&(s=s.negate()),o&&(u=u.negate()),u=new Ee(He(u.x*ge.beta),u.y,u.z),s.add(u)}precomputeWindow(t){const e=Se?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(Ee.BASE)&&(e=Oe.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&Ce.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=Ee.normalizeZ(n),Ce.set(e,n)));let i=Ee.ZERO,o=Ee.BASE;const a=1+(Se?128/r:256/r),s=2**(r-1),u=BigInt(2**r-1),c=2**r,f=BigInt(r);for(let e=0;e<a;e++){const r=e*s;let a=Number(t&u);t>>=f,a>s&&(a-=c,t+=ce);const h=r,l=r+Math.abs(a)-1,d=e%2!=0,p=a<0;0===a?o=o.add(ke(d,n[h])):i=i.add(ke(p,n[l]))}return{p:i,f:o}}multiply(t,e){let r,n,i=Ke(t);if(Se){const{k1neg:t,k1:o,k2neg:a,k2:s}=ge.splitScalar(i);let{p:u,f:c}=this.wNAF(o,e),{p:f,f:h}=this.wNAF(s,e);u=ke(t,u),f=ke(a,f),f=new Ee(He(f.x*ge.beta),f.y,f.z),r=u.add(f),n=c.add(h)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return Ee.normalizeZ([r,n])[0]}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(Ee.ZERO);null==t&&(t=i?le:ze(n));const o=t,a=He(o*o),s=He(a*o),u=He(e*a),c=He(r*s),f=He(n*o);if(i)return Oe.ZERO;if(f!==ce)throw new Error("invZ was invalid");return new Oe(u,c)}}function ke(t,e){const r=e.negate();return t?r:e}Ee.BASE=new Ee(de.Gx,de.Gy,ce),Ee.ZERO=new Ee(ue,ce,ue);const Ce=new WeakMap;class Oe{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,Ce.delete(this)}hasEvenY(){return this.y%fe===ue}static fromCompressedHex(t){const e=32===t.length,r=je(e?t:t.subarray(1));if(!Ze(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=de,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),s=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=qe(c,he)*c%e,h=qe(f,he)*c%e,l=qe(h,fe)*u%e,d=qe(l,n)*l%e,p=qe(d,i)*d%e,g=qe(p,a)*p%e,y=qe(g,s)*g%e,m=qe(y,a)*p%e,w=qe(m,he)*c%e,b=qe(w,o)*d%e,v=qe(b,r)*u%e,_=qe(v,fe);if(_*_%e!==t)throw new Error("Cannot find square root");return _}(_e(r));const i=(n&ce)===ce;e?i&&(n=He(-n)):!(1&~t[0])!==i&&(n=He(-n));const o=new Oe(r,n);return o.assertValidity(),o}static fromUncompressedHex(t){const e=je(t.subarray(1,ye+1)),r=je(t.subarray(ye+1,2*ye+1)),n=new Oe(e,r);return n.assertValidity(),n}static fromHex(t){const e=We(t),r=e.length,n=e[0];if(r===ye)return this.fromCompressedHex(e);if(r===be&&(2===n||3===n))return this.fromCompressedHex(e);if(r===ve&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-${be} compressed bytes or ${ve} uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return Oe.BASE.multiply(tr(t))}static fromSignature(t,e,r){const{r:n,s:i}=er(e);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=Ge(We(t)),{n:a}=de,s=2===r||3===r?n+a:n,u=ze(s,a),c=He(-o*u,a),f=He(i*u,a),h=1&r?"03":"02",l=Oe.fromHex(h+Fe(s)),d=Oe.BASE.multiplyAndAddUnsafe(l,c,f);if(!d)throw new Error("Cannot recover signature: point at infinify");return d.assertValidity(),d}toRawBytes(t=!1){return Ve(this.toHex(t))}toHex(t=!1){const e=Fe(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${Fe(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!Ze(e)||!Ze(r))throw new Error(t);const n=He(r*r);if(He(n-_e(e))!==ue)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new Oe(this.x,He(-this.y))}double(){return Ee.fromAffine(this).double().toAffine()}add(t){return Ee.fromAffine(this).add(Ee.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return Ee.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=Ee.fromAffine(this),i=e===ue||e===ce||this!==Oe.BASE?n.multiplyUnsafe(e):n.multiply(e),o=Ee.fromAffine(t).multiplyUnsafe(r),a=i.add(o);return a.equals(Ee.ZERO)?void 0:a.toAffine()}}function Pe(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function Me(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${xe(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:je(r),left:t.subarray(e+2)}}Oe.BASE=new Oe(de.Gx,de.Gy),Oe.ZERO=new Oe(ue,ue);class Re{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?xe(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new Re(Ue(n.slice(0,64)),Ue(n.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${xe(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=Me(t.subarray(2)),{data:n,left:i}=Me(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${xe(i)}`);return{r:e,s:n}}(e?t:Ve(t));return new Re(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!Ye(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ye(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=de.n>>ce;return this.s>t}normalizeS(){return this.hasHighS()?new Re(this.r,He(-this.s,de.n)):this}toDERRawBytes(){return Ve(this.toDERHex())}toDERHex(){const t=Pe(De(this.s)),e=Pe(De(this.r)),r=t.length/2,n=e.length/2,i=De(r),o=De(n);return`30${De(n+r+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Ve(this.toCompactHex())}toCompactHex(){return Fe(this.r)+Fe(this.s)}}function Ne(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}const Be=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function xe(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=Be[t[r]];return e}const Ie=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Fe(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(ue<=t&&t<Ie))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function Le(t){const e=Ve(Fe(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function De(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Ue(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Ve(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function je(t){return Ue(xe(t))}function We(t){return t instanceof Uint8Array?Uint8Array.from(t):Ve(t)}function Ke(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Ye(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function He(t,e=de.P){const r=t%e;return r>=ue?r:e+r}function qe(t,e){const{P:r}=de;let n=t;for(;e-- >ue;)n*=n,n%=r;return n}function ze(t,e=de.P){if(t===ue||e<=ue)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=He(t,e),n=e,i=ue,o=ce,a=ce,s=ue;for(;r!==ue;){const t=n/r,e=n%r,u=i-a*t,c=o-s*t;n=r,r=e,i=a,o=s,a=u,s=c}if(n!==ce)throw new Error("invert: does not exist");return He(i,e)}function Ge(t,e=!1){const r=function(t){const e=8*t.length-8*me,r=je(t);return e>0?r>>BigInt(e):r}(t);if(e)return r;const{n}=de;return r>=n?r-n:r}let $e,Xe;class Je{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return cr.hmacSha256(this.k,...t)}hmacSync(...t){return Xe(this.k,...t)}checkSync(){if("function"!=typeof Xe)throw new Ae("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();e.push(r),t+=this.v.length}return Ne(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();e.push(r),t+=this.v.length}return Ne(...e)}}function Ye(t){return ue<t&&t<de.n}function Ze(t){return ue<t&&t<de.P}function Qe(t,e,r,n=!0){const{n:i}=de,o=Ge(t,!0);if(!Ye(o))return;const a=ze(o,i),s=Oe.BASE.multiply(o),u=He(s.x,i);if(u===ue)return;const c=He(a*He(e+r*u,i),i);if(c===ue)return;let f=new Re(u,c),h=(s.x===f.r?0:2)|Number(s.y&ce);return n&&f.hasHighS()&&(f=f.normalizeS(),h^=1),{sig:f,recovery:h}}function tr(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(t.length!==2*me)throw new Error("Expected 32 bytes of private key");e=Ue(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==me)throw new Error("Expected 32 bytes of private key");e=je(t)}if(!Ye(e))throw new Error("Expected private key: 0 < key < n");return e}function er(t){if(t instanceof Re)return t.assertValidity(),t;try{return Re.fromDER(t)}catch(e){return Re.fromCompact(t)}}function rr(t){return je(t.length>ye?t.slice(0,ye):t)}function nr(t){const e=rr(t),r=He(e,de.n);return ir(r<ue?e:r)}function ir(t){return Le(t)}const or={strict:!0};function ar(t,e,r,n=or){let i;try{i=er(t),e=We(e)}catch(t){return!1}const{r:o,s:a}=i;if(n.strict&&i.hasHighS())return!1;const s=Ge(e);let u;try{u=function(t){return t instanceof Oe?(t.assertValidity(),t):Oe.fromHex(t)}(r)}catch(t){return!1}const{n:c}=de,f=ze(a,c),h=He(s*f,c),l=He(o*f,c),d=Oe.BASE.multiplyAndAddUnsafe(u,h,l);return!!d&&He(d.x,c)===o}Oe.BASE._setWindowSize(8);const sr={node:se,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ur={},cr={bytesToHex:xe,hexToBytes:Ve,concatBytes:Ne,mod:He,invert:ze,isValidPrivateKey(t){try{return tr(t),!0}catch(t){return!1}},_bigintTo32Bytes:Le,_normalizePrivateKey:tr,hashToPrivateKey:t=>{t=We(t);const e=me+8;if(t.length<e||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Le(He(je(t),de.n-ce)+ce)},randomBytes:(t=32)=>{if(sr.web)return sr.web.getRandomValues(new Uint8Array(t));if(sr.node){const{randomBytes:e}=sr.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>cr.hashToPrivateKey(cr.randomBytes(me+8)),precompute(t=8,e=Oe.BASE){const r=e===Oe.BASE?e:new Oe(e.x,e.y);return r._setWindowSize(t),r.multiply(he),r},sha256:async(...t)=>{if(sr.web){const e=await sr.web.subtle.digest("SHA-256",Ne(...t));return new Uint8Array(e)}if(sr.node){const{createHash:e}=sr.node,r=e("sha256");return t.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(sr.web){const r=await sr.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=Ne(...e),i=await sr.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(sr.node){const{createHmac:r}=sr.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...e)=>{let r=ur[t];if(void 0===r){const e=await cr.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=Ne(e,e),ur[t]=r}return cr.sha256(r,...e)},taggedHashSync:(t,...e)=>{if("function"!=typeof $e)throw new Ae("sha256Sync is undefined, you need to set it");let r=ur[t];if(void 0===r){const e=$e(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=Ne(e,e),ur[t]=r}return $e(r,...e)},_JacobianPoint:Ee};Object.defineProperties(cr,{sha256Sync:{configurable:!1,get:()=>$e,set(t){$e||($e=t)}},hmacSha256Sync:{configurable:!1,get:()=>Xe,set(t){Xe||(Xe=t)}}});var fr=r(7581),hr=r(7193),lr=r.n(hr);class dr extends ct{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ot.hash(t);const r=ut(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return ot.exists(this),this.iHash.update(t),this}digestInto(t){ot.exists(this),ot.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:a}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const pr=(t,e,r)=>new dr(t,e).update(r).digest();pr.create=(t,e)=>new dr(t,e);const gr=32;var yr,mr,wr;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(yr||(yr={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(mr||(mr={})),function(t){t[t.Mainnet=385875968]="Mainnet",t[t.Testnet=4278190080]="Testnet"}(wr||(wr={}));const br=33;function vr(t){if(p(t).byteLength!=R)throw Error("Invalid signature");return{type:F.MessageSignature,data:t}}function _r(t,e){switch(t){case X.SerializeP2PKH:switch(e){case H.Mainnet:return J.MainnetSingleSig;case H.Testnet:return J.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case X.SerializeP2SH:case X.SerializeP2SHNonSequential:case X.SerializeP2WPKH:case X.SerializeP2WSH:case X.SerializeP2WSHNonSequential:switch(e){case H.Mainnet:return J.MainnetMultiSig;case H.Testnet:return J.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}function Sr(t,e){return{type:F.Address,version:t,hash160:e}}function Ar(t){return(0,fr.bJ)(t.version,t.hash160)}function Tr(t,e=H.Mainnet){return Er(Br(t).data,e)}function Er(t,e=H.Mainnet){return t="string"==typeof t?t:d(t),Ar(Sr(_r(X.SerializeP2PKH,e),Li(p(t))))}function kr(t){return{type:F.PublicKey,data:p(t)}}function Cr(t,e,r=Y.Compressed){const n=function(t){if(t.length<2*gr*2+1)throw new Error("Invalid signature");const e=t.slice(0,2),r=t.slice(2,2+2*gr),n=t.slice(2+2*gr);return{recoveryId:f(e),r,s:n}}(e.data),i=new Re(u(n.r),u(n.s)),o=Oe.fromSignature(t,i,n.recoveryId),a=r===Y.Compressed;return o.toHex(a)}function Or(t,e,r=Y.Compressed){return Cr(t,{...e,data:(n=e.data,n.slice(-2)+n.slice(0,-2))},r);var n}function Pr(t){return{type:F.PublicKey,data:t}}function Mr(t){return!d(t.data).startsWith("04")}function Rr(t){return d(t.data)}function Nr(t){return t.data.slice()}function Br(t){const e=Lr(t),r=function(t,e=!1){return Oe.fromPrivateKey(t).toRawBytes(e)}(e.data.slice(0,32),e.compressed);return kr(d(r))}function xr(t){const e="string"==typeof t?t:d(t);return kr(Oe.fromHex(e).toHex(!0))}function Ir(t){const e="string"==typeof t?t:d(t);return kr(Oe.fromHex(e).toHex(!1))}function Fr(t){const e=t.readUInt8(),r=4===e?B:N;return Pr(S([e,t.readBytes(r)]))}function Lr(t){const e=function(t){const e="string"==typeof t?p(t):t;if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}(t);return{data:e,compressed:e.length==br}}function Dr(){return Lr(cr.randomPrivateKey())}function Ur(t,e){const[r,n]=function(t,e,r={}){const{seed:n,m:i,d:o}=function(t,e,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const n=We(t),i=tr(e),o=[ir(i),nr(n)];if(null!=r){!0===r&&(r=cr.randomBytes(ye));const t=We(r);if(t.length!==ye)throw new Error(`sign: Expected ${ye} bytes of extra data`);o.push(t)}return{seed:Ne(...o),m:rr(n),d:i}}(t,e,r.extraEntropy),a=new Je(we,me);let s;for(a.reseedSync(n);!(s=Qe(a.generateSync(),i,o,r.canonical));)a.reseedSync();return function(t,e){const{sig:r,recovery:n}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),a=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}(s,r)}(e,t.data.slice(0,32),{canonical:!0,recovered:!0});if(null==n)throw new Error("No signature recoveryId received");return vr(c(n,1)+Re.fromHex(r).toCompactHex())}function Vr({messageHash:t,privateKey:e}){const r=Ur(e,t);return{...r,data:(n=r.data,n.slice(2)+n.slice(0,2))};var n}function jr(t){return Br(t.data)}function Wr(t){return d(t.data)}function Kr(t,e){return(0,fr.bJ)(t,d(xi(e.data)))}function Hr(t){const[e,r,n]=t.split(/\.|::/);return zr(e,r,n)}function qr(t,e,r){const n=e||1,i=r||k;if(Ri(t,i))throw new Error(`String length exceeds maximum bytes ${i}`);return{type:F.LengthPrefixedString,content:t,lengthPrefixBytes:n,maxLengthBytes:i}}function zr(t,e,r){return{type:F.AssetInfo,address:Gr(t),contractName:qr(e),assetName:qr(r)}}function Gr(t){const e=(0,fr.ns)(t);return{type:F.Address,version:e[0],hash160:e[1]}}function $r(t){if(t.includes(".")){const[e,r]=t.split(".");return Xr(e,r)}return Jr(t)}function Xr(t,e){const r=Gr(t),n=qr(e);return{type:F.Principal,prefix:tt.Contract,address:r,contractName:n}}function Jr(t){const e=Gr(t);return{type:F.Principal,prefix:tt.Standard,address:e}}var Yr;function Zr(){return{type:Yr.OptionalNone}}function Qr(t){return{type:Yr.OptionalSome,value:t}}function tn(t){return t?Qr(t):Zr()}cr.hmacSha256Sync=(t,...e)=>{const r=pr.create(Bt,t);return e.forEach((t=>r.update(t))),r.digest()},function(t){t[t.Int=0]="Int",t[t.UInt=1]="UInt",t[t.Buffer=2]="Buffer",t[t.BoolTrue=3]="BoolTrue",t[t.BoolFalse=4]="BoolFalse",t[t.PrincipalStandard=5]="PrincipalStandard",t[t.PrincipalContract=6]="PrincipalContract",t[t.ResponseOk=7]="ResponseOk",t[t.ResponseErr=8]="ResponseErr",t[t.OptionalNone=9]="OptionalNone",t[t.OptionalSome=10]="OptionalSome",t[t.List=11]="List",t[t.Tuple=12]="Tuple",t[t.StringASCII=13]="StringASCII",t[t.StringUTF8=14]="StringUTF8"}(Yr||(Yr={}));const en=BigInt("0xffffffffffffffffffffffffffffffff"),rn=BigInt(0),nn=BigInt("0x7fffffffffffffffffffffffffffffff"),on=BigInt("-170141183460469231731687303715884105728"),an=t=>{const e=a(t,!0);if(e>nn)throw new RangeError(`Cannot construct clarity integer from value greater than ${nn}`);if(e<on)throw new RangeError(`Cannot construct clarity integer form value less than ${on}`);return{type:Yr.Int,value:e}},sn=t=>{const e=a(t,!1);if(e<rn)throw new RangeError("Cannot construct unsigned clarity integer from negative value");if(e>en)throw new RangeError(`Cannot construct unsigned clarity integer greater than ${en}`);return{type:Yr.UInt,value:e}},un=t=>{if(t.byteLength>1048576)throw new Error("Cannot construct clarity buffer that is greater than 1MB");return{type:Yr.Buffer,buffer:t}},cn=t=>un(g(t)),fn=()=>({type:Yr.BoolTrue}),hn=()=>({type:Yr.BoolFalse}),ln=t=>t?fn():hn();function dn(t){if(t.type===Yr.PrincipalStandard)return Ar(t.address);if(t.type===Yr.PrincipalContract)return`${Ar(t.address)}.${t.contractName.content}`;throw new Error(`Unexpected principal data: ${JSON.stringify(t)}`)}function pn(t){if(t.includes(".")){const[e,r]=t.split(".");return mn(e,r)}return gn(t)}function gn(t){const e=Gr(t);return{type:Yr.PrincipalStandard,address:e}}function yn(t){return{type:Yr.PrincipalStandard,address:t}}function mn(t,e){return wn(Gr(t),qr(e))}function wn(t,e){if(g(e.content).byteLength>=128)throw new Error("Contract name must be less than 128 bytes");return{type:Yr.PrincipalContract,address:t,contractName:e}}function bn(t,e){const r=qr(e);return{type:Yr.PrincipalContract,address:t.address,contractName:r}}function vn(t){return{type:Yr.ResponseErr,value:t}}function _n(t){return{type:Yr.ResponseOk,value:t}}function Sn(t){return{type:Yr.List,list:t}}function An(t){for(const e in t)if(!ji(e))throw new Error(`"${e}" is not a valid Clarity name`);return{type:Yr.Tuple,data:t}}const Tn=new Map;function En(t,e){const r=Tn.get(t);if(void 0!==r)return r(e);const n=function(t){const e=Object.values(t).filter((t=>"number"==typeof t)),r=new Set(e);return t=>r.has(t)}(t);return Tn.set(t,n),En(t,e)}class kn{constructor(t){this.consumed=0,this.source=t}readBytes(t){const e=this.source.subarray(this.consumed,this.consumed+t);return this.consumed+=t,e}readUInt32BE(){return(t=this.readBytes(4))[0]*2**24+65536*t[1]+256*t[2]+t[3];var t}readUInt8(){return this.readBytes(1)[0]}readUInt16BE(){return((t=this.readBytes(2))[0+0]<<8|t[1])>>>0;var t}readBigUIntLE(t){const e=d(this.readBytes(t).slice().reverse());return BigInt(`0x${e}`)}readBigUIntBE(t){const e=d(this.readBytes(t));return BigInt(`0x${e}`)}get readOffset(){return this.consumed}set readOffset(t){this.consumed=t}get internalBytes(){return this.source}readUInt8Enum(t,e){const r=this.readUInt8();if(En(t,r))return r;throw e(r)}}class Cn extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class On extends Cn{constructor(t){super(t)}}class Pn extends Cn{constructor(t){super(t)}}class Mn extends Cn{constructor(t){super(t)}}class Rn extends Cn{constructor(t){super(t)}}class Nn extends Cn{constructor(t){super(t)}}class Bn extends Cn{constructor(t){super(t)}}const xn=t=>({type:Yr.StringASCII,data:t}),In=t=>({type:Yr.StringUTF8,data:t}),Fn=(t,e)=>{switch(e){case"ascii":return xn(t);case"utf8":return In(t)}};function Ln(t){let e;if("string"==typeof t){const r="0x"===t.slice(0,2).toLowerCase();e=new kn(p(r?t.slice(2):t))}else e=t instanceof Uint8Array?new kn(t):t;switch(e.readUInt8Enum(Yr,(t=>{throw new Pn(`Cannot recognize Clarity Type: ${t}`)}))){case Yr.Int:return an(e.readBytes(16));case Yr.UInt:return sn(e.readBytes(16));case Yr.Buffer:const t=e.readUInt32BE();return un(e.readBytes(t));case Yr.BoolTrue:return fn();case Yr.BoolFalse:return hn();case Yr.PrincipalStandard:return yn(ui(e));case Yr.PrincipalContract:return wn(ui(e),li(e));case Yr.ResponseOk:return _n(Ln(e));case Yr.ResponseErr:return vn(Ln(e));case Yr.OptionalNone:return Zr();case Yr.OptionalSome:return Qr(Ln(e));case Yr.List:const r=e.readUInt32BE(),n=[];for(let t=0;t<r;t++)n.push(Ln(e));return Sn(n);case Yr.Tuple:const i=e.readUInt32BE(),o={};for(let t=0;t<i;t++){const t=li(e).content;if(void 0===t)throw new Pn('"content" is undefined');o[t]=Ln(e)}return An(o);case Yr.StringASCII:const a=e.readUInt32BE(),s=w(e.readBytes(a));return xn(s);case Yr.StringUTF8:const u=e.readUInt32BE(),c=y(e.readBytes(u));return In(c);default:throw new Pn("Unable to deserialize Clarity Value from Uint8Array. Could not find valid Clarity Type.")}}function Dn(t){return t.payloadType===L.TokenTransfer}function Un(t){return t.payloadType===L.ContractCall}function Vn(t){return t.payloadType===L.SmartContract}function jn(t){return t.payloadType===L.PoisonMicroblock}function Wn(t){return t.payloadType===L.Coinbase}function Kn(t,e,r){return"string"==typeof t&&(t=pn(t)),"string"==typeof r&&(r=pi(r)),{type:F.Payload,payloadType:L.TokenTransfer,recipient:t,amount:a(e,!1),memo:r??pi("")}}function Hn(t,e,r,n){return"string"==typeof t&&(t=Gr(t)),"string"==typeof e&&(e=qr(e)),"string"==typeof r&&(r=qr(r)),{type:F.Payload,payloadType:L.ContractCall,contractAddress:t,contractName:e,functionName:r,functionArgs:n}}function qn(t,e,r){return"string"==typeof t&&(t=qr(t)),"string"==typeof e&&(e=di(e)),"number"==typeof r?{type:F.Payload,payloadType:L.VersionedSmartContract,clarityVersion:r,contractName:t,codeBody:e}:{type:F.Payload,payloadType:L.SmartContract,contractName:t,codeBody:e}}function zn(t,e){if(t.byteLength!=P)throw Error(`Coinbase buffer size must be ${P} bytes`);return null!=e?{type:F.Payload,payloadType:L.CoinbaseToAltRecipient,coinbaseBytes:t,recipient:e}:{type:F.Payload,payloadType:L.Coinbase,coinbaseBytes:t}}var Gn,$n;function Xn(t){const e=[];switch(e.push(t.payloadType),t.payloadType){case L.TokenTransfer:e.push(ki(t.recipient)),e.push(o(t.amount,!1,8)),e.push(ri(t.memo));break;case L.ContractCall:e.push(ri(t.contractAddress)),e.push(ri(t.contractName)),e.push(ri(t.functionName));const r=new Uint8Array(4);A(r,t.functionArgs.length,0),e.push(r),t.functionArgs.forEach((t=>{e.push(ki(t))}));break;case L.SmartContract:e.push(ri(t.contractName)),e.push(ri(t.codeBody));break;case L.VersionedSmartContract:e.push(t.clarityVersion),e.push(ri(t.contractName)),e.push(ri(t.codeBody));break;case L.PoisonMicroblock:break;case L.Coinbase:e.push(t.coinbaseBytes);break;case L.CoinbaseToAltRecipient:e.push(t.coinbaseBytes),e.push(ki(t.recipient));break;case L.NakamotoCoinbase:e.push(t.coinbaseBytes),e.push(ki(t.recipient?Qr(t.recipient):Zr())),e.push(t.vrfProof);break;case L.TenureChange:e.push(p(t.tenureHash)),e.push(p(t.previousTenureHash)),e.push(p(t.burnViewHash)),e.push(p(t.previousTenureEnd)),e.push(A(new Uint8Array(4),t.previousTenureBlocks)),e.push(function(t,e,r=0){return t[r]=e,t}(new Uint8Array(1),t.cause)),e.push(p(t.publicKeyHash))}return S(e)}function Jn(t){switch(t.readUInt8Enum(L,(t=>{throw new Error(`Cannot recognize PayloadType: ${t}`)}))){case L.TokenTransfer:return Kn(Ln(t),a(t.readBytes(8),!1),yi(t));case L.ContractCall:const c=ui(t),f=li(t),h=li(t),l=[],p=t.readUInt32BE();for(let e=0;e<p;e++){const e=Ln(t);l.push(e)}return Hn(c,f,h,l);case L.SmartContract:return qn(li(t),li(t,4,1e5));case L.VersionedSmartContract:{const e=t.readUInt8Enum(D,(t=>{throw new Error(`Cannot recognize ClarityVersion: ${t}`)}));return qn(li(t),li(t,4,1e5),e)}case L.PoisonMicroblock:return{type:F.Payload,payloadType:L.PoisonMicroblock};case L.Coinbase:return zn(t.readBytes(P));case L.CoinbaseToAltRecipient:return zn(t.readBytes(P),Ln(t));case L.NakamotoCoinbase:return function(t,e,r){if(t.byteLength!=P)throw Error(`Coinbase buffer size must be ${P} bytes`);if(r.byteLength!=M)throw Error(`VRF proof buffer size must be ${M} bytes`);return{type:F.Payload,payloadType:L.NakamotoCoinbase,coinbaseBytes:t,recipient:e.type===Yr.OptionalSome?e.value:void 0,vrfProof:r}}(t.readBytes(P),Ln(t),t.readBytes(M));case L.TenureChange:return e=d(t.readBytes(20)),r=d(t.readBytes(20)),n=d(t.readBytes(20)),i=d(t.readBytes(32)),o=t.readUInt32BE(),s=t.readUInt8Enum(Gn,(t=>{throw new Error(`Cannot recognize TenureChangeCause: ${t}`)})),u=d(t.readBytes(20)),{type:F.Payload,payloadType:L.TenureChange,tenureHash:e,previousTenureHash:r,burnViewHash:n,previousTenureEnd:i,previousTenureBlocks:o,cause:s,publicKeyHash:u}}var e,r,n,i,o,s,u}function Yn(t){return vr(d(t.readBytes(R)))}function Zn(t,e){return{pubKeyEncoding:t,type:F.TransactionAuthField,contents:e}}function Qn(t){const e=t.readUInt8Enum($n,(t=>{throw new Pn(`Could not read ${t} as AuthFieldType`)}));switch(e){case $n.PublicKeyCompressed:return Zn(Y.Compressed,Fr(t));case $n.PublicKeyUncompressed:return Zn(Y.Uncompressed,Ir(Fr(t).data));case $n.SignatureCompressed:return Zn(Y.Compressed,Yn(t));case $n.SignatureUncompressed:return Zn(Y.Uncompressed,Yn(t));default:throw new Error(`Unknown auth field type: ${JSON.stringify(e)}`)}}function ti(t){return p(t.data)}function ei(t){const e=[];switch(t.contents.type){case F.PublicKey:e.push(t.pubKeyEncoding===Y.Compressed?$n.PublicKeyCompressed:$n.PublicKeyUncompressed),e.push(Nr(xr(t.contents.data)));break;case F.MessageSignature:e.push(t.pubKeyEncoding===Y.Compressed?$n.SignatureCompressed:$n.SignatureUncompressed),e.push(ti(t.contents))}return S(e)}function ri(t){switch(t.type){case F.Address:return si(t);case F.Principal:return ci(t);case F.LengthPrefixedString:return hi(t);case F.MemoString:return gi(t);case F.AssetInfo:return mi(t);case F.PostCondition:return Si(t);case F.PublicKey:return Nr(t);case F.LengthPrefixedList:return vi(t);case F.Payload:return Xn(t);case F.TransactionAuthField:return ei(t);case F.MessageSignature:return ti(t)}}function ni(t,e,r){switch(e){case F.Address:return ui(t);case F.Principal:return fi(t);case F.LengthPrefixedString:return li(t);case F.MemoString:return yi(t);case F.AssetInfo:return wi(t);case F.PostCondition:return Ai(t);case F.PublicKey:return Fr(t);case F.Payload:return Jn(t);case F.LengthPrefixedList:if(!r)throw new Pn("No List Type specified");return _i(t,r);case F.MessageSignature:return Yn(t);default:throw new Error("Could not recognize StacksMessageType")}}function ii(){return{type:F.Address,version:J.MainnetSingleSig,hash160:"0".repeat(40)}}function oi(t,e,r){return Sr(_r(t,e),r)}function ai(t,e,r,n){if(0===n.length)throw Error("Invalid number of public keys");if(!(e!==X.SerializeP2PKH&&e!==X.SerializeP2WPKH||1===n.length&&1===r))throw Error("Invalid number of public keys or signatures");if((e===X.SerializeP2WPKH||e===X.SerializeP2WSH||e===X.SerializeP2WSHNonSequential)&&!n.every(Mr))throw Error("Public keys must be compressed for segwit");switch(e){case X.SerializeP2PKH:return Sr(t,Li(n[0].data));case X.SerializeP2WPKH:return Sr(t,Di(n[0].data));case X.SerializeP2SH:case X.SerializeP2SHNonSequential:return Sr(t,Ui(r,n.map(Nr)));case X.SerializeP2WSH:case X.SerializeP2WSHNonSequential:return Sr(t,Vi(r,n.map(Nr)))}}function si(t){const e=[];return e.push(p(c(t.version,1))),e.push(p(t.hash160)),S(e)}function ui(t){const e=f(d(t.readBytes(1))),r=d(t.readBytes(20));return{type:F.Address,version:e,hash160:r}}function ci(t){const e=[];return e.push(t.prefix),e.push(si(t.address)),t.prefix===tt.Contract&&e.push(hi(t.contractName)),S(e)}function fi(t){const e=t.readUInt8Enum(tt,(t=>{throw new Pn(`Unexpected Principal payload type: ${t}`)})),r=ui(t);if(e===tt.Standard)return{type:F.Principal,prefix:e,address:r};const n=li(t);return{type:F.Principal,prefix:e,address:r,contractName:n}}function hi(t){const e=[],r=g(t.content),n=r.byteLength;return e.push(p(c(n,t.lengthPrefixBytes))),e.push(r),S(e)}function li(t,e,r){e=e||1;const n=f(d(t.readBytes(e)));return qr(y(t.readBytes(n)),e,r??128)}function di(t){return qr(t,4,1e5)}function pi(t){if(t&&Ri(t,x))throw new Error(`Memo exceeds maximum length of ${x} bytes`);return{type:F.MemoString,content:t}}function gi(t){const e=[],r=g(t.content),n=Mi(d(r),2*x);return e.push(p(n)),S(e)}function yi(t){let e=y(t.readBytes(x));return e=e.replace(/\u0000*$/,""),{type:F.MemoString,content:e}}function mi(t){const e=[];return e.push(si(t.address)),e.push(hi(t.contractName)),e.push(hi(t.assetName)),S(e)}function wi(t){return{type:F.AssetInfo,address:ui(t),contractName:li(t),assetName:li(t)}}function bi(t,e){return{type:F.LengthPrefixedList,lengthPrefixBytes:e||4,values:t}}function vi(t){const e=t.values,r=[];r.push(p(c(e.length,t.lengthPrefixBytes)));for(const t of e)r.push(ri(t));return S(r)}function _i(t,e,r){const n=f(d(t.readBytes(r||4))),i=[];for(let r=0;r<n;r++)switch(e){case F.Address:i.push(ui(t));break;case F.LengthPrefixedString:i.push(li(t));break;case F.MemoString:i.push(yi(t));break;case F.AssetInfo:i.push(wi(t));break;case F.PostCondition:i.push(Ai(t));break;case F.PublicKey:i.push(Fr(t));break;case F.TransactionAuthField:i.push(Qn(t))}return bi(i,r)}function Si(t){const e=[];if(e.push(t.conditionType),e.push(ci(t.principal)),t.conditionType!==G.Fungible&&t.conditionType!==G.NonFungible||e.push(mi(t.assetInfo)),t.conditionType===G.NonFungible&&e.push(ki(t.assetName)),e.push(t.conditionCode),t.conditionType===G.STX||t.conditionType===G.Fungible){if(t.amount>BigInt("0xffffffffffffffff"))throw new On("The post-condition amount may not be larger than 8 bytes");e.push(o(t.amount,!1,8))}return S(e)}function Ai(t){const e=t.readUInt8Enum(G,(t=>{throw new Pn(`Could not read ${t} as PostConditionType`)})),r=fi(t);let n,i,o;switch(e){case G.STX:return n=t.readUInt8Enum(Z,(t=>{throw new Pn(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt(`0x${d(t.readBytes(8))}`),{type:F.PostCondition,conditionType:G.STX,principal:r,conditionCode:n,amount:o};case G.Fungible:return i=wi(t),n=t.readUInt8Enum(Z,(t=>{throw new Pn(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt(`0x${d(t.readBytes(8))}`),{type:F.PostCondition,conditionType:G.Fungible,principal:r,conditionCode:n,amount:o,assetInfo:i};case G.NonFungible:i=wi(t);const e=Ln(t);return n=t.readUInt8Enum(Q,(t=>{throw new Pn(`Could not read ${t} as FungibleConditionCode`)})),{type:F.PostCondition,conditionType:G.NonFungible,principal:r,conditionCode:n,assetInfo:i,assetName:e}}}function Ti(t,e){return S([t,e])}function Ei(t,e){const r=[],n="ascii"==e?m(t.data):g(t.data),i=new Uint8Array(4);return A(i,n.length,0),r.push(i),r.push(n),Ti(t.type,S(r))}function ki(t){switch(t.type){case Yr.BoolTrue:case Yr.BoolFalse:return function(t){return new Uint8Array([t.type])}(t);case Yr.OptionalNone:case Yr.OptionalSome:return(e=t).type===Yr.OptionalNone?new Uint8Array([e.type]):Ti(e.type,ki(e.value));case Yr.Buffer:return function(t){const e=new Uint8Array(4);return A(e,t.buffer.length,0),Ti(t.type,_(e,t.buffer))}(t);case Yr.UInt:return function(t){const e=h(t.value,O);return Ti(t.type,e)}(t);case Yr.Int:return function(t){const e=h(function(t,e){if(t<-(BigInt(1)<<e-BigInt(1))||(BigInt(1)<<e-BigInt(1))-BigInt(1)<t)throw`Unable to represent integer in width: ${e}`;return t>=BigInt(0)?BigInt(t):t+(BigInt(1)<<e)}(t.value,BigInt(C)),O);return Ti(t.type,e)}(t);case Yr.PrincipalStandard:return function(t){return Ti(t.type,si(t.address))}(t);case Yr.PrincipalContract:return function(t){return Ti(t.type,_(si(t.address),hi(t.contractName)))}(t);case Yr.ResponseOk:case Yr.ResponseErr:return function(t){return Ti(t.type,ki(t.value))}(t);case Yr.List:return function(t){const e=[],r=new Uint8Array(4);A(r,t.list.length,0),e.push(r);for(const r of t.list){const t=ki(r);e.push(t)}return Ti(t.type,S(e))}(t);case Yr.Tuple:return function(t){const e=[],r=new Uint8Array(4);A(r,Object.keys(t.data).length,0),e.push(r);const n=Object.keys(t.data).sort(((t,e)=>t.localeCompare(e)));for(const r of n){const n=qr(r);e.push(hi(n));const i=ki(t.data[r]);e.push(i)}return Ti(t.type,S(e))}(t);case Yr.StringASCII:return function(t){return Ei(t,"ascii")}(t);case Yr.StringUTF8:return function(t){return Ei(t,"utf8")}(t);default:throw new On("Unable to serialize. Invalid Clarity Value.")}var e}!function(t){t[t.BlockFound=0]="BlockFound",t[t.Extended=1]="Extended"}(Gn||(Gn={})),function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}($n||($n={}));const Ci=t=>cr.randomBytes(t),Oi=t=>t.length%2==0?t:`0${t}`,Pi=(t,e)=>t.padStart(e,"0"),Mi=(t,e)=>t.padEnd(e,"0"),Ri=(t,e)=>!!t&&g(t).length>e;function Ni(t){return lr()(t)}function Bi(t,e){const r=Ni(t);return delete r[e],r}const xi=t=>kt(Bt(t)),Ii=t=>d(oe(t)),Fi=Ii,Li=t=>d(xi(t)),Di=t=>{const e=xi(t),r=_(new Uint8Array([0]),new Uint8Array([e.length]),e);return d(xi(r))},Ui=(t,e)=>{if(t>15||e.length>15)throw Error("P2SH multisig address can only contain up to 15 public keys");const r=[];r.push(80+t),e.forEach((t=>{r.push(t.length),r.push(t)})),r.push(80+e.length),r.push(174);const n=S(r);return d(xi(n))},Vi=(t,e)=>{if(t>15||e.length>15)throw Error("P2WSH multisig address can only contain up to 15 public keys");const r=[];r.push(80+t),e.forEach((t=>{r.push(t.length),r.push(t)})),r.push(80+e.length),r.push(174);const n=S(r),i=Bt(n),o=[];o.push(0),o.push(i.length),o.push(i);const a=S(o);return d(xi(a))};function ji(t){return/^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/.test(t)&&t.length<128}function Wi(t){return`0x${d(ki(t))}`}function Ki(t){return Ln(t)}const Hi=t=>{if(t.okay)return Ki(t.result);throw new Error(t.cause)},qi=t=>{try{return(0,fr.ns)(t),!0}catch(t){return!1}},zi=t=>{if("success"===t)return!0;const e=s(t).toLowerCase();return 66===e.length&&s(BigInt(e).toString(16).padStart(64,"0"))===e};function Gi(){return{type:F.MessageSignature,data:d(new Uint8Array(R))}}function $i(t,e,r,n){const i=ai(0,t,1,[kr(e)]).hash160,o=Mr(kr(e))?Y.Compressed:Y.Uncompressed;return{hashMode:t,signer:i,nonce:a(r,!1),fee:a(n,!1),keyEncoding:o,signature:Gi()}}function Xi(t,e,r,n,i){return{hashMode:t,signer:ai(0,t,e,r.map(kr)).hash160,nonce:a(n,!1),fee:a(i,!1),fields:[],signaturesRequired:e}}function Ji(t){return"signature"in t}function Yi(t){return t===X.SerializeP2SH||t===X.SerializeP2WSH}function Zi(t){return t===X.SerializeP2SHNonSequential||t===X.SerializeP2WSHNonSequential}function Qi(t){const e=Ni(t);return e.nonce=0,e.fee=0,Ji(e)?e.signature=Gi():e.fields=[],{...e,nonce:BigInt(0),fee:BigInt(0)}}function to(t){return S([t.hashMode,p(t.signer),o(t.nonce,!1,8),o(t.fee,!1,8),t.keyEncoding,ti(t.signature)])}function eo(t){const e=[t.hashMode,p(t.signer),o(t.nonce,!1,8),o(t.fee,!1,8)],r=bi(t.fields);e.push(vi(r));const n=new Uint8Array(2);return function(t,e,r=0){t[r+0]=e>>>8,t[r+1]=e>>>0}(n,t.signaturesRequired,0),e.push(n),S(e)}function ro(t,e){const r=d(e.readBytes(20)),n=BigInt(`0x${d(e.readBytes(8))}`),i=BigInt(`0x${d(e.readBytes(8))}`),o=e.readUInt8Enum(Y,(t=>{throw new Pn(`Could not parse ${t} as PubKeyEncoding`)}));if(t===X.SerializeP2WPKH&&o!=Y.Compressed)throw new Pn("Failed to parse singlesig spending condition: incomaptible hash mode and key encoding");return{hashMode:t,signer:r,nonce:n,fee:i,keyEncoding:o,signature:Yn(e)}}function no(t,e){const r=d(e.readBytes(20)),n=BigInt("0x"+d(e.readBytes(8))),i=BigInt("0x"+d(e.readBytes(8))),o=_i(e,F.TransactionAuthField).values;let a=!1,s=0;for(const t of o)switch(t.contents.type){case F.PublicKey:Mr(t.contents)||(a=!0);break;case F.MessageSignature:if(t.pubKeyEncoding===Y.Uncompressed&&(a=!0),s+=1,65536===s)throw new Bn("Failed to parse multisig spending condition: too many signatures")}const u=e.readUInt16BE();if(a&&(t===X.SerializeP2WSH||t===X.SerializeP2WSHNonSequential))throw new Bn("Uncompressed keys are not allowed in this hash mode");return{hashMode:t,signer:r,nonce:n,fee:i,fields:o,signaturesRequired:u}}function io(t){return Ji(t)?to(t):eo(t)}function oo(t){const e=t.readUInt8Enum(X,(t=>{throw new Pn(`Could not parse ${t} as AddressHashMode`)}));return e===X.SerializeP2PKH||e===X.SerializeP2WPKH?ro(e,t):no(e,t)}function ao(t,e,r,n){const i=t+d(new Uint8Array([e]))+d(o(r,!1,8))+d(o(n,!1,8));if(49!==p(i).byteLength)throw Error("Invalid signature hash length");return Ii(p(i))}function so(t,e,r){const n=33+R,i=Mr(e)?Y.Compressed:Y.Uncompressed,o=p(t+Oi(i.toString(16))+r.data);if(o.byteLength>n)throw Error("Invalid signature hash length");return Ii(o)}function uo(t,e,r,n,i){const o=ao(t,e,r,n),a=Ur(i,o);return{nextSig:a,nextSigHash:so(o,jr(i),a)}}function co(t,e,r,n,i,o){const a=ao(t,e,r,n),s=kr(Cr(a,o,i));return{pubKey:s,nextSigHash:so(a,s,o)}}function fo(t){return{authType:$.Standard,spendingCondition:t}}function ho(t,e){return{authType:$.Sponsored,spendingCondition:t,sponsorSpendingCondition:e||$i(X.SerializeP2PKH,"0".repeat(66),0,0)}}function lo(t){if(t.spendingCondition)switch(t.authType){case $.Standard:return fo(Qi(t.spendingCondition));case $.Sponsored:return ho(Qi(t.spendingCondition),function(){const t=$i(X.SerializeP2PKH,"",0,0);return t.signer=ii().hash160,t.keyEncoding=Y.Compressed,t.signature=Gi(),t}());default:throw new Nn("Unexpected authorization type for signing")}throw new Error("Authorization missing SpendingCondition")}function po(t,e){switch(t.authType){case $.Standard:case $.Sponsored:return function(t,e,r){return Ji(t)?function(t,e,r){const{pubKey:n,nextSigHash:i}=co(e,r,t.fee,t.nonce,t.keyEncoding,t.signature),o=ai(0,t.hashMode,1,[n]).hash160;if(o!==t.signer)throw new Bn(`Signer hash does not equal hash of public key(s): ${o} != ${t.signer}`);return i}(t,e,r):function(t,e,r){const n=[];let i=e,o=!1,a=0;for(const e of t.fields)switch(e.contents.type){case F.PublicKey:Mr(e.contents)||(o=!0),n.push(e.contents);break;case F.MessageSignature:e.pubKeyEncoding===Y.Uncompressed&&(o=!0);const{pubKey:s,nextSigHash:u}=co(i,r,t.fee,t.nonce,e.pubKeyEncoding,e.contents);if(Yi(t.hashMode)&&(i=u),n.push(s),a+=1,65536===a)throw new Bn("Too many signatures")}if(Yi(t.hashMode)&&a!==t.signaturesRequired||Zi(t.hashMode)&&a<t.signaturesRequired)throw new Bn("Incorrect number of signatures");if(o&&(t.hashMode===X.SerializeP2WSH||t.hashMode===X.SerializeP2WSHNonSequential))throw new Bn("Uncompressed keys are not allowed in this hash mode");const s=ai(0,t.hashMode,t.signaturesRequired,n).hash160;if(s!==t.signer)throw new Bn(`Signer hash does not equal hash of public key(s): ${s} != ${t.signer}`);return i}(t,e,r)}(t.spendingCondition,e,$.Standard);default:throw new Nn("Invalid origin auth type")}}function go(t,e){switch(t.authType){case $.Standard:const r={...t.spendingCondition,fee:a(e,!1)};return{...t,spendingCondition:r};case $.Sponsored:const n={...t.sponsorSpendingCondition,fee:a(e,!1)};return{...t,sponsorSpendingCondition:n}}}function yo(t){switch(t.authType){case $.Standard:return t.spendingCondition.fee;case $.Sponsored:return t.sponsorSpendingCondition.fee}}function mo(t,e){const r={...t.spendingCondition,nonce:a(e,!1)};return{...t,spendingCondition:r}}function wo(t,e){const r={...t.sponsorSpendingCondition,nonce:a(e,!1)};return{...t,sponsorSpendingCondition:r}}function bo(t,e){return{...t,sponsorSpendingCondition:{...e,nonce:a(e.nonce,!1),fee:a(e.fee,!1)}}}function vo(t){const e=[];switch(e.push(t.authType),t.authType){case $.Standard:e.push(io(t.spendingCondition));break;case $.Sponsored:e.push(io(t.spendingCondition)),e.push(io(t.sponsorSpendingCondition))}return S(e)}function _o(t){let e;switch(t.readUInt8Enum($,(t=>{throw new Pn(`Could not parse ${t} as AuthType`)}))){case $.Standard:return e=oo(t),fo(e);case $.Sponsored:return e=oo(t),ho(e,oo(t))}}r(6547);const So={referrerPolicy:"origin",headers:{"x-hiro-product":"stacksjs"}};async function Ao(t,e){const r={};return Object.assign(r,So,e),await fetch(t,r)}function To(...t){const{fetchLib:e,middlewares:r}=function(t){let e=Ao,r=[];return t.length>0&&"function"==typeof t[0]&&(e=t.shift()),t.length>0&&(r=t),{fetchLib:e,middlewares:r}}(t);return async(t,n)=>{let i={url:t,init:n??{}};for(const t of r)"function"==typeof t.pre&&(i=await Promise.resolve(t.pre({fetch:e,...i}))??i);let o=await e(i.url,i.init);for(const t of r)if("function"==typeof t.post){const r=await Promise.resolve(t.post({fetch:e,url:i.url,init:i.init,response:o?.clone()??o}));o=r??o}return o}}const Eo=["mainnet","testnet","devnet","mocknet"];class ko{constructor(t){this.version=mr.Mainnet,this.chainId=yr.Mainnet,this.bnsLookupUrl="https://api.mainnet.hiro.so",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===mr.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAccountExtendedBalancesApiUrl=t=>`${this.coreApiUrl}/extended/v1/address/${t}/balances`,this.getAbiApiUrl=(t,e)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${e}`,this.getReadOnlyFunctionCallApiUrl=(t,e,r)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${e}/${encodeURIComponent(r)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getStackerInfoUrl=(t,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${e}/get-stacker-info`,this.getDataVarUrl=(t,e,r)=>`${this.coreApiUrl}/v2/data_var/${t}/${e}/${r}?proof=0`,this.getMapEntryUrl=(t,e,r)=>`${this.coreApiUrl}/v2/map_entry/${t}/${e}/${r}?proof=0`,this.coreApiUrl=t.url,this.fetchFn=t.fetchFn??To()}getNameInfo(t){const e=`${this.bnsLookupUrl}/v1/names/${t}`;return this.fetchFn(e).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}ko.fromName=t=>{switch(t){case"mainnet":return new Co;case"testnet":return new Oo;case"devnet":return new Mo;case"mocknet":return new Po;default:throw new Error(`Invalid network name provided. Must be one of the following: ${Eo.join(", ")}`)}},ko.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:ko.fromName(t);class Co extends ko{constructor(t){super({url:t?.url??"https://api.mainnet.hiro.so",fetchFn:t?.fetchFn}),this.version=mr.Mainnet,this.chainId=yr.Mainnet}}class Oo extends ko{constructor(t){super({url:t?.url??"https://api.testnet.hiro.so",fetchFn:t?.fetchFn}),this.version=mr.Testnet,this.chainId=yr.Testnet}}class Po extends ko{constructor(t){super({url:t?.url??"http://localhost:3999",fetchFn:t?.fetchFn}),this.version=mr.Testnet,this.chainId=yr.Testnet}}const Mo=Po;function Ro(t,e="hex"){switch(t.type){case Yr.BoolTrue:return"true";case Yr.BoolFalse:return"false";case Yr.Int:return t.value.toString();case Yr.UInt:return`u${t.value.toString()}`;case Yr.Buffer:if("tryAscii"===e){const e=w(t.buffer);if(/[ -~]/.test(e))return JSON.stringify(e)}return`0x${d(t.buffer)}`;case Yr.OptionalNone:return"none";case Yr.OptionalSome:return`(some ${Ro(t.value,e)})`;case Yr.ResponseErr:return`(err ${Ro(t.value,e)})`;case Yr.ResponseOk:return`(ok ${Ro(t.value,e)})`;case Yr.PrincipalStandard:case Yr.PrincipalContract:return dn(t);case Yr.List:return`(list ${t.list.map((t=>Ro(t,e))).join(" ")})`;case Yr.Tuple:return`(tuple ${Object.keys(t.data).map((r=>`(${r} ${Ro(t.data[r],e)})`)).join(" ")})`;case Yr.StringASCII:return`"${t.data}"`;case Yr.StringUTF8:return`u"${t.data}"`}}function No(t,e=!1){switch(t.type){case Yr.BoolTrue:return!0;case Yr.BoolFalse:return!1;case Yr.Int:case Yr.UInt:return e?t.value.toString():t.value;case Yr.Buffer:return`0x${d(t.buffer)}`;case Yr.OptionalNone:return null;case Yr.OptionalSome:case Yr.ResponseErr:case Yr.ResponseOk:return Bo(t.value);case Yr.PrincipalStandard:case Yr.PrincipalContract:return dn(t);case Yr.List:return t.list.map((t=>Bo(t)));case Yr.Tuple:const r={};return Object.keys(t.data).forEach((e=>{r[e]=Bo(t.data[e])})),r;case Yr.StringASCII:case Yr.StringUTF8:return t.data}}function Bo(t){switch(t.type){case Yr.ResponseErr:return{type:xo(t),value:No(t,!0),success:!1};case Yr.ResponseOk:return{type:xo(t),value:No(t,!0),success:!0};default:return{type:xo(t),value:No(t,!0)}}}function xo(t){switch(t.type){case Yr.BoolTrue:case Yr.BoolFalse:return"bool";case Yr.Int:return"int";case Yr.UInt:return"uint";case Yr.Buffer:return`(buff ${t.buffer.length})`;case Yr.OptionalNone:return"(optional none)";case Yr.OptionalSome:return`(optional ${xo(t.value)})`;case Yr.ResponseErr:return`(response UnknownType ${xo(t.value)})`;case Yr.ResponseOk:return`(response ${xo(t.value)} UnknownType)`;case Yr.PrincipalStandard:case Yr.PrincipalContract:return"principal";case Yr.List:return`(list ${t.list.length} ${t.list.length?xo(t.list[0]):"UnknownType"})`;case Yr.Tuple:return`(tuple ${Object.keys(t.data).map((e=>`(${e} ${xo(t.data[e])})`)).join(" ")})`;case Yr.StringASCII:return`(string-ascii ${m(t.data).length})`;case Yr.StringUTF8:return`(string-utf8 ${g(t.data).length})`}}function Io(t,e){return t.type===e}var Fo;!function(t){t[t.ClarityAbiTypeUInt128=1]="ClarityAbiTypeUInt128",t[t.ClarityAbiTypeInt128=2]="ClarityAbiTypeInt128",t[t.ClarityAbiTypeBool=3]="ClarityAbiTypeBool",t[t.ClarityAbiTypePrincipal=4]="ClarityAbiTypePrincipal",t[t.ClarityAbiTypeNone=5]="ClarityAbiTypeNone",t[t.ClarityAbiTypeBuffer=6]="ClarityAbiTypeBuffer",t[t.ClarityAbiTypeResponse=7]="ClarityAbiTypeResponse",t[t.ClarityAbiTypeOptional=8]="ClarityAbiTypeOptional",t[t.ClarityAbiTypeTuple=9]="ClarityAbiTypeTuple",t[t.ClarityAbiTypeList=10]="ClarityAbiTypeList",t[t.ClarityAbiTypeStringAscii=11]="ClarityAbiTypeStringAscii",t[t.ClarityAbiTypeStringUtf8=12]="ClarityAbiTypeStringUtf8",t[t.ClarityAbiTypeTraitReference=13]="ClarityAbiTypeTraitReference"}(Fo||(Fo={}));const Lo=t=>"string"==typeof t,Do=t=>void 0!==t.buffer,Uo=t=>void 0!==t["string-ascii"],Vo=t=>void 0!==t["string-utf8"],jo=t=>void 0!==t.response,Wo=t=>void 0!==t.optional,Ko=t=>void 0!==t.tuple,Ho=t=>void 0!==t.list;function qo(t){if(Lo(t)){if("uint128"===t)return{id:Fo.ClarityAbiTypeUInt128,type:t};if("int128"===t)return{id:Fo.ClarityAbiTypeInt128,type:t};if("bool"===t)return{id:Fo.ClarityAbiTypeBool,type:t};if("principal"===t)return{id:Fo.ClarityAbiTypePrincipal,type:t};if("trait_reference"===t)return{id:Fo.ClarityAbiTypeTraitReference,type:t};if("none"===t)return{id:Fo.ClarityAbiTypeNone,type:t};throw new Error(`Unexpected Clarity ABI type primitive: ${JSON.stringify(t)}`)}if(Do(t))return{id:Fo.ClarityAbiTypeBuffer,type:t};if(jo(t))return{id:Fo.ClarityAbiTypeResponse,type:t};if(Wo(t))return{id:Fo.ClarityAbiTypeOptional,type:t};if(Ko(t))return{id:Fo.ClarityAbiTypeTuple,type:t};if(Ho(t))return{id:Fo.ClarityAbiTypeList,type:t};if(Uo(t))return{id:Fo.ClarityAbiTypeStringAscii,type:t};if(Vo(t))return{id:Fo.ClarityAbiTypeStringUtf8,type:t};throw new Error(`Unexpected Clarity ABI type: ${JSON.stringify(t)}`)}function zo(t,e){const r=e.id?e:qo(e);switch(r.id){case Fo.ClarityAbiTypeUInt128:return sn(t);case Fo.ClarityAbiTypeInt128:return an(t);case Fo.ClarityAbiTypeBool:if("false"===t||"0"===t)return hn();if("true"===t||"1"===t)return fn();throw new Error(`Unexpected Clarity bool value: ${JSON.stringify(t)}`);case Fo.ClarityAbiTypePrincipal:if(t.includes(".")){const[e,r]=t.split(".");return mn(e,r)}return gn(t);case Fo.ClarityAbiTypeTraitReference:const[e,n]=t.split(".");return mn(e,n);case Fo.ClarityAbiTypeNone:return Zr();case Fo.ClarityAbiTypeBuffer:return un(p(t));case Fo.ClarityAbiTypeStringAscii:return xn(t);case Fo.ClarityAbiTypeStringUtf8:return In(t);case Fo.ClarityAbiTypeOptional:return Qr(zo(t,r.type.optional));case Fo.ClarityAbiTypeResponse:case Fo.ClarityAbiTypeTuple:case Fo.ClarityAbiTypeList:throw new Rn(`Unsupported encoding for Clarity type: ${r.id}`);default:throw new Error(`Unexpected Clarity type ID: ${JSON.stringify(r)}`)}}function Go(t,e){const r=t.id?t:qo(t);return r.id===Fo.ClarityAbiTypeBuffer?un(g(e)):zo(e,r)}function $o(t){if(Lo(t))return"int128"===t?"int":"uint128"===t?"uint":t;if(Do(t))return`(buff ${t.buffer.length})`;if(Uo(t))return`(string-ascii ${t["string-ascii"].length})`;if(Vo(t))return`(string-utf8 ${t["string-utf8"].length})`;if(jo(t))return`(response ${$o(t.response.ok)} ${$o(t.response.error)})`;if(Wo(t))return`(optional ${$o(t.optional)})`;if(Ko(t))return`(tuple ${t.tuple.map((t=>`(${t.name} ${$o(t.type)})`)).join(" ")})`;if(Ho(t))return`(list ${t.list.length} ${$o(t.list.type)})`;throw new Error(`Type string unsupported for Clarity type: ${JSON.stringify(t)}`)}function Xo(t){return`(define-${"read_only"===t.access?"read-only":t.access} (${t.name} ${t.args.map((t=>`(${t.name} ${$o(t.type)})`)).join(" ")}))`}function Jo(t,e){const r=qo(e);switch(t.type){case Yr.BoolTrue:case Yr.BoolFalse:return r.id===Fo.ClarityAbiTypeBool;case Yr.Int:return r.id===Fo.ClarityAbiTypeInt128;case Yr.UInt:return r.id===Fo.ClarityAbiTypeUInt128;case Yr.Buffer:return r.id===Fo.ClarityAbiTypeBuffer&&r.type.buffer.length>=t.buffer.length;case Yr.StringASCII:return r.id===Fo.ClarityAbiTypeStringAscii&&r.type["string-ascii"].length>=t.data.length;case Yr.StringUTF8:return r.id===Fo.ClarityAbiTypeStringUtf8&&r.type["string-utf8"].length>=t.data.length;case Yr.OptionalNone:return r.id===Fo.ClarityAbiTypeNone||r.id===Fo.ClarityAbiTypeOptional;case Yr.OptionalSome:return r.id===Fo.ClarityAbiTypeOptional&&Jo(t.value,r.type.optional);case Yr.ResponseErr:return r.id===Fo.ClarityAbiTypeResponse&&Jo(t.value,r.type.response.error);case Yr.ResponseOk:return r.id===Fo.ClarityAbiTypeResponse&&Jo(t.value,r.type.response.ok);case Yr.PrincipalContract:return r.id===Fo.ClarityAbiTypePrincipal||r.id===Fo.ClarityAbiTypeTraitReference;case Yr.PrincipalStandard:return r.id===Fo.ClarityAbiTypePrincipal;case Yr.List:return r.id==Fo.ClarityAbiTypeList&&r.type.list.length>=t.list.length&&t.list.every((t=>Jo(t,r.type.list.type)));case Yr.Tuple:if(r.id==Fo.ClarityAbiTypeTuple){const e=Ni(t.data);for(let t=0;t<r.type.tuple.length;t++){const n=r.type.tuple[t],i=n.name,o=e[i];if(!o)return!1;if(!Jo(o,n.type))return!1;delete e[i]}return!0}return!1;default:return!1}}function Yo(t,e){const r=e.functions.filter((e=>e.name===t.functionName.content));if(1===r.length){const e=r[0].args;if(t.functionArgs.length!==e.length)throw new Error(`Clarity function expects ${e.length} argument(s) but received ${t.functionArgs.length}`);for(let r=0;r<t.functionArgs.length;r++){const n=t.functionArgs[r],i=e[r];if(!Jo(n,i.type)){const e=r+1;throw new Error(`Clarity function \`${t.functionName.content}\` expects argument ${e} to be of type ${$o(i.type)}, not ${xo(n)}`)}}return!0}throw 0===r.length?new Error(`ABI doesn't contain a function with the name ${t.functionName.content}`):new Error(`Malformed ABI. Contains multiple functions with the name ${t.functionName.content}`)}function Zo(t,e){const r=$o(e);if(Lo(e)){if("uint128"===e)return sn(t);if("int128"===e)return an(t);if("bool"===e){if("true"===t.toLowerCase())return fn();if("false"===t.toLowerCase())return hn();throw new Error(`Invalid bool value: ${t}`)}if("principal"===e){if(t.includes(".")){const[e,r]=t.split(".");return mn(e,r)}return gn(t)}throw new Error(`Contract function contains unsupported Clarity ABI type: ${r}`)}if(Do(e)){if(g(t).byteLength>e.buffer.length)throw new Error(`Input exceeds specified buffer length limit of ${e.buffer.length}`);return cn(t)}throw jo(e)||Wo(e)||Ko(e)||Ho(e),new Error(`Contract function contains unsupported Clarity ABI type: ${r}`)}function Qo(t,e,r){return"string"==typeof t&&(t=$r(t)),{type:F.PostCondition,conditionType:G.STX,principal:t,conditionCode:e,amount:a(r,!1)}}function ta(t,e,r,n){return"string"==typeof t&&(t=$r(t)),"string"==typeof n&&(n=Hr(n)),{type:F.PostCondition,conditionType:G.Fungible,principal:t,conditionCode:e,amount:a(r,!1),assetInfo:n}}function ea(t,e,r,n){return"string"==typeof t&&(t=$r(t)),"string"==typeof r&&(r=Hr(r)),{type:F.PostCondition,conditionType:G.NonFungible,principal:t,conditionCode:e,assetInfo:r,assetName:n}}class ra{constructor(t){this.transaction=t,this.sigHash=t.signBegin(),this.originDone=!1,this.checkOversign=!0,this.checkOverlap=!0;const e=t.auth.spendingCondition;if(e&&!Ji(e)){if(e.fields.filter((t=>t.contents.type===F.MessageSignature)).length>=e.signaturesRequired)throw new Error("SpendingCondition has more signatures than are expected");e.fields.forEach((r=>{if(r.contents.type!==F.MessageSignature)return;const n=r.contents,i=co(this.sigHash,t.auth.authType,e.fee,e.nonce,Y.Compressed,n);Zi(e.hashMode)||(this.sigHash=i.nextSigHash)}))}}static createSponsorSigner(t,e){if(t.auth.authType!=$.Sponsored)throw new Nn("Cannot add sponsor to non-sponsored transaction");const r=Ni(t);r.setSponsor(e);const n=r.verifyOrigin(),i=new this(r);return i.originDone=!0,i.sigHash=n,i.checkOversign=!0,i.checkOverlap=!0,i}signOrigin(t){if(this.checkOverlap&&this.originDone)throw new Nn("Cannot sign origin after sponsor key");if(void 0===this.transaction.auth)throw new Nn('"transaction.auth" is undefined');if(void 0===this.transaction.auth.spendingCondition)throw new Nn('"transaction.auth.spendingCondition" is undefined');const e=this.transaction.auth.spendingCondition;if((e.hashMode===X.SerializeP2SH||e.hashMode===X.SerializeP2WSH)&&this.checkOversign&&e.fields.filter((t=>t.contents.type===F.MessageSignature)).length>=e.signaturesRequired)throw new Error("Origin would have too many signatures");const r=this.transaction.signNextOrigin(this.sigHash,t);(Ji(this.transaction.auth.spendingCondition)||Yi(this.transaction.auth.spendingCondition.hashMode))&&(this.sigHash=r)}appendOrigin(t){if(this.checkOverlap&&this.originDone)throw Error("Cannot append public key to origin after sponsor key");if(void 0===this.transaction.auth)throw new Error('"transaction.auth" is undefined');if(void 0===this.transaction.auth.spendingCondition)throw new Error('"transaction.auth.spendingCondition" is undefined');this.transaction.appendPubkey(t)}signSponsor(t){if(void 0===this.transaction.auth)throw new Nn('"transaction.auth" is undefined');if(this.transaction.auth.authType!==$.Sponsored)throw new Nn('"transaction.auth.authType" is not AuthType.Sponsored');const e=this.transaction.signNextSponsor(this.sigHash,t);this.sigHash=e,this.originDone=!0}getTxInComplete(){return Ni(this.transaction)}resume(t){this.transaction=Ni(t),this.sigHash=t.signBegin()}}class na{constructor(t,e,r,n,i,o,s){if(this.version=t,this.auth=e,this.payload="amount"in r?{...r,amount:a(r.amount,!1)}:r,this.chainId=s??E,this.postConditionMode=i??z.Deny,this.postConditions=n??bi([]),o)this.anchorMode=K(o);else switch(r.payloadType){case L.Coinbase:case L.CoinbaseToAltRecipient:case L.NakamotoCoinbase:case L.PoisonMicroblock:case L.TenureChange:this.anchorMode=U.OnChainOnly;break;case L.ContractCall:case L.SmartContract:case L.VersionedSmartContract:case L.TokenTransfer:this.anchorMode=U.Any}}signBegin(){const t=Ni(this);return t.auth=lo(t.auth),t.txid()}verifyBegin(){const t=Ni(this);return t.auth=lo(t.auth),t.txid()}verifyOrigin(){return po(this.auth,this.verifyBegin())}signNextOrigin(t,e){if(void 0===this.auth.spendingCondition)throw new Error('"auth.spendingCondition" is undefined');if(void 0===this.auth.authType)throw new Error('"auth.authType" is undefined');return this.signAndAppend(this.auth.spendingCondition,t,$.Standard,e)}signNextSponsor(t,e){if(this.auth.authType===$.Sponsored)return this.signAndAppend(this.auth.sponsorSpendingCondition,t,$.Sponsored,e);throw new Error('"auth.sponsorSpendingCondition" is undefined')}appendPubkey(t){const e=this.auth.spendingCondition;if(!e||Ji(e))throw new Error("Can't append public key to a singlesig condition");{const r=Mr(t);e.fields.push(Zn(r?Y.Compressed:Y.Uncompressed,t))}}signAndAppend(t,e,r,n){const{nextSig:i,nextSigHash:o}=uo(e,r,t.fee,t.nonce,n);return Ji(t)?t.signature=i:t.fields.push(Zn(n.data.byteLength===br?Y.Compressed:Y.Uncompressed,i)),o}txid(){const t=this.serialize();return Ii(t)}setSponsor(t){if(this.auth.authType!=$.Sponsored)throw new Nn("Cannot sponsor sign a non-sponsored transaction");this.auth=bo(this.auth,t)}setFee(t){this.auth=go(this.auth,t)}setNonce(t){this.auth=mo(this.auth,t)}setSponsorNonce(t){if(this.auth.authType!=$.Sponsored)throw new Nn("Cannot sponsor sign a non-sponsored transaction");this.auth=wo(this.auth,t)}serialize(){if(void 0===this.version)throw new On('"version" is undefined');if(void 0===this.chainId)throw new On('"chainId" is undefined');if(void 0===this.auth)throw new On('"auth" is undefined');if(void 0===this.anchorMode)throw new On('"anchorMode" is undefined');if(void 0===this.payload)throw new On('"payload" is undefined');const t=[];t.push(this.version);const e=new Uint8Array(4);return A(e,this.chainId,0),t.push(e),t.push(vo(this.auth)),t.push(this.anchorMode),t.push(this.postConditionMode),t.push(vi(this.postConditions)),t.push(Xn(this.payload)),S(t)}}function ia(t){let e;e="string"==typeof t?"0x"===t.slice(0,2).toLowerCase()?new kn(p(t.slice(2))):new kn(p(t)):t instanceof Uint8Array?new kn(t):t;const r=e.readUInt8Enum(H,(t=>{throw new Error(`Could not parse ${t} as TransactionVersion`)})),n=e.readUInt32BE(),i=_o(e),o=e.readUInt8Enum(U,(t=>{throw new Error(`Could not parse ${t} as AnchorMode`)})),a=e.readUInt8Enum(z,(t=>{throw new Error(`Could not parse ${t} as PostConditionMode`)})),s=_i(e,F.PostCondition),u=Jn(e);return new na(r,i,u,s,a,o,n)}async function oa(t,e){const r=ko.fromNameOrNetwork(e??new Co),n=r.getAccountApiUrl(t);try{return await async function(t,e){const r=`${e.coreApiUrl}/extended/v1/address/${t}/nonces`,n=await e.fetchFn(r),i=await n.json();return BigInt(i.possible_next_nonce)}(t,r)}catch(t){}const i=await r.fetchFn(n);if(!i.ok){let t="";try{t=await i.text()}catch(t){}throw new Error(`Error fetching nonce. Response ${i.status}: ${i.statusText}. Attempted to fetch ${n} and failed with the message: "${t}"`)}const o=await i.text(),a=JSON.parse(o);return BigInt(a.nonce)}async function aa(t,e){if(t.payload.payloadType!==L.TokenTransfer)throw new Error(`Transaction fee estimation only possible with ${L[L.TokenTransfer]} transactions. Invoked with: ${L[t.payload.payloadType]}`);return sa(t,e)}async function sa(t,e){const r=ko.fromNameOrNetwork(e??la(t)),n=r.getTransferFeeEstimateApiUrl(),i=await r.fetchFn(n,{method:"GET",headers:{Accept:"application/text"}});if(!i.ok){let t="";try{t=await i.text()}catch(t){}throw new Error(`Error estimating transaction fee. Response ${i.status}: ${i.statusText}. Attempted to fetch ${n} and failed with the message: "${t}"`)}const o=await i.text(),a=BigInt(t.serialize().byteLength);return BigInt(o)*a}async function ua(t,e,r){const n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({transaction_payload:d(Xn(t)),...e?{estimated_len:e}:{}})},i=ko.fromNameOrNetwork(r??new Co),o=i.getTransactionFeeEstimateApiUrl(),a=await i.fetchFn(o,n);if(!a.ok){const t=await a.text().then((t=>{try{return JSON.parse(t)}catch(e){return t}}));if("NoEstimateAvailable"===t?.reason||"string"==typeof t&&t.includes("NoEstimateAvailable"))throw new Mn(t?.reason_data?.message??"");throw new Error(`Error estimating transaction fee. Response ${a.status}: ${a.statusText}. Attempted to fetch ${o} and failed with the message: "${t}"`)}return(await a.json()).estimations}async function ca(t,e,r){const n=t.serialize(),i=ko.fromNameOrNetwork(e??la(t));return fa(n,i.getBroadcastApiUrl(),r,i.fetchFn)}async function fa(t,e,r,n=To()){const i={method:"POST",headers:{"Content-Type":r?"application/json":"application/octet-stream"},body:r?JSON.stringify({tx:d(t),attachment:d(r)}):t},o=await n(e,i);if(!o.ok)try{return await o.json()}catch(t){throw Error(`Failed to broadcast transaction: ${t.message}`)}const a=await o.text(),s=a.replace(/["]+/g,"");if(!zi(s))throw new Error(a);return{txid:s}}async function ha(t,e,r){const n=ko.fromNameOrNetwork(r),i=n.getAbiApiUrl(t,e),o=await n.fetchFn(i,{method:"GET"});if(!o.ok){const r=await o.text().catch((()=>""));throw new Error(`Error fetching contract ABI for contract "${e}" at address ${t}. Response ${o.status}: ${o.statusText}. Attempted to fetch ${i} and failed with the message: "${r}"`)}return JSON.parse(await o.text())}function la(t){switch(t.version){case H.Mainnet:return new Co;case H.Testnet:return new Oo}}async function da(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Co,memo:"",sponsored:!1},r=Object.assign(e,t),n=Kn(r.recipient,r.amount,r.memo);let i=null,o=null;if("publicKey"in r)o=$i(X.SerializeP2PKH,r.publicKey,r.nonce,r.fee);else{const t=r.useNonSequentialMultiSig?X.SerializeP2SHNonSequential:X.SerializeP2SH,e=r.address?Ba(r.publicKeys,r.numSignatures,t,Gr(r.address).hash160):r.publicKeys;o=Xi(t,r.numSignatures,e,r.nonce,r.fee)}i=r.sponsored?ho(o):fo(o);const a=ko.fromNameOrNetwork(r.network),s=new na(a.version,i,n,void 0,void 0,r.anchorMode,a.chainId);if(void 0===t.fee||null===t.fee){const t=await Ra(s,a);s.setFee(t)}if(void 0===t.nonce||null===t.nonce){const t=r.network.version===H.Mainnet?J.MainnetSingleSig:J.TestnetSingleSig,e=(0,fr.bJ)(t,s.auth.spendingCondition.signer),n=await oa(e,r.network);s.setNonce(n)}return s}async function pa(t){if("senderKey"in t){const e=Rr(jr(Lr(t.senderKey))),r=Bi(t,"senderKey"),n=await da({publicKey:e,...r}),i=Lr(t.senderKey);return new ra(n).signOrigin(i),n}{const e=Bi(t,"signerKeys"),r=await da(e);return Na(r,t.publicKeys.slice(),t.signerKeys,t.address),r}}async function ga(t,e){if(t.payload.payloadType!==L.SmartContract&&t.payload.payloadType!==L.VersionedSmartContract)throw new Error(`Contract deploy fee estimation only possible with ${L[L.SmartContract]} transactions. Invoked with: ${L[t.payload.payloadType]}`);const r=ko.fromNameOrNetwork(e??la(t)),n=r.getTransferFeeEstimateApiUrl(),i=await r.fetchFn(n,{method:"GET",headers:{Accept:"application/text"}});if(!i.ok){const t=await i.text().catch((()=>""));throw new Error(`Error estimating contract deploy fee. Response ${i.status}: ${i.statusText}. Attempted to fetch ${n} and failed with the message: "${t}"`)}const o=await i.text(),s=a(t.serialize().byteLength,!1);return a(o,!1)*s}async function ya(t){if("senderKey"in t){const e=Rr(jr(Lr(t.senderKey))),r=Bi(t,"senderKey"),n=await ma({publicKey:e,...r}),i=Lr(t.senderKey);return new ra(n).signOrigin(i),n}{const e=Bi(t,"signerKeys"),r=await ma(e);return Na(r,t.publicKeys.slice(),t.signerKeys,t.address),r}}async function ma(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Co,postConditionMode:z.Deny,sponsored:!1,clarityVersion:D.Clarity2},r=Object.assign(e,t),n=qn(r.contractName,r.codeBody,r.clarityVersion);let i=null,o=null;if("publicKey"in r)o=$i(X.SerializeP2PKH,r.publicKey,r.nonce,r.fee);else{const t=r.useNonSequentialMultiSig?X.SerializeP2SHNonSequential:X.SerializeP2SH,e=r.address?Ba(r.publicKeys,r.numSignatures,t,Gr(r.address).hash160):r.publicKeys;o=Xi(t,r.numSignatures,e,r.nonce,r.fee)}i=r.sponsored?ho(o):fo(o);const a=ko.fromNameOrNetwork(r.network),s=[];r.postConditions&&r.postConditions.length>0&&r.postConditions.forEach((t=>{s.push(t)}));const u=bi(s),c=new na(a.version,i,n,u,r.postConditionMode,r.anchorMode,a.chainId);if(void 0===t.fee||null===t.fee){const t=await Ra(c,a);c.setFee(t)}if(void 0===t.nonce||null===t.nonce){const t=r.network.version===H.Mainnet?J.MainnetSingleSig:J.TestnetSingleSig,e=(0,fr.bJ)(t,c.auth.spendingCondition.signer),n=await oa(e,r.network);c.setNonce(n)}return c}async function wa(t,e){if(t.payload.payloadType!==L.ContractCall)throw new Error(`Contract call fee estimation only possible with ${L[L.ContractCall]} transactions. Invoked with: ${L[t.payload.payloadType]}`);const r=ko.fromNameOrNetwork(e??la(t)),n=r.getTransferFeeEstimateApiUrl(),i=await r.fetchFn(n,{method:"GET",headers:{Accept:"application/text"}});if(!i.ok){const t=await i.text().catch((()=>""));throw new Error(`Error estimating contract call fee. Response ${i.status}: ${i.statusText}. Attempted to fetch ${n} and failed with the message: "${t}"`)}const o=await i.text(),s=a(t.serialize().byteLength,!1);return a(o,!1)*s}async function ba(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Co,postConditionMode:z.Deny,sponsored:!1},r=Object.assign(e,t),n=Hn(r.contractAddress,r.contractName,r.functionName,r.functionArgs);if(r?.validateWithAbi){let t;if("boolean"==typeof r.validateWithAbi){if(!r?.network)throw new Error("Network option must be provided in order to validate with ABI");t=await ha(r.contractAddress,r.contractName,r.network)}else t=r.validateWithAbi;Yo(n,t)}let i=null,o=null;if("publicKey"in r)i=$i(X.SerializeP2PKH,r.publicKey,r.nonce,r.fee);else{const t=r.useNonSequentialMultiSig?X.SerializeP2SHNonSequential:X.SerializeP2SH,e=r.address?Ba(r.publicKeys,r.numSignatures,t,Gr(r.address).hash160):r.publicKeys;i=Xi(t,r.numSignatures,e,r.nonce,r.fee)}o=r.sponsored?ho(i):fo(i);const a=ko.fromNameOrNetwork(r.network),s=[];r.postConditions&&r.postConditions.length>0&&r.postConditions.forEach((t=>{s.push(t)}));const u=bi(s),c=new na(a.version,o,n,u,r.postConditionMode,r.anchorMode,a.chainId);if(void 0===t.fee||null===t.fee){const t=await Ra(c,a);c.setFee(t)}if(void 0===t.nonce||null===t.nonce){const t=a.version===H.Mainnet?J.MainnetSingleSig:J.TestnetSingleSig,e=(0,fr.bJ)(t,c.auth.spendingCondition.signer),r=await oa(e,a);c.setNonce(r)}return c}async function va(t){if("senderKey"in t){const e=Rr(jr(Lr(t.senderKey))),r=Bi(t,"senderKey"),n=await ba({publicKey:e,...r}),i=Lr(t.senderKey);return new ra(n).signOrigin(i),n}{const e=Bi(t,"signerKeys"),r=await ba(e);return Na(r,t.publicKeys.slice(),t.signerKeys,t.address),r}}function _a(t,e,r){return Qo(Jr(t),e,r)}function Sa(t,e,r,n){return Qo(Xr(t,e),r,n)}function Aa(t,e,r,n){return ta(Jr(t),e,r,n)}function Ta(t,e,r,n,i){return ta(Xr(t,e),r,n,i)}function Ea(t,e,r,n){return ea(Jr(t),e,r,n)}function ka(t,e,r,n,i){return ea(Xr(t,e),r,n,i)}async function Ca(t){const e={network:new Co},r=Object.assign(e,t),{contractName:n,contractAddress:i,functionName:o,functionArgs:a,senderAddress:s}=r,u=ko.fromNameOrNetwork(r.network),c=u.getReadOnlyFunctionCallApiUrl(i,n,o),f=a.map((t=>Wi(t))),h=JSON.stringify({sender:s,arguments:f}),l=await u.fetchFn(c,{method:"POST",body:h,headers:{"Content-Type":"application/json"}});if(!l.ok){const t=await l.text().catch((()=>""));throw new Error(`Error calling read-only function. Response ${l.status}: ${l.statusText}. Attempted to fetch ${c} and failed with the message: "${t}"`)}return l.json().then((t=>Hi(t)))}async function Oa(t){const e={network:new Co},{contractAddress:r,contractName:n,mapName:i,mapKey:o,network:a}=Object.assign(e,t),s=ko.fromNameOrNetwork(a),u=s.getMapEntryUrl(r,n,i),c="0x"+d(ki(o)),f={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(c)},h=await s.fetchFn(u,f);if(!h.ok){const t=await h.text().catch((()=>""));throw new Error(`Error fetching map entry for map "${i}" in contract "${n}" at address ${r}, using map key "${c}". Response ${h.status}: ${h.statusText}. Attempted to fetch ${u} and failed with the message: "${t}"`)}const l=await h.text(),p=JSON.parse(l);if(!p.data)throw new Error(`Error fetching map entry for map "${i}" in contract "${n}" at address ${r}, using map key "${c}". Response ${h.status}: ${h.statusText}. Attempted to fetch ${u} and failed with the response: "${l}"`);let g;try{g=Ln(p.data)}catch(t){throw new Error(`Error deserializing Clarity value "${p.data}": ${t}`)}return g}async function Pa(t){const e={fee:0,sponsorNonce:0,sponsorAddressHashmode:X.SerializeP2PKH,network:t.transaction.version===H.Mainnet?new Co:new Oo},r=Object.assign(e,t),n=ko.fromNameOrNetwork(r.network),i=Br(r.sponsorPrivateKey);if(void 0===t.fee||null===t.fee){let t=0;switch(r.transaction.payload.payloadType){case L.TokenTransfer:case L.SmartContract:case L.VersionedSmartContract:case L.ContractCall:const e=Ma(r.transaction);try{t=(await ua(r.transaction.payload,e,n))[1].fee}catch(t){throw t}break;default:throw new Error(`Sponsored transactions not supported for transaction type ${L[r.transaction.payload.payloadType]}`)}r.transaction.setFee(t),r.fee=t}if(void 0===t.sponsorNonce||null===t.sponsorNonce){const t=Kr(n.version===H.Mainnet?J.MainnetSingleSig:J.TestnetSingleSig,i),e=await oa(t,n);r.sponsorNonce=e}const o=$i(r.sponsorAddressHashmode,Rr(i),r.sponsorNonce,r.fee);r.transaction.setSponsor(o);const a=Lr(r.sponsorPrivateKey),s=ra.createSponsorSigner(r.transaction,o);return s.signSponsor(a),s.transaction}function Ma(t){const e=t.auth.spendingCondition.hashMode;if([X.SerializeP2SH,X.SerializeP2WSH].includes(e)){const e=t.auth.spendingCondition,r=e.fields.filter((t=>t.contents.type===F.MessageSignature)).length,n=(e.signaturesRequired-r)*(R+1);return t.serialize().byteLength+n}return t.serialize().byteLength}async function Ra(t,e){try{const r=Ma(t);return(await ua(t.payload,r,e))[1].fee}catch(r){if(r instanceof Mn)return await sa(t,e);throw r}}function Na(t,e,r,n){if(Ji(t.auth.spendingCondition))throw new Error("Transaction is not a multi-sig transaction");const i=new ra(t),o=n?Ba(e,t.auth.spendingCondition.signaturesRequired,t.auth.spendingCondition.hashMode,Gr(n).hash160):e;for(const t of o){const e=r.find((e=>d(Br(e).data)===t));e?i.signOrigin(Lr(e)):i.appendOrigin(Pr(p(t)))}}function Ba(t,e,r,n){if(ai(0,r,e,t.map(kr)).hash160===n)return t;const i=t.slice().sort();if(ai(0,r,e,i.map(kr)).hash160===n)return i;throw new Error("Failed to find matching multi-sig address given public-keys.")}function xa(t,e,r=!1){return t?`\n${" ".repeat(t*(e-(r?1:0)))}`:" "}function Ia(t,e=0,r){return t.type===Yr.BoolFalse?"false":t.type===Yr.BoolTrue?"true":t.type===Yr.Int?t.value.toString():t.type===Yr.UInt?`u${t.value.toString()}`:t.type===Yr.StringASCII?`"${t.data}"`:t.type===Yr.StringUTF8?`u"${t.data}"`:t.type===Yr.PrincipalContract||t.type===Yr.PrincipalStandard?`'${dn(t)}`:t.type===Yr.Buffer?`0x${d(t.buffer)}`:t.type===Yr.OptionalNone?"none":t.type===Yr.OptionalSome?`(some ${Ia(t.value,e,r)})`:t.type===Yr.ResponseOk?`(ok ${Ia(t.value,e,r)})`:t.type===Yr.ResponseErr?`(err ${Ia(t.value,e,r)})`:t.type===Yr.List?function(t,e,r=1){if(0===t.list.length)return"(list)";const n=xa(e,r,!1),i=e?xa(e,r,!0):"";return`(list${n}${t.list.map((t=>Ia(t,e,r))).join(n)}${i})`}(t,e,r+1):t.type===Yr.Tuple?function(t,e,r=1){if(0===Object.keys(t.data).length)return"{}";const n=[];for(const[i,o]of Object.entries(t.data))n.push(`${i}: ${Ia(o,e,r)}`);const i=xa(e,r,!1),o=xa(e,r,!0);return`{${i}${n.sort().join(`,${i}`)}${o}}`}(t,e,r+1):void function(t){throw new Error(`invalid clarity value type: ${t}`)}(t)}function Fa(t,e=0){return Ia(t,e,0)}const La=Fa;function Da(t,e){return r=>{const n=r.match(t);return n&&0===n.index?{success:!0,value:n[0],rest:r.substring(n[0].length),capture:e?e(n[0]):void 0}:{success:!1}}}function Ua(){return Da(/\s+/)}function Va(t){return e=>t()(e)}function ja(t){return e=>{for(const r of t){const t=r(e);if(t.success)return t}return{success:!1}}}function Wa(t){return e=>{const r=t(e);return!r.success||r.rest?{success:!1}:r}}function Ka(t){return e=>{const r=t(e);return r.success?r:{success:!0,value:"",rest:e}}}function Ha(t,e=t=>t[0]){return r=>{let n=r,i="";const o=[];for(const e of t){const t=e(n);if(!t.success)return{success:!1};n=t.rest,i+=t.value,t.capture&&o.push(t.capture)}return{success:!0,value:i,rest:n,capture:e(o)}}}function qa(t,e=t=>t[0]){return Ha(t.flatMap(((t,e)=>0===e?[t]:[Ka(Ua()),t])),e)}function za(t){return qa([Da(/\(/),t,Da(/\)/)])}function Ga(t,e,r=t=>t[t.length-1],n){return i=>{let o=i,a="";const s=[];let u;for(u=0;;u++){const t=e(o);if(!t.success)break;if(o=t.rest,a+=t.value,t.capture&&s.push(t.capture),n){const t=n(o);if(!t.success){u++;break}o=t.rest,a+=t.value}}return u<t?{success:!1}:{success:!0,value:a,rest:o,capture:r(s)}}}function $a(t,e){return r=>{const n=t(r);return n.success?{success:!0,value:n.value,rest:n.rest,capture:e?e(n.value):n.value}:{success:!1}}}function Xa(){return $a(Da(/\-?[0-9]+/),(t=>ls(parseInt(t))))}function Ja(){return Ha([Da(/u/),$a(Da(/[0-9]+/),(t=>ds(parseInt(t))))])}function Ya(){return $a(Da(/true|false/),(t=>hs("true"===t)))}function Za(){return Ha([Da(/\'/),$a(Ha([Da(/[A-Z0-9]+/),Ka(Ha([Da(/\./),Da(/[a-zA-Z0-9\-]+/)]))]),gs)])}function Qa(){return Ha([Da(/0x/),$a(Da(/[0-9a-fA-F]+/),Ss)])}function ts(t){return t.replace(/\\\\/g,"\\").replace(/\\(.)/g,"$1")}function es(){return Ha([Da(/"/),$a(Da(/(\\.|[^"])*/),(t=>bs(ts(t)))),Da(/"/)])}function rs(){return Ha([Da(/u"/),$a(Da(/(\\.|[^"])*/),(t=>vs(ts(t)))),Da(/"/)])}function ns(){return za(Ha([Da(/list/),Ga(0,Ha([Ua(),cs()]),(t=>ws(t)))]))}function is(){return ja([qa([Da(/\{/),Ga(1,Ha([$a(Da(/[a-zA-Z][a-zA-Z0-9_]*/)),Da(/\s*\:/),Ua(),cs()],(([t,e])=>Ps({[t]:e}))),(t=>Ps(Object.assign({},...t.map((t=>t.data))))),Da(/\s*\,\s*/)),Da(/\}/)]),za(Ha([Ka(Ua()),Da(/tuple/),Ua(),Ga(1,za(Ha([Ka(Ua()),$a(Da(/[a-zA-Z][a-zA-Z0-9_]*/)),Ua(),cs(),Ka(Ua())],(([t,e])=>Ps({[t]:e})))),(t=>Ps(Object.assign({},...t.map((t=>t.data))))),Ua())]))])}function os(){return $a(Da(/none/),Es)}function as(){return za(Ha([Da(/some/),Ua(),cs()],(t=>ks(t[0]))))}function ss(){return za(Ha([Da(/ok/),Ua(),cs()],(t=>Cs(t[0]))))}function us(){return za(Ha([Da(/err/),Ua(),cs()],(t=>Os(t[0]))))}function cs(t=t=>t){return ja([Qa,es,rs,Xa,Ja,Ya,Za,ns,is,os,as,ss,us].map(Va).map(t))}function fs(t){const e=cs(Wa)(t);if(!e.success||!e.capture)throw"Parse error";return e.capture}const hs=ln,ls=an,ds=sn;function ps(t){const[e,r]=t.split(".");return r?mn(e,r):gn(e)}const gs=ps,ys=mn,ms=gn,ws=Sn,bs=xn,vs=In,_s=un,Ss=t=>un(p(t)),As=t=>un(m(t)),Ts=t=>un(g(t)),Es=Zr,ks=Qr,Cs=_n,Os=vn,Ps=An,Ms=ki,Rs=Ln;function Ns(t){if(t.includes(".")){const[e,r]=Fs(t);return new Bs(e,r)}return new Bs(t,void 0)}class Bs{constructor(t,e){this.address=t,this.contractName=e}willSendEq(t){return new xs(this.address,t,Z.Equal,this.contractName)}willSendLte(t){return new xs(this.address,t,Z.LessEqual,this.contractName)}willSendLt(t){return new xs(this.address,t,Z.Less,this.contractName)}willSendGte(t){return new xs(this.address,t,Z.GreaterEqual,this.contractName)}willSendGt(t){return new xs(this.address,t,Z.Greater,this.contractName)}willSendAsset(){return new Is(this.address,Q.Sends,this.contractName)}willNotSendAsset(){return new Is(this.address,Q.DoesNotSend,this.contractName)}}class xs{constructor(t,e,r,n){this.address=t,this.amount=e,this.code=r,this.contractName=n}ustx(){return this.contractName?Sa(this.address,this.contractName,this.code,this.amount):_a(this.address,this.code,this.amount)}ft(t,e){const[r,n]=Fs(t);return this.contractName?Ta(this.address,this.contractName,this.code,this.amount,zr(r,n,e)):Aa(this.address,this.code,this.amount,zr(r,n,e))}}class Is{constructor(t,e,r){this.principal=t,this.code=e,this.contractName=r}nft(...t){const{contractAddress:e,contractName:r,tokenName:n,assetId:i}=function(...t){if(2===t.length){const[e,r]=t;return{...Ls(e),assetId:r}}const[e,r,n]=t,[i,o]=Fs(e);return{contractAddress:i,contractName:o,tokenName:r,assetId:n}}(...t);return this.contractName?ka(this.principal,this.contractName,this.code,zr(e,r,n),i):Ea(this.principal,this.code,zr(e,r,n),i)}}function Fs(t){const[e,r]=t.split(".");if(!e||!r)throw new Error(`Invalid contract identifier: ${t}`);return[e,r]}function Ls(t){const[e,r]=t.split("::");if(!e||!r)throw new Error(`Invalid fully-qualified nft asset name: ${t}`);const[n,i]=Fs(e);return{contractAddress:n,contractName:i,tokenName:r}}const Ds=new Uint8Array([83,73,80,48,49,56]);function Us(t){return Bt(ki(t))}const Vs=32;function js({message:t,domain:e}){const r=Us(t);if((n=e).type!==Yr.Tuple||!["name","version","chain-id"].every((t=>t in n.data))||!["name","version"].every((t=>n.data[t].type===Yr.StringASCII))||n.data["chain-id"].type!==Yr.UInt)throw new Error("domain parameter must be a valid domain of type TupleCV with keys 'name', 'version', 'chain-id' with respective types StringASCII, StringASCII, UInt");var n;const i=Us(e);return _(Ds,i,r)}function Ws(t){const e="string"==typeof t?g(t):t;return{domainHash:e.slice(Ds.length,Ds.length+Vs),messageHash:e.slice(Ds.length+Vs)}}function Ks({message:t,domain:e,privateKey:r}){const n=d(Bt(js({message:t,domain:e}))),{data:i}=Vr({messageHash:n,privateKey:r});return{data:i,type:F.StructuredDataSignature}}},7500:function(t,e,r){t=r.nmd(t),function(e){"use strict";function n(t,e){e|=0;for(var r=Math.max(t.length-e,0),n=Array(r),i=0;i<r;i++)n[i]=t[e+i];return n}var i=function(t){var e=n(arguments,1);return function(){var r=n(arguments);return t.apply(null,e.concat(r))}},o=function(t){return function(){var e=n(arguments),r=e.pop();t.call(this,e,r)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var s="function"==typeof setImmediate&&setImmediate,u="object"==typeof process&&"function"==typeof process.nextTick;function c(t){setTimeout(t,0)}function f(t){return function(e){var r=n(arguments,1);t((function(){e.apply(null,r)}))}}var h=f(s?setImmediate:u?process.nextTick:c);function l(t){return o((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}a(n)&&"function"==typeof n.then?n.then((function(t){d(r,null,t)}),(function(t){d(r,t.message?t:new Error(t))})):r(null,n)}))}function d(t,e,r){try{t(e,r)}catch(t){h(p,t)}}function p(t){throw t}var g="function"==typeof Symbol;function y(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function m(t){return y(t)?l(t):t}function w(t){return function(e){var r=n(arguments,1),i=o((function(r,n){var i=this;return t(e,(function(t,e){m(t).apply(i,r.concat(e))}),n)}));return r.length?i.apply(this,r):i}}var b="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,v="object"==typeof self&&self&&self.Object===Object&&self,_=b||v||Function("return this")(),S=_.Symbol,A=Object.prototype,T=A.hasOwnProperty,E=A.toString,k=S?S.toStringTag:void 0;var C=Object.prototype.toString;var O=S?S.toStringTag:void 0;function P(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":O&&O in Object(t)?function(t){var e=T.call(t,k),r=t[k];try{t[k]=void 0;var n=!0}catch(t){}var i=E.call(t);return n&&(e?t[k]=r:delete t[k]),i}(t):function(t){return C.call(t)}(t)}function M(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function R(t){return null!=t&&M(t.length)&&!function(t){if(!a(t))return!1;var e=P(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var N={};function B(){}function x(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var I="function"==typeof Symbol&&Symbol.iterator;function F(t){return null!=t&&"object"==typeof t}function L(t){return F(t)&&"[object Arguments]"==P(t)}var D=Object.prototype,U=D.hasOwnProperty,V=D.propertyIsEnumerable,j=L(function(){return arguments}())?L:function(t){return F(t)&&U.call(t,"callee")&&!V.call(t,"callee")},W=Array.isArray;var K="object"==typeof e&&e&&!e.nodeType&&e,H=K&&t&&!t.nodeType&&t,q=H&&H.exports===K?_.Buffer:void 0,z=(q?q.isBuffer:void 0)||function(){return!1},G=/^(?:0|[1-9]\d*)$/;function $(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&G.test(t))&&t>-1&&t%1==0&&t<e}var X={};X["[object Float32Array]"]=X["[object Float64Array]"]=X["[object Int8Array]"]=X["[object Int16Array]"]=X["[object Int32Array]"]=X["[object Uint8Array]"]=X["[object Uint8ClampedArray]"]=X["[object Uint16Array]"]=X["[object Uint32Array]"]=!0,X["[object Arguments]"]=X["[object Array]"]=X["[object ArrayBuffer]"]=X["[object Boolean]"]=X["[object DataView]"]=X["[object Date]"]=X["[object Error]"]=X["[object Function]"]=X["[object Map]"]=X["[object Number]"]=X["[object Object]"]=X["[object RegExp]"]=X["[object Set]"]=X["[object String]"]=X["[object WeakMap]"]=!1;var J,Y="object"==typeof e&&e&&!e.nodeType&&e,Z=Y&&t&&!t.nodeType&&t,Q=Z&&Z.exports===Y&&b.process,tt=function(){try{return Z&&Z.require&&Z.require("util").types||Q&&Q.binding&&Q.binding("util")}catch(t){}}(),et=tt&&tt.isTypedArray,rt=et?(J=et,function(t){return J(t)}):function(t){return F(t)&&M(t.length)&&!!X[P(t)]},nt=Object.prototype.hasOwnProperty;function it(t,e){var r=W(t),n=!r&&j(t),i=!r&&!n&&z(t),o=!r&&!n&&!i&&rt(t),a=r||n||i||o,s=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=s.length;for(var c in t)!e&&!nt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||$(c,u))||s.push(c);return s}var ot=Object.prototype;var at=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),st=Object.prototype.hasOwnProperty;function ut(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||ot))return at(t);var e,r,n=[];for(var i in Object(t))st.call(t,i)&&"constructor"!=i&&n.push(i);return n}function ct(t){return R(t)?it(t):ut(t)}function ft(t){if(R(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return I&&t[I]&&t[I]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=ct(e=t),n=-1,i=r.length,function t(){var o=r[++n];return"__proto__"===o?t():n<i?{value:e[o],key:o}:null})}function ht(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function lt(t){return function(e,r,n){if(n=x(n||B),t<=0||!e)return n(null);var i=ft(e),o=!1,a=0,s=!1;function u(t,e){if(a-=1,t)o=!0,n(t);else{if(e===N||o&&a<=0)return o=!0,n(null);s||c()}}function c(){for(s=!0;a<t&&!o;){var e=i();if(null===e)return o=!0,void(a<=0&&n(null));a+=1,r(e.value,e.key,ht(u))}s=!1}c()}}function dt(t,e,r,n){lt(e)(t,m(r),n)}function pt(t,e){return function(r,n,i){return t(r,e,n,i)}}function gt(t,e,r){r=x(r||B);var n=0,i=0,o=t.length;function a(t,e){t?r(t):++i!==o&&e!==N||r(null)}for(0===o&&r(null);n<o;n++)e(t[n],n,ht(a))}var yt=pt(dt,1/0),mt=function(t,e,r){(R(t)?gt:yt)(t,m(e),r)};function wt(t){return function(e,r,n){return t(mt,e,m(r),n)}}function bt(t,e,r,n){n=n||B,e=e||[];var i=[],o=0,a=m(r);t(e,(function(t,e,r){var n=o++;a(t,(function(t,e){i[n]=e,r(t)}))}),(function(t){n(t,i)}))}var vt=wt(bt),_t=w(vt);function St(t){return function(e,r,n,i){return t(lt(r),e,m(n),i)}}var At=St(bt),Tt=pt(At,1),Et=w(Tt);function kt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var Ct,Ot=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),a=o.length;a--;){var s=o[Ct?a:++n];if(!1===e(i[s],s,i))break}return t};function Pt(t,e){return t&&Ot(t,e,ct)}function Mt(t){return t!=t}function Rt(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Mt,r)}var Nt=function(t,e,r){"function"==typeof e&&(r=e,e=null),r=x(r||B);var i=ct(t).length;if(!i)return r(null);e||(e=i);var o={},a=0,s=!1,u=Object.create(null),c=[],f=[],h={};function l(t,e){c.push((function(){!function(t,e){if(!s){var i=ht((function(e,i){if(a--,arguments.length>2&&(i=n(arguments,1)),e){var c={};Pt(o,(function(t,e){c[e]=t})),c[t]=i,s=!0,u=Object.create(null),r(e,c)}else o[t]=i,kt(u[t]||[],(function(t){t()})),d()}));a++;var c=m(e[e.length-1]);e.length>1?c(o,i):c(i)}}(t,e)}))}function d(){if(0===c.length&&0===a)return r(null,o);for(;c.length&&a<e;)c.shift()()}function p(e){var r=[];return Pt(t,(function(t,n){W(t)&&Rt(t,e,0)>=0&&r.push(n)})),r}Pt(t,(function(e,r){if(!W(e))return l(r,[e]),void f.push(r);var n=e.slice(0,e.length-1),i=n.length;if(0===i)return l(r,e),void f.push(r);h[r]=i,kt(n,(function(o){if(!t[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));var a,s,c;s=function(){0==--i&&l(r,e)},(c=u[a=o])||(c=u[a]=[]),c.push(s)}))})),function(){for(var t=0;f.length;)t++,kt(p(f.pop()),(function(t){0==--h[t]&&f.push(t)}));if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),d()};function Bt(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var xt=S?S.prototype:void 0,It=xt?xt.toString:void 0;function Ft(t){if("string"==typeof t)return t;if(W(t))return Bt(t,Ft)+"";if(function(t){return"symbol"==typeof t||F(t)&&"[object Symbol]"==P(t)}(t))return It?It.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Lt(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}(t,e,r)}var Dt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Ut="\\ud800-\\udfff",Vt="["+Ut+"]",jt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Wt="\\ud83c[\\udffb-\\udfff]",Kt="[^"+Ut+"]",Ht="(?:\\ud83c[\\udde6-\\uddff]){2}",qt="[\\ud800-\\udbff][\\udc00-\\udfff]",zt="(?:"+jt+"|"+Wt+")?",Gt="[\\ufe0e\\ufe0f]?",$t=Gt+zt+("(?:\\u200d(?:"+[Kt,Ht,qt].join("|")+")"+Gt+zt+")*"),Xt="(?:"+[Kt+jt+"?",jt,Ht,qt,Vt].join("|")+")",Jt=RegExp(Wt+"(?="+Wt+")|"+Xt+$t,"g");function Yt(t){return function(t){return Dt.test(t)}(t)?function(t){return t.match(Jt)||[]}(t):function(t){return t.split("")}(t)}var Zt=/^\s+|\s+$/g;function Qt(t,e,r){if((t=null==(n=t)?"":Ft(n))&&(r||void 0===e))return t.replace(Zt,"");var n;if(!t||!(e=Ft(e)))return t;var i=Yt(t),o=Yt(e);return Lt(i,function(t,e){for(var r=-1,n=t.length;++r<n&&Rt(e,t[r],0)>-1;);return r}(i,o),function(t,e){for(var r=t.length;r--&&Rt(e,t[r],0)>-1;);return r}(i,o)+1).join("")}var te=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ee=/,/,re=/(=.+)?(\s*)$/,ne=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ie(t,e){var r={};Pt(t,(function(t,e){var n,i=y(t),o=!i&&1===t.length||i&&0===t.length;if(W(t))n=t.slice(0,-1),t=t[t.length-1],r[e]=n.concat(n.length>0?a:t);else if(o)r[e]=t;else{if(n=function(t){return(t=(t=(t=t.toString().replace(ne,"")).match(te)[2].replace(" ",""))?t.split(ee):[]).map((function(t){return Qt(t.replace(re,""))}))}(t),0===t.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[e]=n.concat(a)}function a(e,r){var i=Bt(n,(function(t){return e[t]}));i.push(r),m(t).apply(null,i)}})),Nt(r,e)}function oe(){this.head=this.tail=null,this.length=0}function ae(t,e){t.length=1,t.head=t.tail=e}function se(t,e,r){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var n=m(t),i=0,o=[],a=!1;function s(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,W(t)||(t=[t]),0===t.length&&f.idle())return h((function(){f.drain()}));for(var n=0,i=t.length;n<i;n++){var o={data:t[n],callback:r||B};e?f._tasks.unshift(o):f._tasks.push(o)}a||(a=!0,h((function(){a=!1,f.process()})))}function u(t){return function(e){i-=1;for(var r=0,n=t.length;r<n;r++){var a=t[r],s=Rt(o,a,0);0===s?o.shift():s>0&&o.splice(s,1),a.callback.apply(a,arguments),null!=e&&f.error(e,a.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var c=!1,f={_tasks:new oe,concurrency:e,payload:r,saturated:B,unsaturated:B,buffer:e/4,empty:B,drain:B,error:B,started:!1,paused:!1,push:function(t,e){s(t,!1,e)},kill:function(){f.drain=B,f._tasks.empty()},unshift:function(t,e){s(t,!0,e)},remove:function(t){f._tasks.remove(t)},process:function(){if(!c){for(c=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var t=[],e=[],r=f._tasks.length;f.payload&&(r=Math.min(r,f.payload));for(var a=0;a<r;a++){var s=f._tasks.shift();t.push(s),o.push(s),e.push(s.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var h=ht(u(t));n(e,h)}c=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,h(f.process))}};return f}function ue(t,e){return se(t,1,e)}oe.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},oe.prototype.empty=function(){for(;this.head;)this.shift();return this},oe.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},oe.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},oe.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):ae(this,t)},oe.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):ae(this,t)},oe.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oe.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},oe.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,r=0;r<this.length;r++)t[r]=e.data,e=e.next;return t},oe.prototype.remove=function(t){for(var e=this.head;e;){var r=e.next;t(e)&&this.removeLink(e),e=r}return this};var ce=pt(dt,1);function fe(t,e,r,n){n=x(n||B);var i=m(r);ce(t,(function(t,r,n){i(e,t,(function(t,r){e=r,n(t)}))}),(function(t){n(t,e)}))}function he(){var t=Bt(arguments,m);return function(){var e=n(arguments),r=this,i=e[e.length-1];"function"==typeof i?e.pop():i=B,fe(t,e,(function(t,e,i){e.apply(r,t.concat((function(t){var e=n(arguments,1);i(t,e)})))}),(function(t,e){i.apply(r,[t].concat(e))}))}}var le=function(){return he.apply(null,n(arguments).reverse())},de=Array.prototype.concat,pe=function(t,e,r,i){i=i||B;var o=m(r);At(t,e,(function(t,e){o(t,(function(t){return t?e(t):e(null,n(arguments,1))}))}),(function(t,e){for(var r=[],n=0;n<e.length;n++)e[n]&&(r=de.apply(r,e[n]));return i(t,r)}))},ge=pt(pe,1/0),ye=pt(pe,1),me=function(){var t=n(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function we(t){return t}function be(t,e){return function(r,n,i,o){o=o||B;var a,s=!1;r(n,(function(r,n,o){i(r,(function(n,i){n?o(n):t(i)&&!a?(s=!0,a=e(!0,r),o(null,N)):o()}))}),(function(t){t?o(t):o(null,s?a:e(!1))}))}}function ve(t,e){return e}var _e=wt(be(we,ve)),Se=St(be(we,ve)),Ae=pt(Se,1);function Te(t){return function(e){var r=n(arguments,1);r.push((function(e){var r=n(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&kt(r,(function(e){console[t](e)})))})),m(e).apply(null,r)}}var Ee=Te("dir");function ke(t,e,r){r=ht(r||B);var i=m(t),o=m(e);function a(t){if(t)return r(t);var e=n(arguments,1);e.push(s),o.apply(this,e)}function s(t,e){return t?r(t):e?void i(a):r(null)}s(null,!0)}function Ce(t,e,r){r=ht(r||B);var i=m(t),o=function(t){if(t)return r(t);var a=n(arguments,1);if(e.apply(this,a))return i(o);r.apply(null,[null].concat(a))};i(o)}function Oe(t,e,r){Ce(t,(function(){return!e.apply(this,arguments)}),r)}function Pe(t,e,r){r=ht(r||B);var n=m(e),i=m(t);function o(t){if(t)return r(t);i(a)}function a(t,e){return t?r(t):e?void n(o):r(null)}i(a)}function Me(t){return function(e,r,n){return t(e,n)}}function Re(t,e,r){mt(t,Me(m(e)),r)}function Ne(t,e,r,n){lt(e)(t,Me(m(r)),n)}var Be=pt(Ne,1);function xe(t){return y(t)?t:o((function(e,r){var n=!0;e.push((function(){var t=arguments;n?h((function(){r.apply(null,t)})):r.apply(null,t)})),t.apply(this,e),n=!1}))}function Ie(t){return!t}var Fe=wt(be(Ie,Ie)),Le=St(be(Ie,Ie)),De=pt(Le,1);function Ue(t){return function(e){return null==e?void 0:e[t]}}function Ve(t,e,r,n){var i=new Array(e.length);t(e,(function(t,e,n){r(t,(function(t,r){i[e]=!!r,n(t)}))}),(function(t){if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)}))}function je(t,e,r,n){var i=[];t(e,(function(t,e,n){r(t,(function(r,o){r?n(r):(o&&i.push({index:e,value:t}),n())}))}),(function(t){t?n(t):n(null,Bt(i.sort((function(t,e){return t.index-e.index})),Ue("value")))}))}function We(t,e,r,n){(R(e)?Ve:je)(t,e,m(r),n||B)}var Ke=wt(We),He=St(We),qe=pt(He,1);function ze(t,e){var r=ht(e||B),n=m(xe(t));!function t(e){if(e)return r(e);n(t)}()}var Ge=function(t,e,r,n){n=n||B;var i=m(r);At(t,e,(function(t,e){i(t,(function(r,n){return r?e(r):e(null,{key:n,val:t})}))}),(function(t,e){for(var r={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var a=e[o].key,s=e[o].val;i.call(r,a)?r[a].push(s):r[a]=[s]}return n(t,r)}))},$e=pt(Ge,1/0),Xe=pt(Ge,1),Je=Te("log");function Ye(t,e,r,n){n=x(n||B);var i={},o=m(r);dt(t,e,(function(t,e,r){o(t,e,(function(t,n){if(t)return r(t);i[e]=n,r()}))}),(function(t){n(t,i)}))}var Ze=pt(Ye,1/0),Qe=pt(Ye,1);function tr(t,e){return e in t}function er(t,e){var r=Object.create(null),i=Object.create(null);e=e||we;var a=m(t),s=o((function(t,o){var s=e.apply(null,t);tr(r,s)?h((function(){o.apply(null,r[s])})):tr(i,s)?i[s].push(o):(i[s]=[o],a.apply(null,t.concat((function(){var t=n(arguments);r[s]=t;var e=i[s];delete i[s];for(var o=0,a=e.length;o<a;o++)e[o].apply(null,t)}))))}));return s.memo=r,s.unmemoized=t,s}var rr=f(u?process.nextTick:s?setImmediate:c);function nr(t,e,r){r=r||B;var i=R(e)?[]:{};t(e,(function(t,e,r){m(t)((function(t,o){arguments.length>2&&(o=n(arguments,1)),i[e]=o,r(t)}))}),(function(t){r(t,i)}))}function ir(t,e){nr(mt,t,e)}function or(t,e,r){nr(lt(e),t,r)}var ar=function(t,e){var r=m(t);return se((function(t,e){r(t[0],e)}),e,1)},sr=function(t,e){var r=ar(t,e);return r.push=function(t,e,n){if(null==n&&(n=B),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,W(t)||(t=[t]),0===t.length)return h((function(){r.drain()}));e=e||0;for(var i=r._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,a=t.length;o<a;o++){var s={data:t[o],priority:e,callback:n};i?r._tasks.insertBefore(i,s):r._tasks.push(s)}h(r.process)},delete r.unshift,r};function ur(t,e){if(e=x(e||B),!W(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)m(t[r])(e)}function cr(t,e,r,i){fe(n(t).reverse(),e,r,i)}function fr(t){var e=m(t);return o((function(t,r){return t.push((function(t,e){var i;t?r(null,{error:t}):(i=arguments.length<=2?e:n(arguments,1),r(null,{value:i}))})),e.apply(this,t)}))}function hr(t){var e;return W(t)?e=Bt(t,fr):(e={},Pt(t,(function(t,r){e[r]=fr.call(this,t)}))),e}function lr(t,e,r,n){We(t,e,(function(t,e){r(t,(function(t,r){e(t,!r)}))}),n)}var dr=wt(lr),pr=St(lr),gr=pt(pr,1);function yr(t){return function(){return t}}function mr(t,e,r){var n={times:5,intervalFunc:yr(0)};if(arguments.length<3&&"function"==typeof t?(r=e||B,e=t):(function(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:yr(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}(n,t),r=r||B),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=m(e),o=1;!function t(){i((function(e){e&&o++<n.times&&("function"!=typeof n.errorFilter||n.errorFilter(e))?setTimeout(t,n.intervalFunc(o)):r.apply(null,arguments)}))}()}var wr=function(t,e){e||(e=t,t=null);var r=m(e);return o((function(e,n){function i(t){r.apply(null,e.concat(t))}t?mr(t,i,n):mr(i,n)}))};function br(t,e){nr(ce,t,e)}var vr=wt(be(Boolean,we)),_r=St(be(Boolean,we)),Sr=pt(_r,1);function Ar(t,e,r){var n=m(e);function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}vt(t,(function(t,e){n(t,(function(r,n){if(r)return e(r);e(null,{value:t,criteria:n})}))}),(function(t,e){if(t)return r(t);r(null,Bt(e.sort(i),Ue("value")))}))}function Tr(t,e,r){var n=m(t);return o((function(i,o){var a,s=!1;i.push((function(){s||(o.apply(null,arguments),clearTimeout(a))})),a=setTimeout((function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}),e),n.apply(null,i)}))}var Er=Math.ceil,kr=Math.max;function Cr(t,e,r,n){var i=m(r);At(function(t,e,r,n){for(var i=-1,o=kr(Er((e-t)/(r||1)),0),a=Array(o);o--;)a[n?o:++i]=t,t+=r;return a}(0,t,1),e,i,n)}var Or=pt(Cr,1/0),Pr=pt(Cr,1);function Mr(t,e,r,n){arguments.length<=3&&(n=r,r=e,e=W(t)?[]:{}),n=x(n||B);var i=m(r);mt(t,(function(t,r,n){i(e,t,r,n)}),(function(t){n(t,e)}))}function Rr(t,e){var r,i=null;e=e||B,Be(t,(function(t,e){m(t)((function(t,o){r=arguments.length>2?n(arguments,1):o,i=t,e(!t)}))}),(function(){e(i,r)}))}function Nr(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Br(t,e,r){r=ht(r||B);var i=m(e);if(!t())return r(null);var o=function(e){if(e)return r(e);if(t())return i(o);var a=n(arguments,1);r.apply(null,[null].concat(a))};i(o)}function xr(t,e,r){Br((function(){return!t.apply(this,arguments)}),e,r)}var Ir=function(t,e){if(e=x(e||B),!W(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function i(e){var n=m(t[r++]);e.push(ht(o)),n.apply(null,e)}function o(o){if(o||r===t.length)return e.apply(null,arguments);i(n(arguments,1))}i([])},Fr={apply:i,applyEach:_t,applyEachSeries:Et,asyncify:l,auto:Nt,autoInject:ie,cargo:ue,compose:le,concat:ge,concatLimit:pe,concatSeries:ye,constant:me,detect:_e,detectLimit:Se,detectSeries:Ae,dir:Ee,doDuring:ke,doUntil:Oe,doWhilst:Ce,during:Pe,each:Re,eachLimit:Ne,eachOf:mt,eachOfLimit:dt,eachOfSeries:ce,eachSeries:Be,ensureAsync:xe,every:Fe,everyLimit:Le,everySeries:De,filter:Ke,filterLimit:He,filterSeries:qe,forever:ze,groupBy:$e,groupByLimit:Ge,groupBySeries:Xe,log:Je,map:vt,mapLimit:At,mapSeries:Tt,mapValues:Ze,mapValuesLimit:Ye,mapValuesSeries:Qe,memoize:er,nextTick:rr,parallel:ir,parallelLimit:or,priorityQueue:sr,queue:ar,race:ur,reduce:fe,reduceRight:cr,reflect:fr,reflectAll:hr,reject:dr,rejectLimit:pr,rejectSeries:gr,retry:mr,retryable:wr,seq:he,series:br,setImmediate:h,some:vr,someLimit:_r,someSeries:Sr,sortBy:Ar,timeout:Tr,times:Or,timesLimit:Cr,timesSeries:Pr,transform:Mr,tryEach:Rr,unmemoize:Nr,until:xr,waterfall:Ir,whilst:Br,all:Fe,allLimit:Le,allSeries:De,any:vr,anyLimit:_r,anySeries:Sr,find:_e,findLimit:Se,findSeries:Ae,forEach:Re,forEachSeries:Be,forEachLimit:Ne,forEachOf:mt,forEachOfSeries:ce,forEachOfLimit:dt,inject:fe,foldl:fe,foldr:cr,select:Ke,selectLimit:He,selectSeries:qe,wrapSync:l};e.default=Fr,e.apply=i,e.applyEach=_t,e.applyEachSeries=Et,e.asyncify=l,e.auto=Nt,e.autoInject=ie,e.cargo=ue,e.compose=le,e.concat=ge,e.concatLimit=pe,e.concatSeries=ye,e.constant=me,e.detect=_e,e.detectLimit=Se,e.detectSeries=Ae,e.dir=Ee,e.doDuring=ke,e.doUntil=Oe,e.doWhilst=Ce,e.during=Pe,e.each=Re,e.eachLimit=Ne,e.eachOf=mt,e.eachOfLimit=dt,e.eachOfSeries=ce,e.eachSeries=Be,e.ensureAsync=xe,e.every=Fe,e.everyLimit=Le,e.everySeries=De,e.filter=Ke,e.filterLimit=He,e.filterSeries=qe,e.forever=ze,e.groupBy=$e,e.groupByLimit=Ge,e.groupBySeries=Xe,e.log=Je,e.map=vt,e.mapLimit=At,e.mapSeries=Tt,e.mapValues=Ze,e.mapValuesLimit=Ye,e.mapValuesSeries=Qe,e.memoize=er,e.nextTick=rr,e.parallel=ir,e.parallelLimit=or,e.priorityQueue=sr,e.queue=ar,e.race=ur,e.reduce=fe,e.reduceRight=cr,e.reflect=fr,e.reflectAll=hr,e.reject=dr,e.rejectLimit=pr,e.rejectSeries=gr,e.retry=mr,e.retryable=wr,e.seq=he,e.series=br,e.setImmediate=h,e.some=vr,e.someLimit=_r,e.someSeries=Sr,e.sortBy=Ar,e.timeout=Tr,e.times=Or,e.timesLimit=Cr,e.timesSeries=Pr,e.transform=Mr,e.tryEach=Rr,e.unmemoize=Nr,e.until=xr,e.waterfall=Ir,e.whilst=Br,e.all=Fe,e.allLimit=Le,e.allSeries=De,e.any=vr,e.anyLimit=_r,e.anySeries=Sr,e.find=_e,e.findLimit=Se,e.findSeries=Ae,e.forEach=Re,e.forEachSeries=Be,e.forEachLimit=Ne,e.forEachOf=mt,e.forEachOfSeries=ce,e.forEachOfLimit=dt,e.inject=fe,e.foldl=fe,e.foldr=cr,e.select=Ke,e.selectLimit=He,e.selectSeries=qe,e.wrapSync=l,Object.defineProperty(e,"__esModule",{value:!0})}(e)},5364:(t,e,r)=>{"use strict";var n=r(2861).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),a=o.charCodeAt(0);if(255!==e[a])throw new TypeError(o+" is ambiguous");e[a]=i}var s=t.length,u=t.charAt(0),c=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var a=(t.length-r)*c+1>>>0,f=new Uint8Array(a);r<t.length;){var h=e[t.charCodeAt(r)];if(255===h)return;for(var l=0,d=a-1;(0!==h||l<o)&&-1!==d;d--,l++)h+=s*f[d]>>>0,f[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=l,r++}for(var p=a-o;p!==a&&0===f[p];)p++;var g=n.allocUnsafe(i+(a-p));g.fill(0,0,i);for(var y=i;p!==a;)g[y++]=f[p++];return g}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,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var c=(a-o)*f+1>>>0,h=new Uint8Array(c);o!==a;){for(var l=e[o],d=0,p=c-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*h[p]>>>0,h[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var g=c-i;g!==c&&0===h[g];)g++;for(var y=u.repeat(r);g<c;++g)y+=t.charAt(h[g]);return y},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},7526:(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),a=o[0],u=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),f=0,h=u>0?a-4:a;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[f++]=e>>16&255,c[f++]=e>>8&255,c[f++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[f++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,c=n-i;s<c;s+=a)o.push(u(t,s,s+a>c?c:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)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 u(t,e,n){for(var i,o,a=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2788:(t,e,r)=>{"use strict";var n=r(8287).Buffer,i=r(2931);function o(t,e){return void 0===e&&(e="utf8"),n.isBuffer(t)?s(t.toString("base64")):s(n.from(t,e).toString("base64"))}function a(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function s(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var u=o;u.encode=o,u.decode=function(t,e){return void 0===e&&(e="utf8"),n.from(a(t),"base64").toString(e)},u.toBase64=a,u.fromBase64=s,u.toBuffer=function(t){return n.from(a(t),"base64")},e.default=u},2931:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.length,r=e%4;if(!r)return t;var i=e,o=4-r,a=e+o,s=n.alloc(a);for(s.write(t);o--;)s.write("=",i++);return s.toString()}},4711:(t,e,r)=>{t.exports=r(2788).default,t.exports.default=t.exports},9674:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<32;n++){var i=e.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function o(t){var e=t>>25;return(33554431&t)<<5^996825010&-(1&e)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){for(var e=1,r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}for(e=o(e),r=0;r<t.length;++r){var i=t.charCodeAt(r);e=o(e)^31&i}return e}function s(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var s=(t=n).lastIndexOf("1");if(-1===s)return"No separator character for "+t;if(0===s)return"Missing prefix for "+t;var u=t.slice(0,s),c=t.slice(s+1);if(c.length<6)return"Data too short";var f=a(u);if("string"==typeof f)return f;for(var h=[],l=0;l<c.length;++l){var d=c.charAt(l),p=r[d];if(void 0===p)return"Unknown character "+d;f=o(f)^p,l+6>=c.length||h.push(p)}return 1!==f?"Invalid checksum for "+t:{prefix:u,words:h}}function u(t,e,r,n){for(var i=0,o=0,a=(1<<r)-1,s=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<<r-o&a);else{if(o>=e)return"Excess padding";if(i<<r-o&a)return"Non-zero padding"}return s}t.exports={decodeUnsafe:function(){var t=s.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=s.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,r,n){if(n=n||90,t.length+7+r.length>n)throw new TypeError("Exceeds length limit");var i=a(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var s=t+"1",u=0;u<r.length;++u){var c=r[u];if(c>>5)throw new Error("Non 5-bit word");i=o(i)^c,s+=e.charAt(c)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)s+=e.charAt(i>>5*(5-u)&31);return s},toWordsUnsafe:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}},1594:function(t,e,r){var n;!function(){"use strict";var i,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,s=Math.floor,u="[BigNumber Error] ",c=u+"Number primitive has more than 15 significant digits: ",f=1e14,h=14,l=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function m(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=h-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function w(t,e){var r,n,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(t,e,r,n){if(t<e||t>r||t!==s(t))throw Error(u+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function v(t){var e=t.c.length-1;return y(t.e/h)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}i=function t(e){var r,n,i,A,T,E,k,C,O,P,M=H.prototype={constructor:H,toString:null,valueOf:null},R=new H(1),N=20,B=4,x=-7,I=21,F=-1e7,L=1e7,D=!1,U=1,V=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},W="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function H(t,e){var r,a,u,f,d,p,g,y,m=this;if(!(m instanceof H))return new H(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>L?m.c=m.e=null:t.e<F?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(f=0,d=t;d>=10;d/=10,f++);return void(f>L?m.c=m.e=null:(m.e=f,m.c=[t]))}y=String(t)}else{if(!o.test(y=String(t)))return i(m,y,p);m.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(f=y.indexOf("."))>-1&&(y=y.replace(".","")),(d=y.search(/e/i))>0?(f<0&&(f=d),f+=+y.slice(d+1),y=y.substring(0,d)):f<0&&(f=y.length)}else{if(b(e,2,W.length,"Base"),10==e&&K)return $(m=new H(t),N+m.e+1,B);if(y=String(t),p="number"==typeof t){if(0*t!=0)return i(m,y,p,e);if(m.s=1/t<0?(y=y.slice(1),-1):1,H.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else m.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(r=W.slice(0,e),f=d=0,g=y.length;d<g;d++)if(r.indexOf(a=y.charAt(d))<0){if("."==a){if(d>f){f=g;continue}}else if(!u&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){u=!0,d=-1,f=0;continue}return i(m,String(t),p,e)}p=!1,(f=(y=n(y,e,10,m.s)).indexOf("."))>-1?y=y.replace(".",""):f=y.length}for(d=0;48===y.charCodeAt(d);d++);for(g=y.length;48===y.charCodeAt(--g););if(y=y.slice(d,++g)){if(g-=d,p&&H.DEBUG&&g>15&&(t>l||t!==s(t)))throw Error(c+m.s*t);if((f=f-d-1)>L)m.c=m.e=null;else if(f<F)m.c=[m.e=0];else{if(m.e=f,m.c=[],d=(f+1)%h,f<0&&(d+=h),d<g){for(d&&m.c.push(+y.slice(0,d)),g-=h;d<g;)m.c.push(+y.slice(d,d+=h));d=h-(y=y.slice(d)).length}else d-=g;for(;d--;y+="0");m.c.push(+y)}}else m.c=[m.e=0]}function q(t,e,r,n){var i,o,a,s,u;if(null==r?r=B:b(r,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=m(t.c),u=1==n||2==n&&(a<=x||a>=I)?_(u,a):S(u,a,"0");else if(o=(t=$(new H(t),e,r)).e,s=(u=m(t.c)).length,1==n||2==n&&(e<=o||o<=x)){for(;s<e;u+="0",s++);u=_(u,o)}else if(e-=a,u=S(u,o,"0"),o+1>s){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function z(t,e){for(var r,n,i=1,o=new H(t[0]);i<t.length;i++)(!(n=new H(t[i])).s||(r=w(o,n))===e||0===r&&o.s===e)&&(o=n);return o}function G(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*h-1)>L?t.c=t.e=null:r<F?t.c=[t.e=0]:(t.e=r,t.c=e),t}function $(t,e,r,n){var i,o,u,c,l,p,g,y=t.c,m=d;if(y){t:{for(i=1,c=y[0];c>=10;c/=10,i++);if((o=e-i)<0)o+=h,u=e,l=y[p=0],g=s(l/m[i-u-1]%10);else if((p=a((o+1)/h))>=y.length){if(!n)break t;for(;y.length<=p;y.push(0));l=g=0,i=1,u=(o%=h)-h+1}else{for(l=c=y[p],i=1;c>=10;c/=10,i++);g=(u=(o%=h)-h+i)<0?0:s(l/m[i-u-1]%10)}if(n=n||e<0||null!=y[p+1]||(u<0?l:l%m[i-u-1]),n=r<4?(g||n)&&(0==r||r==(t.s<0?3:2)):g>5||5==g&&(4==r||n||6==r&&(o>0?u>0?l/m[i-u]:0:y[p-1])%10&1||r==(t.s<0?8:7)),e<1||!y[0])return y.length=0,n?(e-=t.e+1,y[0]=m[(h-e%h)%h],t.e=-e||0):y[0]=t.e=0,t;if(0==o?(y.length=p,c=1,p--):(y.length=p+1,c=m[h-o],y[p]=u>0?s(l/m[i-u]%m[u])*c:0),n)for(;;){if(0==p){for(o=1,u=y[0];u>=10;u/=10,o++);for(u=y[0]+=c,c=1;u>=10;u/=10,c++);o!=c&&(t.e++,y[0]==f&&(y[0]=1));break}if(y[p]+=c,y[p]!=f)break;y[p--]=0,c=1}for(o=y.length;0===y[--o];y.pop());}t.e>L?t.c=t.e=null:t.e<F&&(t.c=[t.e=0])}return t}function X(t){var e,r=t.e;return null===r?t.toString():(e=m(t.c),e=r<=x||r>=I?_(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return H.clone=t,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(r=t[e],0,g,e),N=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(r=t[e],0,8,e),B=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(b(r[0],-g,0,e),b(r[1],0,g,e),x=r[0],I=r[1]):(b(r,-g,g,e),x=-(I=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)b(r[0],-g,-1,e),b(r[1],1,g,e),F=r[0],L=r[1];else{if(b(r,-g,g,e),!r)throw Error(u+e+" cannot be zero: "+r);F=-(L=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(u+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!r,Error(u+"crypto unavailable");D=r}else D=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(b(r=t[e],0,g,e),V=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(u+e+" not an object: "+r);j=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+e+" invalid: "+r);K="0123456789"==r.slice(0,10),W=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:B,EXPONENTIAL_AT:[x,I],RANGE:[F,L],CRYPTO:D,MODULO_MODE:U,POW_PRECISION:V,FORMAT:j,ALPHABET:W}},H.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!H.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===s(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%h)<1&&(e+=h),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=f||r!==s(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+t)},H.maximum=H.max=function(){return z(arguments,-1)},H.minimum=H.min=function(){return z(arguments,1)},H.random=(A=9007199254740992,T=Math.random()*A&2097151?function(){return s(Math.random()*A)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,c=0,f=[],l=new H(R);if(null==t?t=N:b(t,0,g),i=a(t/h),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));c<i;)(o=131072*e[c]+(e[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(f.push(o%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(i*=7);c<i;)(o=281474976710656*(31&e[c])+1099511627776*e[c+1]+4294967296*e[c+2]+16777216*e[c+3]+(e[c+4]<<16)+(e[c+5]<<8)+e[c+6])>=9e15?crypto.randomBytes(7).copy(e,c):(f.push(o%1e14),c+=7);c=i/7}if(!D)for(;c<i;)(o=T())<9e15&&(f[c++]=o%1e14);for(i=f[--c],t%=h,i&&t&&(o=d[h-t],f[c]=s(i/o)*o);0===f[c];f.pop(),c--);if(c<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=h);for(c=1,o=f[0];o>=10;o/=10,c++);c<h&&(n-=h-c)}return l.e=n,l.c=f,l}),H.sum=function(){for(var t=1,e=arguments,r=new H(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,a=[0],s=0,u=t.length;s<u;){for(o=a.length;o--;a[o]*=e);for(a[0]+=n.indexOf(t.charAt(s++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,s){var u,c,f,h,l,d,p,g,y=n.indexOf("."),w=N,b=B;for(y>=0&&(h=V,V=0,n=n.replace(".",""),d=(g=new H(i)).pow(n.length-y),V=h,g.c=e(S(m(d.c),d.e,"0"),10,o,t),g.e=g.c.length),f=h=(p=e(n,i,o,s?(u=W,t):(u=t,W))).length;0==p[--h];p.pop());if(!p[0])return u.charAt(0);if(y<0?--f:(d.c=p,d.e=f,d.s=a,p=(d=r(d,g,w,b,o)).c,l=d.r,f=d.e),y=p[c=f+w+1],h=o/2,l=l||c<0||null!=p[c+1],l=b<4?(null!=y||l)&&(0==b||b==(d.s<0?3:2)):y>h||y==h&&(4==b||l||6==b&&1&p[c-1]||b==(d.s<0?8:7)),c<1||!p[0])n=l?S(u.charAt(1),-w,u.charAt(0)):u.charAt(0);else{if(p.length=c,l)for(--o;++p[--c]>o;)p[c]=0,c||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(y=0,n="";y<=h;n+=u.charAt(p[y++]));n=S(n,f,u.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,a,s=0,u=t.length,c=e%p,f=e/p|0;for(t=t.slice();u--;)s=((i=c*(o=t[u]%p)+(n=f*o+(a=t[u]/p|0)*c)%p*p+s)/r|0)+(n/p|0)+f*a,t[u]=i%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,a,u){var c,l,d,p,g,m,w,b,v,_,S,A,T,E,k,C,O,P=n.s==i.s?1:-1,M=n.c,R=i.c;if(!(M&&M[0]&&R&&R[0]))return new H(n.s&&i.s&&(M?!R||M[0]!=R[0]:R)?M&&0==M[0]||!R?0*P:P/0:NaN);for(v=(b=new H(P)).c=[],P=o+(l=n.e-i.e)+1,u||(u=f,l=y(n.e/h)-y(i.e/h),P=P/h|0),d=0;R[d]==(M[d]||0);d++);if(R[d]>(M[d]||0)&&l--,P<0)v.push(1),p=!0;else{for(E=M.length,C=R.length,d=0,P+=2,(g=s(u/(R[0]+1)))>1&&(R=t(R,g,u),M=t(M,g,u),C=R.length,E=M.length),T=C,S=(_=M.slice(0,C)).length;S<C;_[S++]=0);O=R.slice(),O=[0].concat(O),k=R[0],R[1]>=u/2&&k++;do{if(g=0,(c=e(R,_,C,S))<0){if(A=_[0],C!=S&&(A=A*u+(_[1]||0)),(g=s(A/k))>1)for(g>=u&&(g=u-1),w=(m=t(R,g,u)).length,S=_.length;1==e(m,_,w,S);)g--,r(m,C<w?O:R,w,u),w=m.length,c=1;else 0==g&&(c=g=1),w=(m=R.slice()).length;if(w<S&&(m=[0].concat(m)),r(_,m,S,u),S=_.length,-1==c)for(;e(R,_,C,S)<1;)g++,r(_,C<S?O:R,S,u),S=_.length}else 0===c&&(g++,_=[0]);v[d++]=g,_[0]?_[S++]=M[T]||0:(_=[M[T]],S=1)}while((T++<E||null!=_[0])&&P--);p=null!=_[0],v[0]||v.splice(0,1)}if(u==f){for(d=1,P=v[0];P>=10;P/=10,d++);$(b,o+(b.e=d+l*h-1)+1,a,p)}else b.e=l,b.r=+p;return b}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,C=/^\.([^.]+)$/,O=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(P,"");if(O.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(E,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(k,"$1").replace(C,"0.$1")),e!=o))return new H(o,i);if(H.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},M.absoluteValue=M.abs=function(){var t=new H(this);return t.s<0&&(t.s=1),t},M.comparedTo=function(t,e){return w(this,new H(t,e))},M.decimalPlaces=M.dp=function(t,e){var r,n,i,o=this;if(null!=t)return b(t,0,g),null==e?e=B:b(e,0,8),$(new H(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-y(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},M.dividedBy=M.div=function(t,e){return r(this,new H(t,e),N,B)},M.dividedToIntegerBy=M.idiv=function(t,e){return r(this,new H(t,e),0,1)},M.exponentiatedBy=M.pow=function(t,e){var r,n,i,o,c,f,l,d,p=this;if((t=new H(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+X(t));if(null!=e&&(e=new H(e)),c=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new H(Math.pow(+X(p),c?t.s*(2-v(t)):+X(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new H(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||c&&p.c[1]>=24e7:p.c[0]<8e13||c&&p.c[0]<=9999975e7)))return o=p.s<0&&v(t)?-0:0,p.e>-1&&(o=1/o),new H(f?1/o:o);V&&(o=a(V/h+2))}for(c?(r=new H(.5),f&&(t.s=1),l=v(t)):l=(i=Math.abs(+X(t)))%2,d=new H(R);;){if(l){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}if(i){if(0===(i=s(i/2)))break;l=i%2}else if($(t=t.times(r),t.e+1,1),t.e>14)l=v(t);else{if(0==(i=+X(t)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}return n?d:(f&&(d=R.div(d)),e?d.mod(e):o?$(d,V,B,void 0):d)},M.integerValue=function(t){var e=new H(this);return null==t?t=B:b(t,0,8),$(e,e.e+1,t)},M.isEqualTo=M.eq=function(t,e){return 0===w(this,new H(t,e))},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(t,e){return w(this,new H(t,e))>0},M.isGreaterThanOrEqualTo=M.gte=function(t,e){return 1===(e=w(this,new H(t,e)))||0===e},M.isInteger=function(){return!!this.c&&y(this.e/h)>this.c.length-2},M.isLessThan=M.lt=function(t,e){return w(this,new H(t,e))<0},M.isLessThanOrEqualTo=M.lte=function(t,e){return-1===(e=w(this,new H(t,e)))||0===e},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.minus=function(t,e){var r,n,i,o,a=this,s=a.s;if(e=(t=new H(t,e)).s,!s||!e)return new H(NaN);if(s!=e)return t.s=-e,a.plus(t);var u=a.e/h,c=t.e/h,l=a.c,d=t.c;if(!u||!c){if(!l||!d)return l?(t.s=-e,t):new H(d?a:NaN);if(!l[0]||!d[0])return d[0]?(t.s=-e,t):new H(l[0]?a:3==B?-0:0)}if(u=y(u),c=y(c),l=l.slice(),s=u-c){for((o=s<0)?(s=-s,i=l):(c=u,i=d),i.reverse(),e=s;e--;i.push(0));i.reverse()}else for(n=(o=(s=l.length)<(e=d.length))?s:e,s=e=0;e<n;e++)if(l[e]!=d[e]){o=l[e]<d[e];break}if(o&&(i=l,l=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=f-1;n>s;){if(l[--n]<d[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=f}l[n]-=d[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?G(t,l,c):(t.s=3==B?-1:1,t.c=[t.e=0],t)},M.modulo=M.mod=function(t,e){var n,i,o=this;return t=new H(t,e),!o.c||!t.s||t.c&&!t.c[0]?new H(NaN):!t.c||o.c&&!o.c[0]?new H(o):(9==U?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,U),(t=o.minus(n.times(t))).c[0]||1!=U||(t.s=o.s),t)},M.multipliedBy=M.times=function(t,e){var r,n,i,o,a,s,u,c,l,d,g,m,w,b,v,_=this,S=_.c,A=(t=new H(t,e)).c;if(!(S&&A&&S[0]&&A[0]))return!_.s||!t.s||S&&!S[0]&&!A||A&&!A[0]&&!S?t.c=t.e=t.s=null:(t.s*=_.s,S&&A?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=y(_.e/h)+y(t.e/h),t.s*=_.s,(u=S.length)<(d=A.length)&&(w=S,S=A,A=w,i=u,u=d,d=i),i=u+d,w=[];i--;w.push(0));for(b=f,v=p,i=d;--i>=0;){for(r=0,g=A[i]%v,m=A[i]/v|0,o=i+(a=u);o>i;)r=((c=g*(c=S[--a]%v)+(s=m*c+(l=S[a]/v|0)*g)%v*v+w[o]+r)/b|0)+(s/v|0)+m*l,w[o--]=c%b;w[o]=r}return r?++n:w.splice(0,1),G(t,w,n)},M.negated=function(){var t=new H(this);return t.s=-t.s||null,t},M.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new H(t,e)).s,!i||!e)return new H(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/h,a=t.e/h,s=n.c,u=t.c;if(!o||!a){if(!s||!u)return new H(i/0);if(!s[0]||!u[0])return u[0]?t:new H(s[0]?n:0*i)}if(o=y(o),a=y(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(e=u.length)<0&&(r=u,u=s,s=r,e=i),i=0;e;)i=(s[--e]=s[e]+u[e]+i)/f|0,s[e]=f===s[e]?0:s[e]%f;return i&&(s=[i].concat(s),++a),G(t,s,a)},M.precision=M.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return b(t,1,g),null==e?e=B:b(e,0,8),$(new H(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},M.shiftedBy=function(t){return b(t,-9007199254740991,l),this.times("1e"+t)},M.squareRoot=M.sqrt=function(){var t,e,n,i,o,a=this,s=a.c,u=a.s,c=a.e,f=N+4,h=new H("0.5");if(1!==u||!s||!s[0])return new H(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(u=Math.sqrt(+X(a)))||u==1/0?(((e=m(s)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),n=new H(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new H(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=h.times(o.plus(r(a,o,f,1))),m(o.c).slice(0,u)===(e=m(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||($(n,n.e+N+2,1),t=!n.times(n).eq(a));break}if(!i&&($(o,o.e+N+2,0),o.times(o).eq(a))){n=o;break}f+=4,u+=4,i=1}return $(n,n.e+N+1,B,t)},M.toExponential=function(t,e){return null!=t&&(b(t,0,g),t++),q(this,t,e,1)},M.toFixed=function(t,e){return null!=t&&(b(t,0,g),t=t+this.e+1),q(this,t,e)},M.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=j;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,a=n.split("."),s=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=a[0],l=a[1],d=i.s<0,p=d?h.slice(1):h,g=p.length;if(c&&(o=s,s=c,c=o,g-=o),s>0&&g>0){for(o=g%s||s,h=p.substr(0,o);o<g;o+=s)h+=f+p.substr(o,s);c>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},M.toFraction=function(t){var e,n,i,o,a,s,c,f,l,p,g,y,w=this,b=w.c;if(null!=t&&(!(c=new H(t)).isInteger()&&(c.c||1!==c.s)||c.lt(R)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!b)return new H(w);for(e=new H(R),l=n=new H(R),i=f=new H(R),y=m(b),a=e.e=y.length-w.e-1,e.c[0]=d[(s=a%h)<0?h+s:s],t=!t||c.comparedTo(e)>0?a>0?e:l:c,s=L,L=1/0,c=new H(y),f.c[0]=0;p=r(c,e,0,1),1!=(o=n.plus(p.times(i))).comparedTo(t);)n=i,i=o,l=f.plus(p.times(o=l)),f=o,e=c.minus(p.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=w.s,g=r(l,i,a*=2,B).minus(w).abs().comparedTo(r(f,n,a,B).minus(w).abs())<1?[l,i]:[f,n],L=s,g},M.toNumber=function(){return+X(this)},M.toPrecision=function(t,e){return null!=t&&b(t,1,g),q(this,t,e,2)},M.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=x||o>=I?_(m(r.c),o):S(m(r.c),o,"0"):10===t&&K?e=S(m((r=$(new H(r),N+o+1,B)).c),r.e,"0"):(b(t,2,W.length,"Base"),e=n(S(m(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},M.valueOf=M.toJSON=function(){return X(this)},M._isBigNumber=!0,null!=e&&H.set(e),H}(),i.default=i.BigNumber=i,void 0===(n=function(){return i}.call(e,r,e,t))||(t.exports=n)}()},4863:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1457);function i(t,e,r){return n=>{if(t.has(n))return;const i=r.filter((t=>t.key.toString("hex")===n))[0];e.push(i),t.add(n)}}function o(t){return t.globalMap.unsignedTx}function a(t){const e=new Set;return t.forEach((t=>{const r=t.key.toString("hex");if(e.has(r))throw new Error("Combine: KeyValue Map keys should be unique");e.add(r)})),e}e.combine=function(t){const e=t[0],r=n.psbtToKeyVals(e),s=t.slice(1);if(0===s.length)throw new Error("Combine: Nothing to combine");const u=o(e);if(void 0===u)throw new Error("Combine: Self missing transaction");const c=a(r.globalKeyVals),f=r.inputKeyVals.map(a),h=r.outputKeyVals.map(a);for(const t of s){const e=o(t);if(void 0===e||!e.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const s=n.psbtToKeyVals(t);a(s.globalKeyVals).forEach(i(c,r.globalKeyVals,s.globalKeyVals)),s.inputKeyVals.map(a).forEach(((t,e)=>t.forEach(i(f[e],r.inputKeyVals[e],s.inputKeyVals[e])))),s.outputKeyVals.map(a).forEach(((t,e)=>t.forEach(i(h[e],r.outputKeyVals[e],s.outputKeyVals[e]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},4834:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+t.key.toString("hex"));if(79!==t.key.length||![2,3].includes(t.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const e=t.key.slice(1),r={masterFingerprint:t.value.slice(0,4),extendedPubkey:e,path:"m"};for(const e of(n=t.value.length/4-1,[...Array(n).keys()])){const n=t.value.readUInt32LE(4*e+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}var n;return r},e.encode=function(t){const e=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([e,t.extendedPubkey]),o=t.path.split("/"),a=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:r,value:a}},e.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",e.check=function(t){const e=t.extendedPubkey,r=t.masterFingerprint,i=t.path;return n.isBuffer(e)&&78===e.length&&[2,3].indexOf(e[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)*$/)},e.canAddToArray=function(t,e,r){const n=e.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.extendedPubkey.equals(e.extendedPubkey))).length)}},4213:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.encode=function(t){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}},2706:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9080),i=r(4834),o=r(4213),a=r(6605),s=r(1795),u=r(4431),c=r(6907),f=r(5949),h=r(9344),l=r(2760),d=r(1695),p=r(8454),g=r(9034),y=r(2926),m=r(7851),w=r(7545),b=r(2412),v=r(4307),_=r(7636),S=r(2223),A=r(5578),T={unsignedTx:o,globalXpub:i,checkPubkey:b.makeChecker([])};e.globals=T;const E={nonWitnessUtxo:u,partialSig:c,sighashType:h,finalScriptSig:a,finalScriptWitness:s,porCommitment:f,witnessUtxo:y,bip32Derivation:w.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:v.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:A.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:b.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION]),tapKeySig:l,tapScriptSig:g,tapLeafScript:d,tapBip32Derivation:_.makeConverter(n.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:S.makeConverter(n.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:p};e.inputs=E;const k={bip32Derivation:w.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:v.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:A.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:b.makeChecker([n.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:_.makeConverter(n.OutputTypes.TAP_BIP32_DERIVATION),tapTree:m,tapInternalKey:S.makeConverter(n.OutputTypes.TAP_INTERNAL_KEY)};e.outputs=k},6605:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptSig}},1795:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptWitness}},4431:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.nonWitnessUtxo}},6907:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([e,t.pubkey]),value:t.signature}},e.expected="{ pubkey: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.signature)&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&function(t){if(!n.isBuffer(t)||t.length<9)return!1;if(48!==t[0])return!1;if(t.length!==t[1]+3)return!1;if(2!==t[2])return!1;const e=t[3];if(e>33||e<1)return!1;if(2!==t[3+e+1])return!1;const r=t[3+e+2];return!(r>33||r<1)&&t.length===3+e+2+r+2}(t.signature)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}},5949:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+t.key.toString("hex"));return t.value.toString("utf8")},e.encode=function(t){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(t,"utf8")}},e.expected="string",e.check=function(t){return"string"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.porCommitment}},9344:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+t.key.toString("hex"));return t.value.readUInt32LE(0)},e.encode=function(t){const e=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(t,0),{key:e,value:r}},e.expected="number",e.check=function(t){return"number"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.sighashType}},2760:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);function o(t){return n.isBuffer(t)&&(64===t.length||65===t.length)}e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_KEY_SIG||1!==t.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+t.key.toString("hex"));if(!o(t.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.TAP_KEY_SIG]),value:t}},e.expected="Buffer",e.check=o,e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapKeySig}},1695:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+t.key.toString("hex"));if((t.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+t.key.toString("hex"));const e=t.value[t.value.length-1];if((254&t.key[1])!==e)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+t.key.toString("hex"));const r=t.value.slice(0,-1);return{controlBlock:t.key.slice(1),script:r,leafVersion:e}},e.encode=function(t){const e=n.from([i.InputTypes.TAP_LEAF_SCRIPT]),r=n.from([t.leafVersion]);return{key:n.concat([e,t.controlBlock]),value:n.concat([t.script,r])}},e.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",e.check=function(t){return n.isBuffer(t.controlBlock)&&(t.controlBlock.length-1)%32==0&&(254&t.controlBlock[0])===t.leafVersion&&n.isBuffer(t.script)},e.canAddToArray=function(t,e,r){const n=e.controlBlock.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.controlBlock.equals(e.controlBlock))).length)}},8454:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);function o(t){return n.isBuffer(t)&&32===t.length}e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_MERKLE_ROOT||1!==t.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+t.key.toString("hex"));if(!o(t.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.TAP_MERKLE_ROOT]),value:t}},e.expected="Buffer",e.check=o,e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapMerkleRoot}},9034:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080);e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+t.key.toString("hex"));if(65!==t.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+t.key.toString("hex"));if(64!==t.value.length&&65!==t.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1,33),leafHash:t.key.slice(33),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.TAP_SCRIPT_SIG]);return{key:n.concat([e,t.pubkey,t.leafHash]),value:t.signature}},e.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.leafHash)&&n.isBuffer(t.signature)&&32===t.pubkey.length&&32===t.leafHash.length&&(64===t.signature.length||65===t.signature.length)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex")+e.leafHash.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey)&&t.leafHash.equals(e.leafHash))).length)}},2926:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080),o=r(8133),a=r(394);e.decode=function(t){if(t.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+t.key.toString("hex"));const e=o.readUInt64LE(t.value,0);let r=8;const n=a.decode(t.value,r);r+=a.encodingLength(n);const s=t.value.slice(r);if(s.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:s,value:e}},e.encode=function(t){const{script:e,value:r}=t,s=a.encodingLength(e.length),u=n.allocUnsafe(8+s+e.length);return o.writeUInt64LE(u,r,0),a.encode(e.length,u,8),e.copy(u,8+s),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},e.expected="{ script: Buffer; value: number; }",e.check=function(t){return n.isBuffer(t.script)&&"number"==typeof t.value},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.witnessUtxo}},7851:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9080),o=r(394);e.decode=function(t){if(t.key[0]!==i.OutputTypes.TAP_TREE||1!==t.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+t.key.toString("hex"));let e=0;const r=[];for(;e<t.value.length;){const n=t.value[e++],i=t.value[e++],a=o.decode(t.value,e);e+=o.encodingLength(a),r.push({depth:n,leafVersion:i,script:t.value.slice(e,e+a)}),e+=a}return{leaves:r}},e.encode=function(t){const e=n.from([i.OutputTypes.TAP_TREE]),r=[].concat(...t.leaves.map((t=>[n.of(t.depth,t.leafVersion),o.encode(t.script.length),t.script])));return{key:e,value:n.concat(r)}},e.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",e.check=function(t){return Array.isArray(t.leaves)&&t.leaves.every((t=>t.depth>=0&&t.depth<=128&&(254&t.leafVersion)===t.leafVersion&&n.isBuffer(t.script)))},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapTree}},7545:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=t=>33===t.length&&[2,3].includes(t[0])||65===t.length&&4===t[0];e.makeConverter=function(t,e=i){return{decode:function(r){if(r.key[0]!==t)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+r.key.toString("hex"));const n=r.key.slice(1);if(!e(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+r.key.toString("hex"));if(r.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const t of(o=r.value.length/4-1,[...Array(o).keys()])){const e=r.value.readUInt32LE(4*t+4),n=!!(2147483648&e),o=2147483647&e;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(e){const r=n.from([t]),i=n.concat([r,e.pubkey]),o=e.path.split("/"),a=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:i,value:a}},check:function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.masterFingerprint)&&"string"==typeof t.path&&e(t.pubkey)&&4===t.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}}}},2412:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeChecker=function(t){return function(e){let r;if(t.includes(e.key[0])&&(r=e.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+e.key.toString("hex"));return r}}},4307:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode redeemScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.redeemScript}}}},7636:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(394),o=r(7545),a=t=>32===t.length;e.makeConverter=function(t){const e=o.makeConverter(t,a);return{decode:function(t){const r=i.decode(t.value),n=i.encodingLength(r),o=e.decode({key:t.key,value:t.value.slice(n+32*r)}),a=new Array(r);for(let e=0,i=n;e<r;e++,i+=32)a[e]=t.value.slice(i,i+32);return Object.assign({},o,{leafHashes:a})},encode:function(t){const r=e.encode(t),o=i.encodingLength(t.leafHashes.length),a=n.allocUnsafe(o);i.encode(t.leafHashes.length,a);const s=n.concat([a,...t.leafHashes,r.value]);return Object.assign({},r,{value:s})},check:function(t){return Array.isArray(t.leafHashes)&&t.leafHashes.every((t=>n.isBuffer(t)&&32===t.length))&&e.check(t)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:e.canAddToArray}}},2223:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t||1!==e.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+e.key.toString("hex"));if(32!==e.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)&&32===t.length},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.tapInternalKey}}}},5578:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode witnessScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.witnessScript}}}},8133:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(394);function o(t){const e=t.key.length,r=t.value.length,o=i.encodingLength(e),a=i.encodingLength(r),s=n.allocUnsafe(o+e+a+r);return i.encode(e,s,0),t.key.copy(s,o),i.encode(r,s,o+e),t.value.copy(s,o+e+a),s}function a(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}e.range=t=>[...Array(t).keys()],e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.keyValsToBuffer=function(t){const e=t.map(o);return e.push(n.from([0])),n.concat(e)},e.keyValToBuffer=o,e.readUInt64LE=function(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,a(n+r,9007199254740991),n+r},e.writeUInt64LE=function(t,e,r){return a(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}},394:(t,e,r)=>{"use strict";var n=r(8287).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}Object.defineProperty(e,"__esModule",{value:!0}),e.encode=function t(e,r,a){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return a||(a=0),e<253?(r.writeUInt8(e,a),Object.assign(t,{bytes:1})):e<=65535?(r.writeUInt8(253,a),r.writeUInt16LE(e,a+1),Object.assign(t,{bytes:3})):e<=4294967295?(r.writeUInt8(254,a),r.writeUInt32LE(e,a+1),Object.assign(t,{bytes:5})):(r.writeUInt8(255,a),r.writeUInt32LE(e>>>0,a+1),r.writeUInt32LE(e/4294967296|0,a+5),Object.assign(t,{bytes:9})),r},e.decode=function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const o=e.readUInt8(r);if(o<253)return Object.assign(t,{bytes:1}),o;if(253===o)return Object.assign(t,{bytes:3}),e.readUInt16LE(r+1);if(254===o)return Object.assign(t,{bytes:5}),e.readUInt32LE(r+1);{Object.assign(t,{bytes:9});const n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return i(o),o}},e.encodingLength=o},6263:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2706),o=r(8133),a=r(394),s=r(9080);function u(t,e,r){if(!e.equals(n.from([r])))throw new Error(`Format Error: Invalid ${t} key: ${e.toString("hex")}`)}function c(t,{globalMapKeyVals:e,inputKeyVals:r,outputKeyVals:n}){const a={unsignedTx:t};let c=0;for(const t of e)switch(t.key[0]){case s.GlobalTypes.UNSIGNED_TX:if(u("global",t.key,s.GlobalTypes.UNSIGNED_TX),c>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");c++;break;case s.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(i.globals.globalXpub.decode(t));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(t)}const f=r.length,h=n.length,l=[],d=[];for(const t of o.range(f)){const e={};for(const n of r[t])switch(i.inputs.checkPubkey(n),n.key[0]){case s.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,s.InputTypes.NON_WITNESS_UTXO),void 0!==e.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");e.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(n);break;case s.InputTypes.WITNESS_UTXO:if(u("input",n.key,s.InputTypes.WITNESS_UTXO),void 0!==e.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");e.witnessUtxo=i.inputs.witnessUtxo.decode(n);break;case s.InputTypes.PARTIAL_SIG:void 0===e.partialSig&&(e.partialSig=[]),e.partialSig.push(i.inputs.partialSig.decode(n));break;case s.InputTypes.SIGHASH_TYPE:if(u("input",n.key,s.InputTypes.SIGHASH_TYPE),void 0!==e.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");e.sighashType=i.inputs.sighashType.decode(n);break;case s.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,s.InputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");e.redeemScript=i.inputs.redeemScript.decode(n);break;case s.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,s.InputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");e.witnessScript=i.inputs.witnessScript.decode(n);break;case s.InputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case s.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,s.InputTypes.FINAL_SCRIPTSIG),e.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case s.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,s.InputTypes.FINAL_SCRIPTWITNESS),e.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case s.InputTypes.POR_COMMITMENT:u("input",n.key,s.InputTypes.POR_COMMITMENT),e.porCommitment=i.inputs.porCommitment.decode(n);break;case s.InputTypes.TAP_KEY_SIG:u("input",n.key,s.InputTypes.TAP_KEY_SIG),e.tapKeySig=i.inputs.tapKeySig.decode(n);break;case s.InputTypes.TAP_SCRIPT_SIG:void 0===e.tapScriptSig&&(e.tapScriptSig=[]),e.tapScriptSig.push(i.inputs.tapScriptSig.decode(n));break;case s.InputTypes.TAP_LEAF_SCRIPT:void 0===e.tapLeafScript&&(e.tapLeafScript=[]),e.tapLeafScript.push(i.inputs.tapLeafScript.decode(n));break;case s.InputTypes.TAP_BIP32_DERIVATION:void 0===e.tapBip32Derivation&&(e.tapBip32Derivation=[]),e.tapBip32Derivation.push(i.inputs.tapBip32Derivation.decode(n));break;case s.InputTypes.TAP_INTERNAL_KEY:u("input",n.key,s.InputTypes.TAP_INTERNAL_KEY),e.tapInternalKey=i.inputs.tapInternalKey.decode(n);break;case s.InputTypes.TAP_MERKLE_ROOT:u("input",n.key,s.InputTypes.TAP_MERKLE_ROOT),e.tapMerkleRoot=i.inputs.tapMerkleRoot.decode(n);break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(n)}l.push(e)}for(const t of o.range(h)){const e={};for(const r of n[t])switch(i.outputs.checkPubkey(r),r.key[0]){case s.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,s.OutputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");e.redeemScript=i.outputs.redeemScript.decode(r);break;case s.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,s.OutputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");e.witnessScript=i.outputs.witnessScript.decode(r);break;case s.OutputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;case s.OutputTypes.TAP_INTERNAL_KEY:u("output",r.key,s.OutputTypes.TAP_INTERNAL_KEY),e.tapInternalKey=i.outputs.tapInternalKey.decode(r);break;case s.OutputTypes.TAP_TREE:u("output",r.key,s.OutputTypes.TAP_TREE),e.tapTree=i.outputs.tapTree.decode(r);break;case s.OutputTypes.TAP_BIP32_DERIVATION:void 0===e.tapBip32Derivation&&(e.tapBip32Derivation=[]),e.tapBip32Derivation.push(i.outputs.tapBip32Derivation.decode(r));break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(r)}d.push(e)}return{globalMap:a,inputs:l,outputs:d}}e.psbtFromBuffer=function(t,e){let r=0;function n(){const e=a.decode(t,r);r+=a.encodingLength(e);const n=t.slice(r,r+e);return r+=e,n}function i(){return{key:n(),value:n()}}function u(){if(r>=t.length)throw new Error("Format Error: Unexpected End of PSBT");const e=0===t.readUInt8(r);return e&&r++,e}if(1886610036!==function(){const e=t.readUInt32BE(r);return r+=4,e}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const e=t.readUInt8(r);return r+=1,e}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const f=[],h={};for(;!u();){const t=i(),e=t.key.toString("hex");if(h[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);h[e]=1,f.push(t)}const l=f.filter((t=>t.key[0]===s.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=e(l[0].value),{inputCount:p,outputCount:g}=d.getInputOutputCounts(),y=[],m=[];for(const t of o.range(p)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each input: input index "+t+" key "+o);e[o]=1,r.push(n)}y.push(r)}for(const t of o.range(g)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each output: output index "+t+" key "+o);e[o]=1,r.push(n)}m.push(r)}return c(d,{globalMapKeyVals:f,inputKeyVals:y,outputKeyVals:m})},e.checkKeyBuffer=u,e.psbtFromKeyVals=c},1457:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(6263)),n(r(238))},238:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2706),o=r(8133);e.psbtToBuffer=function({globalMap:t,inputs:e,outputs:r}){const{globalKeyVals:i,inputKeyVals:a,outputKeyVals:s}=u({globalMap:t,inputs:e,outputs:r}),c=o.keyValsToBuffer(i),f=t=>0===t.length?[n.from([0])]:t.map(o.keyValsToBuffer),h=f(a),l=f(s),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,c].concat(h,l))};const a=(t,e)=>t.key.compare(e.key);function s(t,e){const r=new Set,n=Object.entries(t).reduce(((t,[n,i])=>{if("unknownKeyVals"===n)return t;const o=e[n];if(void 0===o)return t;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((t=>t.key.toString("hex"))).forEach((t=>{if(r.has(t))throw new Error("Serialize Error: Duplicate key: "+t);r.add(t)})),t.concat(a)}),[]),i=t.unknownKeyVals?t.unknownKeyVals.filter((t=>!r.has(t.key.toString("hex")))):[];return n.concat(i).sort(a)}function u({globalMap:t,inputs:e,outputs:r}){return{globalKeyVals:s(t,i.globals),inputKeyVals:e.map((t=>s(t,i.inputs))),outputKeyVals:r.map((t=>s(t,i.outputs)))}}e.psbtToKeyVals=u},1614:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(4863),o=r(1457),a=r(9080),s=r(5080);e.Psbt=class{constructor(t){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}static fromBase64(t,e){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e){const r=o.psbtFromBuffer(t,e),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(t){return s.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=s.checkForInput(this.inputs,t);return s.updateInput(e,r),this}updateOutput(t,e){const r=s.checkForOutput(this.outputs,t);return s.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return s.checkHasKey(t,this.globalMap.unknownKeyVals,s.getEnumLength(a.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=s.checkForInput(this.inputs,t);return s.checkHasKey(e,r.unknownKeyVals,s.getEnumLength(a.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=s.checkForOutput(this.outputs,t);return s.checkHasKey(e,r.unknownKeyVals,s.getEnumLength(a.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addInput(t){this.globalMap.unsignedTx.addInput(t),this.inputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),s.addInputAttributes(this.inputs,t),this}addOutput(t){this.globalMap.unsignedTx.addOutput(t),this.outputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToOutput(r,t))),s.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=s.checkForInput(this.inputs,t);s.inputCheckUncleanFinalized(t,e);for(const t of Object.keys(e))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(t)||delete e[t];return this}combine(...t){const e=i.combine([this].concat(t));return Object.assign(this,e),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}},9080:(t,e)=>{"use strict";var r,n,i;Object.defineProperty(e,"__esModule",{value:!0}),(i=e.GlobalTypes||(e.GlobalTypes={}))[i.UNSIGNED_TX=0]="UNSIGNED_TX",i[i.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]},5080:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2706);function o(t,e){const r=t[e];if(void 0===r)throw new Error(`No input #${e}`);return r}function a(t,e){const r=t[e];if(void 0===r)throw new Error(`No output #${e}`);return r}function s(t,e,r,n){throw new Error(`Data for ${t} key ${e} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function u(t){return(e,r)=>{for(const n of Object.keys(e)){const o=e[n],{canAdd:a,canAddToArray:u,check:c,expected:f}=i[t+"s"][n]||{};if(c)if(u){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error(`Key type ${n} must be an array`);o.every(c)||s(t,n,f,o);const e=r[n]||[],i=new Set;if(!o.every((t=>u(e,t,i))))throw new Error("Can not add duplicate data to array");r[n]=e.concat(o)}else{if(c(o)||s(t,n,f,o),!a(r,o))throw new Error(`Can not add duplicate data to ${t}`);r[n]=o}}}}e.checkForInput=o,e.checkForOutput=a,e.checkHasKey=function(t,e,r){if(t.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(e&&0!==e.filter((e=>e.key.equals(t.key))).length)throw new Error(`Duplicate Key: ${t.key.toString("hex")}`)},e.getEnumLength=function(t){let e=0;return Object.keys(t).forEach((t=>{Number(isNaN(Number(t)))&&e++})),e},e.inputCheckUncleanFinalized=function(t,e){let r=!1;if(e.nonWitnessUtxo||e.witnessUtxo){const t=!!e.redeemScript,n=!!e.witnessScript,i=!t||!!e.finalScriptSig,o=!n||!!e.finalScriptWitness,a=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&a}if(!1===r)throw new Error(`Input #${t} has too much or too little data to clean`)},e.updateGlobal=u("global"),e.updateInput=u("input"),e.updateOutput=u("output"),e.addInputAttributes=function(t,r){const n=o(t,t.length-1);e.updateInput(r,n)},e.addOutputAttributes=function(t,r){const n=a(t,t.length-1);e.updateOutput(r,n)},e.defaultVersionSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Version: Invalid Transaction");return e.writeUInt32LE(t,0),e},e.defaultLocktimeSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Locktime: Invalid Transaction");return e.writeUInt32LE(t,e.length-4),e}},4642:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9571),o=r(1889),a=r(1155),s=r(8676),u=r(7513),c=s.BufferN(32),f=s.compile({wif:s.UInt8,bip32:{public:s.UInt32,private:s.UInt32}}),h={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},l=2147483648,d=Math.pow(2,31)-1;function p(t){return s.String(t)&&null!==t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function g(t){return s.UInt32(t)&&t<=d}class y{constructor(t,e,r,n,i=0,o=0,a=0){this.__D=t,this.__Q=e,this.chainCode=r,this.network=n,this.__DEPTH=i,this.__INDEX=o,this.__PARENT_FINGERPRINT=a,s(f,n),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return void 0===this.__Q&&(this.__Q=a.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return i.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return b(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const t=this.network,e=this.isNeutered()?t.bip32.public:t.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(e,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),o.encode(r)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return u.encode(this.network.wif,this.privateKey,!0)}derive(t){s(s.UInt32,t);const e=t>=l,r=n.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(t,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(t,33);const o=i.hmacSHA512(this.chainCode,r),u=o.slice(0,32),c=o.slice(32);if(!a.isPrivate(u))return this.derive(t+1);let f;if(this.isNeutered()){const e=a.pointAddScalar(this.publicKey,u,!0);if(null===e)return this.derive(t+1);f=b(e,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const e=a.privateAdd(this.privateKey,u);if(null==e)return this.derive(t+1);f=w(e,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return f}deriveHardened(t){return s(g,t),this.derive(t+l)}derivePath(t){s(p,t);let e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");e=e.slice(1)}return e.reduce(((t,e)=>{let r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)}sign(t,e){if(!this.privateKey)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return a.sign(t,this.privateKey);{let e=a.sign(t,this.privateKey);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=a.signWithEntropy(t,this.privateKey,r);return e}}verify(t,e){return a.verify(t,this.publicKey,e)}}function m(t,e,r){return w(t,e,r)}function w(t,e,r,n,i,o){if(s({privateKey:c,chainCode:c},{privateKey:t,chainCode:e}),r=r||h,!a.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return new y(t,void 0,e,r,n,i,o)}function b(t,e,r,n,i,o){if(s({publicKey:s.BufferN(33),chainCode:c},{publicKey:t,chainCode:e}),r=r||h,!a.isPoint(t))throw new TypeError("Point is not on the curve");return new y(void 0,t,e,r,n,i,o)}e.fromBase58=function(t,e){const r=o.decode(t);if(78!==r.length)throw new TypeError("Invalid buffer length");e=e||h;const n=r.readUInt32BE(0);if(n!==e.bip32.private&&n!==e.bip32.public)throw new TypeError("Invalid network version");const i=r[4],a=r.readUInt32BE(5);if(0===i&&0!==a)throw new TypeError("Invalid parent fingerprint");const s=r.readUInt32BE(9);if(0===i&&0!==s)throw new TypeError("Invalid index");const u=r.slice(13,45);let c;if(n===e.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");c=w(r.slice(46,78),u,e,i,s,a)}else c=b(r.slice(45,78),u,e,i,s,a);return c},e.fromPrivateKey=m,e.fromPublicKey=function(t,e,r){return b(t,e,r)},e.fromSeed=function(t,e){if(s(s.Buffer,t),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");e=e||h;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),t);return m(r.slice(0,32),r.slice(32),e)}},9571:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7108),i=r(3507);e.hash160=function(t){const e=n("sha256").update(t).digest();try{return n("rmd160").update(e).digest()}catch(t){return n("ripemd160").update(e).digest()}},e.hmacSHA512=function(t,e){return i("sha512",t).update(e).digest()}},852:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4642);e.fromSeed=n.fromSeed,e.fromBase58=n.fromBase58,e.fromPublicKey=n.fromPublicKey,e.fromPrivateKey=n.fromPrivateKey},2368:(t,e,r)=>{var n=r(2861).Buffer;t.exports={check:function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=t.length,t.copy(o,4),o[4+r]=2,o[5+r]=e.length,e.copy(o,6+r),o}}},1870:(t,e,r)=>{var n=r(8119),i={};for(var o in n)i[n[o]]=o;t.exports=i},57:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(622),o=r(885),a=r(7038),s=r(8116),u=r(9674),c=r(1889),f=r(8676);function h(t){const e=c.decode(t);if(e.length<21)throw new TypeError(t+" is too short");if(e.length>21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function l(t){const e=u.decode(t),r=u.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:n.from(r)}}e.fromBase58Check=h,e.fromBech32=l,e.toBase58Check=function(t,e){f(s.tuple(s.Hash160bit,s.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),c.encode(r)},e.toBech32=function(t,e,r){const n=u.toWords(t);return n.unshift(e),u.encode(r,n)},e.fromOutputScript=function(t,e){e=e||i.bitcoin;try{return o.p2pkh({output:t,network:e}).address}catch(t){}try{return o.p2sh({output:t,network:e}).address}catch(t){}try{return o.p2wpkh({output:t,network:e}).address}catch(t){}try{return o.p2wsh({output:t,network:e}).address}catch(t){}throw new Error(a.toASM(t)+" has no matching Address")},e.toOutputScript=function(t,e){let r,n;e=e||i.bitcoin;try{r=h(t)}catch(t){}if(r){if(r.version===e.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===e.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=l(t)}catch(t){}if(n){if(n.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}}}throw new Error(t+" has no matching Script")}},1696:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(606),o=r(1944),a=r(2021),s=r(8116),u=r(3547),c=r(8676),f=r(8469),h=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class d{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");const e=new i.BufferReader(t),r=new d;if(r.version=e.readInt32(),r.prevHash=e.readSlice(32),r.merkleRoot=e.readSlice(32),r.timestamp=e.readUInt32(),r.bits=e.readUInt32(),r.nonce=e.readUInt32(),80===t.length)return r;const n=()=>{const t=a.Transaction.fromBuffer(e.buffer.slice(e.offset),!0);return e.offset+=t.byteLength(),t},o=e.readVarInt();r.transactions=[];for(let t=0;t<o;++t){const t=n();r.transactions.push(t)}const s=r.getWitnessCommit();return s&&(r.witnessCommit=s),r}static fromHex(t){return d.fromBuffer(n.from(t,"hex"))}static calculateTarget(t){const e=((4278190080&t)>>24)-3,r=8388607&t,i=n.alloc(32,0);return i.writeUIntBE(r,29-e,3),i}static calculateMerkleRoot(t,e){if(c([{getHash:s.Function}],t),0===t.length)throw h;if(e&&!p(t))throw l;const r=t.map((t=>t.getHash(e))),i=u(r,o.hash256);return e?o.hash256(n.concat([i,t[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!p(this.transactions))return null;const t=this.transactions[0].outs.filter((t=>t.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((t=>t.script.slice(6,38)));if(0===t.length)return null;const e=t[t.length-1];return e instanceof n&&32===e.length?e:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(t=this.transactions)instanceof Array&&t.some((t=>"object"==typeof t&&t.ins instanceof Array&&t.ins.some((t=>"object"==typeof t&&t.witness instanceof Array&&t.witness.length>0))));var t}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(t,e=!0){return t||!this.transactions?80:80+f.encodingLength(this.transactions.length)+this.transactions.reduce(((t,r)=>t+r.byteLength(e)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return i.reverseBuffer(this.getHash()).toString("hex")}getUTCDate(){const t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){const e=n.allocUnsafe(this.byteLength(t)),r=new i.BufferWriter(e);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),t||!this.transactions||(f.encode(this.transactions.length,e,r.offset),r.offset+=f.encode.bytes,this.transactions.forEach((t=>{const n=t.byteLength();t.toBuffer(e,r.offset),r.offset+=n}))),e}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){const t=this.hasWitnessCommit();return!(!t&&this.hasWitness())&&this.__checkMerkleRoot()&&(!t||this.__checkWitnessCommit())}checkProofOfWork(){const t=i.reverseBuffer(this.getHash()),e=d.calculateTarget(this.bits);return t.compare(e)<=0}__checkMerkleRoot(){if(!this.transactions)throw h;const t=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw h;if(!this.hasWitnessCommit())throw l;const t=d.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}function p(t){return t instanceof Array&&t[0]&&t[0].ins&&t[0].ins instanceof Array&&t[0].ins[0]&&t[0].ins[0].witness&&t[0].ins[0].witness instanceof Array&&t[0].ins[0].witness.length>0}e.Block=d},606:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8116),o=r(8676),a=r(8469);function s(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,s(n+r,9007199254740991),n+r}function c(t,e,r){return s(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}e.readUInt64LE=u,e.writeUInt64LE=c,e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.cloneBuffer=function(t){const e=n.allocUnsafe(t.length);return t.copy(e),e},e.BufferWriter=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=c(this.buffer,t,this.offset)}writeVarInt(t){a.encode(t,this.buffer,this.offset),this.offset+=a.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach((t=>this.writeVarSlice(t)))}},e.BufferReader=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=u(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=a.decode(this.buffer,this.offset);return this.offset+=a.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),e=[];for(let r=0;r<t;r++)e.push(this.readVarSlice());return e}}},2503:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(2124),o=r(8608),a=r(9856),s=r(1168),u=r(8573),c=r(1180),f=r(6323),h=r(7926),l={P2MS:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};e.types=l,e.output=function(t){if(f.output.check(t))return l.P2WPKH;if(h.output.check(t))return l.P2WSH;if(s.output.check(t))return l.P2PKH;if(u.output.check(t))return l.P2SH;const e=n.decompile(t);if(!e)throw new TypeError("Invalid script");return i.output.check(e)?l.P2MS:a.output.check(e)?l.P2PK:c.output.check(e)?l.WITNESS_COMMITMENT:o.output.check(e)?l.NULLDATA:l.NONSTANDARD},e.input=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return s.input.check(r)?l.P2PKH:u.input.check(r,e)?l.P2SH:i.input.check(r,e)?l.P2MS:a.input.check(r)?l.P2PK:l.NONSTANDARD},e.witness=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return f.input.check(r)?l.P2WPKH:h.input.check(r,e)?l.P2WSH:l.NONSTANDARD}},1944:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7108);function i(t){try{return n("rmd160").update(t).digest()}catch(e){return n("ripemd160").update(t).digest()}}function o(t){return n("sha256").update(t).digest()}e.ripemd160=i,e.sha1=function(t){return n("sha1").update(t).digest()},e.sha256=o,e.hash160=function(t){return i(o(t))},e.hash256=function(t){return o(o(t))}},5041:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(622),o=r(8116),a=r(1155),s=r(3209),u=r(8676),c=r(7513),f=u.maybe(u.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));class h{constructor(t,e,r){this.__D=t,this.__Q=e,this.lowR=!1,void 0===r&&(r={}),this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||i.bitcoin,void 0!==e&&(this.__Q=a.pointCompress(e,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=a.pointFromScalar(this.__D,this.compressed)),this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return c.encode(this.network.wif,this.__D,this.compressed)}sign(t,e){if(!this.__D)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return a.sign(t,this.__D);{let e=a.sign(t,this.__D);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=a.signWithEntropy(t,this.__D,r);return e}}verify(t,e){return a.verify(t,this.publicKey,e)}}function l(t,e){if(u(o.Buffer256bit,t),!a.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return u(f,e),new h(t,void 0,e)}e.fromPrivateKey=l,e.fromPublicKey=function(t,e){return u(a.isPoint,t),u(f,e),new h(void 0,t,e)},e.fromWIF=function(t,e){const r=c.decode(t),n=r.version;if(o.Array(e)){if(!(e=e.filter((t=>n===t.wif)).pop()))throw new Error("Unknown network version")}else if(e=e||i.bitcoin,n!==e.wif)throw new Error("Invalid network version");return l(r.privateKey,{compressed:r.compressed,network:e})},e.makeRandom=function(t){u(f,t),void 0===t&&(t={});const e=t.rng||s;let r;do{r=e(32),u(o.Buffer256bit,r)}while(!a.isPrivate(r));return l(r,t)}},1757:(t,e,r)=>{"use strict";r(852);const n=r(57);e.hl=n,r(1944);const i=r(5041);e.Jc=i;const o=r(622);e.o8=o,r(885),r(7038),r(1696).Block,r(9646).Psbt,r(7038).OPS,r(2021).Transaction,r(2401).TransactionBuilder},622:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},e.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},e.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},5472:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(622),i=r(7038),o=r(7883),a=r(8676),s=i.OPS;e.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),a({network:a.maybe(a.Object),output:a.maybe(a.Buffer),data:a.maybe(a.arrayOf(a.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(o.prop(r,"output",(()=>{if(t.data)return i.compile([s.OP_RETURN].concat(t.data))})),o.prop(r,"data",(()=>{if(t.output)return i.decompile(t.output).slice(1)})),e.validate&&t.output){const e=i.decompile(t.output);if(e[0]!==s.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(a.Buffer))throw new TypeError("Output is invalid");if(t.data&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,t)}},885:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5472);e.embed=n.p2data;const i=r(1395);e.p2ms=i.p2ms;const o=r(4930);e.p2pk=o.p2pk;const a=r(3504);e.p2pkh=a.p2pkh;const s=r(8368);e.p2sh=s.p2sh;const u=r(7027);e.p2wpkh=u.p2wpkh;const c=r(9041);e.p2wsh=c.p2wsh},7883:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.prop=function(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){const t=r.call(this);return this[e]=t,t},set(t){Object.defineProperty(this,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})},e.value=function(t){let e;return()=>(void 0!==e||(e=t()),e)}},1395:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(622),i=r(7038),o=r(7883),a=i.OPS,s=r(8676),u=r(1155),c=a.OP_RESERVED;function f(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}e.p2ms=function(t,e){if(!(t.input||t.output||t.pubkeys&&void 0!==t.m||t.signatures))throw new TypeError("Not enough data");function r(t){return i.isCanonicalScriptSignature(t)||void 0!==(e.allowIncomplete&&t===a.OP_0)}e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),m:s.maybe(s.Number),n:s.maybe(s.Number),output:s.maybe(s.Buffer),pubkeys:s.maybe(s.arrayOf(u.isPoint)),signatures:s.maybe(s.arrayOf(r)),input:s.maybe(s.Buffer)},t);const h={network:t.network||n.bitcoin};let l=[],d=!1;function p(t){d||(d=!0,l=i.decompile(t),h.m=l[0]-c,h.n=l[l.length-2]-c,h.pubkeys=l.slice(1,-2))}if(o.prop(h,"output",(()=>{if(t.m&&h.n&&t.pubkeys)return i.compile([].concat(c+t.m,t.pubkeys,c+h.n,a.OP_CHECKMULTISIG))})),o.prop(h,"m",(()=>{if(h.output)return p(h.output),h.m})),o.prop(h,"n",(()=>{if(h.pubkeys)return h.pubkeys.length})),o.prop(h,"pubkeys",(()=>{if(t.output)return p(t.output),h.pubkeys})),o.prop(h,"signatures",(()=>{if(t.input)return i.decompile(t.input).slice(1)})),o.prop(h,"input",(()=>{if(t.signatures)return i.compile([a.OP_0].concat(t.signatures))})),o.prop(h,"witness",(()=>{if(h.input)return[]})),o.prop(h,"name",(()=>{if(h.m&&h.n)return`p2ms(${h.m} of ${h.n})`})),e.validate){if(t.output){if(p(t.output),!s.Number(l[0]))throw new TypeError("Output is invalid");if(!s.Number(l[l.length-2]))throw new TypeError("Output is invalid");if(l[l.length-1]!==a.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(h.m<=0||h.n>16||h.m>h.n||h.n!==l.length-3)throw new TypeError("Output is invalid");if(!h.pubkeys.every((t=>u.isPoint(t))))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==h.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==h.n)throw new TypeError("n mismatch");if(t.pubkeys&&!f(t.pubkeys,h.pubkeys))throw new TypeError("Pubkeys mismatch")}if(t.pubkeys){if(void 0!==t.n&&t.n!==t.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(h.n=t.pubkeys.length,h.n<h.m)throw new TypeError("Pubkey count cannot be less than m")}if(t.signatures){if(t.signatures.length<h.m)throw new TypeError("Not enough signatures provided");if(t.signatures.length>h.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==a.OP_0)throw new TypeError("Input is invalid");if(0===h.signatures.length||!h.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!f(t.signatures,h.signatures))throw new TypeError("Signature mismatch");if(void 0!==t.m&&t.m!==t.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(h,t)}},4930:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(622),i=r(7038),o=r(7883),a=r(8676),s=i.OPS,u=r(1155);e.p2pk=function(t,e){if(!(t.input||t.output||t.pubkey||t.input||t.signature))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),a({network:a.maybe(a.Object),output:a.maybe(a.Buffer),pubkey:a.maybe(u.isPoint),signature:a.maybe(i.isCanonicalScriptSignature),input:a.maybe(a.Buffer)},t);const r=o.value((()=>i.decompile(t.input))),c={name:"p2pk",network:t.network||n.bitcoin};if(o.prop(c,"output",(()=>{if(t.pubkey)return i.compile([t.pubkey,s.OP_CHECKSIG])})),o.prop(c,"pubkey",(()=>{if(t.output)return t.output.slice(1,-1)})),o.prop(c,"signature",(()=>{if(t.input)return r()[0]})),o.prop(c,"input",(()=>{if(t.signature)return i.compile([t.signature])})),o.prop(c,"witness",(()=>{if(c.input)return[]})),e.validate){if(t.output){if(t.output[t.output.length-1]!==s.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!u.isPoint(c.pubkey))throw new TypeError("Output pubkey is invalid");if(t.pubkey&&!t.pubkey.equals(c.pubkey))throw new TypeError("Pubkey mismatch")}if(t.signature&&t.input&&!t.input.equals(c.input))throw new TypeError("Signature mismatch");if(t.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(c.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(c,t)}},3504:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1944),o=r(622),a=r(7038),s=r(7883),u=r(8676),c=a.OPS,f=r(1155),h=r(1889);e.p2pkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(25)),pubkey:u.maybe(f.isPoint),signature:u.maybe(a.isCanonicalScriptSignature),input:u.maybe(u.Buffer)},t);const r=s.value((()=>{const e=h.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),l=s.value((()=>a.decompile(t.input))),d=t.network||o.bitcoin,p={name:"p2pkh",network:d};if(s.prop(p,"address",(()=>{if(!p.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(d.pubKeyHash,0),p.hash.copy(t,1),h.encode(t)})),s.prop(p,"hash",(()=>t.output?t.output.slice(3,23):t.address?r().hash:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),s.prop(p,"output",(()=>{if(p.hash)return a.compile([c.OP_DUP,c.OP_HASH160,p.hash,c.OP_EQUALVERIFY,c.OP_CHECKSIG])})),s.prop(p,"pubkey",(()=>{if(t.input)return l()[1]})),s.prop(p,"signature",(()=>{if(t.input)return l()[0]})),s.prop(p,"input",(()=>{if(t.pubkey&&t.signature)return a.compile([t.signature,t.pubkey])})),s.prop(p,"witness",(()=>{if(p.input)return[]})),e.validate){let e=n.from([]);if(t.address){if(r().version!==d.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");e=r().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(25!==t.output.length||t.output[0]!==c.OP_DUP||t.output[1]!==c.OP_HASH160||20!==t.output[2]||t.output[23]!==c.OP_EQUALVERIFY||t.output[24]!==c.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=t.output.slice(3,23);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!a.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!f.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(t.signature&&!t.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},8368:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1944),o=r(622),a=r(7038),s=r(7883),u=r(8676),c=a.OPS,f=r(1889);e.p2sh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(23)),redeem:u.maybe({network:u.maybe(u.Object),output:u.maybe(u.Buffer),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))},t);let r=t.network;r||(r=t.redeem&&t.redeem.network||o.bitcoin);const h={network:r},l=s.value((()=>{const e=f.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),d=s.value((()=>a.decompile(t.input))),p=s.value((()=>{const e=d();return{network:r,output:e[e.length-1],input:a.compile(e.slice(0,-1)),witness:t.witness||[]}}));if(s.prop(h,"address",(()=>{if(!h.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(h.network.scriptHash,0),h.hash.copy(t,1),f.encode(t)})),s.prop(h,"hash",(()=>t.output?t.output.slice(2,22):t.address?l().hash:h.redeem&&h.redeem.output?i.hash160(h.redeem.output):void 0)),s.prop(h,"output",(()=>{if(h.hash)return a.compile([c.OP_HASH160,h.hash,c.OP_EQUAL])})),s.prop(h,"redeem",(()=>{if(t.input)return p()})),s.prop(h,"input",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return a.compile([].concat(a.decompile(t.redeem.input),t.redeem.output))})),s.prop(h,"witness",(()=>h.redeem&&h.redeem.witness?h.redeem.witness:h.input?[]:void 0)),s.prop(h,"name",(()=>{const t=["p2sh"];return void 0!==h.redeem&&t.push(h.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(l().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");e=l().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(23!==t.output.length||t.output[0]!==c.OP_HASH160||20!==t.output[1]||t.output[22]!==c.OP_EQUAL)throw new TypeError("Output is invalid");const r=t.output.slice(2,22);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}const o=t=>{if(t.output){const r=a.decompile(t.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");const n=i.hash160(t.output);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch");e=n}if(t.input){const e=t.input.length>0,r=t.witness&&t.witness.length>0;if(!e&&!r)throw new TypeError("Empty input");if(e&&r)throw new TypeError("Input and witness provided");if(e){const e=a.decompile(t.input);if(!a.isPushOnly(e))throw new TypeError("Non push-only scriptSig")}}};if(t.input){const t=d();if(!t||t.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(t.redeem){if(t.redeem.network&&t.redeem.network!==r)throw new TypeError("Network mismatch");if(t.input){const e=p();if(t.redeem.output&&!t.redeem.output.equals(e.output))throw new TypeError("Redeem.output mismatch");if(t.redeem.input&&!t.redeem.input.equals(e.input))throw new TypeError("Redeem.input mismatch")}o(t.redeem)}if(t.witness&&t.redeem&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.redeem.witness,t.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(h,t)}},7027:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1944),o=r(622),a=r(7038),s=r(7883),u=r(8676),c=a.OPS,f=r(1155),h=r(9674),l=n.alloc(0);e.p2wpkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),input:u.maybe(u.BufferN(0)),network:u.maybe(u.Object),output:u.maybe(u.BufferN(22)),pubkey:u.maybe(f.isPoint),signature:u.maybe(a.isCanonicalScriptSignature),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=s.value((()=>{const e=h.decode(t.address),r=e.words.shift(),i=h.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),d=t.network||o.bitcoin,p={name:"p2wpkh",network:d};if(s.prop(p,"address",(()=>{if(!p.hash)return;const t=h.toWords(p.hash);return t.unshift(0),h.encode(d.bech32,t)})),s.prop(p,"hash",(()=>t.output?t.output.slice(2,22):t.address?r().data:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),s.prop(p,"output",(()=>{if(p.hash)return a.compile([c.OP_0,p.hash])})),s.prop(p,"pubkey",(()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0)),s.prop(p,"signature",(()=>{if(t.witness)return t.witness[0]})),s.prop(p,"input",(()=>{if(p.witness)return l})),s.prop(p,"witness",(()=>{if(t.pubkey&&t.signature)return[t.signature,t.pubkey]})),e.validate){let e=n.from([]);if(t.address){if(d&&d.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(22!==t.output.length||t.output[0]!==c.OP_0||20!==t.output[1])throw new TypeError("Output is invalid");if(e.length>0&&!e.equals(t.output.slice(2)))throw new TypeError("Hash mismatch");e=t.output.slice(2)}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");if(e=r,!f.isPoint(t.pubkey)||33!==t.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(t.witness){if(2!==t.witness.length)throw new TypeError("Witness is invalid");if(!a.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!f.isPoint(t.witness[1])||33!==t.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(t.signature&&!t.signature.equals(t.witness[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(t.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(t.witness[1]);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},9041:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1944),o=r(622),a=r(7038),s=r(7883),u=r(8676),c=a.OPS,f=r(1155),h=r(9674),l=n.alloc(0);function d(t){return!(!n.isBuffer(t)||65!==t.length||4!==t[0]||!f.isPoint(t))}e.p2wsh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(32)),output:u.maybe(u.BufferN(34)),redeem:u.maybe({input:u.maybe(u.Buffer),network:u.maybe(u.Object),output:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.BufferN(0)),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=s.value((()=>{const e=h.decode(t.address),r=e.words.shift(),i=h.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),f=s.value((()=>a.decompile(t.redeem.input)));let p=t.network;p||(p=t.redeem&&t.redeem.network||o.bitcoin);const g={network:p};if(s.prop(g,"address",(()=>{if(!g.hash)return;const t=h.toWords(g.hash);return t.unshift(0),h.encode(p.bech32,t)})),s.prop(g,"hash",(()=>t.output?t.output.slice(2):t.address?r().data:g.redeem&&g.redeem.output?i.sha256(g.redeem.output):void 0)),s.prop(g,"output",(()=>{if(g.hash)return a.compile([c.OP_0,g.hash])})),s.prop(g,"redeem",(()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:l,witness:t.witness.slice(0,-1)}})),s.prop(g,"input",(()=>{if(g.witness)return l})),s.prop(g,"witness",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=a.toStack(f());return g.redeem=Object.assign({witness:e},t.redeem),g.redeem.input=l,[].concat(e,t.redeem.output)}if(t.redeem&&t.redeem.output&&t.redeem.witness)return[].concat(t.redeem.witness,t.redeem.output)})),s.prop(g,"name",(()=>{const t=["p2wsh"];return void 0!==g.redeem&&t.push(g.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(34!==t.output.length||t.output[0]!==c.OP_0||32!==t.output[1])throw new TypeError("Output is invalid");const r=t.output.slice(2);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem){if(t.redeem.network&&t.redeem.network!==p)throw new TypeError("Network mismatch");if(t.redeem.input&&t.redeem.input.length>0&&t.redeem.witness&&t.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(t.redeem.output){if(0===a.decompile(t.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=i.sha256(t.redeem.output);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem.input&&!a.isPushOnly(f()))throw new TypeError("Non push-only scriptSig");if(t.witness&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.witness,t.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(t.redeem.input&&f().some(d)||t.redeem.output&&(a.decompile(t.redeem.output)||[]).some(d))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(t.witness&&t.witness.length>0){const e=t.witness[t.witness.length-1];if(t.redeem&&t.redeem.output&&!t.redeem.output.equals(e))throw new TypeError("Witness and redeem.output mismatch");if(t.witness.some(d)||(a.decompile(e)||[]).some(d))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(g,t)}},9646:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1614),o=r(394),a=r(5080),s=r(57),u=r(606),c=r(1944),f=r(5041),h=r(622),l=r(885),d=r(7038),p=r(2021),g={network:h.bitcoin,maximumFeeRate:5e3};class y{constructor(t={},e=new i.Psbt(new w)){this.data=e,this.opts=Object.assign({},g,t),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(t,e,r,n)=>Object.defineProperty(t,e,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}static fromBase64(t,e={}){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e={}){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e={}){const r=i.Psbt.fromBuffer(t,m),n=new y(e,r);var o,a;return o=n.__CACHE.__TX,a=n.__CACHE,o.ins.forEach((t=>{B(a,t)})),n}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(t){this.setVersion(t)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(t){this.setLocktime(t)}get txInputs(){return this.__CACHE.__TX.ins.map((t=>({hash:u.cloneBuffer(t.hash),index:t.index,sequence:t.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((t=>{let e;try{e=s.fromOutputScript(t.script,this.opts.network)}catch(t){}return{script:u.cloneBuffer(t.script),value:t.value,address:e}}))}combine(...t){return this.data.combine(...t.map((t=>t.data))),this}clone(){const t=y.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){M(t),this.opts.maximumFeeRate=t}setVersion(t){M(t),R(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){M(t),R(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){M(e),R(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=t)throw new Error("Input index too high");return r.__TX.ins[t].sequence=e,r.__EXTRACTED_TX=void 0,this}addInputs(t){return t.forEach((t=>this.addInput(t))),this}addInput(t){if(arguments.length>1||!t||void 0===t.hash||void 0===t.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");R(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t),B(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&K(this.__CACHE,n,r),e.__FEE=void 0,e.__FEE_RATE=void 0,e.__EXTRACTED_TX=void 0,this}addOutputs(t){return t.forEach((t=>this.addOutput(t))),this}addOutput(t){if(arguments.length>1||!t||void 0===t.value||void 0===t.address&&void 0===t.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");R(this.data.inputs,"addOutput");const{address:e}=t;if("string"==typeof e){const{network:r}=this.opts,n=s.toOutputScript(e,r);t=Object.assign(t,{script:n})}const r=this.__CACHE;return this.data.addOutput(t),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(t){if(!this.data.inputs.every(_))throw new Error("Not finalized");const e=this.__CACHE;if(t||function(t,e,r){const n=e.__FEE_RATE||t.getFeeRate(),i=e.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,e,this.opts),e.__EXTRACTED_TX)return e.__EXTRACTED_TX;const r=e.__TX.clone();return H(this.data.inputs,r,e,!0),r}getFeeRate(){return L("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return L("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return a.checkForInput(this.data.inputs,0),Z(this.data.inputs.length).forEach((t=>this.finalizeInput(t))),this}finalizeInput(t,e=D){const r=a.checkForInput(this.data.inputs,t),{script:n,isP2SH:i,isP2WSH:o,isSegwit:s}=function(t,e,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!e.redeemScript,i.isP2WSH=!!e.witnessScript,e.witnessScript)i.script=e.witnessScript;else if(e.redeemScript)i.script=e.redeemScript;else if(e.nonWitnessUtxo){const o=q(r,e,t),a=n.ins[t].index;i.script=o.outs[a].script}else e.witnessUtxo&&(i.script=e.witnessUtxo.script);return(e.witnessScript||k(i.script))&&(i.isSegwit=!0),i}(t,r,this.__CACHE);if(!n)throw new Error(`No script found for input #${t}`);!function(t){if(!t.sighashType||!t.partialSig)return;const{partialSig:e,sighashType:r}=t;e.forEach((t=>{const{hashType:e}=d.signature.decode(t.signature);if(r!==e)throw new Error("Signature sighash does not match input sighash type")}))}(r);const{finalScriptSig:u,finalScriptWitness:c}=e(t,r,n,s,i,o);if(u&&this.data.updateInput(t,{finalScriptSig:u}),c&&this.data.updateInput(t,{finalScriptWitness:c}),!u&&!c)throw new Error(`Unknown error finalizing input #${t}`);return this.data.clearFinalizedInput(t),this}getInputType(t){const e=a.checkForInput(this.data.inputs,t),r=$(z(t,e,this.__CACHE),t,"input",e.redeemScript||function(t){if(!t)return;const e=d.decompile(t);if(!e)return;const r=e[e.length-1];var i;if(n.isBuffer(r)&&!G(r)&&(i=r,!d.isCanonicalScriptSignature(i))&&d.decompile(r))return r}(e.finalScriptSig),e.witnessScript||function(t){if(!t)return;const e=W(t),r=e[e.length-1];return!G(r)&&d.decompile(r)?r:void 0}(e.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+Y(r.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=z(r,e,n),{meaningfulScript:o}=$(i,r,"input",e.redeemScript,e.witnessScript);return J(t,o)}(e,a.checkForInput(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=a.checkForInput(this.data.inputs,t),n=P(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(t,e){return function(t,e,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=$(i,r,"output",e.redeemScript,e.witnessScript);return J(t,o)}(e,a.checkForOutput(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=a.checkForOutput(this.data.outputs,t),n=P(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(){return a.checkForInput(this.data.inputs,0),Z(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t))).reduce(((t,e)=>!0===e&&t),!0)}validateSignaturesOfInput(t,e){const r=this.data.inputs[t],n=(r||{}).partialSig;if(!r||!n||n.length<1)throw new Error("No signatures to validate");const i=e?n.filter((t=>t.pubkey.equals(e))):n;if(i.length<1)throw new Error("No signatures for this pubkey");const o=[];let a,s,u;for(const e of i){const n=d.signature.decode(e.signature),{hash:i,script:c}=u!==n.hashType?V(t,Object.assign({},r,{sighashType:n.hashType}),this.__CACHE,!0):{hash:a,script:s};u=n.hashType,a=i,s=c,N(e.pubkey,c,"verify");const h=f.fromPublicKey(e.pubkey);o.push(h.verify(i,n.signature))}return o.every((t=>!0===t))}signAllInputsHD(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of Z(this.data.inputs.length))try{this.signInputHD(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey||!t.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of Z(this.data.inputs.length))o.push(this.signInputHDAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");return j(t,this.data.inputs,e).forEach((e=>this.signInput(t,e,r))),this}signInputHDAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=j(t,this.data.inputs,e).map((e=>this.signInputAsync(t,e,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of Z(this.data.inputs.length))try{this.signInput(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInput(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=U(this.data.inputs,t,e.publicKey,this.__CACHE,r),o=[{pubkey:e.publicKey,signature:d.signature.encode(e.sign(n),i)}];return this.data.updateInput(t,{partialSig:o}),this}signInputAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=U(this.data.inputs,t,e.publicKey,this.__CACHE,r);return Promise.resolve(e.sign(n)).then((r=>{const n=[{pubkey:e.publicKey,signature:d.signature.encode(r,i)}];this.data.updateInput(t,{partialSig:n})}))}))}toBuffer(){return b(this.__CACHE),this.data.toBuffer()}toHex(){return b(this.__CACHE),this.data.toHex()}toBase64(){return b(this.__CACHE),this.data.toBase64()}updateGlobal(t){return this.data.updateGlobal(t),this}updateInput(t,e){return e.witnessScript&&X(e.witnessScript),this.data.updateInput(t,e),e.nonWitnessUtxo&&K(this.__CACHE,this.data.inputs[t],t),this}updateOutput(t,e){return this.data.updateOutput(t,e),this}addUnknownKeyValToGlobal(t){return this.data.addUnknownKeyValToGlobal(t),this}addUnknownKeyValToInput(t,e){return this.data.addUnknownKeyValToInput(t,e),this}addUnknownKeyValToOutput(t,e){return this.data.addUnknownKeyValToOutput(t,e),this}clearFinalizedInput(t){return this.data.clearFinalizedInput(t),this}}e.Psbt=y;const m=t=>new w(t);class w{constructor(t=n.from([2,0,0,0,0,0,0,0,0,0])){this.tx=p.Transaction.fromBuffer(t),function(t){if(!t.ins.every((t=>t.script&&0===t.script.length&&t.witness&&0===t.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(t){if(void 0===t.hash||void 0===t.index||!n.isBuffer(t.hash)&&"string"!=typeof t.hash||"number"!=typeof t.index)throw new Error("Error adding input.");const e="string"==typeof t.hash?u.reverseBuffer(n.from(t.hash,"hex")):t.hash;this.tx.addInput(e,t.index,t.sequence)}addOutput(t){if(void 0===t.script||void 0===t.value||!n.isBuffer(t.script)||"number"!=typeof t.value)throw new Error("Error adding output.");this.tx.addOutput(t.script,t.value)}toBuffer(){return this.tx.toBuffer()}}function b(t){if(!1!==t.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function v(t,e,r){if(!e)return!1;let n;if(n=r?r.map((t=>{const r=f.fromPublicKey(t,{compressed:!0}).publicKey;return e.find((t=>t.pubkey.equals(r)))})).filter((t=>!!t)):e,n.length>t)throw new Error("Too many signatures");return n.length===t}function _(t){return!!t.finalScriptSig||!!t.finalScriptWitness}function S(t){return e=>{try{return t({output:e}),!0}catch(t){return!1}}}const A=S(l.p2ms),T=S(l.p2pk),E=S(l.p2pkh),k=S(l.p2wpkh),C=S(l.p2wsh),O=S(l.p2sh);function P(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function M(t){if("number"!=typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function R(t,e){t.forEach((t=>{let r=!1,i=[];if(0===(t.partialSig||[]).length){if(!t.finalScriptSig&&!t.finalScriptWitness)return;i=function(t){const e=t.finalScriptSig&&d.decompile(t.finalScriptSig)||[],r=t.finalScriptWitness&&d.decompile(t.finalScriptWitness)||[];return e.concat(r).filter((t=>n.isBuffer(t)&&d.isCanonicalScriptSignature(t))).map((t=>({signature:t})))}(t)}else i=t.partialSig;if(i.forEach((t=>{const{hashType:n}=d.signature.decode(t.signature),i=[];switch(n&p.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case p.Transaction.SIGHASH_ALL:break;case p.Transaction.SIGHASH_SINGLE:case p.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(e)&&(r=!0)})),r)throw new Error("Can not modify transaction, signatures exist.")}))}function N(t,e,r){if(!J(t,e))throw new Error(`Can not ${r} for this input with the key ${t.toString("hex")}`)}function B(t,e){const r=u.reverseBuffer(n.from(e.hash)).toString("hex")+":"+e.index;if(t.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");t.__TX_IN_CACHE[r]=1}function x(t,e){return(r,n,i,o)=>{const a=t({redeem:{output:i}}).output;if(!n.equals(a))throw new Error(`${e} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const I=x(l.p2sh,"Redeem script"),F=x(l.p2wsh,"Witness script");function L(t,e,r,n){if(!r.every(_))throw new Error(`PSBT must be finalized to calculate ${e}`);if("__FEE_RATE"===t&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===t&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),H(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function D(t,e,r,i,a,s){const u=Y(r);if(!function(t,e,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return v(1,t.partialSig);case"multisig":const r=l.p2ms({output:e});return v(r.m,t.partialSig,r.pubkeys);default:return!1}}(e,r,u))throw new Error(`Can not finalize input #${t}`);return function(t,e,r,i,a,s){let u,c;const f=function(t,e,r){let n;switch(e){case"multisig":const e=function(t,e){return l.p2ms({output:t}).pubkeys.map((t=>(e.filter((e=>e.pubkey.equals(t)))[0]||{}).signature)).filter((t=>!!t))}(t,r);n=l.p2ms({output:t,signatures:e});break;case"pubkey":n=l.p2pk({output:t,signature:r[0].signature});break;case"pubkeyhash":n=l.p2pkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=l.p2wpkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(t,e,r),h=s?l.p2wsh({redeem:f}):null,d=a?l.p2sh({redeem:h||f}):null;return i?(c=function(t){let e=n.allocUnsafe(0);function r(t){const r=e.length,i=o.encodingLength(t);e=n.concat([e,n.allocUnsafe(i)]),o.encode(t,e,r)}function i(t){r(t.length),function(t){e=n.concat([e,n.from(t)])}(t)}var a;return r((a=t).length),a.forEach(i),e}(h?h.witness:f.witness),d&&(u=d.input)):u=d?d.input:f.input,{finalScriptSig:u,finalScriptWitness:c}}(r,u,e.partialSig,i,a,s)}function U(t,e,r,n,i){const o=a.checkForInput(t,e),{hash:s,sighashType:u,script:c}=V(e,o,n,!1,i);return N(r,c,"sign"),{hash:s,sighashType:u}}function V(t,e,r,n,i){const o=r.__TX,a=e.sighashType||p.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const t=function(t){let e=t&p.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&t){case p.Transaction.SIGHASH_ALL:e+="SIGHASH_ALL";break;case p.Transaction.SIGHASH_SINGLE:e+="SIGHASH_SINGLE";break;case p.Transaction.SIGHASH_NONE:e+="SIGHASH_NONE"}return e}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}let s,u;if(e.nonWitnessUtxo){const n=q(r,e,t),i=o.ins[t].hash,a=n.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`);const s=o.ins[t].index;u=n.outs[s]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=e.witnessUtxo}const{meaningfulScript:c,type:f}=$(u.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(f)>=0)s=o.hashForWitnessV0(t,c,u.value,a);else if(k(c)){const e=l.p2pkh({hash:c.slice(2)}).output;s=o.hashForWitnessV0(t,e,u.value,a)}else{if(void 0===e.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${t} has witnessUtxo but non-segwit script: ${c.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as the old TransactionBuilder class when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(t,c,a)}return{script:c,sighashType:a,hash:s}}function j(t,e,r){const n=a.checkForInput(e,t);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((t=>t.masterFingerprint.equals(r.fingerprint)?t:void 0)).filter((t=>!!t));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((t=>{const e=r.derivePath(t.path);if(!t.pubkey.equals(e.publicKey))throw new Error("pubkey did not match bip32Derivation");return e}))}function W(t){let e=0;function r(){const r=o.decode(t,e);return e+=o.decode.bytes,r}return function(){const n=r(),i=[];for(let a=0;a<n;a++)i.push((o=void 0,o=r(),e+=o,t.slice(e-o,e)));var o;return i}()}function K(t,e,r){t.__NON_WITNESS_UTXO_BUF_CACHE[r]=e.nonWitnessUtxo;const n=p.Transaction.fromBuffer(e.nonWitnessUtxo);t.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=t,o=r;delete e.nonWitnessUtxo,Object.defineProperty(e,"nonWitnessUtxo",{enumerable:!0,get(){const t=i.__NON_WITNESS_UTXO_BUF_CACHE[o],e=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==t)return t;{const t=e.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t,t}},set(t){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t}})}function H(t,e,r,n){let i=0;t.forEach(((t,o)=>{if(n&&t.finalScriptSig&&(e.ins[o].script=t.finalScriptSig),n&&t.finalScriptWitness&&(e.ins[o].witness=W(t.finalScriptWitness)),t.witnessUtxo)i+=t.witnessUtxo.value;else if(t.nonWitnessUtxo){const n=q(r,t,o),a=e.ins[o].index,s=n.outs[a];i+=s.value}}));const o=e.outs.reduce(((t,e)=>t+e.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=e.virtualSize();r.__FEE=a,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(a/s)}function q(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||K(t,e,r),n[r]}function z(t,e,r){if(void 0!==e.witnessUtxo)return e.witnessUtxo.script;if(void 0!==e.nonWitnessUtxo)return q(r,e,t).outs[r.__TX.ins[t].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function G(t){return 33===t.length&&d.isCanonicalPubKey(t)}function $(t,e,r,n,i){const o=O(t),a=o&&n&&C(n),s=C(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return a?(u=i,I(e,t,n,r),F(e,n,i,r),X(u)):s?(u=i,F(e,t,i,r),X(u)):o?(u=n,I(e,t,n,r)):u=t,{meaningfulScript:u,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function X(t){if(k(t)||O(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function J(t,e){const r=c.hash160(t),n=d.decompile(e);if(null===n)throw new Error("Unknown script error");return n.some((e=>"number"!=typeof e&&(e.equals(t)||e.equals(r))))}function Y(t){return k(t)?"witnesspubkeyhash":E(t)?"pubkeyhash":A(t)?"multisig":T(t)?"pubkey":"nonstandard"}function Z(t){return[...Array(t).keys()]}},7038:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9464),o=r(1043),a=r(8116),s=r(2368),u=r(1155),c=r(3106),f=r(8676);e.OPS=r(8119);const h=r(1870),l=e.OPS.OP_RESERVED;function d(t){return a.Buffer(t)||function(t){return a.Number(t)&&(t===e.OPS.OP_0||t>=e.OPS.OP_1&&t<=e.OPS.OP_16||t===e.OPS.OP_1NEGATE)}(t)}function p(t){return a.Array(t)&&t.every(d)}function g(t){return 0===t.length?e.OPS.OP_0:1===t.length?t[0]>=1&&t[0]<=16?l+t[0]:129===t[0]?e.OPS.OP_1NEGATE:void 0:void 0}function y(t){return n.isBuffer(t)}function m(t){return n.isBuffer(t)}function w(t){if(y(t))return t;f(a.Array,t);const e=t.reduce(((t,e)=>m(e)?1===e.length&&void 0!==g(e)?t+1:t+c.encodingLength(e.length)+e.length:t+1),0),r=n.allocUnsafe(e);let i=0;if(t.forEach((t=>{if(m(t)){const e=g(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=c.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function b(t){if(r=t,a.Array(r))return t;var r;f(a.Buffer,t);const n=[];let i=0;for(;i<t.length;){const r=t[i];if(r>e.OPS.OP_0&&r<=e.OPS.OP_PUSHDATA4){const e=c.decode(t,i);if(null===e)return null;if(i+=e.size,i+e.number>t.length)return null;const r=t.slice(i,i+e.number);i+=e.number;const o=g(r);void 0!==o?n.push(o):n.push(r)}else n.push(r),i+=1}return n}function v(t){const e=-129&t;return e>0&&e<4}e.isPushOnly=p,e.compile=w,e.decompile=b,e.toASM=function(t){return y(t)&&(t=b(t)),t.map((t=>{if(m(t)){const e=g(t);if(void 0===e)return t.toString("hex");t=e}return h[t]})).join(" ")},e.fromASM=function(t){return f(a.String,t),w(t.split(" ").map((t=>void 0!==e.OPS[t]?e.OPS[t]:(f(a.Hex,t),n.from(t,"hex")))))},e.toStack=function(t){return t=b(t),f(p,t),t.map((t=>m(t)?t:t===e.OPS.OP_0?n.allocUnsafe(0):i.encode(t-l)))},e.isCanonicalPubKey=function(t){return u.isPoint(t)},e.isDefinedHashType=v,e.isCanonicalScriptSignature=function(t){return!!n.isBuffer(t)&&!!v(t[t.length-1])&&s.check(t.slice(0,-1))},e.number=i,e.signature=o},9464:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e,r){e=e||4,r=void 0===r||r;const n=t.length;if(0===n)return 0;if(n>e)throw new TypeError("Script number overflow");if(r&&!(127&t[n-1]||!(n<=1)&&128&t[n-2]))throw new Error("Non-minimally encoded script number");if(5===n){const e=t.readUInt32LE(0),r=t.readUInt8(4);return 128&r?-(4294967296*(-129&r)+e):4294967296*r+e}let i=0;for(let e=0;e<n;++e)i|=t[e]<<8*e;return 128&t[n-1]?-(i&~(128<<8*(n-1))):i},e.encode=function(t){let e=Math.abs(t);const r=(i=e)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),a=t<0;for(let t=0;t<r;++t)o.writeUInt8(255&e,t),e>>=8;return 128&o[r-1]?o.writeUInt8(a?128:0,r-1):a&&(o[r-1]|=128),o}},1043:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8116),o=r(2368),a=r(8676),s=n.alloc(1,0);function u(t){let e=0;for(;0===t[e];)++e;return e===t.length?s:128&(t=t.slice(e))[0]?n.concat([s,t],1+t.length):t}function c(t){0===t[0]&&(t=t.slice(1));const e=n.alloc(32,0),r=Math.max(0,32-t.length);return t.copy(e,r),e}e.decode=function(t){const e=t.readUInt8(t.length-1),r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const i=o.decode(t.slice(0,-1)),a=c(i.r),s=c(i.s);return{signature:n.concat([a,s],64),hashType:e}},e.encode=function(t,e){a({signature:i.BufferN(64),hashType:i.UInt8},{signature:t,hashType:e});const r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const s=n.allocUnsafe(1);s.writeUInt8(e,0);const c=u(t.slice(0,32)),f=u(t.slice(32,64));return n.concat([o.encode(c,f),s])}},2124:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3324);e.input=n;const i=r(3431);e.output=i},3324:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){return t===i.OPS.OP_0||n.isCanonicalScriptSignature(t)}function a(t,e){const r=n.decompile(t);return!(r.length<2)&&r[0]===i.OPS.OP_0&&(e?r.slice(1).every(o):r.slice(1).every(n.isCanonicalScriptSignature))}e.check=a,a.toJSON=()=>"multisig input"},3431:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038),o=r(8116),a=i.OPS.OP_RESERVED;function s(t,e){const r=n.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==i.OPS.OP_CHECKMULTISIG)return!1;if(!o.Number(r[0]))return!1;if(!o.Number(r[r.length-2]))return!1;const s=r[0]-a,u=r[r.length-2]-a;return!(s<=0)&&(!(u>16)&&(!(s>u)&&(u===r.length-3&&(!!e||r.slice(1,-2).every(n.isCanonicalPubKey)))))}e.check=s,s.toJSON=()=>"multi-sig output"},8608:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=n.OPS;function o(t){const e=n.compile(t);return e.length>1&&e[0]===i.OP_RETURN}e.check=o,o.toJSON=()=>"null data output";const a={check:o};e.output=a},9856:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1184);e.input=n;const i=r(3603);e.output=i},1184:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038);function i(t){const e=n.decompile(t);return 1===e.length&&n.isCanonicalScriptSignature(e[0])}e.check=i,i.toJSON=()=>"pubKey input"},3603:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalPubKey(e[0])&&e[1]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKey output"},1168:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2496);e.input=n;const i=r(7443);e.output=i},2496:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&n.isCanonicalPubKey(e[1])}e.check=i,i.toJSON=()=>"pubKeyHash input"},7443:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){const e=n.compile(t);return 25===e.length&&e[0]===i.OPS.OP_DUP&&e[1]===i.OPS.OP_HASH160&&20===e[2]&&e[23]===i.OPS.OP_EQUALVERIFY&&e[24]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKeyHash output"},8573:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(45);e.input=n;const i=r(2068);e.output=i},45:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7038),o=r(2124),a=r(9856),s=r(1168),u=r(998),c=r(7389);function f(t,e){const r=i.decompile(t);if(r.length<1)return!1;const f=r[r.length-1];if(!n.isBuffer(f))return!1;const h=i.decompile(i.compile(r.slice(0,-1))),l=i.decompile(f);return!!l&&!!i.isPushOnly(h)&&(1===r.length?c.check(l)||u.check(l):!(!s.input.check(h)||!s.output.check(l))||!(!o.input.check(h,e)||!o.output.check(l))||!(!a.input.check(h)||!a.output.check(l)))}e.check=f,f.toJSON=()=>"scriptHash input"},2068:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){const e=n.compile(t);return 23===e.length&&e[0]===i.OPS.OP_HASH160&&20===e[1]&&e[22]===i.OPS.OP_EQUAL}e.check=o,o.toJSON=()=>"scriptHash output"},1180:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8263);e.output=n},8263:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7038),o=r(7038),a=r(8116),s=r(8676),u=n.from("aa21a9ed","hex");function c(t){const e=i.compile(t);return e.length>37&&e[0]===o.OPS.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(u)}e.check=c,c.toJSON=()=>"Witness commitment output",e.encode=function(t){s(a.Hash256bit,t);const e=n.allocUnsafe(36);return u.copy(e,0),t.copy(e,4),i.compile([o.OPS.OP_RETURN,e])},e.decode=function(t){return s(c,t),i.decompile(t)[1].slice(4,36)}},6323:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(232);e.input=n;const i=r(998);e.output=i},232:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&(r=e[1],n.isCanonicalPubKey(r)&&33===r.length);var r}e.check=i,i.toJSON=()=>"witnessPubKeyHash input"},998:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){const e=n.compile(t);return 22===e.length&&e[0]===i.OPS.OP_0&&20===e[1]}e.check=o,o.toJSON=()=>"Witness pubKeyHash output"},7926:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6942);e.input=n;const i=r(7389);e.output=i},6942:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7038),o=r(8676),a=r(2124),s=r(9856),u=r(1168);function c(t,e){if(o(o.Array,t),t.length<1)return!1;const r=t[t.length-1];if(!n.isBuffer(r))return!1;const c=i.decompile(r);if(!c||0===c.length)return!1;const f=i.compile(t.slice(0,-1));return!(!u.input.check(f)||!u.output.check(c))||!(!a.input.check(f,e)||!a.output.check(c))||!(!s.input.check(f)||!s.output.check(c))}e.check=c,c.toJSON=()=>"witnessScriptHash input"},7389:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7038),i=r(7038);function o(t){const e=n.compile(t);return 34===e.length&&e[0]===i.OPS.OP_0&&32===e[1]}e.check=o,o.toJSON=()=>"Witness scriptHash output"},2021:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(606),o=r(1944),a=r(7038),s=r(7038),u=r(8116),c=r(8676),f=r(8469);function h(t){const e=t.length;return f.encodingLength(e)+e}const l=n.allocUnsafe(0),d=[],p=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),g=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),y=n.from("ffffffffffffffff","hex"),m={script:l,valueBuffer:y};class w{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,e){const r=new i.BufferReader(t),n=new w;n.version=r.readInt32();const o=r.readUInt8(),a=r.readUInt8();let s=!1;o===w.ADVANCED_TRANSACTION_MARKER&&a===w.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;const u=r.readVarInt();for(let t=0;t<u;++t)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:d});const c=r.readVarInt();for(let t=0;t<c;++t)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(let t=0;t<u;++t)n.ins[t].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),e)return n;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return n}static fromHex(t){return w.fromBuffer(n.from(t,"hex"),!1)}static isCoinbaseHash(t){c(u.Hash256bit,t);for(let e=0;e<32;++e)if(0!==t[e])return!1;return!0}isCoinbase(){return 1===this.ins.length&&w.isCoinbaseHash(this.ins[0].hash)}addInput(t,e,r,n){return c(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=w.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:e,script:n||l,sequence:r,witness:d})-1}addOutput(t,e){return c(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:t,value:e})-1}hasWitnesses(){return this.ins.some((t=>0!==t.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const e=t&&this.hasWitnesses();return(e?10:8)+f.encodingLength(this.ins.length)+f.encodingLength(this.outs.length)+this.ins.reduce(((t,e)=>t+40+h(e.script)),0)+this.outs.reduce(((t,e)=>t+8+h(e.script)),0)+(e?this.ins.reduce(((t,e)=>t+function(t){const e=t.length;return f.encodingLength(e)+t.reduce(((t,e)=>t+h(e)),0)}(e.witness)),0):0)}clone(){const t=new w;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((t=>({hash:t.hash,index:t.index,script:t.script,sequence:t.sequence,witness:t.witness}))),t.outs=this.outs.map((t=>({script:t.script,value:t.value}))),t}hashForSignature(t,e,r){if(c(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),t>=this.ins.length)return g;const i=a.compile(a.decompile(e).filter((t=>t!==s.OPS.OP_CODESEPARATOR))),f=this.clone();if((31&r)===w.SIGHASH_NONE)f.outs=[],f.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}));else if((31&r)===w.SIGHASH_SINGLE){if(t>=this.outs.length)return g;f.outs.length=t+1;for(let e=0;e<t;e++)f.outs[e]=m;f.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}))}r&w.SIGHASH_ANYONECANPAY?(f.ins=[f.ins[t]],f.ins[0].script=i):(f.ins.forEach((t=>{t.script=l})),f.ins[t].script=i);const h=n.allocUnsafe(f.byteLength(!1)+4);return h.writeInt32LE(r,h.length-4),f.__toBuffer(h,0,!1),o.hash256(h)}hashForWitnessV0(t,e,r,a){c(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let s,f=n.from([]),l=p,d=p,g=p;if(a&w.SIGHASH_ANYONECANPAY||(f=n.allocUnsafe(36*this.ins.length),s=new i.BufferWriter(f,0),this.ins.forEach((t=>{s.writeSlice(t.hash),s.writeUInt32(t.index)})),d=o.hash256(f)),a&w.SIGHASH_ANYONECANPAY||(31&a)===w.SIGHASH_SINGLE||(31&a)===w.SIGHASH_NONE||(f=n.allocUnsafe(4*this.ins.length),s=new i.BufferWriter(f,0),this.ins.forEach((t=>{s.writeUInt32(t.sequence)})),g=o.hash256(f)),(31&a)!==w.SIGHASH_SINGLE&&(31&a)!==w.SIGHASH_NONE){const t=this.outs.reduce(((t,e)=>t+8+h(e.script)),0);f=n.allocUnsafe(t),s=new i.BufferWriter(f,0),this.outs.forEach((t=>{s.writeUInt64(t.value),s.writeVarSlice(t.script)})),l=o.hash256(f)}else if((31&a)===w.SIGHASH_SINGLE&&t<this.outs.length){const e=this.outs[t];f=n.allocUnsafe(8+h(e.script)),s=new i.BufferWriter(f,0),s.writeUInt64(e.value),s.writeVarSlice(e.script),l=o.hash256(f)}f=n.allocUnsafe(156+h(e)),s=new i.BufferWriter(f,0);const y=this.ins[t];return s.writeUInt32(this.version),s.writeSlice(d),s.writeSlice(g),s.writeSlice(y.hash),s.writeUInt32(y.index),s.writeVarSlice(e),s.writeUInt64(r),s.writeUInt32(y.sequence),s.writeSlice(l),s.writeUInt32(this.locktime),s.writeUInt32(a),o.hash256(f)}getHash(t){return t&&this.isCoinbase()?n.alloc(32,0):o.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return i.reverseBuffer(this.getHash(!1)).toString("hex")}toBuffer(t,e){return this.__toBuffer(t,e,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,e){c(u.tuple(u.Number,u.Buffer),arguments),this.ins[t].script=e}setWitness(t,e){c(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[t].witness=e}__toBuffer(t,e,r=!1){t||(t=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(t,e||0);o.writeInt32(this.version);const a=r&&this.hasWitnesses();return a&&(o.writeUInt8(w.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(w.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((t=>{o.writeSlice(t.hash),o.writeUInt32(t.index),o.writeVarSlice(t.script),o.writeUInt32(t.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((t=>{void 0!==t.value?o.writeUInt64(t.value):o.writeSlice(t.valueBuffer),o.writeVarSlice(t.script)})),a&&this.ins.forEach((t=>{o.writeVector(t.witness)})),o.writeUInt32(this.locktime),void 0!==e?t.slice(e,o.offset):t}}w.DEFAULT_SEQUENCE=4294967295,w.SIGHASH_ALL=1,w.SIGHASH_NONE=2,w.SIGHASH_SINGLE=3,w.SIGHASH_ANYONECANPAY=128,w.ADVANCED_TRANSACTION_MARKER=0,w.ADVANCED_TRANSACTION_FLAG=1,e.Transaction=w},2401:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(57),o=r(606),a=r(2503),s=r(1944),u=r(5041),c=r(622),f=r(885),h=r(7038),l=r(7038),d=r(2021),p=r(8116),g=r(8676),y=a.types,m=new Set(["p2pkh","p2pk","p2wpkh","p2ms","p2sh-p2pkh","p2sh-p2pk","p2sh-p2wpkh","p2sh-p2ms","p2wsh-p2pkh","p2wsh-p2pk","p2wsh-p2ms","p2sh-p2wsh-p2pkh","p2sh-p2wsh-p2pk","p2sh-p2wsh-p2ms"]);function w(t,e,r){try{g(t,e)}catch(t){throw new Error(r)}}class b{constructor(t=c.bitcoin,e=2500){this.network=t,this.maximumFeeRate=e,this.__PREV_TX_SET={},this.__INPUTS=[],this.__TX=new d.Transaction,this.__TX.version=2,this.__USE_LOW_R=!1,console.warn("Deprecation Warning: TransactionBuilder will be removed in the future. (v6.x.x or later) Please use the Psbt class instead. Examples of usage are available in the transactions-psbt.js integration test file on our Github. A high level explanation is available in the psbt.ts and psbt.js files as well.")}static fromTransaction(t,e){const r=new b(e);return r.setVersion(t.version),r.setLockTime(t.locktime),t.outs.forEach((t=>{r.addOutput(t.script,t.value)})),t.ins.forEach((t=>{r.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness})})),r.__INPUTS.forEach(((e,r)=>{!function(t,e,r){if(t.redeemScriptType!==y.P2MS||!t.redeemScript)return;if(t.pubkeys.length===t.signatures.length)return;const n=t.signatures.concat();t.signatures=t.pubkeys.map((i=>{const o=u.fromPublicKey(i);let a;return n.some(((i,s)=>{if(!i)return!1;const u=h.signature.decode(i),c=e.hashForSignature(r,t.redeemScript,u.hashType);return!!o.verify(c,u.signature)&&(n[s]=void 0,a=i,!0)})),a}))}(e,t,r)})),r}setLowR(t){return g(g.maybe(g.Boolean),t),void 0===t&&(t=!0),this.__USE_LOW_R=t,t}setLockTime(t){if(g(p.UInt32,t),this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>void 0!==t)))))throw new Error("No, this would invalidate signatures");this.__TX.locktime=t}setVersion(t){g(p.UInt32,t),this.__TX.version=t}addInput(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let a;if("string"==typeof(s=t)||s instanceof String)t=o.reverseBuffer(n.from(t,"hex"));else if(function(t){return t instanceof d.Transaction}(t)){const r=t.outs[e];i=r.script,a=r.value,t=t.getHash(!1)}var s;return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:a})}addOutput(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=i.toOutputScript(t,this.network)),this.__TX.addOutput(t,e)}build(){return this.__build(!1)}buildIncomplete(){return this.__build(!0)}sign(t,e,r,n,i,o){!function({input:t,ourPubKey:e,keyPair:r,signatureHash:n,hashType:i,useLowR:o}){let a=!1;for(const[s,u]of t.pubkeys.entries()){if(!e.equals(u))continue;if(t.signatures[s])throw new Error("Signature already exists");if(33!==e.length&&t.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const c=r.sign(n,o);t.signatures[s]=h.signature.encode(c,i),a=!0}if(!a)throw new Error("Key pair cannot sign for this input")}(function(t,e,r,n,i,o,a,s,u,c,l){let b;if("number"==typeof i)console.warn("DEPRECATED: TransactionBuilder sign method arguments will change in v6, please use the TxbSignArg interface"),b=i;else{if("object"!=typeof i)throw new TypeError("TransactionBuilder sign first arg must be TxbSignArg or number");!function(t,e){if(!m.has(e.prevOutScriptType))throw new TypeError(`Unknown prevOutScriptType "${e.prevOutScriptType}"`);w(g.Number,e.vin,"sign must include vin parameter as Number (input index)"),w(p.Signer,e.keyPair,"sign must include keyPair parameter as Signer interface"),w(g.maybe(g.Number),e.hashType,"sign hashType parameter must be a number");const r=(t[e.vin]||[]).prevOutType,n=e.prevOutScriptType;switch(n){case"p2pkh":if(r&&"pubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2pkh: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),w(g.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2pk":if(r&&"pubkey"!==r)throw new TypeError(`input #${e.vin} is not of type p2pk: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),w(g.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wpkh":if(r&&"witnesspubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2wpkh: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),w(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2ms":if(r&&"multisig"!==r)throw new TypeError(`input #${e.vin} is not of type p2ms: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),w(g.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2sh-p2wpkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type p2sh-p2wpkh: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.Buffer,e.redeemScript,`${n} requires redeemScript`),w(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2ms":case"p2sh-p2pk":case"p2sh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);w(g.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),w(g.Buffer,e.redeemScript,`${n} requires redeemScript`),w(g.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wsh-p2ms":case"p2wsh-p2pk":case"p2wsh-p2pkh":if(r&&"witnessscripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);w(g.Buffer,e.witnessScript,`${n} requires witnessScript`),w(g.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),w(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2wsh-p2ms":case"p2sh-p2wsh-p2pk":case"p2sh-p2wsh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);w(g.Buffer,e.witnessScript,`${n} requires witnessScript`),w(g.Buffer,e.redeemScript,`${n} requires witnessScript`),w(p.Satoshi,e.witnessValue,`${n} requires witnessScript`)}}(e,i),({vin:b,keyPair:o,redeemScript:a,hashType:s,witnessValue:u,witnessScript:c}=i)}if(void 0===o)throw new Error("sign requires keypair");if(o.network&&o.network!==t)throw new TypeError("Inconsistent network");if(!e[b])throw new Error("No input at index: "+b);if(r(s=s||d.Transaction.SIGHASH_ALL))throw new Error("Transaction needs outputs");const v=e[b];if(void 0!==v.redeemScript&&a&&!v.redeemScript.equals(a))throw new Error("Inconsistent redeemScript");const S=o.publicKey||o.getPublicKey&&o.getPublicKey();if(!A(v)){if(void 0!==u){if(void 0!==v.value&&v.value!==u)throw new Error("Input did not match witnessValue");g(p.Satoshi,u),v.value=u}if(!A(v)){const t=function(t,e,r,n){if(r&&n){const i=f.p2wsh({redeem:{output:n}}),o=f.p2wsh({output:r}),a=f.p2sh({redeem:{output:r}}),s=f.p2sh({redeem:i});if(!i.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!a.hash.equals(s.hash))throw new Error("Redeem script inconsistent with prevOutScript");const u=_(i.redeem.output,e);if(!u.pubkeys)throw new Error(u.type+" not supported as witnessScript ("+h.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(u.signatures=t.signatures);const c=n;if(u.type===y.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:y.P2WSH,witnessScript:n,witnessScriptType:u.type,prevOutType:y.P2SH,prevOutScript:a.output,hasWitness:!0,signScript:c,signType:u.type,pubkeys:u.pubkeys,signatures:u.signatures,maxSignatures:u.maxSignatures}}if(r){const n=f.p2sh({redeem:{output:r}});if(t.prevOutScript){let e;try{e=f.p2sh({output:t.prevOutScript})}catch(t){throw new Error("PrevOutScript must be P2SH")}if(!n.hash.equals(e.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const i=_(n.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as redeemScript ("+h.toASM(r)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);let o=r;return i.type===y.P2WPKH&&(o=f.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:y.P2SH,prevOutScript:n.output,hasWitness:i.type===y.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(n){const r=f.p2wsh({redeem:{output:n}});if(t.prevOutScript){const e=f.p2wsh({output:t.prevOutScript});if(!r.hash.equals(e.hash))throw new Error("Witness script inconsistent with prevOutScript")}const i=_(r.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as witnessScript ("+h.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);const o=n;if(i.type===y.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:n,witnessScriptType:i.type,prevOutType:y.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(t.prevOutType&&t.prevOutScript){if(t.prevOutType===y.P2SH)throw new Error("PrevOutScript is "+t.prevOutType+", requires redeemScript");if(t.prevOutType===y.P2WSH)throw new Error("PrevOutScript is "+t.prevOutType+", requires witnessScript");if(!t.prevOutScript)throw new Error("PrevOutScript is missing");const r=_(t.prevOutScript,e);if(!r.pubkeys)throw new Error(r.type+" not supported ("+h.toASM(t.prevOutScript)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(r.signatures=t.signatures);let n=t.prevOutScript;return r.type===y.P2WPKH&&(n=f.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:t.prevOutScript,hasWitness:r.type===y.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures,maxSignatures:r.maxSignatures}}const i=f.p2pkh({pubkey:e}).output;return{prevOutType:y.P2PKH,prevOutScript:i,hasWitness:!1,signScript:i,signType:y.P2PKH,pubkeys:[e],signatures:[void 0]}}(v,S,a,c);Object.assign(v,t)}if(!A(v))throw Error(v.prevOutType+" not supported")}let T;return T=v.hasWitness?n.hashForWitnessV0(b,v.signScript,v.value,s):n.hashForSignature(b,v.signScript,s),{input:v,ourPubKey:S,keyPair:o,signatureHash:T,hashType:s,useLowR:!!l}}(this.network,this.__INPUTS,this.__needsOutputs.bind(this),this.__TX,t,e,r,n,i,o,this.__USE_LOW_R))}__addInputUnsafe(t,e,r){if(d.Transaction.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");const n=t.toString("hex")+":"+e;if(void 0!==this.__PREV_TX_SET[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=v(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let t;if(!i.pubkeys&&!i.signatures){const e=_(r.prevOutScript);e.pubkeys&&(i.pubkeys=e.pubkeys,i.signatures=e.signatures),t=e.type}i.prevOutScript=r.prevOutScript,i.prevOutType=t||a.output(r.prevOutScript)}const o=this.__TX.addInput(t,e,r.sequence,r.scriptSig);return this.__INPUTS[o]=i,this.__PREV_TX_SET[n]=!0,o}__build(t){if(!t){if(!this.__TX.ins.length)throw new Error("Transaction has no inputs");if(!this.__TX.outs.length)throw new Error("Transaction has no outputs")}const e=this.__TX.clone();if(this.__INPUTS.forEach(((r,n)=>{if(!r.prevOutType&&!t)throw new Error("Transaction is not complete");const i=S(r.prevOutType,r,t);if(i)e.setInputScript(n,i.input),e.setWitness(n,i.witness);else{if(!t&&r.prevOutType===y.NONSTANDARD)throw new Error("Unknown input type");if(!t)throw new Error("Not enough information")}})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e}__canModifyInputs(){return this.__INPUTS.every((t=>!t.signatures||t.signatures.every((t=>!t||!!(T(t)&d.Transaction.SIGHASH_ANYONECANPAY)))))}__needsOutputs(t){return t===d.Transaction.SIGHASH_ALL?0===this.__TX.outs.length:0===this.__TX.outs.length&&this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>!!t&&!(T(t)&d.Transaction.SIGHASH_NONE)))))}__canModifyOutputs(){const t=this.__TX.ins.length,e=this.__TX.outs.length;return this.__INPUTS.every((r=>void 0===r.signatures||r.signatures.every((r=>{if(!r)return!0;const n=31&T(r);return n===d.Transaction.SIGHASH_NONE||n===d.Transaction.SIGHASH_SINGLE&&t<=e}))))}__overMaximumFees(t){return(this.__INPUTS.reduce(((t,e)=>t+(e.value>>>0)),0)-this.__TX.outs.reduce(((t,e)=>t+e.value),0))/t>this.maximumFeeRate}}function v(t,e,r,n){if(0===t.length&&0===e.length)return{};if(!r){let n=a.input(t,!0),i=a.witness(e,!0);n===y.NONSTANDARD&&(n=void 0),i===y.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case y.P2WPKH:{const{output:t,pubkey:r,signature:n}=f.p2wpkh({witness:e});return{prevOutScript:t,prevOutType:y.P2WPKH,pubkeys:[r],signatures:[n]}}case y.P2PKH:{const{output:e,pubkey:r,signature:n}=f.p2pkh({input:t});return{prevOutScript:e,prevOutType:y.P2PKH,pubkeys:[r],signatures:[n]}}case y.P2PK:{const{signature:e}=f.p2pk({input:t});return{prevOutType:y.P2PK,pubkeys:[void 0],signatures:[e]}}case y.P2MS:{const{m:e,pubkeys:r,signatures:i}=f.p2ms({input:t,output:n},{allowIncomplete:!0});return{prevOutType:y.P2MS,pubkeys:r,signatures:i,maxSignatures:e}}}if(r===y.P2SH){const{output:r,redeem:n}=f.p2sh({input:t,witness:e}),i=a.output(n.output),o=v(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:y.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===y.P2WSH){const{output:r,redeem:n}=f.p2wsh({input:t,witness:e}),i=a.output(n.output);let o;return o=i===y.P2WPKH?v(n.input,n.witness,i):v(h.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:y.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:y.NONSTANDARD,prevOutScript:t}}function _(t,e){g(p.Buffer,t);const r=a.output(t);switch(r){case y.P2PKH:{if(!e)return{type:r};const n=f.p2pkh({output:t}).hash,i=s.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case y.P2WPKH:{if(!e)return{type:r};const n=f.p2wpkh({output:t}).hash,i=s.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case y.P2PK:return{type:r,pubkeys:[f.p2pk({output:t}).pubkey],signatures:[void 0]};case y.P2MS:{const e=f.p2ms({output:t});return{type:r,pubkeys:e.pubkeys,signatures:e.pubkeys.map((()=>{})),maxSignatures:e.m}}}return{type:r}}function S(t,e,r){const n=e.pubkeys||[];let i=e.signatures||[];switch(t){case y.P2PKH:if(0===n.length)break;if(0===i.length)break;return f.p2pkh({pubkey:n[0],signature:i[0]});case y.P2WPKH:if(0===n.length)break;if(0===i.length)break;return f.p2wpkh({pubkey:n[0],signature:i[0]});case y.P2PK:if(0===n.length)break;if(0===i.length)break;return f.p2pk({signature:i[0]});case y.P2MS:{const t=e.maxSignatures;i=r?i.map((t=>t||l.OPS.OP_0)):i.filter((t=>t));const o=!r||t===i.length;return f.p2ms({m:t,pubkeys:n,signatures:i},{allowIncomplete:r,validate:o})}case y.P2SH:{const t=S(e.redeemScriptType,e,r);if(!t)return;return f.p2sh({redeem:{output:t.output||e.redeemScript,input:t.input,witness:t.witness}})}case y.P2WSH:{const t=S(e.witnessScriptType,e,r);if(!t)return;return f.p2wsh({redeem:{output:e.witnessScript,input:t.input,witness:t.witness}})}}}function A(t){return void 0!==t.signScript&&void 0!==t.signType&&void 0!==t.pubkeys&&void 0!==t.signatures&&t.signatures.length===t.pubkeys.length&&t.pubkeys.length>0&&(!1===t.hasWitness||void 0!==t.value)}function T(t){return t.readUInt8(t.length-1)}e.TransactionBuilder=b},8116:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8676),i=Math.pow(2,31)-1;function o(t){return n.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return n.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(n.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return n.UInt53(t)&&t<=21e14},e.ECPoint=n.quacksLike("Point"),e.Network=n.compile({messagePrefix:n.oneOf(n.Buffer,n.String),bip32:{public:n.UInt32,private:n.UInt32},pubKeyHash:n.UInt8,scriptHash:n.UInt8,wif:n.UInt8}),e.Buffer256bit=n.BufferN(32),e.Hash160bit=n.BufferN(20),e.Hash256bit=n.BufferN(32),e.Number=n.Number,e.Array=n.Array,e.Boolean=n.Boolean,e.String=n.String,e.Buffer=n.Buffer,e.Hex=n.Hex,e.maybe=n.maybe,e.tuple=n.tuple,e.UInt8=n.UInt8,e.UInt32=n.UInt32,e.Function=n.Function,e.BufferN=n.BufferN,e.Null=n.Null,e.oneOf=n.oneOf},5037:(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;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(3776);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},6763:(t,e,r)=>{var n=r(5364);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9204:(t,e,r)=>{"use strict";var n=r(6763),i=r(2861).Buffer;t.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=t(e);return n.encode(i.concat([e,r],e.length+4))},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},1889:(t,e,r)=>{"use strict";var n=r(7108),i=r(9204);t.exports=i((function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()}))},8287:(t,e,r)=>{"use strict";const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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 h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=s(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(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(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.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 f(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 h(t){return f(t),s(t<0?0:0|p(t))}function l(t){const e=t.length<0?0:0|p(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(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);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(i)return n?-1:z(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){let 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 M(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function w(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),J(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(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):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,a=1,s=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;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let n=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let a;for(n>o/2&&(n=o/2),a=0;a<n;++a){const n=parseInt(e.substr(2*a,2),16);if(J(n))return a;t[r+a]=n}return a}function _(t,e,r,n){return $(z(e,t.length-r),t,r,n)}function S(t,e,r,n){return $(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return $(G(e),t,r,n)}function T(t,e,r,n){return $(function(t,e){let r,n,i;const o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,a=e>239?4:e>223?3:e>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(t){const e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=C));return r}(n)}e.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(X(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const s=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<s;++t)if(c[t]!==f[t]){o=c[t],a=f[t];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const 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");let o=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function P(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function M(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Y[t[n]];return i}function R(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n,i){W(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function I(t,e,r,n,i){W(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function F(t,e,r,n,i,o){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,o){return e=+e,r>>>=0,o||F(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return e=+e,r>>>=0,o||F(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const 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<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(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 t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=Z((function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeBigUInt64LE=Z((function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Z((function(t,e=0){return I(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=0,o=1,a=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/o|0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o|0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),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||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeBigInt64LE=Z((function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Z((function(t,e=0){return I(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),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 D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%a]}return this};const U={};function V(t,e,r){U[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function j(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function W(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new U.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function K(t,e){if("number"!=typeof t)throw new U.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw K(t,r),new U.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function z(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Y=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},1225:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;const n=r(8010),i=r(785),o=r(9175);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};const a={};a[0]=e.versions.mainnet.p2pkh,a[5]=e.versions.mainnet.p2sh,a[111]=e.versions.testnet.p2pkh,a[196]=e.versions.testnet.p2sh;const s={};function u(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return`S${(0,n.c32checkEncode)(t,e)}`}function c(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return(0,n.c32checkDecode)(t.slice(1))}s[e.versions.mainnet.p2pkh]=0,s[e.versions.mainnet.p2sh]=5,s[e.versions.testnet.p2pkh]=111,s[e.versions.testnet.p2sh]=196,e.c32address=u,e.c32addressDecode=c,e.b58ToC32=function(t,e=-1){const r=i.decode(t),n=(0,o.bytesToHex)(r.data),s=parseInt((0,o.bytesToHex)(r.prefix),16);let c;return e<0?(c=s,void 0!==a[s]&&(c=a[s])):c=e,u(c,n)},e.c32ToB58=function(t,e=-1){const r=c(t),n=r[0],o=r[1];let a;e<0?(a=n,void 0!==s[n]&&(a=s[n])):a=e;let u=a.toString(16);return 1===u.length&&(u=`0${u}`),i.encode(o,u)}},785:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;const n=r(2623),i=r(9175),o=r(5636),a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e="00"){const r="string"==typeof t?(0,i.hexToBytes)(t):t,s="string"==typeof e?(0,i.hexToBytes)(e):t;if(!(r instanceof Uint8Array&&s instanceof Uint8Array))throw new TypeError("Argument must be of type Uint8Array or string");const u=(0,n.sha256)((0,n.sha256)(new Uint8Array([...s,...r])));return o(a).encode([...s,...r,...u.slice(0,4)])},e.decode=function(t){const e=o(a).decode(t),r=e.slice(0,1),i=e.slice(1,-4),s=(0,n.sha256)((0,n.sha256)(new Uint8Array([...r,...i])));return e.slice(-4).forEach(((t,e)=>{if(t!==s[e])throw new Error("Invalid checksum")})),{prefix:r,data:i}}},8010:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;const n=r(2623),i=r(9175),o=r(1556);function a(t){const e=(0,n.sha256)((0,n.sha256)((0,i.hexToBytes)(t)));return(0,i.bytesToHex)(e.slice(0,4))}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e=`0${e}`);let r=t.toString(16);1===r.length&&(r=`0${r}`);const n=a(`${r}${e}`),i=(0,o.c32encode)(`${e}${n}`);return`${o.c32[t]}${i}`},e.c32checkDecode=function(t){t=(0,o.c32normalize)(t);const e=(0,o.c32decode)(t.slice(1)),r=t[0],n=o.c32.indexOf(r),i=e.slice(-8);let s=n.toString(16);if(1===s.length&&(s=`0${s}`),a(`${s}${e.substring(0,e.length-8)}`)!==i)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},1556:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;const n=r(9175);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";const i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,r){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t=`0${t}`);let o=[],a=0;for(let r=(t=t.toLowerCase()).length-1;r>=0;r--)if(a<4){const n=i.indexOf(t[r])>>a;let s=0;0!==r&&(s=i.indexOf(t[r-1]));const u=1+a,c=s%(1<<u)<<5-u,f=e.c32[n+c];a=u,o.unshift(f)}else a=0;let s=0;for(let t=0;t<o.length&&"0"===o[t];t++)s++;o=o.slice(s);const u=(new TextDecoder).decode((0,n.hexToBytes)(t)).match(/^\u0000*/),c=u?u[0].length:0;for(let t=0;t<c;t++)o.unshift(e.c32[0]);if(r){const t=r-o.length;for(let r=0;r<t;r++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,r){if(!(t=o(t)).match(`^[${e.c32}]*$`))throw new Error("Not a c32-encoded string");const n=t.match(`^${e.c32[0]}*`),a=n?n[0].length:0;let s=[],u=0,c=0;for(let r=t.length-1;r>=0;r--){4===c&&(s.unshift(i[u]),c=0,u=0);const n=(e.c32.indexOf(t[r])<<c)+u,o=i[n%16];if(c+=1,u=n>>4,u>1<<c)throw new Error("Panic error in decoding.");s.unshift(o)}s.unshift(i[u]),s.length%2==1&&s.unshift("0");let f=0;for(let t=0;t<s.length&&"0"===s[t];t++)f++;s=s.slice(f-f%2);let h=s.join("");for(let t=0;t<a;t++)h=`00${h}`;if(r){const t=2*r-h.length;for(let e=0;e<t;e+=2)h=`00${h}`}return h}},7581:(t,e,r)=>{"use strict";e.ns=e.bJ=void 0;r(1556),r(8010);const n=r(1225);Object.defineProperty(e,"bJ",{enumerable:!0,get:function(){return n.c32address}}),Object.defineProperty(e,"ns",{enumerable:!0,get:function(){return n.c32addressDecode}})},5636:t=>{"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<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var a=t.length,s=t.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===s;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,l=o-1;(0!==f||h<i)&&-1!==l;l--,h++)f+=a*c[l]>>>0,c[l]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var d=o-i;d!==o&&0===c[d];)d++;for(var p=new Uint8Array(n+(o-d)),g=n;d!==o;)p[g++]=c[d++];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,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],l=0,d=u-1;(0!==h||l<n)&&-1!==d;d--,l++)h+=256*f[d]>>>0,f[d]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=l,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var g=s.repeat(r);p<u;++p)g+=t.charAt(f[p]);return g},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},3144:(t,e,r)=>{"use strict";var n=r(6743),i=r(1002),o=r(76),a=r(7119);t.exports=a||n.call(o,i)},1002:t=>{"use strict";t.exports=Function.prototype.apply},76:t=>{"use strict";t.exports=Function.prototype.call},3126:(t,e,r)=>{"use strict";var n=r(6743),i=r(9675),o=r(76),a=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new i("a function is required");return a(n,o,t)}},7119:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},6556:(t,e,r)=>{"use strict";var n=r(453),i=r(3126),o=i([n("%String.prototype.indexOf%")]);t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?i([r]):r}},6168:(t,e,r)=>{"use strict";var n=r(2861).Buffer,i=r(7406).Transform,o=r(3141).I;function a(t){i.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}r(6698)(a,i);var s="undefined"!=typeof Uint8Array,u="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);a.prototype.update=function(t,e,r){var i=function(t,e){if(t instanceof n)return t;if("string"==typeof t)return n.from(t,e);if(u&&ArrayBuffer.isView(t)){if(0===t.byteLength)return n.alloc(0);var r=n.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(s&&t instanceof Uint8Array)return n.from(t);if(n.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return n.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e),o=this._update(i);return this.hashMode?this:(r&&(o=this._toString(o,r)),o)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.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)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(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=a},7108:(t,e,r)=>{"use strict";var n=r(6698),i=r(8276),o=r(6011),a=r(2802),s=r(6168);function u(t){s.call(this,"digest"),this._hash=t}n(u,s),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 i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},320:(t,e,r)=>{var n=r(8276);t.exports=function(t){return(new n).update(t).digest()}},3507:(t,e,r)=>{"use strict";var n=r(6698),i=r(1800),o=r(6168),a=r(2861).Buffer,s=r(320),u=r(6011),c=r(2802),f=a.alloc(128);function h(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<r&&(e=a.concat([e,f],r));for(var n=this._ipad=a.allocUnsafe(r),i=this._opad=a.allocUnsafe(r),s=0;s<r;s++)n[s]=54^e[s],i[s]=92^e[s];this._hash="rmd160"===t?new u:c(t),this._hash.update(n)}n(h,o),h.prototype._update=function(t){this._hash.update(t)},h.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new h("rmd160",e):"md5"===t?new i(s,e):new h(t,e)}},1800:(t,e,r)=>{"use strict";var n=r(6698),i=r(2861).Buffer,o=r(6168),a=i.alloc(128),s=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>s?e=t(e):e.length<s&&(e=i.concat([e,a],s));for(var r=this._ipad=i.allocUnsafe(s),n=this._opad=i.allocUnsafe(s),u=0;u<s;u++)r[u]=54^e[u],n[u]=92^e[u];this._hash=[r]}n(u,o),u.prototype._update=function(t){this._hash.push(t)},u.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=u},6547:function(){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?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 d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=y(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):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(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(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),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<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,n,i=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),w.indexOf(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");this._initBody(i)}function v(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 _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new _(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=l,t.Request=b,t.Response=_),e.Headers=l,e.Request=b,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},4945:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?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 d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=y(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):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(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(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),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<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,n,i=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),w.indexOf(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");this._initBody(i)}function v(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 _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new _(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=l,t.Request=b,t.Response=_),e.Headers=l,e.Request=b,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},1189:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256=e.sha256=e.sha256nodeCrypto=e.sha256js=void 0;var n=r(2911),i=function(){function t(){this._blockSize=64,this._finalSize=56,this._len=0,this._w=new Array(64),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._block=n.Buffer.alloc(this._blockSize)}return t.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.Buffer.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),f=0;f<c;f++)r[u+f]=t[s+f];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},t.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=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 i=(4294967295&r)>>>0,o=(r-i)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=n.Buffer.alloc(32);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a.writeInt32BE(this._h,28),t?a.toString(t):a},t.prototype.ch=function(t,e,r){return r^t&(e^r)},t.prototype.maj=function(t,e,r){return t&e|r&(t|e)},t.prototype.sigma0=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},t.prototype.sigma1=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},t.prototype.gamma0=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},t.prototype.gamma1=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10},t.prototype._update=function(e){for(var r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,c=0|this._g,f=0|this._h,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<64;++h)r[h]=this.gamma1(r[h-2])+r[h-7]+this.gamma0(r[h-15])+r[h-16]|0;for(var l=0;l<64;++l){var d=f+this.sigma1(s)+this.ch(s,u,c)+t.K[l]+r[l]|0,p=this.sigma0(n)+this.maj(n,i,o)|0;f=c,c=u,u=s,s=a+d|0,a=o,o=i,i=n,n=d+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=f+this._h|0},t.K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],t}();e.sha256js=i;var o=function(){function t(){t.useCryptoModuleCache&&void 0!==t.nodeCryptoCreateHash||(t.nodeCryptoCreateHash=r(3640).createHash),this.hash=t.nodeCryptoCreateHash("sha256")}return t.prototype.update=function(t,e){return this.hash.update(t,e),this},t.prototype.digest=function(t){return t?this.hash.digest(t):this.hash.digest()},t.useCryptoModuleCache=!0,t}();e.sha256nodeCrypto=o;var a=void 0,s=function(){function t(){!function(){if(o.useCryptoModuleCache&&void 0!==a)return a;var t=!1;try{var e=r(3640);t=e&&"function"==typeof e.createHash}catch(t){}return a=t,t}()?this.instance=new i:this.instance=new o}return t.prototype.update=function(t,e){return this.instance.update(t,e),this},t.prototype.digest=function(t){return t?this.instance.digest(t):this.instance.digest()},t}();function u(t){return(new s).update(t).digest()}e.sha256=s,e.hashSha256=u,e.default=u},2911:(t,e,r)=>{"use strict";var n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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 h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(j(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(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(j(t,ArrayBuffer)||t&&j(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(j(t,SharedArrayBuffer)||t&&j(t.buffer,SharedArrayBuffer)))return d(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 u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||W(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.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 f(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 h(t){return f(t),s(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||j(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 D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(i)return n?-1:D(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(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 w(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),W(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(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):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,a=1,s=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;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){h=!1;break}if(h)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(W(s))return a;t[r+a]=s}return a}function _(t,e,r,n){return V(D(e,t.length-r),t,r,n)}function S(t,e,r,n){return V(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return V(U(e),t,r,n)}function T(t,e,r,n){return V(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=(r=t.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],f=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=C));return r}(n)}e.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(j(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),j(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(j(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(j(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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 o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r),h=0;h<s;++h)if(c[h]!==f[h]){o=c[h],a=f[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=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 o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function M(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=K[t[o]];return i}function R(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,o){return e=+e,r>>>=0,o||x(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,o){return e=+e,r>>>=0,o||x(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.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<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(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||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||N(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 t>>>=0,e||N(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 t>>>=0,e||N(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 t>>>=0,e||N(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a|0)-s&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);B(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),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||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(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},u.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:u.from(t,n),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var L=/[^+/0-9A-Za-z-_]/g;function D(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function j(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function W(t){return t!=t}var K=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}()},454:t=>{"use strict";var e="%[a-f0-9]{2}",r=new RegExp("("+e+")|([^%]+?)","gi"),n=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],i(r),i(n))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r)||[],n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},r=n.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch(t){var i=o(r[0]);i!==r[0]&&(e[r[0]]=i)}r=n.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},7176:(t,e,r)=>{"use strict";var n,i=r(3126),o=r(5795);try{n=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var a=!!n&&o&&o(Object.prototype,"__proto__"),s=Object,u=s.getPrototypeOf;t.exports=a&&"function"==typeof a.get?i([a.get]):"function"==typeof u&&function(t){return u(null==t?t:s(t))}},2010:(t,e,r)=>{"use strict";var n=r(2861).Buffer,i=r(3527);function o(t){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function a(t,e,r){for(var n=0;e+n<r&&0===t[e+n];)++n;return t[e+n]>=128&&--n,n}t.exports={derToJose:function(t,e){t=o(t);var r=i(e),a=r+1,s=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var c=t[u++];if(129===c&&(c=t[u++]),s-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(s-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var f=t[u++];if(s-u-2<f)throw new Error('"r" specified length of "'+f+'", only "'+(s-u-2)+'" available');if(a<f)throw new Error('"r" specified length of "'+f+'", max of "'+a+'" is acceptable');var h=u;if(u+=f,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(s-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(s-u)+'"');if(a<l)throw new Error('"s" specified length of "'+l+'", max of "'+a+'" is acceptable');var d=u;if((u+=l)!==s)throw new Error('Expected to consume entire buffer, but "'+(s-u)+'" bytes remain');var p=r-f,g=r-l,y=n.allocUnsafe(p+f+g+l);for(u=0;u<p;++u)y[u]=0;t.copy(y,u,h+Math.max(-p,0),h+f);for(var m=u=r;u<m+g;++u)y[u]=0;return t.copy(y,u,d+Math.max(-g,0),d+l),(y=y.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var r=i(e),s=t.length;if(s!==2*r)throw new TypeError('"'+e+'" signatures must be "'+2*r+'" bytes, saw "'+s+'"');var u=a(t,0,r),c=a(t,r,t.length),f=r-u,h=r-c,l=2+f+1+1+h,d=l<128,p=n.allocUnsafe((d?2:3)+l),g=0;return p[g++]=48,d?p[g++]=l:(p[g++]=129,p[g++]=255&l),p[g++]=2,p[g++]=f,u<0?(p[g++]=0,g+=t.copy(p,g,0,r)):g+=t.copy(p,g,u,r),p[g++]=2,p[g++]=h,c<0?(p[g++]=0,t.copy(p,g,r)):t.copy(p,g,r+c),p}}},3527:t=>{"use strict";function e(t){return(t/8|0)+(t%8==0?0:1)}var r={ES256:e(256),ES384:e(384),ES512:e(521)};t.exports=function(t){var e=r[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}},6729:(t,e,r)=>{"use strict";var n=e;n.version=r(1636).rE,n.utils=r(7011),n.rand=r(5037),n.curve=r(894),n.curves=r(480),n.ec=r(7447),n.eddsa=r(8650)},6677:(t,e,r)=>{"use strict";var n=r(8490),i=r(7011),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(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){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var a,u,c=[];for(a=0;a<n.length;a+=r.step){u=0;for(var f=a+r.step-1;f>=a;f--)u=(u<<1)+n[f];c.push(u)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(a=0;a<c.length;a++)(u=c[a])===d?l=l.mixedAdd(r.points[a]):u===-d&&(l=l.mixedAdd(r.points[a].neg()));h=h.add(l)}return h.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,a=o(e,r,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var f=0;c>=0&&0===a[c];c--)f++;if(c>=0&&f++,u=u.dblp(f),c<0)break;var h=a[c];s(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){var s,u,c,f=this._wnafT1,h=this._wnafT2,l=this._wnafT3,d=0;for(s=0;s<n;s++){var p=(c=e[s])._getNAFPoints(t);f[s]=p.wnd,h[s]=p.points}for(s=n-1;s>=1;s-=2){var g=s-1,y=s;if(1===f[g]&&1===f[y]){var m=[e[g],null,null,e[y]];0===e[g].y.cmp(e[y].y)?(m[1]=e[g].add(e[y]),m[2]=e[g].toJ().mixedAdd(e[y].neg())):0===e[g].y.cmp(e[y].y.redNeg())?(m[1]=e[g].toJ().mixedAdd(e[y]),m[2]=e[g].add(e[y].neg())):(m[1]=e[g].toJ().mixedAdd(e[y]),m[2]=e[g].toJ().mixedAdd(e[y].neg()));var w=[-3,-1,-5,-7,0,7,5,1,3],b=a(r[g],r[y]);for(d=Math.max(b[0].length,d),l[g]=new Array(d),l[y]=new Array(d),u=0;u<d;u++){var v=0|b[0][u],_=0|b[1][u];l[g][u]=w[3*(v+1)+(_+1)],l[y][u]=0,h[g]=m}}else l[g]=o(r[g],f[g],this._bitLength),l[y]=o(r[y],f[y],this._bitLength),d=Math.max(l[g].length,d),d=Math.max(l[y].length,d)}var S=this.jpoint(null,null,null),A=this._wnafT4;for(s=d;s>=0;s--){for(var T=0;s>=0;){var E=!0;for(u=0;u<n;u++)A[u]=0|l[u][s],0!==A[u]&&(E=!1);if(!E)break;T++,s--}if(s>=0&&T++,S=S.dblp(T),s<0)break;for(u=0;u<n;u++){var k=A[u];0!==k&&(k>0?c=h[u][k-1>>1]:k<0&&(c=h[u][-k-1>>1].neg()),S="affine"===c.type?S.mixedAdd(c):S.add(c))}}for(s=0;s<n;s++)h[s]=null;return i?S:S.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},1298:(t,e,r)=>{"use strict";var n=r(7011),i=r(8490),o=r(6698),a=r(6677),s=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,r,n,o){a.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(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 i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,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()))))}o(u,a),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 i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=n.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,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)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new c(this,t,e,r,n)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.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),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,f)},c.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.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)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(e),c=o.redMul(a),f=s.redMul(u),h=o.redMul(u),l=a.redMul(s);return this.curve.point(c,f,l,h)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=n.redMul(u).redMul(f);return this.curve.twisted?(e=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.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},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.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}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},894:(t,e,r)=>{"use strict";var n=e;n.base=r(6677),n.short=r(9188),n.mont=r(370),n.edwards=r(1298)},370:(t,e,r)=>{"use strict";var n=r(8490),i=r(6698),o=r(6677),a=r(7011);function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.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)},i(u,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.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()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},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),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,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 o=i.length-1;o>=0;o--)0===i[o]?(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()}},9188:(t,e,r)=>{"use strict";var n=r(7011),i=r(8490),o=r(6698),a=r(6677),s=n.assert;function u(t){a.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 c(t,e,r,n){a.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 f(t,e,r,n){a.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}o(u,a),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 o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(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(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,u,c,f,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),g=new i(0),y=new i(0),m=new i(1),w=0;0!==l.cmpn(0);){var b=d.div(l);c=d.sub(b.mul(l)),f=y.sub(b.mul(p));var v=m.sub(b.mul(g));if(!n&&c.cmp(h)<0)e=u.neg(),r=p,n=c.neg(),o=f;else if(n&&2==++w)break;u=c,d=l,l=c,y=p,p=f,m=g,g=v}a=c.neg(),s=f;var _=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:u.add(c).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 o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(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,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),f=0;f<2*o;f++)n[f]=null,i[f]=null;return c},o(c,a.BasePoint),u.prototype.point=function(t,e,r){return new c(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.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)},c.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),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.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)},c.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)},c.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)},c.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))},c.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},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.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)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.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),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),h=n.redMul(c),l=u.redSqr().redIAdd(f).redISub(h).redISub(h),d=u.redMul(h.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},f.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,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=r.redMul(u),h=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(h)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(h,l,d)},f.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<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var f=o.redSqr(),h=c.redSqr(),l=h.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=o.redMul(h),g=d.redSqr().redISub(p.redAdd(p)),y=p.redISub(g),m=d.redMul(y);m=m.redIAdd(m).redISub(l);var w=c.redMul(s);e+1<t&&(u=u.redMul(l)),o=g,s=w,c=m}return this.curve.jpoint(o,c.redMul(i),s)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),h=this.y.redSqr(),l=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(f).redISub(l);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),g=p.redSqr(),y=l.redIAdd(l);y=(y=y.redIAdd(y)).redIAdd(y),t=g.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},f.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),h=this.y.redSqr(),l=this.x.redMul(h),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),g=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(f);var y=h.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),e=d.redMul(p.redISub(t)).redISub(y)}return this.curve.jpoint(t,e,r)},f.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),f=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(f),l=a.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=s.redMul(h).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,d,p)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),f=e.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var h=this.x.redMul(s).redISub(f);h=(h=h.redIAdd(h)).redIAdd(h);var l=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(h,l,d)},f.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},f.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},f.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480:(t,e,r)=>{"use strict";var n,i=e,o=r(7952),a=r(894),s=r(7011).assert;function u(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(4011)}catch(t){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},7447:(t,e,r)=>{"use strict";var n=r(8490),i=r(2723),o=r(7011),a=r(480),s=r(5037),u=o.assert,c=r(1200),f=r(8545);function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.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=h,h.prototype.keyPair=function(t){return new c(this,t)},h.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},h.prototype._truncateToN=function(t,e,r){var i;if(n.isBN(t)||"number"==typeof t)i=(t=new n(t,16)).byteLength();else if("object"==typeof t)i=t.length,t=new n(t,16);else{var o=t.toString();i=o.length+1>>>1,t=new n(o,16)}"number"!=typeof r&&(r=8*i);var a=r-this.n.bitLength();return a>0&&(t=t.ushrn(a)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},h.prototype.sign=function(t,e,r,o){if("object"==typeof r&&(o=r,r=null),o||(o={}),"string"!=typeof t&&"number"!=typeof t&&!n.isBN(t)){u("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),u(t.length>>>0===t.length);for(var a=0;a<t.length;a++)u((255&t[a])===t[a])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,o.msgBitLength),u(!t.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),c=e.getPrivate().toArray("be",s),h=t.toArray("be",s);u(new n(h).eq(t),"Can not sign message");for(var l=new i({hash:this.hash,entropy:c,nonce:h,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new n(1)),p=0;;p++){var g=o.k?o.k(p):new n(l.generate(this.n.byteLength()));if(!((g=this._truncateToN(g,!0)).cmpn(1)<=0||g.cmp(d)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var m=y.getX(),w=m.umod(this.n);if(0!==w.cmpn(0)){var b=g.invm(this.n).mul(w.mul(e.getPrivate()).iadd(t));if(0!==(b=b.umod(this.n)).cmpn(0)){var v=(y.getY().isOdd()?1:0)|(0!==m.cmp(w)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),v^=1),new f({r:w,s:b,recoveryParam:v})}}}}}},h.prototype.verify=function(t,e,r,n,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var o=(e=new f(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,i);var o=this.n,a=new n(t),s=e.r,c=e.s,h=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var d=e.r.invm(o),p=o.sub(a).mul(d).umod(o),g=c.mul(d).umod(o);return this.g.mulAdd(p,s,g)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new f(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},1200:(t,e,r)=>{"use strict";var n=r(8490),i=r(7011).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},8545:(t,e,r)=>{"use strict";var n=r(8490),i=r(7011),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(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 s(){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;if(0===t[e.place])return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function f(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r);if(!1===a)return!1;if(128&t[r.place])return!1;var c=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var f=u(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;if(128&t[r.place])return!1;var h=t.slice(r.place,f+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new n(c),this.s=new n(h),this.recoveryParam=null,!0},a.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=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var o=n.concat(r),a=[48];return f(a,o.length),a=a.concat(o),i.encode(a,t)}},8650:(t,e,r)=>{"use strict";var n=r(7952),i=r(480),o=r(7011),a=o.assert,s=o.parseBytes,u=r(6661),c=r(220);function f(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=i[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=n.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},f.prototype.verify=function(t,e,r){if(t=s(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},f.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},f.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},f.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},f.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=!!(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},f.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(t){return o.intFromLE(t)},f.prototype.isPoint=function(t){return t instanceof this.pointClass}},6661:(t,e,r)=>{"use strict";var n=r(7011),i=n.assert,o=n.parseBytes,a=n.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},s.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=s},220:(t,e,r)=>{"use strict";var n=r(8490),i=r(7011),o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(o(e.length===2*t.encodingLength,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},4011:t=>{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"]]}}},7011:(t,e,r)=>{"use strict";var n=e,i=r(8490),o=r(3349),a=r(4367);n.assert=o,n.toArray=a.toArray,n.zero2=a.zero2,n.toHex=a.toHex,n.encode=a.encode,n.getNAF=function(t,e,r){var n,i=new Array(Math.max(t.bitLength(),r)+1);for(n=0;n<i.length;n+=1)i[n]=0;var o=1<<e+1,a=t.clone();for(n=0;n<i.length;n++){var s,u=a.andln(o-1);a.isOdd()?(s=u>(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,i[n]=s,a.iushrn(1)}return i},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[0].push(a),s=1&c?3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),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")}},8490:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9368).Buffer}catch(t){}function s(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=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.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<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.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 o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f<s;f+=n)u=c(t,f,f+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],h=[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],l=[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 d(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],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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 c=h[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:f[c-g.length]+g+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(!(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(!(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(!(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.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;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.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<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.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 o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,g=d>>>13,y=0|a[2],m=8191&y,w=y>>>13,b=0|a[3],v=8191&b,_=b>>>13,S=0|a[4],A=8191&S,T=S>>>13,E=0|a[5],k=8191&E,C=E>>>13,O=0|a[6],P=8191&O,M=O>>>13,R=0|a[7],N=8191&R,B=R>>>13,x=0|a[8],I=8191&x,F=x>>>13,L=0|a[9],D=8191&L,U=L>>>13,V=0|s[0],j=8191&V,W=V>>>13,K=0|s[1],H=8191&K,q=K>>>13,z=0|s[2],G=8191&z,$=z>>>13,X=0|s[3],J=8191&X,Y=X>>>13,Z=0|s[4],Q=8191&Z,tt=Z>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(c+(n=Math.imul(h,j))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(l,j)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,W))+Math.imul(g,j)|0,o=Math.imul(g,W);var mt=(c+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(l,H)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,j),i=(i=Math.imul(m,W))+Math.imul(w,j)|0,o=Math.imul(w,W),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,q)|0;var wt=(c+(n=n+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,W))+Math.imul(_,j)|0,o=Math.imul(_,W),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,q)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,q)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,$)|0;var bt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,W))+Math.imul(T,j)|0,o=Math.imul(T,W),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Y)|0;var vt=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(k,j),i=(i=Math.imul(k,W))+Math.imul(C,j)|0,o=Math.imul(C,W),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,q)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,q)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(P,j),i=(i=Math.imul(P,W))+Math.imul(M,j)|0,o=Math.imul(M,W),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,q)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,q)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,$)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var St=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(N,j),i=(i=Math.imul(N,W))+Math.imul(B,j)|0,o=Math.imul(B,W),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,q)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,q)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0;var At=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,W))+Math.imul(F,j)|0,o=Math.imul(F,W),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ct)|0;var Tt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,W))+Math.imul(U,j)|0,o=Math.imul(U,W),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(F,H)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,$)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ht)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,gt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,H),i=(i=Math.imul(D,q))+Math.imul(U,H)|0,o=Math.imul(U,q),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,$)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;c=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,G),i=(i=Math.imul(D,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(v,ht)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0;var Ct=(c+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,gt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Pt=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,at)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,lt)|0;var Mt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,ct)|0,n=n+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,lt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0;var Rt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,lt)|0;var Nt=(c+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;c=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var Bt=(c+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(F,pt)|0))<<13)|0;c=((o=o+Math.imul(F,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var xt=(c+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,gt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,gt))+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,u[0]=yt,u[1]=mt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Tt,u[9]=Et,u[10]=kt,u[11]=Ct,u[12]=Ot,u[13]=Pt,u[14]=Mt,u[15]=Rt,u[16]=Nt,u[17]=Bt,u[18]=xt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new y).mulp(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.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?d(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,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},y.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},y.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},y.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=r[f+d],g=n[f+d],y=r[f+d+a],m=n[f+d+a],w=h*y-l*m;m=h*m+l*y,y=w,r[f+d]=p+y,n[f+d]=g+m,r[f+d+a]=p-y,n[f+d+a]=g-m,d!==s&&(w=u*h-c*l,l=u*l+c*h,h=w)}},y.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},y.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},y.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(!(-8192&o))},y.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},y.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),h=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,f,h,n,i);for(var d=0;d<n;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),g(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=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<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},o.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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.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 o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;!(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,g=1;!(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.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,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;!(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;!(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.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 o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._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 T(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,w),i(_,w),i(S,w),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return m[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(!(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var g=d,y=0;0!==g.cmp(s);y++)g=g.redSqr();n(y<p);var m=this.pow(h,new o(1).iushln(p-y-1));l=l.redMul(m),h=m.redSqr(),d=d.redMul(h),p=y}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===f)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,A),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.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),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)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(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),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},655:t=>{"use strict";var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},1237:t=>{"use strict";t.exports=EvalError},9383:t=>{"use strict";t.exports=Error},9290:t=>{"use strict";t.exports=RangeError},9538:t=>{"use strict";t.exports=ReferenceError},8068:t=>{"use strict";t.exports=SyntaxError},9675:t=>{"use strict";t.exports=TypeError},5345:t=>{"use strict";t.exports=URIError},9612:t=>{"use strict";t.exports=Object},7007:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,r,n){var i,o,a,c;if(s(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"==typeof a?a=o[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=a.length,c=f,console&&console.warn&&console.warn(c)}return t}function f(){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 h(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=f.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;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):p(i,i.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function g(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)n(u,this,e);else{var c=u.length,f=p(u,c);for(r=0;r<c;++r)n(f[r],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return s(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return s(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,o,a;if(s(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,a||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=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):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},3055:t=>{"use strict";t.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),o=0;o<n.length;o++){var a=n[o],s=t[a];(i?-1!==e.indexOf(a):e(a,s,t))&&(r[a]=s)}return r}},9353:t=>{"use strict";var e=Object.prototype.toString,r=Math.max,n=function(t,e){for(var r=[],n=0;n<t.length;n+=1)r[n]=t[n];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r};t.exports=function(t){var i=this;if("function"!=typeof i||"[object Function]"!==e.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,a=function(t){for(var e=[],r=1,n=0;r<t.length;r+=1,n+=1)e[n]=t[r];return e}(arguments),s=r(0,i.length-a.length),u=[],c=0;c<s;c++)u[c]="$"+c;if(o=Function("binder","return function ("+function(t){for(var e="",r=0;r<t.length;r+=1)e+=t[r],r+1<t.length&&(e+=",");return e}(u)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var e=i.apply(this,n(a,arguments));return Object(e)===e?e:this}return i.apply(t,n(a,arguments))})),i.prototype){var f=function(){};f.prototype=i.prototype,o.prototype=new f,f.prototype=null}return o}},6743:(t,e,r)=>{"use strict";var n=r(9353);t.exports=Function.prototype.bind||n},453:(t,e,r)=>{"use strict";var n,i=r(9612),o=r(9383),a=r(1237),s=r(9290),u=r(9538),c=r(8068),f=r(9675),h=r(5345),l=r(1514),d=r(8968),p=r(6188),g=r(8002),y=r(5880),m=Function,w=function(t){try{return m('"use strict"; return ('+t+").constructor;")()}catch(t){}},b=r(5795),v=r(655),_=function(){throw new f},S=b?function(){try{return _}catch(t){try{return b(arguments,"callee").get}catch(t){return _}}}():_,A=r(4039)(),T=r(7176),E="function"==typeof Reflect&&Reflect.getPrototypeOf||i.getPrototypeOf||T,k=r(1002),C=r(76),O={},P="undefined"!=typeof Uint8Array&&E?E(Uint8Array):n,M={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":A&&E?E([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":O,"%AsyncGenerator%":O,"%AsyncGeneratorFunction%":O,"%AsyncIteratorPrototype%":O,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":m,"%GeneratorFunction%":O,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":A&&E?E(E([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&A&&E?E((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":s,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&A&&E?E((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":A&&E?E(""[Symbol.iterator]()):n,"%Symbol%":A?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":S,"%TypedArray%":P,"%TypeError%":f,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":h,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":C,"%Function.prototype.apply%":k,"%Object.defineProperty%":v,"%Math.abs%":l,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":g,"%Math.pow%":y};if(E)try{null.error}catch(t){var R=E(E(t));M["%Error.prototype%"]=R}var N=function t(e){var r;if("%AsyncFunction%"===e)r=w("async function () {}");else if("%GeneratorFunction%"===e)r=w("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=w("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&E&&(r=E(i.prototype))}return M[e]=r,r},B={__proto__:null,"%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"]},x=r(6743),I=r(9957),F=x.call(C,Array.prototype.concat),L=x.call(k,Array.prototype.splice),D=x.call(C,String.prototype.replace),U=x.call(C,String.prototype.slice),V=x.call(C,RegExp.prototype.exec),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,W=/\\(\\)?/g,K=function(t,e){var r,n=t;if(I(B,n)&&(n="%"+(r=B[n])[0]+"%"),I(M,n)){var i=M[n];if(i===O&&(i=N(n)),void 0===i&&!e)throw new f("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new c("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new f("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new f('"allowMissing" argument must be a boolean');if(null===V(/^%?[^%]*%?$/,t))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=U(t,0,1),r=U(t,-1);if("%"===e&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new c("invalid intrinsic syntax, expected opening `%`");var n=[];return D(t,j,(function(t,e,r,i){n[n.length]=r?D(i,W,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",i=K("%"+n+"%",e),o=i.name,a=i.value,s=!1,u=i.alias;u&&(n=u[0],L(r,F([0,1],u)));for(var h=1,l=!0;h<r.length;h+=1){var d=r[h],p=U(d,0,1),g=U(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===g||"'"===g||"`"===g)&&p!==g)throw new c("property names with quotes must have matching quotes");if("constructor"!==d&&l||(s=!0),I(M,o="%"+(n+="."+d)+"%"))a=M[o];else if(null!=a){if(!(d in a)){if(!e)throw new f("base intrinsic for "+t+" exists, but the property is not available.");return}if(b&&h+1>=r.length){var y=b(a,d);a=(l=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:a[d]}else l=I(a,d),a=a[d];l&&!s&&(M[o]=a)}}return a}},6549:t=>{"use strict";t.exports=Object.getOwnPropertyDescriptor},5795:(t,e,r)=>{"use strict";var n=r(6549);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},4039:(t,e,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(1333);t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},1333:t=>{"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(var n 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 i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},4729:(t,e,r)=>{"use strict";var n=r(2861).Buffer,i=r(8399).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6698)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var a=0,s=8*t.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.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},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},7952:(t,e,r)=>{var n=e;n.utils=r(7426),n.common=r(6166),n.sha=r(6229),n.ripemd=r(6784),n.hmac=r(8948),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},6166:(t,e,r)=>{"use strict";var n=r(7426),i=r(3349);function o(){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}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.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=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>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,o=8;o<this.padLength;o++)n[i++]=0;return n}},8948:(t,e,r)=>{"use strict";var n=r(7426),i=r(3349);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},6784:(t,e,r)=>{"use strict";var n=r(7426),i=r(6166),o=n.rotl32,a=n.sum32,s=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(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 l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(f,c),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],f=this.h[4],w=r,b=n,v=i,_=c,S=f,A=0;A<80;A++){var T=a(o(u(r,h(A,n,i,c),t[p[A]+e],l(A)),y[A]),f);r=f,f=c,c=o(i,10),i=n,n=T,T=a(o(u(w,h(79-A,b,v,_),t[g[A]+e],d(A)),m[A]),S),w=S,S=_,_=o(v,10),v=b,b=T}T=s(this.h[1],i,_),this.h[1]=s(this.h[2],c,S),this.h[2]=s(this.h[3],f,w),this.h[3]=s(this.h[4],r,b),this.h[4]=s(this.h[0],n,v),this.h[0]=T},f.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[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],m=[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]},6229:(t,e,r)=>{"use strict";e.sha1=r(3917),e.sha224=r(7714),e.sha256=r(2287),e.sha384=r(1911),e.sha512=r(7766)},3917:(t,e,r)=>{"use strict";var n=r(7426),i=r(6166),o=r(6225),a=n.rotl32,s=n.sum32,u=n.sum32_5,c=o.ft_1,f=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=a(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],f=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),g=u(a(i,5),c(p,o,f,l),d,r[n],h[p]);d=l,l=f,f=a(o,30),o=i,i=g}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],f),this.h[3]=s(this.h[3],l),this.h[4]=s(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},7714:(t,e,r)=>{"use strict";var n=r(7426),i=r(2287);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},2287:(t,e,r)=>{"use strict";var n=r(7426),i=r(6166),o=r(6225),a=r(3349),s=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,h=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,g=o.g1_256,y=i.BlockHash,m=[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 w(){if(!(this instanceof w))return new w;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(w,y),t.exports=w,w.blockSize=512,w.outSize=256,w.hmacStrength=192,w.padLength=64,w.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(g(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],y=this.h[2],m=this.h[3],w=this.h[4],b=this.h[5],v=this.h[6],_=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var S=c(_,d(w),f(w,b,v),this.k[n],r[n]),A=s(l(i),h(i,o,y));_=v,v=b,b=w,w=s(m,S),m=y,y=o,o=i,i=s(S,A)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],y),this.h[3]=s(this.h[3],m),this.h[4]=s(this.h[4],w),this.h[5]=s(this.h[5],b),this.h[6]=s(this.h[6],v),this.h[7]=s(this.h[7],_)},w.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},1911:(t,e,r)=>{"use strict";var n=r(7426),i=r(7766);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},7766:(t,e,r)=>{"use strict";var n=r(7426),i=r(6166),o=r(3349),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,f=n.sum64,h=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,g=n.sum64_5_hi,y=n.sum64_5_lo,m=i.BlockHash,w=[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];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=w,this.W=new Array(160)}function v(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function _(t,e,r,n,i,o){var a=e&n^~e&o;return a<0&&(a+=4294967296),a}function S(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function A(t,e,r,n,i,o){var a=e&n^e&o^n&o;return a<0&&(a+=4294967296),a}function T(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function E(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=s(t,e,14)^s(t,e,18)^s(e,t,9);return r<0&&(r+=4294967296),r}function C(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function O(t,e){var r=s(t,e,1)^s(t,e,8)^c(t,e,7);return r<0&&(r+=4294967296),r}function P(t,e){var r=s(t,e,19)^s(e,t,29)^c(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(b,m),t.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=(y=r[n-4],m=r[n-3],w=void 0,(w=a(y,m,19)^a(m,y,29)^u(y,m,6))<0&&(w+=4294967296),w),o=P(r[n-4],r[n-3]),s=r[n-14],c=r[n-13],f=C(r[n-30],r[n-29]),h=O(r[n-30],r[n-29]),l=r[n-32],g=r[n-31];r[n]=d(i,o,s,c,f,h,l,g),r[n+1]=p(i,o,s,c,f,h,l,g)}var y,m,w},b.prototype._update=function(t,e){this._prepareBlock(t,e);var r,n,i,s=this.W,u=this.h[0],c=this.h[1],d=this.h[2],p=this.h[3],m=this.h[4],w=this.h[5],b=this.h[6],C=this.h[7],O=this.h[8],P=this.h[9],M=this.h[10],R=this.h[11],N=this.h[12],B=this.h[13],x=this.h[14],I=this.h[15];o(this.k.length===s.length);for(var F=0;F<s.length;F+=2){var L=x,D=I,U=(i=void 0,(i=a(r=O,n=P,14)^a(r,n,18)^a(n,r,9))<0&&(i+=4294967296),i),V=k(O,P),j=v(O,0,M,0,N),W=_(0,P,0,R,0,B),K=this.k[F],H=this.k[F+1],q=s[F],z=s[F+1],G=g(L,D,U,V,j,W,K,H,q,z),$=y(L,D,U,V,j,W,K,H,q,z);L=T(u,c),D=E(u,c),U=S(u,0,d,0,m),V=A(0,c,0,p,0,w);var X=h(L,D,U,V),J=l(L,D,U,V);x=N,I=B,N=M,B=R,M=O,R=P,O=h(b,C,G,$),P=l(C,C,G,$),b=m,C=w,m=d,w=p,d=u,p=c,u=h(G,$,X,J),c=l(G,$,X,J)}f(this.h,0,u,c),f(this.h,2,d,p),f(this.h,4,m,w),f(this.h,6,b,C),f(this.h,8,O,P),f(this.h,10,M,R),f(this.h,12,N,B),f(this.h,14,x,I)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},6225:(t,e,r)=>{"use strict";var n=r(7426).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function a(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?a(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},7426:(t,e,r)=>{"use strict";var n=r(3349),i=r(6698);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(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<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=s(t[r].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=a(i)),r+=u(i.toString(16))}return r},e.zero2=s,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var c;c="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=c>>>0}return a},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|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],o=n+t[e+1]>>>0,a=(o<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,c=e;return u+=(c=c+n>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+r+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,c){var f=0,h=e;return f+=(h=h+n>>>0)<e?1:0,f+=(h=h+o>>>0)<o?1:0,f+=(h=h+s>>>0)<s?1:0,t+r+i+a+u+(f+=(h=h+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,c){return e+n+o+s+c>>>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}},9957:(t,e,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=r(6743);t.exports=o.call(n,i)},2723:(t,e,r)=>{"use strict";var n=r(7952),i=r(4367),o=r(3349);function a(t){if(!(this instanceof a))return new a(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");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=a,a.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.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.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 o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,t);return this._update(r),this._reseed++,i.encode(a,e)}},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,f=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+t[e+h],h+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+d]=255&a,d+=p,a/=256,c-=8);t[r+d-p]|=128*g}},6698:t=>{"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}}},1161:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoClients=e.SECP256K1Client=void 0;const n=r(2485);Object.defineProperty(e,"SECP256K1Client",{enumerable:!0,get:function(){return n.SECP256K1Client}});const i={ES256K:n.SECP256K1Client};e.cryptoClients=i},2485:(t,e,r)=>{"use strict";var n=r(8287).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.SECP256K1Client=void 0;const i=r(9615),o=r(2623),a=r(9598),s=r(2010),u=r(8886);a.utils.hmacSha256Sync=(t,...e)=>{const r=i.hmac.create(o.sha256,t);return e.forEach((t=>r.update(t))),r.digest()};class c{static derivePublicKey(t,e=!0){return 66===t.length&&(t=t.slice(0,64)),t.length<64&&(t=t.padStart(64,"0")),n.from(a.getPublicKey(t,e)).toString("hex")}static signHash(t,e,r="jose"){if(!t||!e)throw new u.MissingParametersError("a signing input hash and private key are all required");const i=n.from(a.signSync(t,e.slice(0,64),{der:!0,canonical:!1}));if("der"===r)return i.toString("hex");if("jose"===r)return(0,s.derToJose)(i,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return(0,s.joseToDer)(t,"ES256")}static verifyHash(t,e,r){if(!t||!e||!r)throw new u.MissingParametersError("a signing input hash, der signature, and public key are all required");return a.verify(e,t,r,{strict:!1})}}e.SECP256K1Client=c,c.algorithmName="ES256K"},7990:function(t,e,r){"use strict";var n=r(8287).Buffer,i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(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(a,s)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256Async=e.hashSha256=void 0;const o=r(2623);function a(t){return n.from((0,o.sha256)(t))}e.hashSha256=a,e.hashSha256Async=function(t){return i(this,void 0,void 0,(function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?n.from(t):t,r=yield crypto.subtle.digest("SHA-256",e);return n.from(r)}{const e=r(2632);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(a(t))}}))}},1827:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeToken=void 0;const n=r(4711);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(n.default.decode(e[0])),payload:JSON.parse(n.default.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=n.default.decode(e));const r=[];return t.header.map((t=>{const e=JSON.parse(n.default.decode(t));r.push(e)})),{header:r,payload:JSON.parse(e),signature:t.signature}}}},8886:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidTokenError=e.MissingParametersError=void 0;class r extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=r;class n extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=n},9057:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(675),e),i(r(2695),e),i(r(1827),e),i(r(8886),e),i(r(1161),e)},675:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(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(a,s)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenSigner=e.createUnsecuredToken=void 0;const i=r(4711),o=r(1161),a=r(8886),s=r(7990);function u(t,e){const r=[],n=i.default.encode(JSON.stringify(e));r.push(n);const o=i.default.encode(JSON.stringify(t));return r.push(o),r.join(".")}e.createUnsecuredToken=function(t){return u(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new a.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,r={}){const n=this.header(r),i=u(t,n),o=(0,s.hashSha256)(i);return this.createWithSignedHash(t,e,n,i,o)}signAsync(t,e=!1,r={}){return n(this,void 0,void 0,(function*(){const n=this.header(r),i=u(t,n),o=yield(0,s.hashSha256Async)(i);return this.createWithSignedHash(t,e,n,i,o)}))}createWithSignedHash(t,e,r,n,o){const a=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.default.encode(JSON.stringify(r))],payload:JSON.stringify(t),signature:[a]}:[n,a].join(".")}}},2695:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenVerifier=void 0;const n=r(4711),i=r(1161),o=r(8886),a=r(7990);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t&&this.verifyExpanded(t,!1)}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const r=t.split("."),n=r[0]+"."+r[1],i=t=>{const e=this.cryptoClient.loadSignature(r[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return(0,a.hashSha256Async)(n).then((t=>i(t)));{const t=(0,a.hashSha256)(n);return i(t)}}verifyExpanded(t,e){const r=[t.header.join("."),n.default.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map((t=>{const r=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,r,this.rawPublicKey)||(i=!1)})),i);if(e)return(0,a.hashSha256Async)(r).then((t=>o(t)));{const t=(0,a.hashSha256)(r);return o(t)}}}},7193:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Boolean]",s="[object Date]",u="[object Function]",c="[object GeneratorFunction]",f="[object Map]",h="[object Number]",l="[object Object]",d="[object Promise]",p="[object RegExp]",g="[object Set]",y="[object String]",m="[object Symbol]",w="[object WeakMap]",b="[object ArrayBuffer]",v="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",A="[object Int8Array]",T="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",C="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",M=/\w*$/,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,B={};B[o]=B["[object Array]"]=B[b]=B[v]=B[a]=B[s]=B[_]=B[S]=B[A]=B[T]=B[E]=B[f]=B[h]=B[l]=B[p]=B[g]=B[y]=B[m]=B[k]=B[C]=B[O]=B[P]=!0,B["[object Error]"]=B[u]=B[w]=!1;var x="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,I="object"==typeof self&&self&&self.Object===Object&&self,F=x||I||Function("return this")(),L=e&&!e.nodeType&&e,D=L&&t&&!t.nodeType&&t,U=D&&D.exports===L;function V(t,e){return t.set(e[0],e[1]),t}function j(t,e){return t.add(e),t}function W(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function K(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function H(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function q(t,e){return function(r){return t(e(r))}}function z(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,$=Array.prototype,X=Function.prototype,J=Object.prototype,Y=F["__core-js_shared__"],Z=(G=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Q=X.toString,tt=J.hasOwnProperty,et=J.toString,rt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=U?F.Buffer:void 0,it=F.Symbol,ot=F.Uint8Array,at=q(Object.getPrototypeOf,Object),st=Object.create,ut=J.propertyIsEnumerable,ct=$.splice,ft=Object.getOwnPropertySymbols,ht=nt?nt.isBuffer:void 0,lt=q(Object.keys,Object),dt=Ft(F,"DataView"),pt=Ft(F,"Map"),gt=Ft(F,"Promise"),yt=Ft(F,"Set"),mt=Ft(F,"WeakMap"),wt=Ft(Object,"create"),bt=jt(dt),vt=jt(pt),_t=jt(gt),St=jt(yt),At=jt(mt),Tt=it?it.prototype:void 0,Et=Tt?Tt.valueOf:void 0;function kt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ct(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Pt(t){this.__data__=new Ct(t)}function Mt(t,e,r){var n=t[e];tt.call(t,e)&&Wt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Rt(t,e){for(var r=t.length;r--;)if(Wt(t[r][0],e))return r;return-1}function Nt(t,e,r,n,i,d,w){var R;if(n&&(R=d?n(t,i,d,w):n(t)),void 0!==R)return R;if(!Gt(t))return t;var N=Kt(t);if(N){if(R=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,R)}else{var x=Dt(t),I=x==u||x==c;if(qt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(x==l||x==o||I&&!d){if(K(t))return d?t:{};if(R=function(t){return"function"!=typeof t.constructor||Vt(t)?{}:Gt(e=at(t))?st(e):{};var e}(I?{}:t),!e)return function(t,e){return xt(t,Lt(t),e)}(t,function(t,e){return t&&xt(e,$t(e),t)}(R,t))}else{if(!B[x])return d?t:{};R=function(t,e,r,n){var i,o=t.constructor;switch(e){case b:return Bt(t);case a:case s:return new o(+t);case v:return function(t,e){var r=e?Bt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case _:case S:case A:case T:case E:case k:case C:case O:case P:return function(t,e){var r=e?Bt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return W(e?r(H(t),!0):H(t),V,new t.constructor)}(t,n,r);case h:case y:return new o(t);case p:return function(t){var e=new t.constructor(t.source,M.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,r){return W(e?r(z(t),!0):z(t),j,new t.constructor)}(t,n,r);case m:return i=t,Et?Object(Et.call(i)):{}}}(t,x,Nt,e)}}w||(w=new Pt);var F=w.get(t);if(F)return F;if(w.set(t,R),!N)var L=r?function(t){return function(t,e,r){var n=e(t);return Kt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,$t,Lt)}(t):$t(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(L||t,(function(i,o){L&&(i=t[o=i]),Mt(R,o,Nt(i,e,r,n,o,t,w))})),R}function Bt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function xt(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=n?n(r[a],t[a],a,r,t):void 0;Mt(r,a,void 0===s?t[a]:s)}return r}function It(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Ft(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Gt(t)||(e=t,Z&&Z in e))&&(zt(t)||K(t)?rt:R).test(jt(t));var e}(r)?r:void 0}kt.prototype.clear=function(){this.__data__=wt?wt(null):{}},kt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},kt.prototype.get=function(t){var e=this.__data__;if(wt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},kt.prototype.has=function(t){var e=this.__data__;return wt?void 0!==e[t]:tt.call(e,t)},kt.prototype.set=function(t,e){return this.__data__[t]=wt&&void 0===e?n:e,this},Ct.prototype.clear=function(){this.__data__=[]},Ct.prototype.delete=function(t){var e=this.__data__,r=Rt(e,t);return!(r<0||(r==e.length-1?e.pop():ct.call(e,r,1),0))},Ct.prototype.get=function(t){var e=this.__data__,r=Rt(e,t);return r<0?void 0:e[r][1]},Ct.prototype.has=function(t){return Rt(this.__data__,t)>-1},Ct.prototype.set=function(t,e){var r=this.__data__,n=Rt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Ot.prototype.clear=function(){this.__data__={hash:new kt,map:new(pt||Ct),string:new kt}},Ot.prototype.delete=function(t){return It(this,t).delete(t)},Ot.prototype.get=function(t){return It(this,t).get(t)},Ot.prototype.has=function(t){return It(this,t).has(t)},Ot.prototype.set=function(t,e){return It(this,t).set(t,e),this},Pt.prototype.clear=function(){this.__data__=new Ct},Pt.prototype.delete=function(t){return this.__data__.delete(t)},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ct){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Ot(n)}return r.set(t,e),this};var Lt=ft?q(ft,Object):function(){return[]},Dt=function(t){return et.call(t)};function Ut(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||N.test(t))&&t>-1&&t%1==0&&t<e}function Vt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function jt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Wt(t,e){return t===e||t!=t&&e!=e}(dt&&Dt(new dt(new ArrayBuffer(1)))!=v||pt&&Dt(new pt)!=f||gt&&Dt(gt.resolve())!=d||yt&&Dt(new yt)!=g||mt&&Dt(new mt)!=w)&&(Dt=function(t){var e=et.call(t),r=e==l?t.constructor:void 0,n=r?jt(r):void 0;if(n)switch(n){case bt:return v;case vt:return f;case _t:return d;case St:return g;case At:return w}return e});var Kt=Array.isArray;function Ht(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!zt(t)}var qt=ht||function(){return!1};function zt(t){var e=Gt(t)?et.call(t):"";return e==u||e==c}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function $t(t){return Ht(t)?function(t,e){var r=Kt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ht(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var a in t)!e&&!tt.call(t,a)||i&&("length"==a||Ut(a,n))||r.push(a);return r}(t):function(t){if(!Vt(t))return lt(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Nt(t,!0,!0)}},2543:function(t,e,r){var n;t=r.nmd(t),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",u=32,c=128,f=1/0,h=9007199254740991,l=NaN,d=4294967295,p=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],g="[object Arguments]",y="[object Array]",m="[object Boolean]",w="[object Date]",b="[object Error]",v="[object Function]",_="[object GeneratorFunction]",S="[object Map]",A="[object Number]",T="[object Object]",E="[object Promise]",k="[object RegExp]",C="[object Set]",O="[object String]",P="[object Symbol]",M="[object WeakMap]",R="[object ArrayBuffer]",N="[object DataView]",B="[object Float32Array]",x="[object Float64Array]",I="[object Int8Array]",F="[object Int16Array]",L="[object Int32Array]",D="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",j="[object Uint32Array]",W=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,G=RegExp(q.source),$=RegExp(z.source),X=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,rt=RegExp(et.source),nt=/^\s+/,it=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,st=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,ft=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,lt=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,gt=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,_t="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Tt="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\ufe0e\\ufe0f",Ct="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ot="["+_t+"]",Pt="["+Ct+"]",Mt="["+St+"]",Rt="\\d+",Nt="["+At+"]",Bt="["+Tt+"]",xt="[^"+_t+Ct+Rt+At+Tt+Et+"]",It="\\ud83c[\\udffb-\\udfff]",Ft="[^"+_t+"]",Lt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Et+"]",Vt="\\u200d",jt="(?:"+Bt+"|"+xt+")",Wt="(?:"+Ut+"|"+xt+")",Kt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",qt="(?:"+Mt+"|"+It+")?",zt="["+kt+"]?",Gt=zt+qt+"(?:"+Vt+"(?:"+[Ft,Lt,Dt].join("|")+")"+zt+qt+")*",$t="(?:"+[Nt,Lt,Dt].join("|")+")"+Gt,Xt="(?:"+[Ft+Mt+"?",Mt,Lt,Dt,Ot].join("|")+")",Jt=RegExp("['’]","g"),Yt=RegExp(Mt,"g"),Zt=RegExp(It+"(?="+It+")|"+Xt+Gt,"g"),Qt=RegExp([Ut+"?"+Bt+"+"+Kt+"(?="+[Pt,Ut,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[Pt,Ut+jt,"$"].join("|")+")",Ut+"?"+jt+"+"+Kt,Ut+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rt,$t].join("|"),"g"),te=RegExp("["+Vt+_t+St+kt+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,ie={};ie[B]=ie[x]=ie[I]=ie[F]=ie[L]=ie[D]=ie[U]=ie[V]=ie[j]=!0,ie[g]=ie[y]=ie[R]=ie[m]=ie[N]=ie[w]=ie[b]=ie[v]=ie[S]=ie[A]=ie[T]=ie[k]=ie[C]=ie[O]=ie[M]=!1;var oe={};oe[g]=oe[y]=oe[R]=oe[N]=oe[m]=oe[w]=oe[B]=oe[x]=oe[I]=oe[F]=oe[L]=oe[S]=oe[A]=oe[T]=oe[k]=oe[C]=oe[O]=oe[P]=oe[D]=oe[U]=oe[V]=oe[j]=!0,oe[b]=oe[v]=oe[M]=!1;var ae={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},se=parseFloat,ue=parseInt,ce="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,fe="object"==typeof self&&self&&self.Object===Object&&self,he=ce||fe||Function("return this")(),le=e&&!e.nodeType&&e,de=le&&t&&!t.nodeType&&t,pe=de&&de.exports===le,ge=pe&&ce.process,ye=function(){try{return de&&de.require&&de.require("util").types||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),me=ye&&ye.isArrayBuffer,we=ye&&ye.isDate,be=ye&&ye.isMap,ve=ye&&ye.isRegExp,_e=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function Ae(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Te(t,e,r,n){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(n,a,r(a),t)}return n}function Ee(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function ke(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function Ce(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Oe(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o}function Pe(t,e){return!(null==t||!t.length)&&Ue(t,e,0)>-1}function Me(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function Re(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function Ne(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function Be(t,e,r,n){var i=-1,o=null==t?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function xe(t,e,r,n){var i=null==t?0:t.length;for(n&&i&&(r=t[--i]);i--;)r=e(r,t[i],i,t);return r}function Ie(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Fe=Ke("length");function Le(t,e,r){var n;return r(t,(function(t,r,i){if(e(t,r,i))return n=r,!1})),n}function De(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ue(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):De(t,je,r)}function Ve(t,e,r,n){for(var i=r-1,o=t.length;++i<o;)if(n(t[i],e))return i;return-1}function je(t){return t!=t}function We(t,e){var r=null==t?0:t.length;return r?ze(t,e)/r:l}function Ke(t){return function(e){return null==e?i:e[t]}}function He(t){return function(e){return null==t?i:t[e]}}function qe(t,e,r,n,i){return i(t,(function(t,i,o){r=n?(n=!1,t):e(r,t,i,o)})),r}function ze(t,e){for(var r,n=-1,o=t.length;++n<o;){var a=e(t[n]);a!==i&&(r=r===i?a:r+a)}return r}function Ge(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function $e(t){return t?t.slice(0,hr(t)+1).replace(nt,""):t}function Xe(t){return function(e){return t(e)}}function Je(t,e){return Re(e,(function(e){return t[e]}))}function Ye(t,e){return t.has(e)}function Ze(t,e){for(var r=-1,n=t.length;++r<n&&Ue(e,t[r],0)>-1;);return r}function Qe(t,e){for(var r=t.length;r--&&Ue(e,t[r],0)>-1;);return r}var tr=He({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),er=He({"&":"&","<":"<",">":">",'"':""","'":"'"});function rr(t){return"\\"+ae[t]}function nr(t){return te.test(t)}function ir(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function or(t,e){return function(r){return t(e(r))}}function ar(t,e){for(var r=-1,n=t.length,i=0,o=[];++r<n;){var a=t[r];a!==e&&a!==s||(t[r]=s,o[i++]=r)}return o}function sr(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}function ur(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=[t,t]})),r}function cr(t){return nr(t)?function(t){for(var e=Zt.lastIndex=0;Zt.test(t);)++e;return e}(t):Fe(t)}function fr(t){return nr(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.split("")}(t)}function hr(t){for(var e=t.length;e--&&it.test(t.charAt(e)););return e}var lr=He({"&":"&","<":"<",">":">",""":'"',"'":"'"}),dr=function t(e){var r,n=(e=null==e?he:dr.defaults(he.Object(),e,dr.pick(he,re))).Array,it=e.Date,_t=e.Error,St=e.Function,At=e.Math,Tt=e.Object,Et=e.RegExp,kt=e.String,Ct=e.TypeError,Ot=n.prototype,Pt=St.prototype,Mt=Tt.prototype,Rt=e["__core-js_shared__"],Nt=Pt.toString,Bt=Mt.hasOwnProperty,xt=0,It=(r=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Ft=Mt.toString,Lt=Nt.call(Tt),Dt=he._,Ut=Et("^"+Nt.call(Bt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=pe?e.Buffer:i,jt=e.Symbol,Wt=e.Uint8Array,Kt=Vt?Vt.allocUnsafe:i,Ht=or(Tt.getPrototypeOf,Tt),qt=Tt.create,zt=Mt.propertyIsEnumerable,Gt=Ot.splice,$t=jt?jt.isConcatSpreadable:i,Xt=jt?jt.iterator:i,Zt=jt?jt.toStringTag:i,te=function(){try{var t=uo(Tt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ae=e.clearTimeout!==he.clearTimeout&&e.clearTimeout,ce=it&&it.now!==he.Date.now&&it.now,fe=e.setTimeout!==he.setTimeout&&e.setTimeout,le=At.ceil,de=At.floor,ge=Tt.getOwnPropertySymbols,ye=Vt?Vt.isBuffer:i,Fe=e.isFinite,He=Ot.join,pr=or(Tt.keys,Tt),gr=At.max,yr=At.min,mr=it.now,wr=e.parseInt,br=At.random,vr=Ot.reverse,_r=uo(e,"DataView"),Sr=uo(e,"Map"),Ar=uo(e,"Promise"),Tr=uo(e,"Set"),Er=uo(e,"WeakMap"),kr=uo(Tt,"create"),Cr=Er&&new Er,Or={},Pr=Lo(_r),Mr=Lo(Sr),Rr=Lo(Ar),Nr=Lo(Tr),Br=Lo(Er),xr=jt?jt.prototype:i,Ir=xr?xr.valueOf:i,Fr=xr?xr.toString:i;function Lr(t){if(ts(t)&&!Ka(t)&&!(t instanceof jr)){if(t instanceof Vr)return t;if(Bt.call(t,"__wrapped__"))return Do(t)}return new Vr(t)}var Dr=function(){function t(){}return function(e){if(!Qa(e))return{};if(qt)return qt(e);t.prototype=e;var r=new t;return t.prototype=i,r}}();function Ur(){}function Vr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function jr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Wr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Kr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Hr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function qr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Hr;++e<r;)this.add(t[e])}function zr(t){var e=this.__data__=new Kr(t);this.size=e.size}function Gr(t,e){var r=Ka(t),n=!r&&Wa(t),i=!r&&!n&&Ga(t),o=!r&&!n&&!i&&us(t),a=r||n||i||o,s=a?Ge(t.length,kt):[],u=s.length;for(var c in t)!e&&!Bt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yo(c,u))||s.push(c);return s}function $r(t){var e=t.length;return e?t[qn(0,e-1)]:i}function Xr(t,e){return No(ki(t),on(e,0,t.length))}function Jr(t){return No(ki(t))}function Yr(t,e,r){(r!==i&&!Ua(t[e],r)||r===i&&!(e in t))&&rn(t,e,r)}function Zr(t,e,r){var n=t[e];Bt.call(t,e)&&Ua(n,r)&&(r!==i||e in t)||rn(t,e,r)}function Qr(t,e){for(var r=t.length;r--;)if(Ua(t[r][0],e))return r;return-1}function tn(t,e,r,n){return fn(t,(function(t,i,o){e(n,t,r(t),o)})),n}function en(t,e){return t&&Ci(e,Ms(e),t)}function rn(t,e,r){"__proto__"==e&&te?te(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function nn(t,e){for(var r=-1,o=e.length,a=n(o),s=null==t;++r<o;)a[r]=s?i:Es(t,e[r]);return a}function on(t,e,r){return t==t&&(r!==i&&(t=t<=r?t:r),e!==i&&(t=t>=e?t:e)),t}function an(t,e,r,n,o,a){var s,u=1&e,c=2&e,f=4&e;if(r&&(s=o?r(t,n,o,a):r(t)),s!==i)return s;if(!Qa(t))return t;var h=Ka(t);if(h){if(s=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Bt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!u)return ki(t,s)}else{var l=ho(t),d=l==v||l==_;if(Ga(t))return vi(t,u);if(l==T||l==g||d&&!o){if(s=c||d?{}:po(t),!u)return c?function(t,e){return Ci(t,fo(t),e)}(t,function(t,e){return t&&Ci(e,Rs(e),t)}(s,t)):function(t,e){return Ci(t,co(t),e)}(t,en(s,t))}else{if(!oe[l])return o?t:{};s=function(t,e,r){var n,i=t.constructor;switch(e){case R:return _i(t);case m:case w:return new i(+t);case N:return function(t,e){var r=e?_i(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case B:case x:case I:case F:case L:case D:case U:case V:case j:return Si(t,r);case S:return new i;case A:case O:return new i(t);case k:return function(t){var e=new t.constructor(t.source,lt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case C:return new i;case P:return n=t,Ir?Tt(Ir.call(n)):{}}}(t,l,u)}}a||(a=new zr);var p=a.get(t);if(p)return p;a.set(t,s),os(t)?t.forEach((function(n){s.add(an(n,e,r,n,t,a))})):es(t)&&t.forEach((function(n,i){s.set(i,an(n,e,r,i,t,a))}));var y=h?i:(f?c?eo:to:c?Rs:Ms)(t);return Ee(y||t,(function(n,i){y&&(n=t[i=n]),Zr(s,i,an(n,e,r,i,t,a))})),s}function sn(t,e,r){var n=r.length;if(null==t)return!n;for(t=Tt(t);n--;){var o=r[n],a=e[o],s=t[o];if(s===i&&!(o in t)||!a(s))return!1}return!0}function un(t,e,r){if("function"!=typeof t)throw new Ct(o);return Oo((function(){t.apply(i,r)}),e)}function cn(t,e,r,n){var i=-1,o=Pe,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;r&&(e=Re(e,Xe(r))),n?(o=Me,a=!1):e.length>=200&&(o=Ye,a=!1,e=new qr(e));t:for(;++i<s;){var f=t[i],h=null==r?f:r(f);if(f=n||0!==f?f:0,a&&h==h){for(var l=c;l--;)if(e[l]===h)continue t;u.push(f)}else o(e,h,n)||u.push(f)}return u}Lr.templateSettings={escape:X,evaluate:J,interpolate:Y,variable:"",imports:{_:Lr}},Lr.prototype=Ur.prototype,Lr.prototype.constructor=Lr,Vr.prototype=Dr(Ur.prototype),Vr.prototype.constructor=Vr,jr.prototype=Dr(Ur.prototype),jr.prototype.constructor=jr,Wr.prototype.clear=function(){this.__data__=kr?kr(null):{},this.size=0},Wr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wr.prototype.get=function(t){var e=this.__data__;if(kr){var r=e[t];return r===a?i:r}return Bt.call(e,t)?e[t]:i},Wr.prototype.has=function(t){var e=this.__data__;return kr?e[t]!==i:Bt.call(e,t)},Wr.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=kr&&e===i?a:e,this},Kr.prototype.clear=function(){this.__data__=[],this.size=0},Kr.prototype.delete=function(t){var e=this.__data__,r=Qr(e,t);return!(r<0||(r==e.length-1?e.pop():Gt.call(e,r,1),--this.size,0))},Kr.prototype.get=function(t){var e=this.__data__,r=Qr(e,t);return r<0?i:e[r][1]},Kr.prototype.has=function(t){return Qr(this.__data__,t)>-1},Kr.prototype.set=function(t,e){var r=this.__data__,n=Qr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Hr.prototype.clear=function(){this.size=0,this.__data__={hash:new Wr,map:new(Sr||Kr),string:new Wr}},Hr.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Hr.prototype.get=function(t){return ao(this,t).get(t)},Hr.prototype.has=function(t){return ao(this,t).has(t)},Hr.prototype.set=function(t,e){var r=ao(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},qr.prototype.add=qr.prototype.push=function(t){return this.__data__.set(t,a),this},qr.prototype.has=function(t){return this.__data__.has(t)},zr.prototype.clear=function(){this.__data__=new Kr,this.size=0},zr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},zr.prototype.get=function(t){return this.__data__.get(t)},zr.prototype.has=function(t){return this.__data__.has(t)},zr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Kr){var n=r.__data__;if(!Sr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Hr(n)}return r.set(t,e),this.size=r.size,this};var fn=Mi(wn),hn=Mi(bn,!0);function ln(t,e){var r=!0;return fn(t,(function(t,n,i){return r=!!e(t,n,i)})),r}function dn(t,e,r){for(var n=-1,o=t.length;++n<o;){var a=t[n],s=e(a);if(null!=s&&(u===i?s==s&&!ss(s):r(s,u)))var u=s,c=a}return c}function pn(t,e){var r=[];return fn(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function gn(t,e,r,n,i){var o=-1,a=t.length;for(r||(r=go),i||(i=[]);++o<a;){var s=t[o];e>0&&r(s)?e>1?gn(s,e-1,r,n,i):Ne(i,s):n||(i[i.length]=s)}return i}var yn=Ri(),mn=Ri(!0);function wn(t,e){return t&&yn(t,e,Ms)}function bn(t,e){return t&&mn(t,e,Ms)}function vn(t,e){return Oe(e,(function(e){return Ja(t[e])}))}function _n(t,e){for(var r=0,n=(e=yi(e,t)).length;null!=t&&r<n;)t=t[Fo(e[r++])];return r&&r==n?t:i}function Sn(t,e,r){var n=e(t);return Ka(t)?n:Ne(n,r(t))}function An(t){return null==t?t===i?"[object Undefined]":"[object Null]":Zt&&Zt in Tt(t)?function(t){var e=Bt.call(t,Zt),r=t[Zt];try{t[Zt]=i;var n=!0}catch(t){}var o=Ft.call(t);return n&&(e?t[Zt]=r:delete t[Zt]),o}(t):function(t){return Ft.call(t)}(t)}function Tn(t,e){return t>e}function En(t,e){return null!=t&&Bt.call(t,e)}function kn(t,e){return null!=t&&e in Tt(t)}function Cn(t,e,r){for(var o=r?Me:Pe,a=t[0].length,s=t.length,u=s,c=n(s),f=1/0,h=[];u--;){var l=t[u];u&&e&&(l=Re(l,Xe(e))),f=yr(l.length,f),c[u]=!r&&(e||a>=120&&l.length>=120)?new qr(u&&l):i}l=t[0];var d=-1,p=c[0];t:for(;++d<a&&h.length<f;){var g=l[d],y=e?e(g):g;if(g=r||0!==g?g:0,!(p?Ye(p,y):o(h,y,r))){for(u=s;--u;){var m=c[u];if(!(m?Ye(m,y):o(t[u],y,r)))continue t}p&&p.push(y),h.push(g)}}return h}function On(t,e,r){var n=null==(t=Eo(t,e=yi(e,t)))?t:t[Fo(Xo(e))];return null==n?i:Ae(n,t,r)}function Pn(t){return ts(t)&&An(t)==g}function Mn(t,e,r,n,o){return t===e||(null==t||null==e||!ts(t)&&!ts(e)?t!=t&&e!=e:function(t,e,r,n,o,a){var s=Ka(t),u=Ka(e),c=s?y:ho(t),f=u?y:ho(e),h=(c=c==g?T:c)==T,l=(f=f==g?T:f)==T,d=c==f;if(d&&Ga(t)){if(!Ga(e))return!1;s=!0,h=!1}if(d&&!h)return a||(a=new zr),s||us(t)?Zi(t,e,r,n,o,a):function(t,e,r,n,i,o,a){switch(r){case N:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!o(new Wt(t),new Wt(e)));case m:case w:case A:return Ua(+t,+e);case b:return t.name==e.name&&t.message==e.message;case k:case O:return t==e+"";case S:var s=ir;case C:var u=1&n;if(s||(s=sr),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var f=Zi(s(t),s(e),n,i,o,a);return a.delete(t),f;case P:if(Ir)return Ir.call(t)==Ir.call(e)}return!1}(t,e,c,r,n,o,a);if(!(1&r)){var p=h&&Bt.call(t,"__wrapped__"),v=l&&Bt.call(e,"__wrapped__");if(p||v){var _=p?t.value():t,E=v?e.value():e;return a||(a=new zr),o(_,E,r,n,a)}}return!!d&&(a||(a=new zr),function(t,e,r,n,o,a){var s=1&r,u=to(t),c=u.length;if(c!=to(e).length&&!s)return!1;for(var f=c;f--;){var h=u[f];if(!(s?h in e:Bt.call(e,h)))return!1}var l=a.get(t),d=a.get(e);if(l&&d)return l==e&&d==t;var p=!0;a.set(t,e),a.set(e,t);for(var g=s;++f<c;){var y=t[h=u[f]],m=e[h];if(n)var w=s?n(m,y,h,e,t,a):n(y,m,h,t,e,a);if(!(w===i?y===m||o(y,m,r,n,a):w)){p=!1;break}g||(g="constructor"==h)}if(p&&!g){var b=t.constructor,v=e.constructor;b==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v||(p=!1)}return a.delete(t),a.delete(e),p}(t,e,r,n,o,a))}(t,e,r,n,Mn,o))}function Rn(t,e,r,n){var o=r.length,a=o,s=!n;if(null==t)return!a;for(t=Tt(t);o--;){var u=r[o];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],f=t[c],h=u[1];if(s&&u[2]){if(f===i&&!(c in t))return!1}else{var l=new zr;if(n)var d=n(f,h,c,t,e,l);if(!(d===i?Mn(h,f,3,n,l):d))return!1}}return!0}function Nn(t){return!(!Qa(t)||(e=t,It&&It in e))&&(Ja(t)?Ut:gt).test(Lo(t));var e}function Bn(t){return"function"==typeof t?t:null==t?ru:"object"==typeof t?Ka(t)?Dn(t[0],t[1]):Ln(t):hu(t)}function xn(t){if(!_o(t))return pr(t);var e=[];for(var r in Tt(t))Bt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function In(t,e){return t<e}function Fn(t,e){var r=-1,i=qa(t)?n(t.length):[];return fn(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}function Ln(t){var e=so(t);return 1==e.length&&e[0][2]?Ao(e[0][0],e[0][1]):function(r){return r===t||Rn(r,t,e)}}function Dn(t,e){return wo(t)&&So(e)?Ao(Fo(t),e):function(r){var n=Es(r,t);return n===i&&n===e?ks(r,t):Mn(e,n,3)}}function Un(t,e,r,n,o){t!==e&&yn(e,(function(a,s){if(o||(o=new zr),Qa(a))!function(t,e,r,n,o,a,s){var u=ko(t,r),c=ko(e,r),f=s.get(c);if(f)Yr(t,r,f);else{var h=a?a(u,c,r+"",t,e,s):i,l=h===i;if(l){var d=Ka(c),p=!d&&Ga(c),g=!d&&!p&&us(c);h=c,d||p||g?Ka(u)?h=u:za(u)?h=ki(u):p?(l=!1,h=vi(c,!0)):g?(l=!1,h=Si(c,!0)):h=[]:ns(c)||Wa(c)?(h=u,Wa(u)?h=ys(u):Qa(u)&&!Ja(u)||(h=po(c))):l=!1}l&&(s.set(c,h),o(h,c,n,a,s),s.delete(c)),Yr(t,r,h)}}(t,e,s,r,Un,n,o);else{var u=n?n(ko(t,s),a,s+"",t,e,o):i;u===i&&(u=a),Yr(t,s,u)}}),Rs)}function Vn(t,e){var r=t.length;if(r)return yo(e+=e<0?r:0,r)?t[e]:i}function jn(t,e,r){e=e.length?Re(e,(function(t){return Ka(t)?function(e){return _n(e,1===t.length?t[0]:t)}:t})):[ru];var n=-1;e=Re(e,Xe(oo()));var i=Fn(t,(function(t,r,i){var o=Re(e,(function(e){return e(t)}));return{criteria:o,index:++n,value:t}}));return function(t){var e=t.length;for(t.sort((function(t,e){return function(t,e,r){for(var n=-1,i=t.criteria,o=e.criteria,a=i.length,s=r.length;++n<a;){var u=Ai(i[n],o[n]);if(u)return n>=s?u:u*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));e--;)t[e]=t[e].value;return t}(i)}function Wn(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var a=e[n],s=_n(t,a);r(s,a)&&Jn(o,yi(a,t),s)}return o}function Kn(t,e,r,n){var i=n?Ve:Ue,o=-1,a=e.length,s=t;for(t===e&&(e=ki(e)),r&&(s=Re(t,Xe(r)));++o<a;)for(var u=0,c=e[o],f=r?r(c):c;(u=i(s,f,u,n))>-1;)s!==t&&Gt.call(s,u,1),Gt.call(t,u,1);return t}function Hn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==o){var o=i;yo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function qn(t,e){return t+de(br()*(e-t+1))}function zn(t,e){var r="";if(!t||e<1||e>h)return r;do{e%2&&(r+=t),(e=de(e/2))&&(t+=t)}while(e);return r}function Gn(t,e){return Po(To(t,e,ru),t+"")}function $n(t){return $r(Us(t))}function Xn(t,e){var r=Us(t);return No(r,on(e,0,r.length))}function Jn(t,e,r,n){if(!Qa(t))return t;for(var o=-1,a=(e=yi(e,t)).length,s=a-1,u=t;null!=u&&++o<a;){var c=Fo(e[o]),f=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var h=u[c];(f=n?n(h,c,u):i)===i&&(f=Qa(h)?h:yo(e[o+1])?[]:{})}Zr(u,c,f),u=u[c]}return t}var Yn=Cr?function(t,e){return Cr.set(t,e),t}:ru,Zn=te?function(t,e){return te(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:ru;function Qn(t){return No(Us(t))}function ti(t,e,r){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var a=n(o);++i<o;)a[i]=t[i+e];return a}function ei(t,e){var r;return fn(t,(function(t,n,i){return!(r=e(t,n,i))})),!!r}function ri(t,e,r){var n=0,i=null==t?n:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;n<i;){var o=n+i>>>1,a=t[o];null!==a&&!ss(a)&&(r?a<=e:a<e)?n=o+1:i=o}return i}return ni(t,e,ru,r)}function ni(t,e,r,n){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=r(e))!=e,u=null===e,c=ss(e),f=e===i;o<a;){var h=de((o+a)/2),l=r(t[h]),d=l!==i,p=null===l,g=l==l,y=ss(l);if(s)var m=n||g;else m=f?g&&(n||d):u?g&&d&&(n||!p):c?g&&d&&!p&&(n||!y):!p&&!y&&(n?l<=e:l<e);m?o=h+1:a=h}return yr(a,4294967294)}function ii(t,e){for(var r=-1,n=t.length,i=0,o=[];++r<n;){var a=t[r],s=e?e(a):a;if(!r||!Ua(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function oi(t){return"number"==typeof t?t:ss(t)?l:+t}function ai(t){if("string"==typeof t)return t;if(Ka(t))return Re(t,ai)+"";if(ss(t))return Fr?Fr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function si(t,e,r){var n=-1,i=Pe,o=t.length,a=!0,s=[],u=s;if(r)a=!1,i=Me;else if(o>=200){var c=e?null:zi(t);if(c)return sr(c);a=!1,i=Ye,u=new qr}else u=e?[]:s;t:for(;++n<o;){var f=t[n],h=e?e(f):f;if(f=r||0!==f?f:0,a&&h==h){for(var l=u.length;l--;)if(u[l]===h)continue t;e&&u.push(h),s.push(f)}else i(u,h,r)||(u!==s&&u.push(h),s.push(f))}return s}function ui(t,e){return null==(t=Eo(t,e=yi(e,t)))||delete t[Fo(Xo(e))]}function ci(t,e,r,n){return Jn(t,e,r(_n(t,e)),n)}function fi(t,e,r,n){for(var i=t.length,o=n?i:-1;(n?o--:++o<i)&&e(t[o],o,t););return r?ti(t,n?0:o,n?o+1:i):ti(t,n?o+1:0,n?i:o)}function hi(t,e){var r=t;return r instanceof jr&&(r=r.value()),Be(e,(function(t,e){return e.func.apply(e.thisArg,Ne([t],e.args))}),r)}function li(t,e,r){var i=t.length;if(i<2)return i?si(t[0]):[];for(var o=-1,a=n(i);++o<i;)for(var s=t[o],u=-1;++u<i;)u!=o&&(a[o]=cn(a[o]||s,t[u],e,r));return si(gn(a,1),e,r)}function di(t,e,r){for(var n=-1,o=t.length,a=e.length,s={};++n<o;){var u=n<a?e[n]:i;r(s,t[n],u)}return s}function pi(t){return za(t)?t:[]}function gi(t){return"function"==typeof t?t:ru}function yi(t,e){return Ka(t)?t:wo(t,e)?[t]:Io(ms(t))}var mi=Gn;function wi(t,e,r){var n=t.length;return r=r===i?n:r,!e&&r>=n?t:ti(t,e,r)}var bi=ae||function(t){return he.clearTimeout(t)};function vi(t,e){if(e)return t.slice();var r=t.length,n=Kt?Kt(r):new t.constructor(r);return t.copy(n),n}function _i(t){var e=new t.constructor(t.byteLength);return new Wt(e).set(new Wt(t)),e}function Si(t,e){var r=e?_i(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Ai(t,e){if(t!==e){var r=t!==i,n=null===t,o=t==t,a=ss(t),s=e!==i,u=null===e,c=e==e,f=ss(e);if(!u&&!f&&!a&&t>e||a&&s&&c&&!u&&!f||n&&s&&c||!r&&c||!o)return 1;if(!n&&!a&&!f&&t<e||f&&r&&o&&!n&&!a||u&&r&&o||!s&&o||!c)return-1}return 0}function Ti(t,e,r,i){for(var o=-1,a=t.length,s=r.length,u=-1,c=e.length,f=gr(a-s,0),h=n(c+f),l=!i;++u<c;)h[u]=e[u];for(;++o<s;)(l||o<a)&&(h[r[o]]=t[o]);for(;f--;)h[u++]=t[o++];return h}function Ei(t,e,r,i){for(var o=-1,a=t.length,s=-1,u=r.length,c=-1,f=e.length,h=gr(a-u,0),l=n(h+f),d=!i;++o<h;)l[o]=t[o];for(var p=o;++c<f;)l[p+c]=e[c];for(;++s<u;)(d||o<a)&&(l[p+r[s]]=t[o++]);return l}function ki(t,e){var r=-1,i=t.length;for(e||(e=n(i));++r<i;)e[r]=t[r];return e}function Ci(t,e,r,n){var o=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var u=e[a],c=n?n(r[u],t[u],u,r,t):i;c===i&&(c=t[u]),o?rn(r,u,c):Zr(r,u,c)}return r}function Oi(t,e){return function(r,n){var i=Ka(r)?Te:tn,o=e?e():{};return i(r,t,oo(n,2),o)}}function Pi(t){return Gn((function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:i,s=o>2?r[2]:i;for(a=t.length>3&&"function"==typeof a?(o--,a):i,s&&mo(r[0],r[1],s)&&(a=o<3?i:a,o=1),e=Tt(e);++n<o;){var u=r[n];u&&t(e,u,n,a)}return e}))}function Mi(t,e){return function(r,n){if(null==r)return r;if(!qa(r))return t(r,n);for(var i=r.length,o=e?i:-1,a=Tt(r);(e?o--:++o<i)&&!1!==n(a[o],o,a););return r}}function Ri(t){return function(e,r,n){for(var i=-1,o=Tt(e),a=n(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===r(o[u],u,o))break}return e}}function Ni(t){return function(e){var r=nr(e=ms(e))?fr(e):i,n=r?r[0]:e.charAt(0),o=r?wi(r,1).join(""):e.slice(1);return n[t]()+o}}function Bi(t){return function(e){return Be(Js(Ws(e).replace(Jt,"")),t,"")}}function xi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Dr(t.prototype),n=t.apply(r,e);return Qa(n)?n:r}}function Ii(t){return function(e,r,n){var o=Tt(e);if(!qa(e)){var a=oo(r,3);e=Ms(e),r=function(t){return a(o[t],t,o)}}var s=t(e,r,n);return s>-1?o[a?e[s]:s]:i}}function Fi(t){return Qi((function(e){var r=e.length,n=r,a=Vr.prototype.thru;for(t&&e.reverse();n--;){var s=e[n];if("function"!=typeof s)throw new Ct(o);if(a&&!u&&"wrapper"==no(s))var u=new Vr([],!0)}for(n=u?n:r;++n<r;){var c=no(s=e[n]),f="wrapper"==c?ro(s):i;u=f&&bo(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?u[no(f[0])].apply(u,f[3]):1==s.length&&bo(s)?u[c]():u.thru(s)}return function(){var t=arguments,n=t[0];if(u&&1==t.length&&Ka(n))return u.plant(n).value();for(var i=0,o=r?e[i].apply(this,t):n;++i<r;)o=e[i].call(this,o);return o}}))}function Li(t,e,r,o,a,s,u,f,h,l){var d=e&c,p=1&e,g=2&e,y=24&e,m=512&e,w=g?i:xi(t);return function c(){for(var b=arguments.length,v=n(b),_=b;_--;)v[_]=arguments[_];if(y)var S=io(c),A=function(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}(v,S);if(o&&(v=Ti(v,o,a,y)),s&&(v=Ei(v,s,u,y)),b-=A,y&&b<l){var T=ar(v,S);return Hi(t,e,Li,c.placeholder,r,v,T,f,h,l-b)}var E=p?r:this,k=g?E[t]:t;return b=v.length,f?v=function(t,e){for(var r=t.length,n=yr(e.length,r),o=ki(t);n--;){var a=e[n];t[n]=yo(a,r)?o[a]:i}return t}(v,f):m&&b>1&&v.reverse(),d&&h<b&&(v.length=h),this&&this!==he&&this instanceof c&&(k=w||xi(k)),k.apply(E,v)}}function Di(t,e){return function(r,n){return function(t,e,r,n){return wn(t,(function(t,i,o){e(n,r(t),i,o)})),n}(r,t,e(n),{})}}function Ui(t,e){return function(r,n){var o;if(r===i&&n===i)return e;if(r!==i&&(o=r),n!==i){if(o===i)return n;"string"==typeof r||"string"==typeof n?(r=ai(r),n=ai(n)):(r=oi(r),n=oi(n)),o=t(r,n)}return o}}function Vi(t){return Qi((function(e){return e=Re(e,Xe(oo())),Gn((function(r){var n=this;return t(e,(function(t){return Ae(t,n,r)}))}))}))}function ji(t,e){var r=(e=e===i?" ":ai(e)).length;if(r<2)return r?zn(e,t):e;var n=zn(e,le(t/cr(e)));return nr(e)?wi(fr(n),0,t).join(""):n.slice(0,t)}function Wi(t){return function(e,r,o){return o&&"number"!=typeof o&&mo(e,r,o)&&(r=o=i),e=ls(e),r===i?(r=e,e=0):r=ls(r),function(t,e,r,i){for(var o=-1,a=gr(le((e-t)/(r||1)),0),s=n(a);a--;)s[i?a:++o]=t,t+=r;return s}(e,r,o=o===i?e<r?1:-1:ls(o),t)}}function Ki(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=gs(e),r=gs(r)),t(e,r)}}function Hi(t,e,r,n,o,a,s,c,f,h){var l=8&e;e|=l?u:64,4&(e&=~(l?64:u))||(e&=-4);var d=[t,e,o,l?a:i,l?s:i,l?i:a,l?i:s,c,f,h],p=r.apply(i,d);return bo(t)&&Co(p,d),p.placeholder=n,Mo(p,t,e)}function qi(t){var e=At[t];return function(t,r){if(t=gs(t),(r=null==r?0:yr(ds(r),292))&&Fe(t)){var n=(ms(t)+"e").split("e");return+((n=(ms(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}var zi=Tr&&1/sr(new Tr([,-0]))[1]==f?function(t){return new Tr(t)}:su;function Gi(t){return function(e){var r=ho(e);return r==S?ir(e):r==C?ur(e):function(t,e){return Re(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function $i(t,e,r,a,f,h,l,d){var p=2&e;if(!p&&"function"!=typeof t)throw new Ct(o);var g=a?a.length:0;if(g||(e&=-97,a=f=i),l=l===i?l:gr(ds(l),0),d=d===i?d:ds(d),g-=f?f.length:0,64&e){var y=a,m=f;a=f=i}var w=p?i:ro(t),b=[t,e,r,a,f,y,m,h,l,d];if(w&&function(t,e){var r=t[1],n=e[1],i=r|n,o=i<131,a=n==c&&8==r||n==c&&256==r&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!o&&!a)return t;1&n&&(t[2]=e[2],i|=1&r?0:4);var u=e[3];if(u){var f=t[3];t[3]=f?Ti(f,u,e[4]):u,t[4]=f?ar(t[3],s):e[4]}(u=e[5])&&(f=t[5],t[5]=f?Ei(f,u,e[6]):u,t[6]=f?ar(t[5],s):e[6]),(u=e[7])&&(t[7]=u),n&c&&(t[8]=null==t[8]?e[8]:yr(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(b,w),t=b[0],e=b[1],r=b[2],a=b[3],f=b[4],!(d=b[9]=b[9]===i?p?0:t.length:gr(b[9]-g,0))&&24&e&&(e&=-25),e&&1!=e)v=8==e||16==e?function(t,e,r){var o=xi(t);return function a(){for(var s=arguments.length,u=n(s),c=s,f=io(a);c--;)u[c]=arguments[c];var h=s<3&&u[0]!==f&&u[s-1]!==f?[]:ar(u,f);return(s-=h.length)<r?Hi(t,e,Li,a.placeholder,i,u,h,i,i,r-s):Ae(this&&this!==he&&this instanceof a?o:t,this,u)}}(t,e,d):e!=u&&33!=e||f.length?Li.apply(i,b):function(t,e,r,i){var o=1&e,a=xi(t);return function e(){for(var s=-1,u=arguments.length,c=-1,f=i.length,h=n(f+u),l=this&&this!==he&&this instanceof e?a:t;++c<f;)h[c]=i[c];for(;u--;)h[c++]=arguments[++s];return Ae(l,o?r:this,h)}}(t,e,r,a);else var v=function(t,e,r){var n=1&e,i=xi(t);return function e(){return(this&&this!==he&&this instanceof e?i:t).apply(n?r:this,arguments)}}(t,e,r);return Mo((w?Yn:Co)(v,b),t,e)}function Xi(t,e,r,n){return t===i||Ua(t,Mt[r])&&!Bt.call(n,r)?e:t}function Ji(t,e,r,n,o,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Un(t,e,i,Ji,a),a.delete(e)),t}function Yi(t){return ns(t)?i:t}function Zi(t,e,r,n,o,a){var s=1&r,u=t.length,c=e.length;if(u!=c&&!(s&&c>u))return!1;var f=a.get(t),h=a.get(e);if(f&&h)return f==e&&h==t;var l=-1,d=!0,p=2&r?new qr:i;for(a.set(t,e),a.set(e,t);++l<u;){var g=t[l],y=e[l];if(n)var m=s?n(y,g,l,e,t,a):n(g,y,l,t,e,a);if(m!==i){if(m)continue;d=!1;break}if(p){if(!Ie(e,(function(t,e){if(!Ye(p,e)&&(g===t||o(g,t,r,n,a)))return p.push(e)}))){d=!1;break}}else if(g!==y&&!o(g,y,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d}function Qi(t){return Po(To(t,i,Ho),t+"")}function to(t){return Sn(t,Ms,co)}function eo(t){return Sn(t,Rs,fo)}var ro=Cr?function(t){return Cr.get(t)}:su;function no(t){for(var e=t.name+"",r=Or[e],n=Bt.call(Or,e)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(Bt.call(Lr,"placeholder")?Lr:t).placeholder}function oo(){var t=Lr.iteratee||nu;return t=t===nu?Bn:t,arguments.length?t(arguments[0],arguments[1]):t}function ao(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function so(t){for(var e=Ms(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,So(i)]}return e}function uo(t,e){var r=function(t,e){return null==t?i:t[e]}(t,e);return Nn(r)?r:i}var co=ge?function(t){return null==t?[]:(t=Tt(t),Oe(ge(t),(function(e){return zt.call(t,e)})))}:pu,fo=ge?function(t){for(var e=[];t;)Ne(e,co(t)),t=Ht(t);return e}:pu,ho=An;function lo(t,e,r){for(var n=-1,i=(e=yi(e,t)).length,o=!1;++n<i;){var a=Fo(e[n]);if(!(o=null!=t&&r(t,a)))break;t=t[a]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&Za(i)&&yo(a,i)&&(Ka(t)||Wa(t))}function po(t){return"function"!=typeof t.constructor||_o(t)?{}:Dr(Ht(t))}function go(t){return Ka(t)||Wa(t)||!!($t&&t&&t[$t])}function yo(t,e){var r=typeof t;return!!(e=null==e?h:e)&&("number"==r||"symbol"!=r&&mt.test(t))&&t>-1&&t%1==0&&t<e}function mo(t,e,r){if(!Qa(r))return!1;var n=typeof e;return!!("number"==n?qa(r)&&yo(e,r.length):"string"==n&&e in r)&&Ua(r[e],t)}function wo(t,e){if(Ka(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!ss(t))||Q.test(t)||!Z.test(t)||null!=e&&t in Tt(e)}function bo(t){var e=no(t),r=Lr[e];if("function"!=typeof r||!(e in jr.prototype))return!1;if(t===r)return!0;var n=ro(r);return!!n&&t===n[0]}(_r&&ho(new _r(new ArrayBuffer(1)))!=N||Sr&&ho(new Sr)!=S||Ar&&ho(Ar.resolve())!=E||Tr&&ho(new Tr)!=C||Er&&ho(new Er)!=M)&&(ho=function(t){var e=An(t),r=e==T?t.constructor:i,n=r?Lo(r):"";if(n)switch(n){case Pr:return N;case Mr:return S;case Rr:return E;case Nr:return C;case Br:return M}return e});var vo=Rt?Ja:gu;function _o(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Mt)}function So(t){return t==t&&!Qa(t)}function Ao(t,e){return function(r){return null!=r&&r[t]===e&&(e!==i||t in Tt(r))}}function To(t,e,r){return e=gr(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,a=gr(i.length-e,0),s=n(a);++o<a;)s[o]=i[e+o];o=-1;for(var u=n(e+1);++o<e;)u[o]=i[o];return u[e]=r(s),Ae(t,this,u)}}function Eo(t,e){return e.length<2?t:_n(t,ti(e,0,-1))}function ko(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Co=Ro(Yn),Oo=fe||function(t,e){return he.setTimeout(t,e)},Po=Ro(Zn);function Mo(t,e,r){var n=e+"";return Po(t,function(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Ee(p,(function(r){var n="_."+r[0];e&r[1]&&!Pe(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(st):[]}(n),r)))}function Ro(t){var e=0,r=0;return function(){var n=mr(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function No(t,e){var r=-1,n=t.length,o=n-1;for(e=e===i?n:e;++r<e;){var a=qn(r,o),s=t[a];t[a]=t[r],t[r]=s}return t.length=e,t}var Bo,xo,Io=(Bo=Ba((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,r,n,i){e.push(n?i.replace(ft,"$1"):r||t)})),e}),(function(t){return 500===xo.size&&xo.clear(),t})),xo=Bo.cache,Bo);function Fo(t){if("string"==typeof t||ss(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Lo(t){if(null!=t){try{return Nt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Do(t){if(t instanceof jr)return t.clone();var e=new Vr(t.__wrapped__,t.__chain__);return e.__actions__=ki(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Uo=Gn((function(t,e){return za(t)?cn(t,gn(e,1,za,!0)):[]})),Vo=Gn((function(t,e){var r=Xo(e);return za(r)&&(r=i),za(t)?cn(t,gn(e,1,za,!0),oo(r,2)):[]})),jo=Gn((function(t,e){var r=Xo(e);return za(r)&&(r=i),za(t)?cn(t,gn(e,1,za,!0),i,r):[]}));function Wo(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:ds(r);return i<0&&(i=gr(n+i,0)),De(t,oo(e,3),i)}function Ko(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n-1;return r!==i&&(o=ds(r),o=r<0?gr(n+o,0):yr(o,n-1)),De(t,oo(e,3),o,!0)}function Ho(t){return null!=t&&t.length?gn(t,1):[]}function qo(t){return t&&t.length?t[0]:i}var zo=Gn((function(t){var e=Re(t,pi);return e.length&&e[0]===t[0]?Cn(e):[]})),Go=Gn((function(t){var e=Xo(t),r=Re(t,pi);return e===Xo(r)?e=i:r.pop(),r.length&&r[0]===t[0]?Cn(r,oo(e,2)):[]})),$o=Gn((function(t){var e=Xo(t),r=Re(t,pi);return(e="function"==typeof e?e:i)&&r.pop(),r.length&&r[0]===t[0]?Cn(r,i,e):[]}));function Xo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Jo=Gn(Yo);function Yo(t,e){return t&&t.length&&e&&e.length?Kn(t,e):t}var Zo=Qi((function(t,e){var r=null==t?0:t.length,n=nn(t,e);return Hn(t,Re(e,(function(t){return yo(t,r)?+t:t})).sort(Ai)),n}));function Qo(t){return null==t?t:vr.call(t)}var ta=Gn((function(t){return si(gn(t,1,za,!0))})),ea=Gn((function(t){var e=Xo(t);return za(e)&&(e=i),si(gn(t,1,za,!0),oo(e,2))})),ra=Gn((function(t){var e=Xo(t);return e="function"==typeof e?e:i,si(gn(t,1,za,!0),i,e)}));function na(t){if(!t||!t.length)return[];var e=0;return t=Oe(t,(function(t){if(za(t))return e=gr(t.length,e),!0})),Ge(e,(function(e){return Re(t,Ke(e))}))}function ia(t,e){if(!t||!t.length)return[];var r=na(t);return null==e?r:Re(r,(function(t){return Ae(e,i,t)}))}var oa=Gn((function(t,e){return za(t)?cn(t,e):[]})),aa=Gn((function(t){return li(Oe(t,za))})),sa=Gn((function(t){var e=Xo(t);return za(e)&&(e=i),li(Oe(t,za),oo(e,2))})),ua=Gn((function(t){var e=Xo(t);return e="function"==typeof e?e:i,li(Oe(t,za),i,e)})),ca=Gn(na),fa=Gn((function(t){var e=t.length,r=e>1?t[e-1]:i;return r="function"==typeof r?(t.pop(),r):i,ia(t,r)}));function ha(t){var e=Lr(t);return e.__chain__=!0,e}function la(t,e){return e(t)}var da=Qi((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,o=function(e){return nn(e,t)};return!(e>1||this.__actions__.length)&&n instanceof jr&&yo(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:la,args:[o],thisArg:i}),new Vr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)})),pa=Oi((function(t,e,r){Bt.call(t,r)?++t[r]:rn(t,r,1)})),ga=Ii(Wo),ya=Ii(Ko);function ma(t,e){return(Ka(t)?Ee:fn)(t,oo(e,3))}function wa(t,e){return(Ka(t)?ke:hn)(t,oo(e,3))}var ba=Oi((function(t,e,r){Bt.call(t,r)?t[r].push(e):rn(t,r,[e])})),va=Gn((function(t,e,r){var i=-1,o="function"==typeof e,a=qa(t)?n(t.length):[];return fn(t,(function(t){a[++i]=o?Ae(e,t,r):On(t,e,r)})),a})),_a=Oi((function(t,e,r){rn(t,r,e)}));function Sa(t,e){return(Ka(t)?Re:Fn)(t,oo(e,3))}var Aa=Oi((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),Ta=Gn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&mo(t,e[0],e[1])?e=[]:r>2&&mo(e[0],e[1],e[2])&&(e=[e[0]]),jn(t,gn(e,1),[])})),Ea=ce||function(){return he.Date.now()};function ka(t,e,r){return e=r?i:e,e=t&&null==e?t.length:e,$i(t,c,i,i,i,i,e)}function Ca(t,e){var r;if("function"!=typeof e)throw new Ct(o);return t=ds(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=i),r}}var Oa=Gn((function(t,e,r){var n=1;if(r.length){var i=ar(r,io(Oa));n|=u}return $i(t,n,e,r,i)})),Pa=Gn((function(t,e,r){var n=3;if(r.length){var i=ar(r,io(Pa));n|=u}return $i(e,n,t,r,i)}));function Ma(t,e,r){var n,a,s,u,c,f,h=0,l=!1,d=!1,p=!0;if("function"!=typeof t)throw new Ct(o);function g(e){var r=n,o=a;return n=a=i,h=e,u=t.apply(o,r)}function y(t){var r=t-f;return f===i||r>=e||r<0||d&&t-h>=s}function m(){var t=Ea();if(y(t))return w(t);c=Oo(m,function(t){var r=e-(t-f);return d?yr(r,s-(t-h)):r}(t))}function w(t){return c=i,p&&n?g(t):(n=a=i,u)}function b(){var t=Ea(),r=y(t);if(n=arguments,a=this,f=t,r){if(c===i)return function(t){return h=t,c=Oo(m,e),l?g(t):u}(f);if(d)return bi(c),c=Oo(m,e),g(f)}return c===i&&(c=Oo(m,e)),u}return e=gs(e)||0,Qa(r)&&(l=!!r.leading,s=(d="maxWait"in r)?gr(gs(r.maxWait)||0,e):s,p="trailing"in r?!!r.trailing:p),b.cancel=function(){c!==i&&bi(c),h=0,n=f=a=c=i},b.flush=function(){return c===i?u:w(Ea())},b}var Ra=Gn((function(t,e){return un(t,1,e)})),Na=Gn((function(t,e,r){return un(t,gs(e)||0,r)}));function Ba(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(o);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Ba.Cache||Hr),r}function xa(t){if("function"!=typeof t)throw new Ct(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ba.Cache=Hr;var Ia=mi((function(t,e){var r=(e=1==e.length&&Ka(e[0])?Re(e[0],Xe(oo())):Re(gn(e,1),Xe(oo()))).length;return Gn((function(n){for(var i=-1,o=yr(n.length,r);++i<o;)n[i]=e[i].call(this,n[i]);return Ae(t,this,n)}))})),Fa=Gn((function(t,e){var r=ar(e,io(Fa));return $i(t,u,i,e,r)})),La=Gn((function(t,e){var r=ar(e,io(La));return $i(t,64,i,e,r)})),Da=Qi((function(t,e){return $i(t,256,i,i,i,e)}));function Ua(t,e){return t===e||t!=t&&e!=e}var Va=Ki(Tn),ja=Ki((function(t,e){return t>=e})),Wa=Pn(function(){return arguments}())?Pn:function(t){return ts(t)&&Bt.call(t,"callee")&&!zt.call(t,"callee")},Ka=n.isArray,Ha=me?Xe(me):function(t){return ts(t)&&An(t)==R};function qa(t){return null!=t&&Za(t.length)&&!Ja(t)}function za(t){return ts(t)&&qa(t)}var Ga=ye||gu,$a=we?Xe(we):function(t){return ts(t)&&An(t)==w};function Xa(t){if(!ts(t))return!1;var e=An(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ns(t)}function Ja(t){if(!Qa(t))return!1;var e=An(t);return e==v||e==_||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ya(t){return"number"==typeof t&&t==ds(t)}function Za(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ts(t){return null!=t&&"object"==typeof t}var es=be?Xe(be):function(t){return ts(t)&&ho(t)==S};function rs(t){return"number"==typeof t||ts(t)&&An(t)==A}function ns(t){if(!ts(t)||An(t)!=T)return!1;var e=Ht(t);if(null===e)return!0;var r=Bt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Nt.call(r)==Lt}var is=ve?Xe(ve):function(t){return ts(t)&&An(t)==k},os=_e?Xe(_e):function(t){return ts(t)&&ho(t)==C};function as(t){return"string"==typeof t||!Ka(t)&&ts(t)&&An(t)==O}function ss(t){return"symbol"==typeof t||ts(t)&&An(t)==P}var us=Se?Xe(Se):function(t){return ts(t)&&Za(t.length)&&!!ie[An(t)]},cs=Ki(In),fs=Ki((function(t,e){return t<=e}));function hs(t){if(!t)return[];if(qa(t))return as(t)?fr(t):ki(t);if(Xt&&t[Xt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Xt]());var e=ho(t);return(e==S?ir:e==C?sr:Us)(t)}function ls(t){return t?(t=gs(t))===f||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ds(t){var e=ls(t),r=e%1;return e==e?r?e-r:e:0}function ps(t){return t?on(ds(t),0,d):0}function gs(t){if("number"==typeof t)return t;if(ss(t))return l;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=$e(t);var r=pt.test(t);return r||yt.test(t)?ue(t.slice(2),r?2:8):dt.test(t)?l:+t}function ys(t){return Ci(t,Rs(t))}function ms(t){return null==t?"":ai(t)}var ws=Pi((function(t,e){if(_o(e)||qa(e))Ci(e,Ms(e),t);else for(var r in e)Bt.call(e,r)&&Zr(t,r,e[r])})),bs=Pi((function(t,e){Ci(e,Rs(e),t)})),vs=Pi((function(t,e,r,n){Ci(e,Rs(e),t,n)})),_s=Pi((function(t,e,r,n){Ci(e,Ms(e),t,n)})),Ss=Qi(nn),As=Gn((function(t,e){t=Tt(t);var r=-1,n=e.length,o=n>2?e[2]:i;for(o&&mo(e[0],e[1],o)&&(n=1);++r<n;)for(var a=e[r],s=Rs(a),u=-1,c=s.length;++u<c;){var f=s[u],h=t[f];(h===i||Ua(h,Mt[f])&&!Bt.call(t,f))&&(t[f]=a[f])}return t})),Ts=Gn((function(t){return t.push(i,Ji),Ae(Bs,i,t)}));function Es(t,e,r){var n=null==t?i:_n(t,e);return n===i?r:n}function ks(t,e){return null!=t&&lo(t,e,kn)}var Cs=Di((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=r}),Qs(ru)),Os=Di((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Bt.call(t,e)?t[e].push(r):t[e]=[r]}),oo),Ps=Gn(On);function Ms(t){return qa(t)?Gr(t):xn(t)}function Rs(t){return qa(t)?Gr(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var r in Tt(t))e.push(r);return e}(t);var e=_o(t),r=[];for(var n in t)("constructor"!=n||!e&&Bt.call(t,n))&&r.push(n);return r}(t)}var Ns=Pi((function(t,e,r){Un(t,e,r)})),Bs=Pi((function(t,e,r,n){Un(t,e,r,n)})),xs=Qi((function(t,e){var r={};if(null==t)return r;var n=!1;e=Re(e,(function(e){return e=yi(e,t),n||(n=e.length>1),e})),Ci(t,eo(t),r),n&&(r=an(r,7,Yi));for(var i=e.length;i--;)ui(r,e[i]);return r})),Is=Qi((function(t,e){return null==t?{}:function(t,e){return Wn(t,e,(function(e,r){return ks(t,r)}))}(t,e)}));function Fs(t,e){if(null==t)return{};var r=Re(eo(t),(function(t){return[t]}));return e=oo(e),Wn(t,r,(function(t,r){return e(t,r[0])}))}var Ls=Gi(Ms),Ds=Gi(Rs);function Us(t){return null==t?[]:Je(t,Ms(t))}var Vs=Bi((function(t,e,r){return e=e.toLowerCase(),t+(r?js(e):e)}));function js(t){return Xs(ms(t).toLowerCase())}function Ws(t){return(t=ms(t))&&t.replace(wt,tr).replace(Yt,"")}var Ks=Bi((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Hs=Bi((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),qs=Ni("toLowerCase"),zs=Bi((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),Gs=Bi((function(t,e,r){return t+(r?" ":"")+Xs(e)})),$s=Bi((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Xs=Ni("toUpperCase");function Js(t,e,r){return t=ms(t),(e=r?i:e)===i?function(t){return ee.test(t)}(t)?function(t){return t.match(Qt)||[]}(t):function(t){return t.match(ut)||[]}(t):t.match(e)||[]}var Ys=Gn((function(t,e){try{return Ae(t,i,e)}catch(t){return Xa(t)?t:new _t(t)}})),Zs=Qi((function(t,e){return Ee(e,(function(e){e=Fo(e),rn(t,e,Oa(t[e],t))})),t}));function Qs(t){return function(){return t}}var tu=Fi(),eu=Fi(!0);function ru(t){return t}function nu(t){return Bn("function"==typeof t?t:an(t,1))}var iu=Gn((function(t,e){return function(r){return On(r,t,e)}})),ou=Gn((function(t,e){return function(r){return On(t,r,e)}}));function au(t,e,r){var n=Ms(e),i=vn(e,n);null!=r||Qa(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=vn(e,Ms(e)));var o=!(Qa(r)&&"chain"in r&&!r.chain),a=Ja(t);return Ee(i,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(o||e){var r=t(this.__wrapped__);return(r.__actions__=ki(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,Ne([this.value()],arguments))})})),t}function su(){}var uu=Vi(Re),cu=Vi(Ce),fu=Vi(Ie);function hu(t){return wo(t)?Ke(Fo(t)):function(t){return function(e){return _n(e,t)}}(t)}var lu=Wi(),du=Wi(!0);function pu(){return[]}function gu(){return!1}var yu,mu=Ui((function(t,e){return t+e}),0),wu=qi("ceil"),bu=Ui((function(t,e){return t/e}),1),vu=qi("floor"),_u=Ui((function(t,e){return t*e}),1),Su=qi("round"),Au=Ui((function(t,e){return t-e}),0);return Lr.after=function(t,e){if("function"!=typeof e)throw new Ct(o);return t=ds(t),function(){if(--t<1)return e.apply(this,arguments)}},Lr.ary=ka,Lr.assign=ws,Lr.assignIn=bs,Lr.assignInWith=vs,Lr.assignWith=_s,Lr.at=Ss,Lr.before=Ca,Lr.bind=Oa,Lr.bindAll=Zs,Lr.bindKey=Pa,Lr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ka(t)?t:[t]},Lr.chain=ha,Lr.chunk=function(t,e,r){e=(r?mo(t,e,r):e===i)?1:gr(ds(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var a=0,s=0,u=n(le(o/e));a<o;)u[s++]=ti(t,a,a+=e);return u},Lr.compact=function(t){for(var e=-1,r=null==t?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i},Lr.concat=function(){var t=arguments.length;if(!t)return[];for(var e=n(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Ne(Ka(r)?ki(r):[r],gn(e,1))},Lr.cond=function(t){var e=null==t?0:t.length,r=oo();return t=e?Re(t,(function(t){if("function"!=typeof t[1])throw new Ct(o);return[r(t[0]),t[1]]})):[],Gn((function(r){for(var n=-1;++n<e;){var i=t[n];if(Ae(i[0],this,r))return Ae(i[1],this,r)}}))},Lr.conforms=function(t){return function(t){var e=Ms(t);return function(r){return sn(r,t,e)}}(an(t,1))},Lr.constant=Qs,Lr.countBy=pa,Lr.create=function(t,e){var r=Dr(t);return null==e?r:en(r,e)},Lr.curry=function t(e,r,n){var o=$i(e,8,i,i,i,i,i,r=n?i:r);return o.placeholder=t.placeholder,o},Lr.curryRight=function t(e,r,n){var o=$i(e,16,i,i,i,i,i,r=n?i:r);return o.placeholder=t.placeholder,o},Lr.debounce=Ma,Lr.defaults=As,Lr.defaultsDeep=Ts,Lr.defer=Ra,Lr.delay=Na,Lr.difference=Uo,Lr.differenceBy=Vo,Lr.differenceWith=jo,Lr.drop=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,(e=r||e===i?1:ds(e))<0?0:e,n):[]},Lr.dropRight=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,0,(e=n-(e=r||e===i?1:ds(e)))<0?0:e):[]},Lr.dropRightWhile=function(t,e){return t&&t.length?fi(t,oo(e,3),!0,!0):[]},Lr.dropWhile=function(t,e){return t&&t.length?fi(t,oo(e,3),!0):[]},Lr.fill=function(t,e,r,n){var o=null==t?0:t.length;return o?(r&&"number"!=typeof r&&mo(t,e,r)&&(r=0,n=o),function(t,e,r,n){var o=t.length;for((r=ds(r))<0&&(r=-r>o?0:o+r),(n=n===i||n>o?o:ds(n))<0&&(n+=o),n=r>n?0:ps(n);r<n;)t[r++]=e;return t}(t,e,r,n)):[]},Lr.filter=function(t,e){return(Ka(t)?Oe:pn)(t,oo(e,3))},Lr.flatMap=function(t,e){return gn(Sa(t,e),1)},Lr.flatMapDeep=function(t,e){return gn(Sa(t,e),f)},Lr.flatMapDepth=function(t,e,r){return r=r===i?1:ds(r),gn(Sa(t,e),r)},Lr.flatten=Ho,Lr.flattenDeep=function(t){return null!=t&&t.length?gn(t,f):[]},Lr.flattenDepth=function(t,e){return null!=t&&t.length?gn(t,e=e===i?1:ds(e)):[]},Lr.flip=function(t){return $i(t,512)},Lr.flow=tu,Lr.flowRight=eu,Lr.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n},Lr.functions=function(t){return null==t?[]:vn(t,Ms(t))},Lr.functionsIn=function(t){return null==t?[]:vn(t,Rs(t))},Lr.groupBy=ba,Lr.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Lr.intersection=zo,Lr.intersectionBy=Go,Lr.intersectionWith=$o,Lr.invert=Cs,Lr.invertBy=Os,Lr.invokeMap=va,Lr.iteratee=nu,Lr.keyBy=_a,Lr.keys=Ms,Lr.keysIn=Rs,Lr.map=Sa,Lr.mapKeys=function(t,e){var r={};return e=oo(e,3),wn(t,(function(t,n,i){rn(r,e(t,n,i),t)})),r},Lr.mapValues=function(t,e){var r={};return e=oo(e,3),wn(t,(function(t,n,i){rn(r,n,e(t,n,i))})),r},Lr.matches=function(t){return Ln(an(t,1))},Lr.matchesProperty=function(t,e){return Dn(t,an(e,1))},Lr.memoize=Ba,Lr.merge=Ns,Lr.mergeWith=Bs,Lr.method=iu,Lr.methodOf=ou,Lr.mixin=au,Lr.negate=xa,Lr.nthArg=function(t){return t=ds(t),Gn((function(e){return Vn(e,t)}))},Lr.omit=xs,Lr.omitBy=function(t,e){return Fs(t,xa(oo(e)))},Lr.once=function(t){return Ca(2,t)},Lr.orderBy=function(t,e,r,n){return null==t?[]:(Ka(e)||(e=null==e?[]:[e]),Ka(r=n?i:r)||(r=null==r?[]:[r]),jn(t,e,r))},Lr.over=uu,Lr.overArgs=Ia,Lr.overEvery=cu,Lr.overSome=fu,Lr.partial=Fa,Lr.partialRight=La,Lr.partition=Aa,Lr.pick=Is,Lr.pickBy=Fs,Lr.property=hu,Lr.propertyOf=function(t){return function(e){return null==t?i:_n(t,e)}},Lr.pull=Jo,Lr.pullAll=Yo,Lr.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Kn(t,e,oo(r,2)):t},Lr.pullAllWith=function(t,e,r){return t&&t.length&&e&&e.length?Kn(t,e,i,r):t},Lr.pullAt=Zo,Lr.range=lu,Lr.rangeRight=du,Lr.rearg=Da,Lr.reject=function(t,e){return(Ka(t)?Oe:pn)(t,xa(oo(e,3)))},Lr.remove=function(t,e){var r=[];if(!t||!t.length)return r;var n=-1,i=[],o=t.length;for(e=oo(e,3);++n<o;){var a=t[n];e(a,n,t)&&(r.push(a),i.push(n))}return Hn(t,i),r},Lr.rest=function(t,e){if("function"!=typeof t)throw new Ct(o);return Gn(t,e=e===i?e:ds(e))},Lr.reverse=Qo,Lr.sampleSize=function(t,e,r){return e=(r?mo(t,e,r):e===i)?1:ds(e),(Ka(t)?Xr:Xn)(t,e)},Lr.set=function(t,e,r){return null==t?t:Jn(t,e,r)},Lr.setWith=function(t,e,r,n){return n="function"==typeof n?n:i,null==t?t:Jn(t,e,r,n)},Lr.shuffle=function(t){return(Ka(t)?Jr:Qn)(t)},Lr.slice=function(t,e,r){var n=null==t?0:t.length;return n?(r&&"number"!=typeof r&&mo(t,e,r)?(e=0,r=n):(e=null==e?0:ds(e),r=r===i?n:ds(r)),ti(t,e,r)):[]},Lr.sortBy=Ta,Lr.sortedUniq=function(t){return t&&t.length?ii(t):[]},Lr.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Lr.split=function(t,e,r){return r&&"number"!=typeof r&&mo(t,e,r)&&(e=r=i),(r=r===i?d:r>>>0)?(t=ms(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nr(t)?wi(fr(t),0,r):t.split(e,r):[]},Lr.spread=function(t,e){if("function"!=typeof t)throw new Ct(o);return e=null==e?0:gr(ds(e),0),Gn((function(r){var n=r[e],i=wi(r,0,e);return n&&Ne(i,n),Ae(t,this,i)}))},Lr.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Lr.take=function(t,e,r){return t&&t.length?ti(t,0,(e=r||e===i?1:ds(e))<0?0:e):[]},Lr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,(e=n-(e=r||e===i?1:ds(e)))<0?0:e,n):[]},Lr.takeRightWhile=function(t,e){return t&&t.length?fi(t,oo(e,3),!1,!0):[]},Lr.takeWhile=function(t,e){return t&&t.length?fi(t,oo(e,3)):[]},Lr.tap=function(t,e){return e(t),t},Lr.throttle=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new Ct(o);return Qa(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Ma(t,e,{leading:n,maxWait:e,trailing:i})},Lr.thru=la,Lr.toArray=hs,Lr.toPairs=Ls,Lr.toPairsIn=Ds,Lr.toPath=function(t){return Ka(t)?Re(t,Fo):ss(t)?[t]:ki(Io(ms(t)))},Lr.toPlainObject=ys,Lr.transform=function(t,e,r){var n=Ka(t),i=n||Ga(t)||us(t);if(e=oo(e,4),null==r){var o=t&&t.constructor;r=i?n?new o:[]:Qa(t)&&Ja(o)?Dr(Ht(t)):{}}return(i?Ee:wn)(t,(function(t,n,i){return e(r,t,n,i)})),r},Lr.unary=function(t){return ka(t,1)},Lr.union=ta,Lr.unionBy=ea,Lr.unionWith=ra,Lr.uniq=function(t){return t&&t.length?si(t):[]},Lr.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Lr.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?si(t,i,e):[]},Lr.unset=function(t,e){return null==t||ui(t,e)},Lr.unzip=na,Lr.unzipWith=ia,Lr.update=function(t,e,r){return null==t?t:ci(t,e,gi(r))},Lr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:i,null==t?t:ci(t,e,gi(r),n)},Lr.values=Us,Lr.valuesIn=function(t){return null==t?[]:Je(t,Rs(t))},Lr.without=oa,Lr.words=Js,Lr.wrap=function(t,e){return Fa(gi(e),t)},Lr.xor=aa,Lr.xorBy=sa,Lr.xorWith=ua,Lr.zip=ca,Lr.zipObject=function(t,e){return di(t||[],e||[],Zr)},Lr.zipObjectDeep=function(t,e){return di(t||[],e||[],Jn)},Lr.zipWith=fa,Lr.entries=Ls,Lr.entriesIn=Ds,Lr.extend=bs,Lr.extendWith=vs,au(Lr,Lr),Lr.add=mu,Lr.attempt=Ys,Lr.camelCase=Vs,Lr.capitalize=js,Lr.ceil=wu,Lr.clamp=function(t,e,r){return r===i&&(r=e,e=i),r!==i&&(r=(r=gs(r))==r?r:0),e!==i&&(e=(e=gs(e))==e?e:0),on(gs(t),e,r)},Lr.clone=function(t){return an(t,4)},Lr.cloneDeep=function(t){return an(t,5)},Lr.cloneDeepWith=function(t,e){return an(t,5,e="function"==typeof e?e:i)},Lr.cloneWith=function(t,e){return an(t,4,e="function"==typeof e?e:i)},Lr.conformsTo=function(t,e){return null==e||sn(t,e,Ms(e))},Lr.deburr=Ws,Lr.defaultTo=function(t,e){return null==t||t!=t?e:t},Lr.divide=bu,Lr.endsWith=function(t,e,r){t=ms(t),e=ai(e);var n=t.length,o=r=r===i?n:on(ds(r),0,n);return(r-=e.length)>=0&&t.slice(r,o)==e},Lr.eq=Ua,Lr.escape=function(t){return(t=ms(t))&&$.test(t)?t.replace(z,er):t},Lr.escapeRegExp=function(t){return(t=ms(t))&&rt.test(t)?t.replace(et,"\\$&"):t},Lr.every=function(t,e,r){var n=Ka(t)?Ce:ln;return r&&mo(t,e,r)&&(e=i),n(t,oo(e,3))},Lr.find=ga,Lr.findIndex=Wo,Lr.findKey=function(t,e){return Le(t,oo(e,3),wn)},Lr.findLast=ya,Lr.findLastIndex=Ko,Lr.findLastKey=function(t,e){return Le(t,oo(e,3),bn)},Lr.floor=vu,Lr.forEach=ma,Lr.forEachRight=wa,Lr.forIn=function(t,e){return null==t?t:yn(t,oo(e,3),Rs)},Lr.forInRight=function(t,e){return null==t?t:mn(t,oo(e,3),Rs)},Lr.forOwn=function(t,e){return t&&wn(t,oo(e,3))},Lr.forOwnRight=function(t,e){return t&&bn(t,oo(e,3))},Lr.get=Es,Lr.gt=Va,Lr.gte=ja,Lr.has=function(t,e){return null!=t&&lo(t,e,En)},Lr.hasIn=ks,Lr.head=qo,Lr.identity=ru,Lr.includes=function(t,e,r,n){t=qa(t)?t:Us(t),r=r&&!n?ds(r):0;var i=t.length;return r<0&&(r=gr(i+r,0)),as(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Ue(t,e,r)>-1},Lr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:ds(r);return i<0&&(i=gr(n+i,0)),Ue(t,e,i)},Lr.inRange=function(t,e,r){return e=ls(e),r===i?(r=e,e=0):r=ls(r),function(t,e,r){return t>=yr(e,r)&&t<gr(e,r)}(t=gs(t),e,r)},Lr.invoke=Ps,Lr.isArguments=Wa,Lr.isArray=Ka,Lr.isArrayBuffer=Ha,Lr.isArrayLike=qa,Lr.isArrayLikeObject=za,Lr.isBoolean=function(t){return!0===t||!1===t||ts(t)&&An(t)==m},Lr.isBuffer=Ga,Lr.isDate=$a,Lr.isElement=function(t){return ts(t)&&1===t.nodeType&&!ns(t)},Lr.isEmpty=function(t){if(null==t)return!0;if(qa(t)&&(Ka(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Wa(t)))return!t.length;var e=ho(t);if(e==S||e==C)return!t.size;if(_o(t))return!xn(t).length;for(var r in t)if(Bt.call(t,r))return!1;return!0},Lr.isEqual=function(t,e){return Mn(t,e)},Lr.isEqualWith=function(t,e,r){var n=(r="function"==typeof r?r:i)?r(t,e):i;return n===i?Mn(t,e,i,r):!!n},Lr.isError=Xa,Lr.isFinite=function(t){return"number"==typeof t&&Fe(t)},Lr.isFunction=Ja,Lr.isInteger=Ya,Lr.isLength=Za,Lr.isMap=es,Lr.isMatch=function(t,e){return t===e||Rn(t,e,so(e))},Lr.isMatchWith=function(t,e,r){return r="function"==typeof r?r:i,Rn(t,e,so(e),r)},Lr.isNaN=function(t){return rs(t)&&t!=+t},Lr.isNative=function(t){if(vo(t))throw new _t("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Nn(t)},Lr.isNil=function(t){return null==t},Lr.isNull=function(t){return null===t},Lr.isNumber=rs,Lr.isObject=Qa,Lr.isObjectLike=ts,Lr.isPlainObject=ns,Lr.isRegExp=is,Lr.isSafeInteger=function(t){return Ya(t)&&t>=-9007199254740991&&t<=h},Lr.isSet=os,Lr.isString=as,Lr.isSymbol=ss,Lr.isTypedArray=us,Lr.isUndefined=function(t){return t===i},Lr.isWeakMap=function(t){return ts(t)&&ho(t)==M},Lr.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==An(t)},Lr.join=function(t,e){return null==t?"":He.call(t,e)},Lr.kebabCase=Ks,Lr.last=Xo,Lr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=ds(r))<0?gr(n+o,0):yr(o,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):De(t,je,o,!0)},Lr.lowerCase=Hs,Lr.lowerFirst=qs,Lr.lt=cs,Lr.lte=fs,Lr.max=function(t){return t&&t.length?dn(t,ru,Tn):i},Lr.maxBy=function(t,e){return t&&t.length?dn(t,oo(e,2),Tn):i},Lr.mean=function(t){return We(t,ru)},Lr.meanBy=function(t,e){return We(t,oo(e,2))},Lr.min=function(t){return t&&t.length?dn(t,ru,In):i},Lr.minBy=function(t,e){return t&&t.length?dn(t,oo(e,2),In):i},Lr.stubArray=pu,Lr.stubFalse=gu,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=_u,Lr.nth=function(t,e){return t&&t.length?Vn(t,ds(e)):i},Lr.noConflict=function(){return he._===this&&(he._=Dt),this},Lr.noop=su,Lr.now=Ea,Lr.pad=function(t,e,r){t=ms(t);var n=(e=ds(e))?cr(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return ji(de(i),r)+t+ji(le(i),r)},Lr.padEnd=function(t,e,r){t=ms(t);var n=(e=ds(e))?cr(t):0;return e&&n<e?t+ji(e-n,r):t},Lr.padStart=function(t,e,r){t=ms(t);var n=(e=ds(e))?cr(t):0;return e&&n<e?ji(e-n,r)+t:t},Lr.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),wr(ms(t).replace(nt,""),e||0)},Lr.random=function(t,e,r){if(r&&"boolean"!=typeof r&&mo(t,e,r)&&(e=r=i),r===i&&("boolean"==typeof e?(r=e,e=i):"boolean"==typeof t&&(r=t,t=i)),t===i&&e===i?(t=0,e=1):(t=ls(t),e===i?(e=t,t=0):e=ls(e)),t>e){var n=t;t=e,e=n}if(r||t%1||e%1){var o=br();return yr(t+o*(e-t+se("1e-"+((o+"").length-1))),e)}return qn(t,e)},Lr.reduce=function(t,e,r){var n=Ka(t)?Be:qe,i=arguments.length<3;return n(t,oo(e,4),r,i,fn)},Lr.reduceRight=function(t,e,r){var n=Ka(t)?xe:qe,i=arguments.length<3;return n(t,oo(e,4),r,i,hn)},Lr.repeat=function(t,e,r){return e=(r?mo(t,e,r):e===i)?1:ds(e),zn(ms(t),e)},Lr.replace=function(){var t=arguments,e=ms(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Lr.result=function(t,e,r){var n=-1,o=(e=yi(e,t)).length;for(o||(o=1,t=i);++n<o;){var a=null==t?i:t[Fo(e[n])];a===i&&(n=o,a=r),t=Ja(a)?a.call(t):a}return t},Lr.round=Su,Lr.runInContext=t,Lr.sample=function(t){return(Ka(t)?$r:$n)(t)},Lr.size=function(t){if(null==t)return 0;if(qa(t))return as(t)?cr(t):t.length;var e=ho(t);return e==S||e==C?t.size:xn(t).length},Lr.snakeCase=zs,Lr.some=function(t,e,r){var n=Ka(t)?Ie:ei;return r&&mo(t,e,r)&&(e=i),n(t,oo(e,3))},Lr.sortedIndex=function(t,e){return ri(t,e)},Lr.sortedIndexBy=function(t,e,r){return ni(t,e,oo(r,2))},Lr.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var n=ri(t,e);if(n<r&&Ua(t[n],e))return n}return-1},Lr.sortedLastIndex=function(t,e){return ri(t,e,!0)},Lr.sortedLastIndexBy=function(t,e,r){return ni(t,e,oo(r,2),!0)},Lr.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var r=ri(t,e,!0)-1;if(Ua(t[r],e))return r}return-1},Lr.startCase=Gs,Lr.startsWith=function(t,e,r){return t=ms(t),r=null==r?0:on(ds(r),0,t.length),e=ai(e),t.slice(r,r+e.length)==e},Lr.subtract=Au,Lr.sum=function(t){return t&&t.length?ze(t,ru):0},Lr.sumBy=function(t,e){return t&&t.length?ze(t,oo(e,2)):0},Lr.template=function(t,e,r){var n=Lr.templateSettings;r&&mo(t,e,r)&&(e=i),t=ms(t),e=vs({},e,n,Xi);var o,a,s=vs({},e.imports,n.imports,Xi),u=Ms(s),c=Je(s,u),f=0,h=e.interpolate||bt,l="__p += '",d=Et((e.escape||bt).source+"|"+h.source+"|"+(h===Y?ht:bt).source+"|"+(e.evaluate||bt).source+"|$","g"),p="//# sourceURL="+(Bt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(d,(function(e,r,n,i,s,u){return n||(n=i),l+=t.slice(f,u).replace(vt,rr),r&&(o=!0,l+="' +\n__e("+r+") +\n'"),s&&(a=!0,l+="';\n"+s+";\n__p += '"),n&&(l+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=u+e.length,e})),l+="';\n";var g=Bt.call(e,"variable")&&e.variable;if(g){if(ct.test(g))throw new _t("Invalid `variable` option passed into `_.template`")}else l="with (obj) {\n"+l+"\n}\n";l=(a?l.replace(W,""):l).replace(K,"$1").replace(H,"$1;"),l="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var y=Ys((function(){return St(u,p+"return "+l).apply(i,c)}));if(y.source=l,Xa(y))throw y;return y},Lr.times=function(t,e){if((t=ds(t))<1||t>h)return[];var r=d,n=yr(t,d);e=oo(e),t-=d;for(var i=Ge(n,e);++r<t;)e(r);return i},Lr.toFinite=ls,Lr.toInteger=ds,Lr.toLength=ps,Lr.toLower=function(t){return ms(t).toLowerCase()},Lr.toNumber=gs,Lr.toSafeInteger=function(t){return t?on(ds(t),-9007199254740991,h):0===t?t:0},Lr.toString=ms,Lr.toUpper=function(t){return ms(t).toUpperCase()},Lr.trim=function(t,e,r){if((t=ms(t))&&(r||e===i))return $e(t);if(!t||!(e=ai(e)))return t;var n=fr(t),o=fr(e);return wi(n,Ze(n,o),Qe(n,o)+1).join("")},Lr.trimEnd=function(t,e,r){if((t=ms(t))&&(r||e===i))return t.slice(0,hr(t)+1);if(!t||!(e=ai(e)))return t;var n=fr(t);return wi(n,0,Qe(n,fr(e))+1).join("")},Lr.trimStart=function(t,e,r){if((t=ms(t))&&(r||e===i))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var n=fr(t);return wi(n,Ze(n,fr(e))).join("")},Lr.truncate=function(t,e){var r=30,n="...";if(Qa(e)){var o="separator"in e?e.separator:o;r="length"in e?ds(e.length):r,n="omission"in e?ai(e.omission):n}var a=(t=ms(t)).length;if(nr(t)){var s=fr(t);a=s.length}if(r>=a)return t;var u=r-cr(n);if(u<1)return n;var c=s?wi(s,0,u).join(""):t.slice(0,u);if(o===i)return c+n;if(s&&(u+=c.length-u),is(o)){if(t.slice(u).search(o)){var f,h=c;for(o.global||(o=Et(o.source,ms(lt.exec(o))+"g")),o.lastIndex=0;f=o.exec(h);)var l=f.index;c=c.slice(0,l===i?u:l)}}else if(t.indexOf(ai(o),u)!=u){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+n},Lr.unescape=function(t){return(t=ms(t))&&G.test(t)?t.replace(q,lr):t},Lr.uniqueId=function(t){var e=++xt;return ms(t)+e},Lr.upperCase=$s,Lr.upperFirst=Xs,Lr.each=ma,Lr.eachRight=wa,Lr.first=qo,au(Lr,(yu={},wn(Lr,(function(t,e){Bt.call(Lr.prototype,e)||(yu[e]=t)})),yu),{chain:!1}),Lr.VERSION="4.17.21",Ee(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Lr[t].placeholder=Lr})),Ee(["drop","take"],(function(t,e){jr.prototype[t]=function(r){r=r===i?1:gr(ds(r),0);var n=this.__filtered__&&!e?new jr(this):this.clone();return n.__filtered__?n.__takeCount__=yr(r,n.__takeCount__):n.__views__.push({size:yr(r,d),type:t+(n.__dir__<0?"Right":"")}),n},jr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ee(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;jr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),Ee(["head","last"],(function(t,e){var r="take"+(e?"Right":"");jr.prototype[t]=function(){return this[r](1).value()[0]}})),Ee(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");jr.prototype[t]=function(){return this.__filtered__?new jr(this):this[r](1)}})),jr.prototype.compact=function(){return this.filter(ru)},jr.prototype.find=function(t){return this.filter(t).head()},jr.prototype.findLast=function(t){return this.reverse().find(t)},jr.prototype.invokeMap=Gn((function(t,e){return"function"==typeof t?new jr(this):this.map((function(r){return On(r,t,e)}))})),jr.prototype.reject=function(t){return this.filter(xa(oo(t)))},jr.prototype.slice=function(t,e){t=ds(t);var r=this;return r.__filtered__&&(t>0||e<0)?new jr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==i&&(r=(e=ds(e))<0?r.dropRight(-e):r.take(e-t)),r)},jr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},jr.prototype.toArray=function(){return this.take(d)},wn(jr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),o=Lr[n?"take"+("last"==e?"Right":""):e],a=n||/^find/.test(e);o&&(Lr.prototype[e]=function(){var e=this.__wrapped__,s=n?[1]:arguments,u=e instanceof jr,c=s[0],f=u||Ka(e),h=function(t){var e=o.apply(Lr,Ne([t],s));return n&&l?e[0]:e};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var l=this.__chain__,d=!!this.__actions__.length,p=a&&!l,g=u&&!d;if(!a&&f){e=g?e:new jr(this);var y=t.apply(e,s);return y.__actions__.push({func:la,args:[h],thisArg:i}),new Vr(y,l)}return p&&g?t.apply(this,s):(y=this.thru(h),p?n?y.value()[0]:y.value():y)})})),Ee(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Ot[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Lr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Ka(i)?i:[],t)}return this[r]((function(r){return e.apply(Ka(r)?r:[],t)}))}})),wn(jr.prototype,(function(t,e){var r=Lr[e];if(r){var n=r.name+"";Bt.call(Or,n)||(Or[n]=[]),Or[n].push({name:e,func:r})}})),Or[Li(i,2).name]=[{name:"wrapper",func:i}],jr.prototype.clone=function(){var t=new jr(this.__wrapped__);return t.__actions__=ki(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ki(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ki(this.__views__),t},jr.prototype.reverse=function(){if(this.__filtered__){var t=new jr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},jr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ka(t),n=e<0,i=r?t.length:0,o=function(t,e,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=yr(e,t+a);break;case"takeRight":t=gr(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=n?s:a-1,f=this.__iteratees__,h=f.length,l=0,d=yr(u,this.__takeCount__);if(!r||!n&&i==u&&d==u)return hi(t,this.__actions__);var p=[];t:for(;u--&&l<d;){for(var g=-1,y=t[c+=e];++g<h;){var m=f[g],w=m.iteratee,b=m.type,v=w(y);if(2==b)y=v;else if(!v){if(1==b)continue t;break t}}p[l++]=y}return p},Lr.prototype.at=da,Lr.prototype.chain=function(){return ha(this)},Lr.prototype.commit=function(){return new Vr(this.value(),this.__chain__)},Lr.prototype.next=function(){this.__values__===i&&(this.__values__=hs(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Lr.prototype.plant=function(t){for(var e,r=this;r instanceof Ur;){var n=Do(r);n.__index__=0,n.__values__=i,e?o.__wrapped__=n:e=n;var o=n;r=r.__wrapped__}return o.__wrapped__=t,e},Lr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof jr){var e=t;return this.__actions__.length&&(e=new jr(this)),(e=e.reverse()).__actions__.push({func:la,args:[Qo],thisArg:i}),new Vr(e,this.__chain__)}return this.thru(Qo)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,Xt&&(Lr.prototype[Xt]=function(){return this}),Lr}();he._=dr,(n=function(){return dr}.call(e,r,e,t))===i||(t.exports=n)}.call(this)},1514:t=>{"use strict";t.exports=Math.abs},8968:t=>{"use strict";t.exports=Math.floor},6188:t=>{"use strict";t.exports=Math.max},8002:t=>{"use strict";t.exports=Math.min},5880:t=>{"use strict";t.exports=Math.pow},8276:(t,e,r)=>{"use strict";var n=r(6698),i=r(4729),o=r(2861).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,r,n,i,o,a){return u(t+(e&r|~e&n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return u(t+(e&n|r&~n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return u(t+(e^r^n)+i+o|0,a)+e|0}function l(t,e,r,n,i,o,a){return u(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),r=f(r,n=c(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),r=h(r,n=f(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=h(o,r,n,i,t[8],2272392833,11),i=h(i,o,r,n,t[11],1839030562,16),n=h(n,i,o,r,t[14],4259657740,23),r=h(r,n,i,o,t[1],2763975236,4),o=h(o,r,n,i,t[4],1272893353,11),i=h(i,o,r,n,t[7],4139469664,16),n=h(n,i,o,r,t[10],3200236656,23),r=h(r,n,i,o,t[13],681279174,4),o=h(o,r,n,i,t[0],3936430074,11),i=h(i,o,r,n,t[3],3572445317,16),n=h(n,i,o,r,t[6],76029189,23),r=h(r,n,i,o,t[9],3654602809,4),o=h(o,r,n,i,t[12],3873151461,11),i=h(i,o,r,n,t[15],530742520,16),r=l(r,n=h(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,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+o|0},s.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=o.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=s},3547:(t,e,r)=>{var n=r(8287).Buffer;t.exports=function(t,e){if(!Array.isArray(t))throw TypeError("Expected values Array");if("function"!=typeof e)throw TypeError("Expected digest Function");for(var r=t.length,i=t.concat();r>1;){for(var o=0,a=0;a<r;a+=2,++o){var s=i[a],u=a+1===r?s:i[a+1],c=n.concat([s,u]);i[o]=e(c)}r=o}return i[0]}},3349:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},4367:(t,e)=>{"use strict";var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},8859:(t,e,r)=>{var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=n&&i&&"function"==typeof i.get?i.get:null,a=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&u&&"function"==typeof u.get?u.get:null,f=s&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,l="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,g=Object.prototype.toString,y=Function.prototype.toString,m=String.prototype.match,w=String.prototype.slice,b=String.prototype.replace,v=String.prototype.toUpperCase,_=String.prototype.toLowerCase,S=RegExp.prototype.test,A=Array.prototype.concat,T=Array.prototype.join,E=Array.prototype.slice,k=Math.floor,C="function"==typeof BigInt?BigInt.prototype.valueOf:null,O=Object.getOwnPropertySymbols,P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,M="function"==typeof Symbol&&"object"==typeof Symbol.iterator,R="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,B=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function x(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||S.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-k(-t):k(t);if(n!==t){var i=String(n),o=w.call(e,i.length+1);return b.call(i,r,"$&_")+"."+b.call(b.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(e,r,"$&_")}var I=r(2634),F=I.custom,L=H(F)?F:null,D={__proto__:null,double:'"',single:"'"},U={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function V(t,e,r){var n=r.quoteStyle||e,i=D[n];return i+t+i}function j(t){return b.call(String(t),/"/g,""")}function W(t){return!("[object Array]"!==G(t)||R&&"object"==typeof t&&R in t)}function K(t){return!("[object RegExp]"!==G(t)||R&&"object"==typeof t&&R in t)}function H(t){if(M)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!P)return!1;try{return P.call(t),!0}catch(t){}return!1}t.exports=function t(e,n,i,s){var u=n||{};if(z(u,"quoteStyle")&&!z(D,u.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(z(u,"maxStringLength")&&("number"==typeof u.maxStringLength?u.maxStringLength<0&&u.maxStringLength!==1/0:null!==u.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var g=!z(u,"customInspect")||u.customInspect;if("boolean"!=typeof g&&"symbol"!==g)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(z(u,"indent")&&null!==u.indent&&"\t"!==u.indent&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(z(u,"numericSeparator")&&"boolean"!=typeof u.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var v=u.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return X(e,u);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var S=String(e);return v?x(e,S):S}if("bigint"==typeof e){var k=String(e)+"n";return v?x(e,k):k}var O=void 0===u.depth?5:u.depth;if(void 0===i&&(i=0),i>=O&&O>0&&"object"==typeof e)return W(e)?"[Array]":"[Object]";var F,U=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=T.call(Array(t.indent+1)," ")}return{base:r,prev:T.call(Array(e+1),r)}}(u,i);if(void 0===s)s=[];else if($(s,e)>=0)return"[Circular]";function q(e,r,n){if(r&&(s=E.call(s)).push(r),n){var o={depth:u.depth};return z(u,"quoteStyle")&&(o.quoteStyle=u.quoteStyle),t(e,o,i+1,s)}return t(e,u,i+1,s)}if("function"==typeof e&&!K(e)){var J=function(t){if(t.name)return t.name;var e=m.call(y.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),rt=et(e,q);return"[Function"+(J?": "+J:" (anonymous)")+"]"+(rt.length>0?" { "+T.call(rt,", ")+" }":"")}if(H(e)){var nt=M?b.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):P.call(e);return"object"!=typeof e||M?nt:Y(nt)}if((F=e)&&"object"==typeof F&&("undefined"!=typeof HTMLElement&&F instanceof HTMLElement||"string"==typeof F.nodeName&&"function"==typeof F.getAttribute)){for(var it="<"+_.call(String(e.nodeName)),ot=e.attributes||[],at=0;at<ot.length;at++)it+=" "+ot[at].name+"="+V(j(ot[at].value),"double",u);return it+=">",e.childNodes&&e.childNodes.length&&(it+="..."),it+"</"+_.call(String(e.nodeName))+">"}if(W(e)){if(0===e.length)return"[]";var st=et(e,q);return U&&!function(t){for(var e=0;e<t.length;e++)if($(t[e],"\n")>=0)return!1;return!0}(st)?"["+tt(st,U)+"]":"[ "+T.call(st,", ")+" ]"}if(function(t){return!("[object Error]"!==G(t)||R&&"object"==typeof t&&R in t)}(e)){var ut=et(e,q);return"cause"in Error.prototype||!("cause"in e)||N.call(e,"cause")?0===ut.length?"["+String(e)+"]":"{ ["+String(e)+"] "+T.call(ut,", ")+" }":"{ ["+String(e)+"] "+T.call(A.call("[cause]: "+q(e.cause),ut),", ")+" }"}if("object"==typeof e&&g){if(L&&"function"==typeof e[L]&&I)return I(e,{depth:O-i});if("symbol"!==g&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ct=[];return a&&a.call(e,(function(t,r){ct.push(q(r,e,!0)+" => "+q(t,e))})),Q("Map",o.call(e),ct,U)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ft=[];return f&&f.call(e,(function(t){ft.push(q(t,e))})),Q("Set",c.call(e),ft,U)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t,h);try{l.call(t,l)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Z("WeakMap");if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{h.call(t,h)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Z("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Z("WeakRef");if(function(t){return!("[object Number]"!==G(t)||R&&"object"==typeof t&&R in t)}(e))return Y(q(Number(e)));if(function(t){if(!t||"object"!=typeof t||!C)return!1;try{return C.call(t),!0}catch(t){}return!1}(e))return Y(q(C.call(e)));if(function(t){return!("[object Boolean]"!==G(t)||R&&"object"==typeof t&&R in t)}(e))return Y(p.call(e));if(function(t){return!("[object String]"!==G(t)||R&&"object"==typeof t&&R in t)}(e))return Y(q(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||void 0!==r.g&&e===r.g)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==G(t)||R&&"object"==typeof t&&R in t)}(e)&&!K(e)){var ht=et(e,q),lt=B?B(e)===Object.prototype:e instanceof Object||e.constructor===Object,dt=e instanceof Object?"":"null prototype",pt=!lt&&R&&Object(e)===e&&R in e?w.call(G(e),8,-1):dt?"Object":"",gt=(lt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(pt||dt?"["+T.call(A.call([],pt||[],dt||[]),": ")+"] ":"");return 0===ht.length?gt+"{}":U?gt+"{"+tt(ht,U)+"}":gt+"{ "+T.call(ht,", ")+" }"}return String(e)};var q=Object.prototype.hasOwnProperty||function(t){return t in this};function z(t,e){return q.call(t,e)}function G(t){return g.call(t)}function $(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function X(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return X(w.call(t,0,e.maxStringLength),e)+n}var i=U[e.quoteStyle||"single"];return i.lastIndex=0,V(b.call(b.call(t,i,"\\$1"),/[\x00-\x1f]/g,J),"single",e)}function J(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+v.call(e.toString(16))}function Y(t){return"Object("+t+")"}function Z(t){return t+" { ? }"}function Q(t,e,r,n){return t+" ("+e+") {"+(n?tt(r,n):T.call(r,", "))+"}"}function tt(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+T.call(t,","+r)+"\n"+e.prev}function et(t,e){var r=W(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=z(t,i)?e(t[i],t):""}var o,a="function"==typeof O?O(t):[];if(M){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var u in t)z(t,u)&&(r&&String(Number(u))===u&&u<t.length||M&&o["$"+u]instanceof Symbol||(S.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if("function"==typeof O)for(var c=0;c<a.length;c++)N.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}},3106:(t,e,r)=>{var n=r(8119);function i(t){return t<n.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}t.exports={encodingLength:i,encode:function(t,e,r){var o=i(e);return 1===o?t.writeUInt8(e,r):2===o?(t.writeUInt8(n.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===o?(t.writeUInt8(n.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(n.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),o},decode:function(t,e){var r,i,o=t.readUInt8(e);if(o<n.OP_PUSHDATA1)r=o,i=1;else if(o===n.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(o===n.OP_PUSHDATA2){if(e+3>t.length)return null;r=t.readUInt16LE(e+1),i=3}else{if(e+5>t.length)return null;if(o!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:o,number:r,size:i}}}},4765:t=>{"use strict";var e=String.prototype.replace,r=/%20/g,n="RFC3986";t.exports={default:n,formatters:{RFC1738:function(t){return e.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:n}},5373:(t,e,r)=>{"use strict";var n=r(8636),i=r(2642),o=r(4765);t.exports={formats:o,parse:i,stringify:n}},2642:(t,e,r)=>{"use strict";var n=r(7720),i=Object.prototype.hasOwnProperty,o=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},u=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},c=function(t,e,r,n){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(o),c=s?o.slice(0,s.index):o,f=[];if(c){if(!r.plainObjects&&i.call(Object.prototype,c)&&!r.allowPrototypes)return;f.push(c)}for(var h=0;r.depth>0&&null!==(s=a.exec(o))&&h<r.depth;){if(h+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;f.push(s[1])}if(s){if(!0===r.strictDepth)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");f.push("["+o.slice(s.index)+"]")}return function(t,e,r,n){for(var i=n?e:u(e,r),o=t.length-1;o>=0;--o){var a,s=t[o];if("[]"===s&&r.parseArrays)a=r.allowEmptyArrays&&(""===i||r.strictNullHandling&&null===i)?[]:[].concat(i);else{a=r.plainObjects?{__proto__:null}:{};var c="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,f=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,h=parseInt(f,10);r.parseArrays||""!==f?!isNaN(h)&&s!==f&&String(h)===f&&h>=0&&r.parseArrays&&h<=r.arrayLimit?(a=[])[h]=i:"__proto__"!==f&&(a[f]=i):a={0:i}}i=a}return i}(f,e,r,n)}};t.exports=function(t,e){var r=function(t){if(!t)return a;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset,r=void 0===t.duplicates?a.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||a.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:a.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||n.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:a.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?{__proto__:null}:{};for(var f="string"==typeof t?function(t,e){var r={__proto__:null},c=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;c=c.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var f,h=e.parameterLimit===1/0?void 0:e.parameterLimit,l=c.split(e.delimiter,h),d=-1,p=e.charset;if(e.charsetSentinel)for(f=0;f<l.length;++f)0===l[f].indexOf("utf8=")&&("utf8=%E2%9C%93"===l[f]?p="utf-8":"utf8=%26%2310003%3B"===l[f]&&(p="iso-8859-1"),d=f,f=l.length);for(f=0;f<l.length;++f)if(f!==d){var g,y,m=l[f],w=m.indexOf("]="),b=-1===w?m.indexOf("="):w+1;-1===b?(g=e.decoder(m,a.decoder,p,"key"),y=e.strictNullHandling?null:""):(g=e.decoder(m.slice(0,b),a.decoder,p,"key"),y=n.maybeMap(u(m.slice(b+1),e),(function(t){return e.decoder(t,a.decoder,p,"value")}))),y&&e.interpretNumericEntities&&"iso-8859-1"===p&&(y=s(String(y))),m.indexOf("[]=")>-1&&(y=o(y)?[y]:y);var v=i.call(r,g);v&&"combine"===e.duplicates?r[g]=n.combine(r[g],y):v&&"last"!==e.duplicates||(r[g]=y)}return r}(t,r):t,h=r.plainObjects?{__proto__:null}:{},l=Object.keys(f),d=0;d<l.length;++d){var p=l[d],g=c(p,f[p],r,"string"==typeof t);h=n.merge(h,g,r)}return!0===r.allowSparse?h:n.compact(h)}},8636:(t,e,r)=>{"use strict";var n=r(920),i=r(7720),o=r(4765),a=Object.prototype.hasOwnProperty,s={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},u=Array.isArray,c=Array.prototype.push,f=function(t,e){c.apply(t,u(e)?e:[e])},h=Date.prototype.toISOString,l=o.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:i.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:o.formatters[l],indices:!1,serializeDate:function(t){return h.call(t)},skipNulls:!1,strictNullHandling:!1},p={},g=function t(e,r,o,a,s,c,h,l,g,y,m,w,b,v,_,S,A,T){for(var E,k=e,C=T,O=0,P=!1;void 0!==(C=C.get(p))&&!P;){var M=C.get(e);if(O+=1,void 0!==M){if(M===O)throw new RangeError("Cyclic object value");P=!0}void 0===C.get(p)&&(O=0)}if("function"==typeof y?k=y(r,k):k instanceof Date?k=b(k):"comma"===o&&u(k)&&(k=i.maybeMap(k,(function(t){return t instanceof Date?b(t):t}))),null===k){if(c)return g&&!S?g(r,d.encoder,A,"key",v):r;k=""}if("string"==typeof(E=k)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||i.isBuffer(k))return g?[_(S?r:g(r,d.encoder,A,"key",v))+"="+_(g(k,d.encoder,A,"value",v))]:[_(r)+"="+_(String(k))];var R,N=[];if(void 0===k)return N;if("comma"===o&&u(k))S&&g&&(k=i.maybeMap(k,g)),R=[{value:k.length>0?k.join(",")||null:void 0}];else if(u(y))R=y;else{var B=Object.keys(k);R=m?B.sort(m):B}var x=l?String(r).replace(/\./g,"%2E"):String(r),I=a&&u(k)&&1===k.length?x+"[]":x;if(s&&u(k)&&0===k.length)return I+"[]";for(var F=0;F<R.length;++F){var L=R[F],D="object"==typeof L&&L&&void 0!==L.value?L.value:k[L];if(!h||null!==D){var U=w&&l?String(L).replace(/\./g,"%2E"):String(L),V=u(k)?"function"==typeof o?o(I,U):I:I+(w?"."+U:"["+U+"]");T.set(e,O);var j=n();j.set(p,T),f(N,t(D,V,o,a,s,c,h,l,"comma"===o&&S&&u(k)?null:g,y,m,w,b,v,_,S,A,j))}}return N};t.exports=function(t,e){var r,i=t,c=function(t){if(!t)return d;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=o.default;if(void 0!==t.format){if(!a.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n,i=o.formatters[r],c=d.filter;if(("function"==typeof t.filter||u(t.filter))&&(c=t.filter),n=t.arrayFormat in s?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":d.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var f=void 0===t.allowDots?!0===t.encodeDotInKeys||d.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:d.addQueryPrefix,allowDots:f,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:d.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?d.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:d.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:d.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:d.encodeValuesOnly,filter:c,format:r,formatter:i,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:d.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:d.strictNullHandling}}(e);"function"==typeof c.filter?i=(0,c.filter)("",i):u(c.filter)&&(r=c.filter);var h=[];if("object"!=typeof i||null===i)return"";var l=s[c.arrayFormat],p="comma"===l&&c.commaRoundTrip;r||(r=Object.keys(i)),c.sort&&r.sort(c.sort);for(var y=n(),m=0;m<r.length;++m){var w=r[m],b=i[w];c.skipNulls&&null===b||f(h,g(b,w,l,p,c.allowEmptyArrays,c.strictNullHandling,c.skipNulls,c.encodeDotInKeys,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,y))}var v=h.join(c.delimiter),_=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),v.length>0?_+v:""}},7720:(t,e,r)=>{"use strict";var n=r(4765),i=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),s=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r},u=1024;t.exports={arrayToObject:s,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var i=e[n],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var c=s[u],f=a[c];"object"==typeof f&&null!==f&&-1===r.indexOf(f)&&(e.push({obj:a,prop:c}),r.push(f))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},encode:function(t,e,r,i,o){if(0===t.length)return t;var s=t;if("symbol"==typeof t?s=Symbol.prototype.toString.call(t):"string"!=typeof t&&(s=String(t)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var c="",f=0;f<s.length;f+=u){for(var h=s.length>=u?s.slice(f,f+u):s,l=[],d=0;d<h.length;++d){var p=h.charCodeAt(d);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===n.RFC1738&&(40===p||41===p)?l[l.length]=h.charAt(d):p<128?l[l.length]=a[p]:p<2048?l[l.length]=a[192|p>>6]+a[128|63&p]:p<55296||p>=57344?l[l.length]=a[224|p>>12]+a[128|p>>6&63]+a[128|63&p]:(d+=1,p=65536+((1023&p)<<10|1023&h.charCodeAt(d)),l[l.length]=a[240|p>>18]+a[128|p>>12&63]+a[128|p>>6&63]+a[128|63&p])}c+=l.join("")}return c},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(o(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:function t(e,r,n){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(o(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!i.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var a=e;return o(e)&&!o(r)&&(a=s(e,n)),o(e)&&o(r)?(r.forEach((function(r,o){if(i.call(e,o)){var a=e[o];a&&"object"==typeof a&&r&&"object"==typeof r?e[o]=t(a,r,n):e.push(r)}else e[o]=r})),e):Object.keys(r).reduce((function(e,o){var a=r[o];return i.call(e,o)?e[o]=t(e[o],a,n):e[o]=a,e}),a)}}},6663:(t,e,r)=>{"use strict";const n=r(4280),i=r(454),o=r(528),a=r(3055);function s(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(t,e){return e.encode?e.strict?n(t):encodeURIComponent(t):t}function c(t,e){return e.decode?i(t):t}function f(t){return Array.isArray(t)?t.sort():"object"==typeof t?f(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function h(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function l(t){const e=(t=h(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function d(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function p(t,e){s((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const r=function(t){let e;switch(t.arrayFormat){case"index":return(t,r,n)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===n[t]&&(n[t]={}),n[t][e[1]]=r):n[t]=r};case"bracket":return(t,r,n)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"comma":case"separator":return(e,r,n)=>{const i="string"==typeof r&&r.includes(t.arrayFormatSeparator),o="string"==typeof r&&!i&&c(r,t).includes(t.arrayFormatSeparator);r=o?c(r,t):r;const a=i||o?r.split(t.arrayFormatSeparator).map((e=>c(e,t))):null===r?r:c(r,t);n[e]=a};default:return(t,e,r)=>{void 0!==r[t]?r[t]=[].concat(r[t],e):r[t]=e}}}(e),n=Object.create(null);if("string"!=typeof t)return n;if(!(t=t.trim().replace(/^[?#&]/,"")))return n;for(const i of t.split("&")){if(""===i)continue;let[t,a]=o(e.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator"].includes(e.arrayFormat)?a:c(a,e),r(c(t,e),a,n)}for(const t of Object.keys(n)){const r=n[t];if("object"==typeof r&&null!==r)for(const t of Object.keys(r))r[t]=d(r[t],e);else n[t]=d(r,e)}return!1===e.sort?n:(!0===e.sort?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce(((t,e)=>{const r=n[e];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?t[e]=f(r):t[e]=r,t}),Object.create(null))}e.extract=l,e.parse=p,e.stringify=(t,e)=>{if(!t)return"";s((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const r=r=>e.skipNull&&null==t[r]||e.skipEmptyString&&""===t[r],n=function(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{const i=r.length;return void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[u(e,t),"[",i,"]"].join("")]:[...r,[u(e,t),"[",u(i,t),"]=",u(n,t)].join("")]};case"bracket":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[u(e,t),"[]"].join("")]:[...r,[u(e,t),"[]=",u(n,t)].join("")];case"comma":case"separator":return e=>(r,n)=>null==n||0===n.length?r:0===r.length?[[u(e,t),"=",u(n,t)].join("")]:[[r,u(n,t)].join(t.arrayFormatSeparator)];default:return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,u(e,t)]:[...r,[u(e,t),"=",u(n,t)].join("")]}}(e),i={};for(const e of Object.keys(t))r(e)||(i[e]=t[e]);const o=Object.keys(i);return!1!==e.sort&&o.sort(e.sort),o.map((r=>{const i=t[r];return void 0===i?"":null===i?u(r,e):Array.isArray(i)?i.reduce(n(r),[]).join("&"):u(r,e)+"="+u(i,e)})).filter((t=>t.length>0)).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[r,n]=o(t,"#");return Object.assign({url:r.split("?")[0]||"",query:p(l(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:c(n,e)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=h(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),a=Object.assign(o,t.query);let s=e.stringify(a,r);s&&(s=`?${s}`);let c=function(t){let e="";const r=t.indexOf("#");return-1!==r&&(e=t.slice(r)),e}(t.url);return t.fragmentIdentifier&&(c=`#${u(t.fragmentIdentifier,r)}`),`${n}${s}${c}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0},n);const{url:i,query:o,fragmentIdentifier:s}=e.parseUrl(t,n);return e.stringifyUrl({url:i,query:a(o,r),fragmentIdentifier:s},n)},e.exclude=(t,r,n)=>{const i=Array.isArray(r)?t=>!r.includes(t):(t,e)=>!r(t,e);return e.pick(t,i,n)}},3209:(t,e,r)=>{"use strict";var n=65536,i=r(2861).Buffer,o=r.g.crypto||r.g.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>n)for(var a=0;a<t;a+=n)o.getRandomValues(r.slice(a,a+n));else o.getRandomValues(r);return"function"==typeof e?process.nextTick((function(){e(null,r)})):r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},6048:t=>{"use strict";var e={};function r(t,r,n){n||(n=Error);var i=function(t){var e,n;function i(e,n,i){return t.call(this,function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(e,n,i))||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=t,e[t]=i}function n(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))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,o,a,s,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(n(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+1>(s=t).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(n(e,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.F=e},5382:(t,e,r)=>{"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(5412),o=r(6708);r(6698)(c,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||process.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})},3600:(t,e,r)=>{"use strict";t.exports=i;var n=r(4610);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(6698)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},5412:(t,e,r)=>{"use strict";var n;t.exports=T,T.ReadableState=A,r(7007).EventEmitter;var i,o=function(t,e){return t.listeners(e).length},a=r(345),s=r(8287).Buffer,u=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},c=r(9838);i=c&&c.debuglog?c.debuglog("stream"):function(){};var f,h,l,d=r(2726),p=r(5896),g=r(5291).getHighWaterMark,y=r(6048).F,m=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,b=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(T,a);var _=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function A(t,e,i){n=n||r(5382),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new d,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&&(f||(f=r(3141).I),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(n=n||r(5382),!(this instanceof T))return new T(t);var e=this instanceof n;this._readableState=new A(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 E(t,e,r,n,o){i("readableAddChunk",e);var a,c=t._readableState;if(null===e)c.reading=!1,function(t,e){if(i("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?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,M(t)))}}(t,c);else if(o||(a=function(t,e){var r,n;return n=e,s.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],e)),r}(c,e)),a)_(t,a);else if(c.objectMode||e&&e.length>0)if("string"==typeof e||c.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)c.endEmitted?_(t,new v):k(t,c,e,!0);else if(c.ended)_(t,new w);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(e=c.decoder.write(e),c.objectMode||0!==e.length?k(t,c,e,!1):R(t,c)):k(t,c,e,!1)}else n||(c.reading=!1,R(t,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function k(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&P(t)),R(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),E(this,t,e,!1,r)},T.prototype.unshift=function(t){return E(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=r(3141).I);var e=new f(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var C=1073741824;function O(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=C?t=C:(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 P(t){var e=t._readableState;i("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(i("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(M,t))}function M(t){var e=t._readableState;i("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,F(t)}function R(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(i("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function B(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function x(t){i("readable nexttick read 0"),t.read(0)}function I(t,e){i("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),F(t),e.flowing&&!e.reading&&t.read(0)}function F(t){var e=t._readableState;for(i("flow",e.flowing);e.flowing&&null!==t.read(););}function L(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 D(t){var e=t._readableState;i("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(U,e,t))}function U(t,e){if(i("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 V(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){i("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return i("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?D(this):P(this),null;if(0===(t=O(t,e))&&e.ended)return 0===e.length&&D(this),null;var n,o=e.needReadable;return i("need readable",o),(0===e.length||e.length-t<e.highWaterMark)&&i("length less than watermark",o=!0),e.ended||e.reading?i("reading or ended",o=!1):o&&(i("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=O(r,e))),null===(n=t>0?L(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},T.prototype._read=function(t){_(this,new b("_read()"))},T.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,i("pipe count=%d opts=%j",n.pipesCount,e);var a=e&&!1===e.end||t===process.stdout||t===process.stderr?p:s;function s(){i("onend"),t.end()}n.endEmitted?process.nextTick(a):r.once("end",a),t.on("unpipe",(function e(o,a){i("onunpipe"),o===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,i("cleanup"),t.removeListener("close",l),t.removeListener("finish",d),t.removeListener("drain",u),t.removeListener("error",h),t.removeListener("unpipe",e),r.removeListener("end",s),r.removeListener("end",p),r.removeListener("data",f),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;i("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,F(t))}}(r);t.on("drain",u);var c=!1;function f(e){i("ondata");var o=t.write(e);i("dest.write",o),!1===o&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==V(n.pipes,t))&&!c&&(i("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(e){i("onerror",e),p(),t.removeListener("error",h),0===o(t,"error")&&_(t,e)}function l(){t.removeListener("finish",d),p()}function d(){i("onfinish"),t.removeListener("close",l),p()}function p(){i("unpipe"),r.unpipe(t)}return r.on("data",f),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",h),t.once("close",l),t.once("finish",d),t.emit("pipe",r),n.flowing||(i("pipe resume"),r.resume()),t},T.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 o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=V(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?P(this):n.reading||process.nextTick(x,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(B,this),r},T.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(B,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(i("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(I,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var o in t.on("end",(function(){if(i("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){i("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(n=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a<S.length;a++)t.on(S[a],this.emit.bind(this,S[a]));return this._read=function(e){i("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(2955)),h(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=L,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===l&&(l=r(5157)),l(T,t,e)})},4610:(t,e,r)=>{"use strict";t.exports=f;var n=r(6048).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(5382);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function f(t){if(!(this instanceof f))return new f(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,r){l(t,e,r)}))}function l(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}r(6698)(f,u),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,r){r(new i("_transform()"))},f.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},6708:(t,e,r)=>{"use strict";function n(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e){var r=t.entry;for(t.entry=null;r;){var n=r.callback;e.pendingcb--,n(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var i;t.exports=T,T.WritableState=A;var o,a={deprecate:r(4643)},s=r(345),u=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},f=r(5896),h=r(5291).getHighWaterMark,l=r(6048).F,d=l.ERR_INVALID_ARG_TYPE,p=l.ERR_METHOD_NOT_IMPLEMENTED,g=l.ERR_MULTIPLE_CALLBACK,y=l.ERR_STREAM_CANNOT_PIPE,m=l.ERR_STREAM_DESTROYED,w=l.ERR_STREAM_NULL_VALUES,b=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,_=f.errorOrDestroy;function S(){}function A(t,e,o){i=i||r(5382),t=t||{},"boolean"!=typeof o&&(o=e instanceof i),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(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,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(process.nextTick(i,n),process.nextTick(M,t,e),t._writableState.errorEmitted=!0,_(t,n)):(i(n),t._writableState.errorEmitted=!0,_(t,n),M(t,e))}(t,r,n,e,i);else{var o=O(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||C(t,r),n?process.nextTick(k,t,r,o,i):k(t,r,o,i)}}(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 n(this)}function T(t){var e=this instanceof(i=i||r(5382));if(!e&&!o.call(T,this))return new T(t);this._writableState=new A(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)),s.call(this)}function E(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function k(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),M(t,e)}function C(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,E(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,h=r.callback;if(E(t,e,!1,e.objectMode?1:c.length,c,f,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function O(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(r){e.pendingcb--,r&&_(t,r),e.prefinished=!0,t.emit("prefinish"),M(t,e)}))}function M(t,e){var r=O(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,process.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}r(6698)(T,s),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.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(T,Symbol.hasInstance,{value:function(t){return!!o.call(this,t)||this===T&&t&&t._writableState instanceof A}})):o=function(t){return t instanceof this},T.prototype.pipe=function(){_(this,new y)},T.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,u.isBuffer(n)||n instanceof c);return a&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=S),i.ending?function(t,e){var r=new b;_(t,r),process.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i;return null===r?i=new w:"string"==typeof r||e.objectMode||(i=new d("chunk",["string","Buffer"],r)),!i||(_(t,i),process.nextTick(n,i),!1)}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r)),e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,s,n,i,o);return c}(this,i,a,t,e,r)),o},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||C(this,t))},T.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new p("_write()"))},T.prototype._writev=null,T.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,M(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)}},2955:(t,e,r)=>{"use strict";var n;function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(6238),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var r=t[l].read();null!==r&&(t[f]=null,t[a]=null,t[s]=null,e(d(r,!1)))}}function g(t){process.nextTick(p,t)}var y=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var t=this,e=this[u];if(null!==e)return Promise.reject(e);if(this[c])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(e,r){process.nextTick((function(){t[u]?r(t[u]):e(d(void 0,!0))}))}));var r,n=this[f];if(n)r=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(d(void 0,!0)):e[h](r,n)}),n)}}(n,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(d(i,!1));r=new Promise(this[h])}return this[f]=r,r}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[l].destroy(null,(function(t){t?r(t):e(d(void 0,!0))}))}))})),n),y);t.exports=function(t){var e,r=Object.create(m,(i(e={},l,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var n=r[l].read();n?(r[f]=null,r[a]=null,r[s]=null,t(d(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[f]=null,r[a]=null,r[s]=null,e(t)),void(r[u]=t)}var n=r[a];null!==n&&(r[f]=null,r[a]=null,r[s]=null,n(d(void 0,!0))),r[c]=!0})),t.on("readable",g.bind(null,r)),r}},2726:(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){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,r){return(e=s(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var u=r(8287).Buffer,c=r(5340).inspect,f=c&&c.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?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 u.alloc(0);for(var e,r,n,i=u.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,u.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=u.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:f,value:function(t,e){return c(this,i(i({},e),{},{depth:0,customInspect:!1}))}}])&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},5896:t=>{"use strict";function e(t,e){n(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,i){var o=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(i?i(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,t)):process.nextTick(n,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?o._writableState?o._writableState.errorEmitted?process.nextTick(r,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,t)):process.nextTick(e,o,t):i?(process.nextTick(r,o),i(t)):process.nextTick(r,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)}}},6238:(t,e,r)=>{"use strict";var n=r(6048).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||f()},c=e._writableState&&e._writableState.finished,f=function(){s=!1,c=!0,a||o.call(e)},h=e._readableState&&e._readableState.endEmitted,l=function(){a=!1,h=!0,s||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return a&&!h?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},g=function(){e.req.on("finish",f)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",f),e.on("abort",p),e.req?g():e.on("request",g)):s&&!e._writableState&&(e.on("end",u),e.on("close",u)),e.on("end",l),e.on("finish",f),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",g),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},5157:t=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},7758:(t,e,r)=>{"use strict";var n,i=r(6048).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t){t()}function c(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var f,h=function(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var l=e.map((function(t,i){var o=i<e.length-1;return function(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===n&&(n=r(6238)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}(t,o,i>0,(function(t){f||(f=t),t&&l.forEach(u),o||(l.forEach(u),h(f))}))}));return e.reduce(c)}},5291:(t,e,r)=>{"use strict";var n=r(6048).F.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},345:(t,e,r)=>{t.exports=r(7007).EventEmitter},8399:(t,e,r)=>{(e=t.exports=r(5412)).Stream=e,e.Readable=e,e.Writable=r(6708),e.Duplex=r(5382),e.Transform=r(4610),e.PassThrough=r(3600),e.finished=r(6238),e.pipeline=r(7758)},7452:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new M(n||[]);return i(a,"_invoke",{value:k(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var l="suspendedStart",d="suspendedYield",p="executing",g="completed",y={};function m(){}function w(){}function b(){}var v={};c(v,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(R([])));S&&S!==r&&n.call(S,a)&&(v=S);var A=b.prototype=m.prototype=Object.create(v);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(i,o,a,s){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function k(t,e,r){var n=l;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===g){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=h(t,e,r);if("normal"===u.type){if(n=r.done?g:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=g,r.method="throw",r.arg=u.arg)}}}function C(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=h(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function R(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}return{next:N}}function N(){return{value:e,done:!0}}return w.prototype=b,i(A,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(A),t},t.awrap=function(t){return{__await:t}},T(E.prototype),c(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new E(f(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=R,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:R(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},6011:(t,e,r)=>{"use strict";var n=r(8287).Buffer,i=r(6698),o=r(4729),a=new Array(16),s=[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],c=[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],f=[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],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function g(t,e,r,n,i,o,a,s){return p(t+(e^r^n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return p(t+(e&r|~e&n)+o+a|0,s)+i|0}function m(t,e,r,n,i,o,a,s){return p(t+((e|~r)^n)+o+a|0,s)+i|0}function w(t,e,r,n,i,o,a,s){return p(t+(e&n|r&~n)+o+a|0,s)+i|0}function b(t,e,r,n,i,o,a,s){return p(t+(e^(r|~n))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var t=a,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,o=0|this._d,d=0|this._e,v=0|this._a,_=0|this._b,S=0|this._c,A=0|this._d,T=0|this._e,E=0;E<80;E+=1){var k,C;E<16?(k=g(r,n,i,o,d,t[s[E]],h[0],c[E]),C=b(v,_,S,A,T,t[u[E]],l[0],f[E])):E<32?(k=y(r,n,i,o,d,t[s[E]],h[1],c[E]),C=w(v,_,S,A,T,t[u[E]],l[1],f[E])):E<48?(k=m(r,n,i,o,d,t[s[E]],h[2],c[E]),C=m(v,_,S,A,T,t[u[E]],l[2],f[E])):E<64?(k=w(r,n,i,o,d,t[s[E]],h[3],c[E]),C=y(v,_,S,A,T,t[u[E]],l[3],f[E])):(k=b(r,n,i,o,d,t[s[E]],h[4],c[E]),C=g(v,_,S,A,T,t[u[E]],l[4],f[E])),r=d,d=o,o=p(i,10),i=n,n=k,v=T,T=A,A=p(S,10),S=_,_=C}var O=this._b+i+A|0;this._b=this._c+o+T|0,this._c=this._d+d+v|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=O},d.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=d},2861:(t,e,r)=>{var n=r(8287),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.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},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},4366:(t,e,r)=>{t.exports=r(7715)},7715:(t,e,r)=>{!function(){var e={};if(e.async=r(7500),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var n=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),r=null,n=null;return e.forEach((function(e){if(e&&e.constructor===Object)for(r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]]})),t}function a(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){u.array(t)||(t=[t]),t.forEach((function(t){delete this.custom[t]}),this)}}function s(t,e){var r=["@"];if(this._schema=t,this._custom={},null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._custom["$"+n]=e[n]);this._getDepth=function(){return r.length},this._dumpStack=function(){return r.map((function(t){return t.replace(/^\[/g,"")})).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return r.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return r.push("["+t+"]"),this},this._back=function(){return r.pop(),this}}var u={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return null!=t&&t.constructor===Object},array:function(t){return null!=t&&t.constructor===Array},any:function(t){return!0}};function c(t,e){return"function"==typeof t?e instanceof t:u[t=t in u?t:"any"](e)}function f(t,e){for(var r=[],n=t.indexOf(e);-1!==n;)r.push(n),n=t.indexOf(e,n+1);return r}var h={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},l={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var r=u.array(t.type)?t.type:[t.type];r.some((function(t){return c(t,e)}))||(r=r.map((function(t){return"function"==typeof t?"and instance of "+t.name:t})),this.report("must be "+r.join(" or ")+", but is "+function(t){for(var e in u)if(c(e,t))return"any"!==e?e:"an instance of "+t.constructor.name}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(u.array(e)||"string"==typeof e))for(var r=[],n=0;n<e.length;n++)if(!(r.indexOf(e[n])>=0)){var i=f(e,e[n]);i.length>1&&(r.push(e[n]),this.report("has value ["+e[n]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var r=t.pattern;if("string"==typeof e){var n=!1;u.array(r)||(r=[r]),r.forEach((function(t){"string"==typeof t&&t in h&&(t=h[t]),t instanceof RegExp&&t.test(e)&&(n=!0)})),n||this.report("must match ["+r.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.minLength);isNaN(r)||e.length<r&&this.report("must be longer than "+r+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.maxLength);isNaN(r)||e.length>r&&this.report("must be shorter than "+r+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.exactLength);isNaN(r)||e.length!==r&&this.report("must have exactly "+r+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var r=Number(t.lt);"number"!=typeof e||isNaN(r)||e>=r&&this.report("must be less than "+r+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var r=Number(t.lte);"number"!=typeof e||isNaN(r)||e>r&&this.report("must be less than or equal to "+r+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var r=Number(t.gt);"number"!=typeof e||isNaN(r)||e<=r&&this.report("must be greater than "+r+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var r=Number(t.gte);"number"!=typeof e||isNaN(r)||e<r&&this.report("must be greater than or equal to "+r+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var r=t.eq;if("number"==typeof r||"string"==typeof r||"boolean"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return;this.report("must be equal to ["+r.map((function(t){return'"'+t+'"'})).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==r&&this.report('must be equal to "'+r+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var r=t.ne;if("number"==typeof r||"string"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return void this.report('must not be equal to "'+r[n]+'"',null,"ne")}else e===r&&this.report('must not be equal to "'+r+'"',null,"ne")}},someKeys:function(t,e){var r=t.someKeys;u.object(e)&&(r.some((function(t){return t in e}))||this.report("must have at least key "+r.map((function(t){return'"'+t+'"'})).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&u.object(e)&&u.object(t.properties)&&void 0===t.properties["*"]){var r=Object.keys(e).filter((function(e){return void 0===t.properties[e]}));if(r.length>0){var n="should not contains "+(r.length>1?"properties":"property")+" ["+r.map((function(t){return'"'+t+'"'})).join(", ")+"]";this.report(n,null,"strict")}}},exec:function(t,e,r){var n=this;if("function"==typeof r)return this.asyncExec(t,e,r);(u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&r.call(n,t,e)}))},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(t.properties instanceof Object&&e instanceof Object){var n,i=t.properties;if(null!=i["*"])for(n in e)n in i||(this._deeperObject(n),this._validate(i["*"],e[n]),this._back());for(n in i)"*"!==n&&(this._deeperObject(n),this._validate(i[n],e[n]),this._back())}},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(t.items instanceof Object&&e instanceof Object){var n,i,o=t.items;if(u.array(o)&&u.array(e))for(n=0,i=o.length;n<i;n++)this._deeperArray(n),this._validate(o[n],e[n]),this._back();else for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(this._deeperArray(a),this._validate(o,e[a]),this._back())}}},d={asyncExec:function(t,e,r){var i=this;n.eachSeries(u.array(t.exec)?t.exec:[t.exec],(function(r,o){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,o);r.call(i,t,e)}n.nextTick(o)}),r)},asyncProperties:function(t,e,r){if(!(t.properties instanceof Object&&u.object(e)))return r();var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();n.eachSeries(Object.keys(e),(function(t,r){if(t in o)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o["*"],e[t],(function(t){i._back(),r(t)}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o[t],e[t],(function(t){i._back(),r(t)}))}),t)}],r)},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r();var i=this,o=t.items;u.array(o)&&u.array(e)?n.timesSeries(o.length,(function(t,r){i._deeperArray(t),i._asyncValidate(o[t],e[t],(function(t,e){i._back(),r(t,e)})),i._back()}),r):n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncValidate(o,e[t],(function(t,e){i._back(),r(t,e)}))}),r)}};function p(t,e){s.prototype.constructor.call(this,t,o(p.custom,e));var r=[];this._basicFields=Object.keys(l),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,n){var i={code:e||this.userCode||null,reason:n||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return r.push(i),this},this.result=function(){return{error:r,valid:0===r.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map((function(t){return"Property "+t.property+": "+t.message})).join("\n")}}}}i(p.prototype,l),i(p.prototype,d),i(p,new a),p.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return n.nextTick((function(){r._asyncValidate(r._schema,t,(function(t){r.origin=null,e(t,r.result())}))}))}return this._validate(this._schema,t).result()},p.prototype._validate=function(t,e,r){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||this[r](t,e)}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&this._custom[r].call(this,t,e)}),this),this},p.prototype._asyncValidate=function(t,e,r){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,n.series([function(r){n.eachSeries(Object.keys(l),(function(r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);i[r](t,e)}o()}))}),r)},function(r){n.eachSeries(Object.keys(i._custom),(function(r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);i._custom[r].call(i,t,e)}o()}))}),r)}],r)};var g={number:function(t,e){var r;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return r}else if(t instanceof Date)return+t;return null},integer:function(t,e){var r;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseInt(t.replace(/ /g,""),10)))return r}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():u.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var r=new Date(t);return isNaN(r.getTime())?null:r},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||u.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(u.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return u.array(t)?null:[t]}},y={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:u.object(t.properties)&&u.object(e)?(Object.keys(e).forEach((function(r){r in t.properties||delete e[r]})),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof g[t.type])return e;var r,n="boolean"!=typeof t.optional||t.optional;return"function"==typeof g[t.type]?(null===(r=g[t.type](e,t))&&!n||!r&&isNaN(r)||null===r&&"string"===t.type)&&(r=t.def):n||(r=t.def),(null!=r||void 0!==t.def&&t.def===r)&&r!==e?(this.report(),r):e},rules:function(t,e){var r=t.rules;if("string"!=typeof e||"string"!=typeof r&&!u.array(r))return e;var n=!1;return(u.array(r)?r:[r]).forEach((function(t){"function"==typeof y[t]&&(e=y[t](e),n=!0)})),n&&this.report(),e},min:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.min);return isNaN(n)?e:r<n?(this.report(),n):e},max:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.max);return isNaN(n)?e:r>n?(this.report(),n):e},minLength:function(t,e){var r=Number(t.minLength);if("string"!=typeof e||isNaN(r)||r<0)return e;var n="",i=r-e.length;if(i>0){for(var o=0;o<i;o++)n+="-";return this.report(),e+n}return e},maxLength:function(t,e){var r=Number(t.maxLength);return"string"!=typeof e||isNaN(r)||r<0?e:e.length>r?(this.report(),e.slice(0,r)):e},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(!e||"object"!=typeof e)return e;var n,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties["*"],e[i]))&&(e[i]=n),this._back());for(i in t.properties)"*"!==i&&(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties[i],e[i]))&&(e[i]=n),this._back());return e},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(!(t.items instanceof Object&&e instanceof Object))return e;var n;if(u.array(t.items)&&u.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(n=0;n<i;n++)this._deeperArray(n),e[n]=this._sanitize(t.items[n],e[n]),this._back()}else for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._deeperArray(n),e[n]=this._sanitize(t.items,e[n]),this._back());return e},exec:function(t,e,r){return"function"==typeof r?this.asyncExec(t,e,r):((u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&(e=r.call(this,t,e))}),this),e)}},w={asyncExec:function(t,e,r){var i=this,o=u.array(t.exec)?t.exec:[t.exec];n.eachSeries(o,(function(r,n){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,(function(t,r){if(t)return n(t);e=r,n()}));e=r.call(i,t,e)}n()}),(function(t){r(t,e)}))},asyncProperties:function(t,e,r){if(!e||"object"!=typeof e)return r(null,e);var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();var r=o["*"];n.eachSeries(Object.keys(e),(function(t,n){if(t in o)return n();i._deeperObject(t),i._asyncSanitize(r,e[t],(function(r,o){void 0!==o&&(e[t]=o),i._back(),n()}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return r();i._deeperObject(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);void 0!==o&&(e[t]=o),i._back(),r()}))}),t)}],(function(t){return r(t,e)}))},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r(null,e);var i=this,o=t.items;if(u.array(o)&&u.array(e)){var a=o.length<e.length?o.length:e.length;n.timesSeries(a,(function(t,r){i._deeperArray(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}))}else n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncSanitize(o,e[t],(function(n,o){if(n)return r();e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}));return e}};function b(t,e){s.prototype.constructor.call(this,t,o(b.custom,e));var r=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};r.some((function(t){return t.property===e.property}))||r.push(e)},this.result=function(t){return{data:t,reporting:r,format:function(){return this.reporting.map((function(t){return"Property "+t.property+" "+t.message})).join("\n")}}}}i(b.prototype,m),i(b.prototype,w),i(b,new a),b.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return this._asyncSanitize(this._schema,t,(function(t,n){r.origin=null,e(t,r.result(n))}))}var n=this._sanitize(this._schema,t);return this.origin=null,this.result(n)},b.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||(e=this[r](t,e))}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&(e=this._custom[r].call(this,t,e))}),this),e},b.prototype._asyncSanitize=function(t,e,r){var i=this;this.userAlias=t.alias||null,n.waterfall([function(r){n.reduce(i._basicFields,e,(function(e,r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);e=i[r](t,e)}o(null,e)}))}),r)},function(e,r){n.reduce(i._customFields,e,(function(e,r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);e=i._custom[r].call(i,t,e)}o(null,e)}))}),r)}],r)};var v=2147483647,_={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},S={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var r="#";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("0123456789abcdefABCDEF");return r},numeric:function(){return""+_.int(0,v)},integer:function(){return!0===_.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return r},alphaNumeric:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return r},alphaDash:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return r},javascript:function(t,e){for(var r=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),n=0,i=_.int(t,e-1);n<i;n++)r+=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return r}};function A(t){var e=-2147483648,r=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?r=t.lte:null!=t.lt&&(r=t.lt-1),{min:e,max:r}}var T={string:function(t){if(null!=t.eq)return t.eq;var e="",r=null!=t.minLength?t.minLength:0,n=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof S[t.pattern])return S[t.pattern](r,n);for(var i=null!=t.exactLength?t.exactLength:_.int(r,n),o=0;o<i;o++)e+=_.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=A(t),r=_.float(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.float(e.min,e.max);return r},integer:function(t){if(null!=t.eq)return t.eq;var e=A(t),r=_.int(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.int(e.min,e.max);return r},boolean:function(t){return null!=t.eq?t.eq:_.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},r=t.properties||{};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(!0===r[n].optional&&!0===_.bool())continue;if("*"!==n)e[n]=this.generate(r[n]);else for(var i="__random_key_",o=i+0,a=_.int(1,9),s=1;s<=a;s++)o in r||(e[o]=this.generate(r[n])),o=i+s}return e},array:function(t){var e,r,n,i,o=t.items||{},a=null!=t.minLength?t.minLength:0,s=null!=t.maxLength?t.maxLength:16;if(u.array(o))for(n=o.length,null!=t.exactLength?n=t.exactLength:n<a?n=a:n>s&&(n=s),r=new Array(n),e=null,i=0;i<n;i++)e=o[i].type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),r[i]=this[e](o[i]);else for(n=null!=t.exactLength?t.exactLength:_.int(a,s),r=new Array(n),e=o.type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),i=0;i<n;i++)r[i]=this[e](o);return r},any:function(t){var e=Object.keys(T);return this[e[_.int(0,e.length-2)]](t)}};function E(){}i(E.prototype,T);var k=null;E.instance=function(){return k instanceof E||(k=new E),k},E.prototype.generate=function(t){var e=t.type||"any";return u.array(e)&&(e=e[_.int(0,e.length-1)]),this[e](t)};var C={};t.exports?t.exports=C:window.SchemaInspector=C,C.newSanitization=function(t,e){return new b(t,e)},C.newValidation=function(t,e){return new p(t,e)},C.Validation=p,C.Sanitization=b,C.sanitize=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new b(t,r).sanitize(e,n)},C.validate=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new p(t,r).validate(e,n)},C.generate=function(t,e){if("number"==typeof e){for(var r=new Array(e),n=0;n<e;n++)r[n]=E.instance().generate(t);return r}return E.instance().generate(t)}}()},392:(t,e,r)=>{var n=r(2861).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),f=0;f<c;f++)r[u+f]=t[s+f];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=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 o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},2802:(t,e,r)=>{var n=t.exports=function(t){t=t.toLowerCase();var e=n[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};n.sha=r(7816),n.sha1=r(3737),n.sha224=r(6710),n.sha256=r(4107),n.sha384=r(2827),n.sha512=r(2890)},7816:(t,e,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function f(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,o=0|this._c,s=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+f(d,i,o,s)+u+r[l]+a[d];u=s,s=o,o=c(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.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},3737:(t,e,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}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,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),g=c(n)+h(p,i,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=f(i),i=n,n=g}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.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},6710:(t,e,r)=>{var n=r(6698),i=r(4107),o=r(392),a=r(2861).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.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=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},4107:(t,e,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[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],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(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,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,g=0|this._g,y=0|this._h,m=0;m<16;++m)r[m]=t.readInt32BE(4*m);for(;m<64;++m)r[m]=0|(((e=r[m-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[m-7]+d(r[m-15])+r[m-16];for(var w=0;w<64;++w){var b=y+l(u)+c(u,p,g)+a[w]+r[w]|0,v=h(n)+f(n,i,o)|0;y=g,g=p,p=u,u=s+b|0,s=o,o=i,i=n,n=b+v|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=g+this._g|0,this._h=y+this._h|0},u.prototype._hash=function(){var t=o.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},2827:(t,e,r)=>{var n=r(6698),i=r(2890),o=r(392),a=r(2861).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.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=a.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},2890:(t,e,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[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],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(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 g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function m(t,e){return t>>>0<e>>>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,o=0|this._dh,s=0|this._eh,u=0|this._fh,w=0|this._gh,b=0|this._hh,v=0|this._al,_=0|this._bl,S=0|this._cl,A=0|this._dl,T=0|this._el,E=0|this._fl,k=0|this._gl,C=0|this._hl,O=0;O<32;O+=2)e[O]=t.readInt32BE(4*O),e[O+1]=t.readInt32BE(4*O+4);for(;O<160;O+=2){var P=e[O-30],M=e[O-30+1],R=d(P,M),N=p(M,P),B=g(P=e[O-4],M=e[O-4+1]),x=y(M,P),I=e[O-14],F=e[O-14+1],L=e[O-32],D=e[O-32+1],U=N+F|0,V=R+I+m(U,N)|0;V=(V=V+B+m(U=U+x|0,x)|0)+L+m(U=U+D|0,D)|0,e[O]=V,e[O+1]=U}for(var j=0;j<160;j+=2){V=e[j],U=e[j+1];var W=f(r,n,i),K=f(v,_,S),H=h(r,v),q=h(v,r),z=l(s,T),G=l(T,s),$=a[j],X=a[j+1],J=c(s,u,w),Y=c(T,E,k),Z=C+G|0,Q=b+z+m(Z,C)|0;Q=(Q=(Q=Q+J+m(Z=Z+Y|0,Y)|0)+$+m(Z=Z+X|0,X)|0)+V+m(Z=Z+U|0,U)|0;var tt=q+K|0,et=H+W+m(tt,q)|0;b=w,C=k,w=u,k=E,u=s,E=T,s=o+Q+m(T=A+Z|0,A)|0,o=i,A=S,i=n,S=_,n=r,_=v,r=Q+et+m(v=Z+tt|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+A|0,this._el=this._el+T|0,this._fl=this._fl+E|0,this._gl=this._gl+k|0,this._hl=this._hl+C|0,this._ah=this._ah+r+m(this._al,v)|0,this._bh=this._bh+n+m(this._bl,_)|0,this._ch=this._ch+i+m(this._cl,S)|0,this._dh=this._dh+o+m(this._dl,A)|0,this._eh=this._eh+s+m(this._el,T)|0,this._fh=this._fh+u+m(this._fl,E)|0,this._gh=this._gh+w+m(this._gl,k)|0,this._hh=this._hh+b+m(this._hl,C)|0},u.prototype._hash=function(){var t=o.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},4803:(t,e,r)=>{"use strict";var n=r(8859),i=r(9675),o=function(t,e,r){for(var n,i=t;null!=(n=i.next);i=n)if(n.key===e)return i.next=n.next,r||(n.next=t.next,t.next=n),n};t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+n(t))},delete:function(e){var r=t&&t.next,n=function(t,e){if(t)return o(t,e,!0)}(t,e);return n&&r&&r===n&&(t=void 0),!!n},get:function(e){return function(t,e){if(t){var r=o(t,e);return r&&r.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!o(t,e)}(t,e)},set:function(e,r){t||(t={next:void 0}),function(t,e,r){var n=o(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(t,e,r)}};return e}},507:(t,e,r)=>{"use strict";var n=r(453),i=r(6556),o=r(8859),a=r(9675),s=n("%Map%",!0),u=i("Map.prototype.get",!0),c=i("Map.prototype.set",!0),f=i("Map.prototype.has",!0),h=i("Map.prototype.delete",!0),l=i("Map.prototype.size",!0);t.exports=!!s&&function(){var t,e={assert:function(t){if(!e.has(t))throw new a("Side channel does not contain "+o(t))},delete:function(e){if(t){var r=h(t,e);return 0===l(t)&&(t=void 0),r}return!1},get:function(e){if(t)return u(t,e)},has:function(e){return!!t&&f(t,e)},set:function(e,r){t||(t=new s),c(t,e,r)}};return e}},2271:(t,e,r)=>{"use strict";var n=r(453),i=r(6556),o=r(8859),a=r(507),s=r(9675),u=n("%WeakMap%",!0),c=i("WeakMap.prototype.get",!0),f=i("WeakMap.prototype.set",!0),h=i("WeakMap.prototype.has",!0),l=i("WeakMap.prototype.delete",!0);t.exports=u?function(){var t,e,r={assert:function(t){if(!r.has(t))throw new s("Side channel does not contain "+o(t))},delete:function(r){if(u&&r&&("object"==typeof r||"function"==typeof r)){if(t)return l(t,r)}else if(a&&e)return e.delete(r);return!1},get:function(r){return u&&r&&("object"==typeof r||"function"==typeof r)&&t?c(t,r):e&&e.get(r)},has:function(r){return u&&r&&("object"==typeof r||"function"==typeof r)&&t?h(t,r):!!e&&e.has(r)},set:function(r,n){u&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new u),f(t,r,n)):a&&(e||(e=a()),e.set(r,n))}};return r}:a},920:(t,e,r)=>{"use strict";var n=r(9675),i=r(8859),o=r(4803),a=r(507),s=r(2271)||a||o;t.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new n("Side channel does not contain "+i(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,r){t||(t=s()),t.set(e,r)}};return e}},7575:(t,e,r)=>{"use strict";var n=r(8287).Buffer;const i=r(1725);class o{constructor(t){if(this.length=0,this._encoding="utf8",this._writeOffset=0,this._readOffset=0,o.isSmartBufferOptions(t))if(t.encoding&&(i.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(i.isFiniteInteger(t.size)&&t.size>0))throw new Error(i.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=n.allocUnsafe(t.size)}else if(t.buff){if(!n.isBuffer(t.buff))throw new Error(i.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=n.allocUnsafe(4096);else{if(void 0!==t)throw new Error(i.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=n.allocUnsafe(4096)}}static fromSize(t,e){return new this({size:t,encoding:e})}static fromBuffer(t,e){return new this({buff:t,encoding:e})}static fromOptions(t){return new this(t)}static isSmartBufferOptions(t){const e=t;return e&&(void 0!==e.encoding||void 0!==e.size||void 0!==e.buff)}readInt8(t){return this._readNumberValue(n.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(n.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(n.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(n.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(n.prototype.readInt32LE,4,t)}readBigInt64BE(t){return i.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(n.prototype.readBigInt64BE,8,t)}readBigInt64LE(t){return i.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(n.prototype.readBigInt64LE,8,t)}writeInt8(t,e){return this._writeNumberValue(n.prototype.writeInt8,1,t,e),this}insertInt8(t,e){return this._insertNumberValue(n.prototype.writeInt8,1,t,e)}writeInt16BE(t,e){return this._writeNumberValue(n.prototype.writeInt16BE,2,t,e)}insertInt16BE(t,e){return this._insertNumberValue(n.prototype.writeInt16BE,2,t,e)}writeInt16LE(t,e){return this._writeNumberValue(n.prototype.writeInt16LE,2,t,e)}insertInt16LE(t,e){return this._insertNumberValue(n.prototype.writeInt16LE,2,t,e)}writeInt32BE(t,e){return this._writeNumberValue(n.prototype.writeInt32BE,4,t,e)}insertInt32BE(t,e){return this._insertNumberValue(n.prototype.writeInt32BE,4,t,e)}writeInt32LE(t,e){return this._writeNumberValue(n.prototype.writeInt32LE,4,t,e)}insertInt32LE(t,e){return this._insertNumberValue(n.prototype.writeInt32LE,4,t,e)}writeBigInt64BE(t,e){return i.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(n.prototype.writeBigInt64BE,8,t,e)}insertBigInt64BE(t,e){return i.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(n.prototype.writeBigInt64BE,8,t,e)}writeBigInt64LE(t,e){return i.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(n.prototype.writeBigInt64LE,8,t,e)}insertBigInt64LE(t,e){return i.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(n.prototype.writeBigInt64LE,8,t,e)}readUInt8(t){return this._readNumberValue(n.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(n.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(n.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(n.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(n.prototype.readUInt32LE,4,t)}readBigUInt64BE(t){return i.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(n.prototype.readBigUInt64BE,8,t)}readBigUInt64LE(t){return i.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(n.prototype.readBigUInt64LE,8,t)}writeUInt8(t,e){return this._writeNumberValue(n.prototype.writeUInt8,1,t,e)}insertUInt8(t,e){return this._insertNumberValue(n.prototype.writeUInt8,1,t,e)}writeUInt16BE(t,e){return this._writeNumberValue(n.prototype.writeUInt16BE,2,t,e)}insertUInt16BE(t,e){return this._insertNumberValue(n.prototype.writeUInt16BE,2,t,e)}writeUInt16LE(t,e){return this._writeNumberValue(n.prototype.writeUInt16LE,2,t,e)}insertUInt16LE(t,e){return this._insertNumberValue(n.prototype.writeUInt16LE,2,t,e)}writeUInt32BE(t,e){return this._writeNumberValue(n.prototype.writeUInt32BE,4,t,e)}insertUInt32BE(t,e){return this._insertNumberValue(n.prototype.writeUInt32BE,4,t,e)}writeUInt32LE(t,e){return this._writeNumberValue(n.prototype.writeUInt32LE,4,t,e)}insertUInt32LE(t,e){return this._insertNumberValue(n.prototype.writeUInt32LE,4,t,e)}writeBigUInt64BE(t,e){return i.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(n.prototype.writeBigUInt64BE,8,t,e)}insertBigUInt64BE(t,e){return i.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(n.prototype.writeBigUInt64BE,8,t,e)}writeBigUInt64LE(t,e){return i.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(n.prototype.writeBigUInt64LE,8,t,e)}insertBigUInt64LE(t,e){return i.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(n.prototype.writeBigUInt64LE,8,t,e)}readFloatBE(t){return this._readNumberValue(n.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(n.prototype.readFloatLE,4,t)}writeFloatBE(t,e){return this._writeNumberValue(n.prototype.writeFloatBE,4,t,e)}insertFloatBE(t,e){return this._insertNumberValue(n.prototype.writeFloatBE,4,t,e)}writeFloatLE(t,e){return this._writeNumberValue(n.prototype.writeFloatLE,4,t,e)}insertFloatLE(t,e){return this._insertNumberValue(n.prototype.writeFloatLE,4,t,e)}readDoubleBE(t){return this._readNumberValue(n.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(n.prototype.readDoubleLE,8,t)}writeDoubleBE(t,e){return this._writeNumberValue(n.prototype.writeDoubleBE,8,t,e)}insertDoubleBE(t,e){return this._insertNumberValue(n.prototype.writeDoubleBE,8,t,e)}writeDoubleLE(t,e){return this._writeNumberValue(n.prototype.writeDoubleLE,8,t,e)}insertDoubleLE(t,e){return this._insertNumberValue(n.prototype.writeDoubleLE,8,t,e)}readString(t,e){let r;"number"==typeof t?(i.checkLengthValue(t),r=Math.min(t,this.length-this._readOffset)):(e=t,r=this.length-this._readOffset),void 0!==e&&i.checkEncoding(e);const n=this._buff.slice(this._readOffset,this._readOffset+r).toString(e||this._encoding);return this._readOffset+=r,n}insertString(t,e,r){return i.checkOffsetValue(e),this._handleString(t,!0,e,r)}writeString(t,e,r){return this._handleString(t,!1,e,r)}readStringNT(t){void 0!==t&&i.checkEncoding(t);let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}const r=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,r.toString(t||this._encoding)}insertStringNT(t,e,r){return i.checkOffsetValue(e),this.insertString(t,e,r),this.insertUInt8(0,e+t.length),this}writeStringNT(t,e,r){return this.writeString(t,e,r),this.writeUInt8(0,"number"==typeof e?e+t.length:this.writeOffset),this}readBuffer(t){void 0!==t&&i.checkLengthValue(t);const e="number"==typeof t?t:this.length,r=Math.min(this.length,this._readOffset+e),n=this._buff.slice(this._readOffset,r);return this._readOffset=r,n}insertBuffer(t,e){return i.checkOffsetValue(e),this._handleBuffer(t,!0,e)}writeBuffer(t,e){return this._handleBuffer(t,!1,e)}readBufferNT(){let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}const e=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,e}insertBufferNT(t,e){return i.checkOffsetValue(e),this.insertBuffer(t,e),this.insertUInt8(0,e+t.length),this}writeBufferNT(t,e){return void 0!==e&&i.checkOffsetValue(e),this.writeBuffer(t,e),this.writeUInt8(0,"number"==typeof e?e+t.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(t){i.checkOffsetValue(t),i.checkTargetOffset(t,this),this._readOffset=t}get writeOffset(){return this._writeOffset}set writeOffset(t){i.checkOffsetValue(t),i.checkTargetOffset(t,this),this._writeOffset=t}get encoding(){return this._encoding}set encoding(t){i.checkEncoding(t),this._encoding=t}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(t){const e="string"==typeof t?t:this._encoding;return i.checkEncoding(e),this._buff.toString(e,0,this.length)}destroy(){return this.clear(),this}_handleString(t,e,r,o){let a=this._writeOffset,s=this._encoding;"number"==typeof r?a=r:"string"==typeof r&&(i.checkEncoding(r),s=r),"string"==typeof o&&(i.checkEncoding(o),s=o);const u=n.byteLength(t,s);return e?this.ensureInsertable(u,a):this._ensureWriteable(u,a),this._buff.write(t,a,u,s),e?this._writeOffset+=u:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,a+u):this._writeOffset+=u,this}_handleBuffer(t,e,r){const n="number"==typeof r?r:this._writeOffset;return e?this.ensureInsertable(t.length,n):this._ensureWriteable(t.length,n),t.copy(this._buff,n),e?this._writeOffset+=t.length:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,n+t.length):this._writeOffset+=t.length,this}ensureReadable(t,e){let r=this._readOffset;if(void 0!==e&&(i.checkOffsetValue(e),r=e),r<0||r+t>this.length)throw new Error(i.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(t,e){i.checkOffsetValue(e),this._ensureCapacity(this.length+t),e<this.length&&this._buff.copy(this._buff,e+t,e,this._buff.length),e+t>this.length?this.length=e+t:this.length+=t}_ensureWriteable(t,e){const r="number"==typeof e?e:this._writeOffset;this._ensureCapacity(r+t),r+t>this.length&&(this.length=r+t)}_ensureCapacity(t){const e=this._buff.length;if(t>e){let r=this._buff,i=3*e/2+1;i<t&&(i=t),this._buff=n.allocUnsafe(i),r.copy(this._buff,0,0,e)}}_readNumberValue(t,e,r){this.ensureReadable(e,r);const n=t.call(this._buff,"number"==typeof r?r:this._readOffset);return void 0===r&&(this._readOffset+=e),n}_insertNumberValue(t,e,r,n){return i.checkOffsetValue(n),this.ensureInsertable(e,n),t.call(this._buff,r,n),this._writeOffset+=e,this}_writeNumberValue(t,e,r,n){if("number"==typeof n){if(n<0)throw new Error(i.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);i.checkOffsetValue(n)}const o="number"==typeof n?n:this._writeOffset;return this._ensureWriteable(e,o),t.call(this._buff,r,o),"number"==typeof n?this._writeOffset=Math.max(this._writeOffset,o+e):this._writeOffset+=e,this}}e.I=o},1725:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8287),i={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function o(t){return"number"==typeof t&&isFinite(t)&&function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}(t)}function a(t,e){if("number"!=typeof t)throw new Error(e?i.INVALID_OFFSET_NON_NUMBER:i.INVALID_LENGTH_NON_NUMBER);if(!o(t)||t<0)throw new Error(e?i.INVALID_OFFSET:i.INVALID_LENGTH)}e.ERRORS=i,e.checkEncoding=function(t){if(!n.Buffer.isEncoding(t))throw new Error(i.INVALID_ENCODING)},e.isFiniteInteger=o,e.checkLengthValue=function(t){a(t,!1)},e.checkOffsetValue=function(t){a(t,!0)},e.checkTargetOffset=function(t,e){if(t<0||t>e.length)throw new Error(i.INVALID_TARGET_OFFSET)},e.bigIntAndBufferInt64Check=function(t){if("undefined"==typeof BigInt)throw new Error("Platform does not support JS BigInt type.");if(void 0===n.Buffer.prototype[t])throw new Error(`Platform does not support Buffer.prototype.${t}.`)}},528:t=>{"use strict";t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const r=t.indexOf(e);return-1===r?[t]:[t.slice(0,r),t.slice(r+e.length)]}},4280:t=>{"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},3141:(t,e,r)=>{"use strict";var n=r(2861).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 o(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=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=f,this.end=h,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){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 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 f(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 h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.I=o,o.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<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=a(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=a(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=a(e[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)},o.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}},1155:(t,e,r)=>{var n=r(8287).Buffer;const i=r(9491),o=new(0,r(6729).ec)("secp256k1"),a=r(1074),s=n.alloc(32,0),u=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),c=n.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=o.curve.n,h=f.shrn(1),l=o.curve.g,d="Expected Private",p="Expected Point",g="Expected Tweak",y="Expected Hash";function m(t){return t instanceof Uint8Array&&32===t.length}function w(t){return!!m(t)&&u.compare(t)>0}function b(t){if(!(t instanceof Uint8Array))return!1;if(t.length<33)return!1;const e=t[0],r=t.subarray(1,33);if(0===s.compare(r))return!1;if(c.compare(r)<=0)return!1;if((2===e||3===e)&&33===t.length){try{E(t)}catch(t){return!1}return!0}const n=t.subarray(33);return 0!==s.compare(n)&&!(c.compare(n)<=0)&&4===e&&65===t.length}function v(t){return 4!==t[0]}function _(t){return!!m(t)&&s.compare(t)<0&&u.compare(t)>0}function S(t,e){return void 0===t&&void 0!==e?v(e):void 0===t||t}function A(t){return new i(t)}function T(t){return t.toArrayLike(n,"be",32)}function E(t){return o.curve.decodePoint(t)}function k(t,e){return n.from(t._encode(e))}function C(t,e,r){if(!m(t))throw new TypeError(y);if(!_(e))throw new TypeError(d);if(void 0!==r&&!m(r))throw new TypeError("Expected Extra Data (32 bytes)");const i=A(e),o=A(t);let s,u;a(t,e,(function(t){const e=A(t),r=l.mul(e);return!r.isInfinity()&&(s=r.x.umod(f),0!==s.isZero()&&(u=e.invm(f).mul(o.add(i.mul(s))).umod(f),0!==u.isZero()))}),_,r),u.cmp(h)>0&&(u=f.sub(u));const c=n.allocUnsafe(64);return T(s).copy(c,0),T(u).copy(c,32),c}t.exports={isPoint:b,isPointCompressed:function(t){return!!b(t)&&v(t)},isPrivate:_,pointAdd:function(t,e,r){if(!b(t))throw new TypeError(p);if(!b(e))throw new TypeError(p);const n=E(t),i=E(e),o=n.add(i);return o.isInfinity()?null:k(o,S(r,t))},pointAddScalar:function(t,e,r){if(!b(t))throw new TypeError(p);if(!w(e))throw new TypeError(g);const n=S(r,t),i=E(t);if(0===s.compare(e))return k(i,n);const o=A(e),a=l.mul(o),u=i.add(a);return u.isInfinity()?null:k(u,n)},pointCompress:function(t,e){if(!b(t))throw new TypeError(p);const r=E(t);if(r.isInfinity())throw new TypeError(p);return k(r,S(e,t))},pointFromScalar:function(t,e){if(!_(t))throw new TypeError(d);const r=A(t),n=l.mul(r);return n.isInfinity()?null:k(n,S(e))},pointMultiply:function(t,e,r){if(!b(t))throw new TypeError(p);if(!w(e))throw new TypeError(g);const n=S(r,t),i=E(t),o=A(e),a=i.mul(o);return a.isInfinity()?null:k(a,n)},privateAdd:function(t,e){if(!_(t))throw new TypeError(d);if(!w(e))throw new TypeError(g);const r=A(t),n=A(e),i=T(r.add(n).umod(f));return _(i)?i:null},privateSub:function(t,e){if(!_(t))throw new TypeError(d);if(!w(e))throw new TypeError(g);const r=A(t),n=A(e),i=T(r.sub(n).umod(f));return _(i)?i:null},sign:function(t,e){return C(t,e)},signWithEntropy:function(t,e,r){return C(t,e,r)},verify:function(t,e,r,n){if(!m(t))throw new TypeError(y);if(!b(e))throw new TypeError(p);if(!function(t){const e=t.subarray(0,32),r=t.subarray(32,64);return t instanceof Uint8Array&&64===t.length&&u.compare(e)>0&&u.compare(r)>0}(r))throw new TypeError("Expected Signature");const i=E(e),o=A(r.subarray(0,32)),a=A(r.subarray(32,64));if(n&&a.cmp(h)>0)return!1;if(o.gtn(0)<=0)return!1;if(a.gtn(0)<=0)return!1;const s=A(t),c=a.invm(f),d=s.mul(c).umod(f),g=o.mul(c).umod(f),w=l.mulAdd(d,i,g);return!w.isInfinity()&&w.x.umod(f).eq(o)}}},9491:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(1451).Buffer}catch(t){}function s(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=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.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<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.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 o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f<s;f+=n)u=c(t,f,f+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],h=[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],l=[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 d(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],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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 c=h[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:f[c-g.length]+g+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(!(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(!(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(!(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.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;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.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<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.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 o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,g=d>>>13,y=0|a[2],m=8191&y,w=y>>>13,b=0|a[3],v=8191&b,_=b>>>13,S=0|a[4],A=8191&S,T=S>>>13,E=0|a[5],k=8191&E,C=E>>>13,O=0|a[6],P=8191&O,M=O>>>13,R=0|a[7],N=8191&R,B=R>>>13,x=0|a[8],I=8191&x,F=x>>>13,L=0|a[9],D=8191&L,U=L>>>13,V=0|s[0],j=8191&V,W=V>>>13,K=0|s[1],H=8191&K,q=K>>>13,z=0|s[2],G=8191&z,$=z>>>13,X=0|s[3],J=8191&X,Y=X>>>13,Z=0|s[4],Q=8191&Z,tt=Z>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(c+(n=Math.imul(h,j))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(l,j)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,W))+Math.imul(g,j)|0,o=Math.imul(g,W);var mt=(c+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(l,H)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,j),i=(i=Math.imul(m,W))+Math.imul(w,j)|0,o=Math.imul(w,W),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,q)|0;var wt=(c+(n=n+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,W))+Math.imul(_,j)|0,o=Math.imul(_,W),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,q)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,q)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,$)|0;var bt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,W))+Math.imul(T,j)|0,o=Math.imul(T,W),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Y)|0;var vt=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(k,j),i=(i=Math.imul(k,W))+Math.imul(C,j)|0,o=Math.imul(C,W),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,q)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,q)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(P,j),i=(i=Math.imul(P,W))+Math.imul(M,j)|0,o=Math.imul(M,W),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,q)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,q)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,$)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var St=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(N,j),i=(i=Math.imul(N,W))+Math.imul(B,j)|0,o=Math.imul(B,W),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,q)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,q)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0;var At=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,W))+Math.imul(F,j)|0,o=Math.imul(F,W),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ct)|0;var Tt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,W))+Math.imul(U,j)|0,o=Math.imul(U,W),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(F,H)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,$)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ht)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,gt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,H),i=(i=Math.imul(D,q))+Math.imul(U,H)|0,o=Math.imul(U,q),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,$)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;c=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,G),i=(i=Math.imul(D,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(v,ht)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0;var Ct=(c+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,gt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Pt=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,at)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,lt)|0;var Mt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,ct)|0,n=n+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,lt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0;var Rt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,lt)|0;var Nt=(c+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;c=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var Bt=(c+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(F,pt)|0))<<13)|0;c=((o=o+Math.imul(F,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var xt=(c+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,gt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,gt))+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,u[0]=yt,u[1]=mt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Tt,u[9]=Et,u[10]=kt,u[11]=Ct,u[12]=Ot,u[13]=Pt,u[14]=Mt,u[15]=Rt,u[16]=Nt,u[17]=Bt,u[18]=xt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new y).mulp(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.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?d(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,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},y.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},y.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},y.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=r[f+d],g=n[f+d],y=r[f+d+a],m=n[f+d+a],w=h*y-l*m;m=h*m+l*y,y=w,r[f+d]=p+y,n[f+d]=g+m,r[f+d+a]=p-y,n[f+d+a]=g-m,d!==s&&(w=u*h-c*l,l=u*l+c*h,h=w)}},y.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},y.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},y.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(!(-8192&o))},y.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},y.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),h=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,f,h,n,i);for(var d=0;d<n;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),g(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=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<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},o.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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.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 o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;!(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,g=1;!(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.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,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;!(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;!(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.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 o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._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 T(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,w),i(_,w),i(S,w),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return m[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(!(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var g=d,y=0;0!==g.cmp(s);y++)g=g.redSqr();n(y<p);var m=this.pow(h,new o(1).iushln(p-y-1));l=l.redMul(m),h=m.redSqr(),d=d.redMul(h),p=y}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===f)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,A),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.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),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)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(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),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},1074:(t,e,r)=>{var n=r(8287).Buffer;const i=r(3507),o=n.alloc(1,1),a=n.alloc(1,0);t.exports=function(t,e,r,s,u){let c=n.alloc(32,0),f=n.alloc(32,1);c=i("sha256",c).update(f).update(a).update(e).update(t).update(u||"").digest(),f=i("sha256",c).update(f).digest(),c=i("sha256",c).update(f).update(o).update(e).update(t).update(u||"").digest(),f=i("sha256",c).update(f).digest(),f=i("sha256",c).update(f).digest();let h=f;for(;!s(h)||!r(h);)c=i("sha256",c).update(f).update(a).digest(),f=i("sha256",c).update(f).digest(),f=i("sha256",c).update(f).digest(),h=f;return h}},7729:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.StackswapConfigAPI=e.StackswapDevnetAPI=e.StackswapTestnetAPI=e.StackswapMainnetAPI=void 0;const i=r(966),o=n(r(6425)),a=r(7311),s=r(8921),u=r(2208),c=r(9340),f=r(1114),h=r(3556),l=r(2748),d=r(5199),p=r(8250),g=r(1872),y=r(7450),m=r(4574),w=r(1429),b=r(1905),v=r(7263),_=r(668),S=r(6959),A=r(2643),T=r(713),E=r(9993);class k{constructor(t="",e=null,r,n=null,_=null){this.connected=!1,this.getTenureBlockHeight=async()=>(await o.default.get(this.config.STACKS_API_URL()+"/v2/info")).data.tenure_height,this.getFastBlockHeight=async()=>(await o.default.get(`${this.config.STACKS_API_URL()}/v2/info`)).data.stacks_tip_height,this.getCurrentBlock=async()=>(await o.default.get(this.config.STACKS_API_URL()+"/v2/info")).data.stacks_tip_height,this.fixedSenderAddress=e,this.config=new a.StackswapMainetConfig(t,n,_),this.network=new i.StacksMainnet,this.network.coreApiUrl=r||this.config.STACKS_API_URL(),this.senderAdderss=this.config.NULL_ADDRESS(),this.getConnectedWallet(((t,e)=>{})),this.nftManager=new u.NftManager(this),this.tokenManager=new s.TokenManager(this),this.farm3Manager=new E.Farm3Manager(this),this.farm2Manager=new f.Farm2Manager(this),this.farmManager=new c.FarmManager(this),this.governanceManager=new h.GovernanceManager(this),this.launchpadManager=new l.LaunchpadManager(this),this.lbtcManager=new d.LbtcManager(this),this.multisigManager=new p.MultisigManager(this),this.operatorManager=new g.OperatorManager(this),this.otherManager=new y.OtherManager(this),this.poolManager=new m.PoolManager(this),this.poxlManager=new w.PoxlManager(this),this.stakingManager=new b.StakingManager(this),this.swapManager=new v.SwapManager(this),this.lbtcStakingManager=new S.LBTCStakingManager(this),this.groupFarmManager=new A.GroupFarmManager(this),this.bridgeManager=new T.BridgeManager(this)}getSenderAddress(){return this.fixedSenderAddress?this.fixedSenderAddress:this.senderAdderss}async getCurrentBlocks(){const t=await o.default.get(this.config.STACKS_API_URL()+"/v2/info");return{block_height:t.data.stacks_tip_height,burn_block_height:t.data.burn_block_height,tenure_block_height:t.data.tenure_height}}getQualifiedAddress(t){return this.config.STACKSWAP_ADDRESS()+"."+t}walletConnect(t){try{const e=new _.AppConfig(["store_write","publish_data"]),r=new _.UserSession({appConfig:e});(0,_.showConnect)({userSession:r,appDetails:{name:"Stackswap",icon:"https://app.stackswap.org/favicon.ico"},redirectTo:"/",onFinish:()=>{const e=r.loadUserData().profile.stxAddress;this.config.isMainnet()?this.senderAdderss=e.mainnet:this.senderAdderss=e.testnet,this.connected=!0,t(null,this.senderAdderss)}})}catch(e){t(e,null)}}walletConnect2(t,e){try{(0,_.showConnect)({appDetails:{name:"Stackswap",icon:"https://app.stackswap.org/favicon.ico"},redirectTo:"/",onFinish:()=>{const r=t.loadUserData().profile.stxAddress;this.config.isMainnet()?this.senderAdderss=r.mainnet:this.senderAdderss=r.testnet,this.connected=!0,e(null,this.senderAdderss)},userSession:t})}catch(t){e(t,null)}}getConnectedWallet(t){try{const e=new _.AppConfig(["store_write","publish_data"]),r=new _.UserSession({appConfig:e}).loadUserData().profile.stxAddress;this.config.isMainnet()?this.senderAdderss=r.mainnet:this.senderAdderss=r.testnet,this.connected=!0,t(null,this.senderAdderss)}catch(e){t(e,null)}}signOut(t){try{const e=new _.AppConfig(["store_write","publish_data"]);new _.UserSession({appConfig:e}).signUserOut(),t(null,"success")}catch(e){t(e,null)}}isConnected(){try{const t=new _.AppConfig(["store_write","publish_data"]),e=new _.UserSession({appConfig:t}).loadUserData().profile.stxAddress;return this.config.isMainnet()?this.senderAdderss=e.mainnet:this.senderAdderss=e.testnet,this.connected=!0,!0}catch(t){return!1}}}e.StackswapMainnetAPI=k,e.StackswapTestnetAPI=class extends k{constructor(t="99999",e=null,r){super(t,e,r),this.config=new a.StackswapTestnetConfig(t),this.network=new i.StacksTestnet}},e.StackswapDevnetAPI=class extends k{constructor(t="99999",e=null,r){super(t,e,r),this.config=new a.StackswapDevnetConfig(t),this.network=new i.StacksMocknet}},e.StackswapConfigAPI=class extends k{constructor(t,e="99999",r=null,n){super(e,r,n),this.config=t}}},7311:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StackswapDevnetConfig=e.StackswapTestnetConfig=e.StackswapMainetConfig=void 0;class r{constructor(t="99999",e=null,r=null){this.farm_end_cycle=t,this.apiAddress=e,this.networkAddress=r}CONTRACT_NAME_AINFT(){return"stackswap-leonardoughdavinci-v1b"}CONTRACT_NAME_COLLATERAL_TYPES(){return"stackswap-collateral-types-v1c"}CONTRACT_NAME_COMMISSION(){return"stackswap-nft-commission-v1b"}CONTRACT_NAME_GOLD_PASS(){return"stackswap-gold-pass-v1b"}CONTRACT_NAME_MORTGAGER(){return"stackswap-mortgager-v1d"}CONTRACT_NAME_ORACLE(){return"stackwap-oracle-v1c"}CONTRACT_NAME_POX(){return"SP000000000000000000002Q6VF78"}CONTRACT_NAME_POXL_TOKEN(){return"poxlsoft-token-v4k"}CONTRACT_NAME_SILVER_PASS(){return"stackswap-silver-pass-v1b"}CONTRACT_NAME_SIP10_RESERVE(){return"stackswap-sip10-reserve-v1c"}CONTRACT_NAME_STACKER1(){return"stackswap-stacker1-v1c"}CONTRACT_NAME_STACKER2(){return"stackswap-stacker2-v1c"}CONTRACT_NAME_STACKER3(){return"stackswap-stacker3-v1c"}CONTRACT_NAME_STACKER4(){return"stackswap-stacker4-v1c"}CONTRACT_NAME_STACKSWAP_DAO(){return"stackswap-dao-v5k"}CONTRACT_NAME_STACKSWAP_FARMING(){return"stackswap-farming-v1l"}CONTRACT_NAME_STACKSWAP_FARMING2_1(){return"stackswap-farming-v2c1"}CONTRACT_NAME_STACKSWAP_FARMING2_2(){return"stackswap-farming-v2c2"}CONTRACT_NAME_STACKSWAP_FARMING2_3(){return"stackswap-farming-v2c3"}CONTRACT_NAME_STACKSWAP_FARMING2_4(){return"stackswap-farming-v2c4"}CONTRACT_NAME_STACKSWAP_FARMING2_5(){return"stackswap-farming-v2c5"}CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(){return"farming-v3b-logic"}CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(){return"stackswap-farming-v3-data"}CONTRACT_NAME_STACKSWAP_GOVERNANCE(){return"stackswap-governance-v5k"}CONTRACT_NAME_STACKSWAP_GOVERNANCE_LIST(){return[{version:1,name:"stackswap-governance-v5k"},{version:2,name:"stackswap-governance-v5l"}]}CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(){return"stackswap-one-step-mint-v5k"}CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT_CITY(){return"stackswap-one-step-mint-city-v1a"}CONTRACT_NAME_STACKSWAP_ROUTER_SWAP(){return"stackswap-swap-router-v1b"}CONTRACT_NAME_STACKSWAP_ROUTER_SWAP2(){return"stackswap-swap-router-v2a"}CONTRACT_NAME_STACKSWAP_STACKING(){return"stackswap-staking-v1l"}CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(){return"stackswap-stsw-staking-data-v2a"}CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(){return"stackswap-stsw-staking-logic-v2a"}CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(){return"stackswap-lbtc-staking-logic-v3a"}CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(){return"stackswap-lbtc-staking-data-v3a"}CONTRACT_NAME_STACKSWAP_LBTC_STACKING_V2(){return"stackswap-lbtc-staking-v2a"}CONTRACT_NAME_STACKSWAP_LBTC_STACKING_V1(){return"stackswap-lbtc-staking-v1a"}CONTRACT_NAME_STACKSWAP_SWAP(){return"stackswap-swap-v5k"}CONTRACT_NAME_STX_RESERVE(){return"stackswap-stx-reserve-v1c"}CONTRACT_NAME_VAULT_DATA(){return"stackswap-vault-data-v1c"}FARM_V1_END_CYCLE(){return this.farm_end_cycle}STACKSWAP_ADDRESS(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275"}NULL_ADDRESS(){return"SPM08EE9TDXY962W14B3RC1X9XKHAYD5SFGNYY8D"}STACKS_API_URL(){return this.networkAddress?this.networkAddress:"https://api.hiro.so"}STACKS_BACKEND_PARAM(){return"49"}STACKS_BACKEND_PARAM_LEGACY(){return"43"}STACKS_BACKEND_URL(){return this.apiAddress?this.apiAddress:"https://app.stackswap.org"}isMainnet(){return!0}MODE(){return"mainnet"}CONTRACT_NAME_BRIDGE(){return"SP3YX02QBYNBWQ0QQ9CKSWT263C2KR9AE7BGZT6XA.bridge002"}BASE_WSTX_DATA(){return JSON.parse('{"name":"STACKS","decimal":6,"icon":"https://app.stackswap.org/icon/stx.svg","addr":"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.wstx-token-v4a","symbol":"STX"}')}MIAMI_DATA(){return JSON.parse('{"name":"MiamiCoin","decimal":0,"icon":"https://app.stackswap.org/icon/miamicoin.png","addr":"SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-core-v1","token_addr":"SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token","symbol":"MIA"}')}NEWYORK_DATA(){return JSON.parse("")}BASE_STSW_DATA(){return JSON.parse('{"name":"Stackswap","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stsw-token-v4a","symbol":"STSW"}')}BASE_vSTSW_DATA(){return JSON.parse('{"name":"vSTACKSWAP","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.vstsw-token-v1k","symbol":"vSTSW"}')}BASE_LBTC_DATA(){return JSON.parse('{"name":"Lucid Bitcoin","decimal":8,"icon":"https://app.stackswap.org/icon/lbtc.svg","addr":"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.lbtc-token-v1c","symbol":"lBTC"}')}BASE_NULL_TOKEN_DATA(){return JSON.parse('{"name":"NULL","decimal":6,"icon":"","addr":"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.null-token-v1a","symbol":"NULL"}')}STX_STSW_LP(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-stx-stsw"}STX_USDA_LP(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-v5k0yl5ot8l"}STSW_LBTC_LP(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-v5krqbd8nh6"}CONTRACT_NAME_STACKSWAP_ONE_STEP_GROUP_FARM(){return"stackswap-one-step-group-farm-v1a"}CONTRACT_NAME_STACKSWAP_MULTICHAIN(){return"multichain_v003"}CONTRACT_NAME_REWARD_BALANCER(){return"stackswap-reward-balancer-v1d"}}e.StackswapMainetConfig=r,e.StackswapTestnetConfig=class extends r{constructor(t="99999"){super(t),this.farm_end_cycle=t}FARM_V1_END_CYCLE(){return this.farm_end_cycle}CONTRACT_NAME_POX(){return"ST000000000000000000002AMW42H"}STACKSWAP_ADDRESS(){return"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST"}NULL_ADDRESS(){return"STM08EE9TDXY962W14B3RC1X9XKHAYD5SE2AN2QD"}STACKS_API_URL(){return"https://stacks-node-api.testnet.stacks.co"}STACKS_BACKEND_PARAM(){return"7778"}STACKS_BACKEND_URL(){return"https://app.stackswap.org"}isMainnet(){return!1}MODE(){return"testnet"}BASE_WSTX_DATA(){return JSON.parse('{"name":"STACKS","decimal":6,"icon":"https://app.stackswap.org/icon/stx.svg","addr":"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.wstx-token-v4a","symbol":"STX"}')}BASE_STSW_DATA(){return JSON.parse('{"name":"Stackswap","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.stsw-token-v4a","symbol":"STSW"}')}BASE_vSTSW_DATA(){return JSON.parse('{"name":"vSTACKSWAP","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.vstsw-token-v1k","symbol":"vSTSW"}')}BASE_LBTC_DATA(){return JSON.parse('{"name":"Lucid Bitcoin","decimal":8,"icon":"https://app.stackswap.org/icon/lbtc.svg","addr":"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.lbtc-token-v1c","symbol":"lBTC"}')}BASE_NULL_TOKEN_DATA(){return JSON.parse('{"name":"NULL","decimal":6,"icon":"","addr":"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.null-token-v1a","symbol":"NULL"}')}STX_STSW_LP(){return"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.liquidity-token-stx-stsw"}STSW_LBTC_LP(){return"STXQFYX7YKTFFBSN3JFCB33HHFBAQ0VKPSNXEQST.liquidity-token-v5krqbd8nh6"}},e.StackswapDevnetConfig=class extends r{constructor(t="99999"){super(t),this.farm_end_cycle=t}FARM_V1_END_CYCLE(){return this.farm_end_cycle}CONTRACT_NAME_POX(){return"ST000000000000000000002AMW42H"}STACKSWAP_ADDRESS(){return"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB"}NULL_ADDRESS(){return"STM08EE9TDXY962W14B3RC1X9XKHAYD5SE2AN2QD"}STACKS_API_URL(){return"http://localhost:3999"}STACKS_BACKEND_PARAM(){return"7777"}STACKS_BACKEND_URL(){return"https://app.stackswap.org"}isMainnet(){return!1}MODE(){return"devnet"}BASE_WSTX_DATA(){return JSON.parse('{"name":"STX","decimal":6,"icon":"https://app.stackswap.org/icon/stx.svg","addr":"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.wstx-token-v4a"}')}BASE_STSW_DATA(){return JSON.parse('{"name":"Stackswap","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.stsw-token-v4a","symbol":"STSW"}')}BASE_vSTSW_DATA(){return JSON.parse('{"name":"vSTACKSWAP","decimal":6,"icon":"https://app.stackswap.org/icon/stsw.svg","addr":"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.vstsw-token-v1k","symbol":"vSTSW"}')}BASE_LBTC_DATA(){return JSON.parse('{"name":"Lucid Bitcoin","decimal":8,"icon":"https://app.stackswap.org/icon/lbtc.svg","addr":"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.lbtc-token-v1c","symbol":"lBTC"}')}BASE_NULL_TOKEN_DATA(){return JSON.parse('{"name":"NULL","decimal":6,"icon":"","addr":"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.null-token-v1a","symbol":"NULL"}')}STX_STSW_LP(){return"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.liquidity-token-stx-stsw"}STSW_LBTC_LP(){return"ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB.liquidity-token-v5krqbd8nh6"}}},713:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BridgeManager=void 0;const i=r(4760),o=r(668),a=n(r(1594)),s=r(8597);e.BridgeManager=class{constructor(t){this.stackswap=t}async get_voters(){const t=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"get-voters",[]);try{const e=await(0,i.callReadOnlyFunction)(t),r=[];for(const t of(0,i.cvToValue)(e))r.push(t.value);return r}catch(t){return"0"}}async getVoteRes(){const t=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getVoteRes",[]);try{const e=await(0,i.callReadOnlyFunction)(t);return(0,i.cvToValue)(e)}catch(t){return"0"}}async GetFee(){const t=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"GetFee",[]);try{const e=await(0,i.callReadOnlyFunction)(t);return(0,i.cvToValue)(e)}catch(t){return"0"}}async getETHToken(t){const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getETHToken",[(0,s.parseAddressToCV)(t)]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderIDInfo_From(t){const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getOrderIDInfo_From",[(0,i.uintCV)(t)]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderIDInfo_To(t){const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getOrderIDInfo_To",[(0,i.uintCV)(t)]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderInfo_To(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getOrderInfo_To",[(0,s.parseAddressToCV)(t),(0,i.uintCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderInfo_From(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getOrderInfo_From",[(0,s.parseAddressToCV)(t),(0,i.uintCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderInfoWallet_From(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getWithdrawInfo_Wallet",[(0,s.parseAddressToCV)(this.stackswap.getSenderAddress()),(0,s.parseAddressToCV)(t),(0,i.uintCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t)}catch(t){return"0"}}async getOrderInfoWallet_To(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"getDepositInfo_Wallet",[(0,s.parseAddressToCV)(this.stackswap.getSenderAddress()),(0,s.parseAddressToCV)(t),(0,i.uintCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t)}catch(t){return"0"}}async withdrawFixFee(t,e=null){const r=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),this.stackswap.config.BASE_WSTX_DATA().addr,new a.default(t).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal)],n=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"WithdrawFee_FIX",[],r,e);await(0,o.openContractCall)(n)}async WithdrawFee_RATIO(t,e,r,n=null){let u="WithdrawFee_RATIO_1";switch(t){case"ratio1":u="WithdrawFee_RATIO_1";break;case"ratio2":u="WithdrawFee_RATIO_2";break;case"ratio3":u="WithdrawFee_RATIO_3"}const c=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),this.stackswap.config.BASE_STSW_DATA().addr,new a.default(r).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal)],f=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),u,[(0,s.parseAddressToCV)(e)],c,n);await(0,o.openContractCall)(f)}async getLockedAmount(t=this.stackswap.config.BASE_STSW_DATA()){const e=await this.stackswap.tokenManager.getBalanceOf(t,this.stackswap.config.CONTRACT_NAME_BRIDGE()),r=await this.getETHToken(t.addr),n=new a.default(e).minus(r.FEE_RATIO_1_AMT.value).minus(r.FEE_RATIO_2_AMT.value).minus(r.FEE_RATIO_3_AMT.value);return{amountDecimal:n.dividedBy(10**t.decimal).toFixed(t.decimal),amount:n.toFixed(0)}}async vote(t,e=null){const r=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"vote",[t?(0,i.trueCV)():(0,i.falseCV)()],[],e);await(0,o.openContractCall)(r)}async depositSTSW_SIP10_to_ERC20(t,e,r,n=null){const u=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,new a.default(e).plus(r).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal)],c=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"DepositForETH",[(0,i.stringAsciiCV)(t),(0,s.parseAddressToCV)(this.stackswap.config.BASE_STSW_DATA().addr),(0,i.uintCV)(new a.default(e).multipliedBy(10**6).toFixed(0)),(0,i.uintCV)(new a.default(r).multipliedBy(10**6).toFixed(0))],u,n);await(0,o.openContractCall)(c)}async withdrawSTSW_ERC20_to_SIP10(t,e,r=null){const n=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),this.stackswap.config.BASE_STSW_DATA().addr,new a.default(e).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal),await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,new a.default(10).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal)],u=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"WithdrawFromETH",[(0,i.uintCV)(t),(0,s.parseAddressToCV)(this.stackswap.config.BASE_STSW_DATA().addr)],n,r);await(0,o.openContractCall)(u)}async cancel_depositSTSW_SIP10_to_ERC20(t,e,r,n=null){const u=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),this.stackswap.config.BASE_STSW_DATA().addr,new a.default(r).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal)],c=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"Cancel_DepositForETH",[(0,i.uintCV)(t),(0,s.parseAddressToCV)(e)],u,n);await(0,o.openContractCall)(c)}async registerTokenPair(t,e,r,n,u=null){const c=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"RegisterTokenPair",[(0,s.parseAddressToCV)(t),(0,i.stringAsciiCV)(e),(0,i.uintCV)(new a.default(r).multipliedBy(10**6).toFixed(0)),(0,i.uintCV)(new a.default(n).multipliedBy(10**6).toFixed(0))],[],u);await(0,o.openContractCall)(c)}async update_depositSTSW_SIP10_to_ERC20(t,e,r=null){const n=[];for(const t of e)n.push((0,i.uintCV)(t));const a=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_BRIDGE(),"DepositForETH",[(0,s.parseAddressToCV)(this.stackswap.config.BASE_STSW_DATA().addr),(0,i.uintCV)(t),(0,i.listCV)(n)],[],r);await(0,o.openContractCall)(a)}}},9340:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.FarmManager=e.Farm=void 0;const i=r(4760),o=n(r(1594)),a=r(668),s=r(8597),u=r(1114);e.Farm=class{constructor(t,e,r,n,i,o){this.pool=t,this.locked_token=e,this.TVL=r,this.APR=n,this.in_contract=i,this.cur_round=o}},e.FarmManager=class{constructor(t){this.stackswap=t}async getFarmingRound(t){try{const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-reward-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).value}catch(t){return 0}}async getFarmingRoundFirstBlock(t){const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-first-stacks-block-in-reward-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getFarmingStakerStatus(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-staker",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(r[0],r[1])]),o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);try{const t=a.value.amountUstx.value,r=[],n=[];for(const t of a.value.unclaimedList.value)t.value<e&&t.value<=this.stackswap.config.FARM_V1_END_CYCLE()&&r.push(t.value),n.push(t.value);return{pooledToken:t,unclaimedList:r,stakedList:n}}catch(t){return{pooledToken:0,unclaimedList:[],stakedList:[]}}}async getFarmBalance(t){const e=(0,s.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING())]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t).value}catch(t){return 0}}async getPoolSTXPriceFarm(t,e,r,n){const i=e.addr,a=r.addr;let s=new o.default(-1);return i===this.stackswap.config.BASE_WSTX_DATA().addr?s=new o.default(t.balance_x).multipliedBy(n).dividedBy(t.share_total).dividedBy(new o.default(10**e.decimal)).multipliedBy(2):a===this.stackswap.config.BASE_WSTX_DATA().addr&&(s=new o.default(t.balance_y).multipliedBy(n).dividedBy(t.share_total).dividedBy(new o.default(10**r.decimal)).multipliedBy(2)),s}async getFarmingTotalStatusCycle(t){const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-staking-stats-at-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r);try{return new o.default(n.value.amountUstx.value).multipliedBy(2).toFixed(0).toString()}catch(t){return"0"}}async getFarmingTotalValue(t){try{const e=t.split("."),r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-farm-info",[(0,i.contractPrincipalCV)(e[0],e[1])]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n).value}catch(t){return 0}}async getFarmingUserRewardPerCycle(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-staking-reward-per-user",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.uintCV)(e)]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o)}async getFarmingUserRewardTotal(t){const e=t.split("."),r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-farming-reward-total",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(e[0],e[1])]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n)}async getFarmingUserRewardList(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-farming-reward-from-list",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.listCV)(e)]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o)}async getFarmingRewardInfo(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"get-staker-at-cycle",[(0,i.uintCV)(e),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(r[0],r[1])]),o=await(0,i.callReadOnlyFunction)(n);try{return(0,i.cvToValue)(o).value.toReturn.value}catch(t){return"0"}}async stakeFarmingContract(t,e,r,n=null){const u=t.split("."),c=new o.default(e).multipliedBy(10**6).toFixed(0).toString(),f=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"stake-tokens",[(0,i.uintCV)(c),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.uintCV)(r)],[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,c,i.FungibleConditionCode.Equal)],n);await(0,a.openContractCall)(f)}async claimFarmingContract(t,e,r,n,o=null){const u=t.split("."),c=[];c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),this.stackswap.config.BASE_STSW_DATA().addr,r,i.FungibleConditionCode.Equal)),c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,n,i.FungibleConditionCode.Equal));const f=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"claim-staking-reward",[(0,i.uintCV)(e),(0,i.contractPrincipalCV)(u[0],u[1])],c,o);await(0,a.openContractCall)(f)}async unstakeFarmingContract(t,e,r,n=null){const o=t.split("."),u=[];u.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,r,i.FungibleConditionCode.Equal));const c=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"unstake-from-farming",[(0,i.uintCV)(e),(0,i.contractPrincipalCV)(o[0],o[1])],u,n);await(0,a.openContractCall)(c)}async getCurrentFarmingRound(){const t=await this.stackswap.getCurrentBlocks();return await this.getFarmingRound(t.tenure_block_height)}async getRewardBalanceFromFarming(t,e){const r=[];for(const t of e)r.push((0,i.uintCV)(t));const n=await this.getFarmingUserRewardList(t,r);return(0,s.numFormat_)((0,s.num2decimal)(n.rewardSum.value,6))}getFarmingAPR(t,e){if(new o.default(t)<=new o.default(0))return new o.default(671731.2).multipliedBy(52).multipliedBy(new o.default(e)).toFixed(3).toString();{const r=new o.default(t);return new o.default(671731.2).multipliedBy(new o.default(e)).div(r).multipliedBy(5200).toFixed(3).toString()}}async getEachFarmData(t,e,r){const n=(await this.stackswap.lbtcManager.getPrice("STSW"))["last-price"].value,i=(await this.stackswap.lbtcManager.getPrice("STX"))["last-price"].value,a=await this.stackswap.getCurrentBlocks(),s=new o.default(i).dividedBy(10**6).toNumber(),u=new o.default(n).dividedBy(i).toNumber(),c=await this.getFarmingRound(a.tenure_block_height),f=[];t.forEach((n=>{1===n.farm_group?n.farm_contract=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1():5===n.farm_group&&(n.farm_contract=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_5()),n.round=c,this.getFarmData(n,a,e,s,u).then((e=>{f.push(e),f.length==t.length&&r(f)}))}))}async getFarmData(t,e,r,n,i){switch(t.valid=!1,r){case u.Mode.ONLY_BLOCKCHAIN:t.pair=await this.stackswap.poolManager.getPairDataFromContract(t.token_x,t.token_y);break;case u.Mode.WITH_SERVER:t.pair=(await this.stackswap.swapManager.findRouterAll(t.token_x,t.token_y,Number(e))).pair}return this.getFarmBalance(t.pair.token_lp).then((e=>{this.getPoolSTXPriceFarm(t.pair,t.token_x,t.token_y,e).then((e=>{t.tvl=e.multipliedBy(new o.default(n)).toNumber()}))})),this.getFarmingTotalStatusCycle(Number(t.round)+1).then((e=>{const r=new o.default((0,s.num2decimal)(e,6)).toFixed(3).toString();t.round>this.stackswap.config.FARM_V1_END_CYCLE()?t.apr="0":t.apr=this.getFarmingAPR(r,i)})),t}async getFarmUserData(t,e){t.migratable=!1,t.isMigratable=await this.stackswap.farm2Manager.isUserMigratable2(t.pair.token_lp.addr,t.farm_contract);const r=await this.getFarmingStakerStatus(t.pair.token_lp.addr,Number(t.round));t.claimable_list=r.unclaimedList,t.pooled_stsw=r.pooledToken,t.stakedList=r.stakedList;for(const e of r.stakedList)e>this.stackswap.config.FARM_V1_END_CYCLE()&&t.isMigratable&&(t.migratable=!0),t.unstakedList||(t.unstakedList=[]),t.unstakedList.push(e);const n=await this.getPoolSTXPriceFarm(t.pair,t.token_x,t.token_y,t.pooled_stsw);return t.user_TVL=n.multipliedBy(new o.default(e)).toFixed(3).toString(),t}}},1114:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Farm2Manager=e.Mode=void 0;const i=r(4760),o=n(r(1594)),a=r(668),s=r(8597),u=n(r(2543));var c;!function(t){t[t.WITH_SERVER=0]="WITH_SERVER",t[t.ONLY_BLOCKCHAIN=1]="ONLY_BLOCKCHAIN"}(c=e.Mode||(e.Mode={})),e.Farm2Manager=class{constructor(t){this.localCache={},this.stackswap=t}async getFarmingRound2(t,e){try{const r=(0,s.getReadOptions)(this.stackswap,e,"getRewardRound",[(0,i.uintCV)(t)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n).value}catch(t){return 0}}async getFarmingRoundFirstBlock2(t,e){const r=(0,s.getReadOptions)(this.stackswap,e,"getFirstBlockOfRound",[(0,i.uintCV)(t)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n)}async isUserMigratable2(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,e,"isUserMigratable",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]);try{const t=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(t)}catch(t){return!0}}getPoolUSDPriceFarm(t,e,r){let n=0;switch(t.BASE){case"STX":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stx)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stx)).toNumber();break;case"STSW":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stsw)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stsw)).toNumber();break;case"lBTC":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(r.oracle_lbtc)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(r.oracle_lbtc)).toNumber();break;default:n=0}return n}async getFarmingStakerStatus2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getLPUserData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),a=await(0,i.callReadOnlyFunction)(o),u=(0,i.cvToValue)(a);try{const t=u.value.amountLP.value,r=[],n=[];for(const t of u.value.unclaimedList.value)t.value<e&&r.push(t.value),n.push(t.value);return{pooledToken:t,unclaimedList:r,stakedList:n}}catch(t){return{pooledToken:0,unclaimedList:[],stakedList:[]}}}async getFarmingTotalStatusCycle2(t,e){const r=(0,s.getReadOptions)(this.stackswap,e,"getTotalRoundDataOrDefault",[(0,i.uintCV)(t)]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);try{return{reward:o.reward.value,value:o.value.value}}catch(t){return{reward:0,value:0}}}async getFarmingTotalPoolStatus2(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,e,"getLPTotalData",[(0,i.contractPrincipalCV)(r[0],r[1])]),o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);try{return{amountLP:a.value.amountLP.value,weight:a.value.weight.value}}catch(t){return{amountLP:"0",weight:"1"}}}async getFarmingTotalPoolStatusCycle2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getLPRoundData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o),u=(0,i.cvToValue)(a);try{return u.value}catch(t){return{value:0,weight:0,amountLP:0,price:0}}}async getFarmingTotalValue2(t,e){try{const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,e,"getLPTotalData",[(0,i.contractPrincipalCV)(r[0],r[1])]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o).value}catch(t){return 0}}async getFarmingUserRewardPerCycle2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getFarmingReward",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a)}async getFarmingUserRewardList2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getFarmingRewardFromList",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.listCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a)}async getFarmingRewardInfo2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getLPUserRoundData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a).value.returnLP.value}async getLPUserRoundData(t,e,r){try{const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getLPUserRoundData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a).value}catch(t){return{amountLP:{value:"0"},returnLP:{value:"0"}}}}async migrateToVersion2(t,e,r){const n=t.split("."),o=(0,s.getWriteOptions)(this.stackswap,e,"migrateFromVersion1",[(0,i.contractPrincipalCV)(n[0],n[1])],[],r);await(0,a.openContractCall)(o)}async stakeFarmingContract2(t,e,r,n,u){const c=t.split("."),f=new o.default(e).multipliedBy(10**6).toFixed(0).toString(),h=(0,s.getWriteOptions)(this.stackswap,u,"stakeTokens",[(0,i.uintCV)(f),(0,i.contractPrincipalCV)(c[0],c[1]),(0,i.uintCV)(r),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,f,i.FungibleConditionCode.Equal)],n);await(0,a.openContractCall)(h)}async getFarmBalance2(t,e){const r=(0,s.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t).value}catch(t){return 0}}async claimFarmingContract2(t,e,r,n,o,u){const c=t.split("."),f=[];f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+u,this.stackswap.config.BASE_STSW_DATA().addr,r,i.FungibleConditionCode.Equal)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+u,t,n,i.FungibleConditionCode.Equal)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),f.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,r,i.FungibleConditionCode.Equal));let h=0;switch(u){case this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1():h=1;break;case this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_2():h=2;break;case this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_5():h=3}const l=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),"CLAIM_FROM_FARM",[(0,i.uintCV)(h),(0,i.uintCV)(e),(0,i.contractPrincipalCV)(c[0],c[1]),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],f,o);await(0,a.openContractCall)(l)}async unstakeFarmingContract2(t,e,r,n,o){const u=t.split("."),c=[];c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+o,t,r,i.FungibleConditionCode.Equal));const f=(0,s.getWriteOptions)(this.stackswap,o,"unstakeLP",[(0,i.uintCV)(e),(0,i.contractPrincipalCV)(u[0],u[1])],c,n);await(0,a.openContractCall)(f)}async getCurrentFarmingRound2(t){const e=await this.stackswap.getCurrentBlocks();return await this.getFarmingRound2(Number(e.tenure_block_height),t)}async getRewardBalanceFromFarming2(t,e,r){const n=[];for(const t of e)n.push((0,i.uintCV)(t));let a=new o.default(0);try{for(let e=0;e<n.length;e+=4){const i=await this.getFarmingUserRewardList2(t,n.slice(e,e+4<n.length?e+4:n.length),r);a=a.plus(new o.default(i.rewardSum.value))}return(0,s.num2decimal)(a.toString(),6)}catch(t){return(0,s.num2decimal)(a.toString(),6)}}getFarmingAPR(t,e,r,n){if(!t||new o.default(t)<=new o.default(0))return new o.default(r).dividedBy(10**12).multipliedBy(5200).multipliedBy(e).toFixed(3).toString();{const i=new o.default(t).multipliedBy(10**12);return new o.default(r).multipliedBy(e).div(i).multipliedBy(5200).multipliedBy(n).toFixed(3).toString()}}async getFarmDataFromData(t,e,r){const n=(await this.stackswap.lbtcManager.getPrice("STSW"))["last-price"].value,i=(await this.stackswap.lbtcManager.getPrice("STX"))["last-price"].value,o=(await this.stackswap.lbtcManager.getPrice("lBTC"))["last-price"].value,a=await this.stackswap.getCurrentBlocks();return await this.getEachFarmData(t,a.tenure_block_height,{oracle_stsw:n,oracle_lbtc:o,oracle_stx:i},e,r)}checkAndSetFarmAPR(t,e,r){if(t.length===e){const e={group1:"0",group2:"0",group5:"0"};for(const n of t)switch(n.farm_group){case 1:e.group1=new o.default(e.group1).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v2,r)).multipliedBy(n.weight)).toString();break;case 2:e.group2=new o.default(e.group2).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v2,r)).multipliedBy(n.weight)).toString();break;case 5:e.group5=new o.default(e.group5).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v2,r)).multipliedBy(n.weight)).toString()}for(const n of t)switch(n.farm_group){case 1:n.APR=this.getFarmingAPR(e.group1,r.oracle_stsw,n.reward,n.weight);break;case 2:n.APR=this.getFarmingAPR(e.group2,r.oracle_stsw,n.reward,n.weight);break;case 5:n.APR=this.getFarmingAPR(e.group5,r.oracle_stsw,n.reward,n.weight)}}return t}checkAndSetFarmAPR_Dash(t,e,r){if(t.length===e){const e={group1:"0",group2:"0",group5:"0"};for(const n of t){switch(n.farm_group){case 1:e.group1=new o.default(e.group1).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString();break;case 2:e.group2=new o.default(e.group2).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString();break;case 5:e.group5=new o.default(e.group5).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString()}n.value_per_1LP=new o.default(this.getPoolUSDPriceFarm(n,1e6,r)).multipliedBy(n.weight).toString()}for(const n of t)switch(n.farm_group){case 1:n.APR=this.getFarmingAPR(e.group1,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group1;break;case 2:n.APR=this.getFarmingAPR(e.group2,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group2;break;case 5:n.APR=this.getFarmingAPR(e.group5,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group5}}return t}async getEachFarmData(t,e,r,n,i){const a=new o.default(0),s=[],u=t.length;for(let o=0;o<t.length;o++){let c="";1===t[o].farm_group?c=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1():2===t[o].farm_group?c=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_2():5===t[o].farm_group&&(c=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_5());const f=await this.getCurrentFarmingRound2(c);this.getFarmData(t[o],f,e,a,c,r,n).then((e=>{e.farm_group=t[o].farm_group,e.farm_contract=c,s.push(e),this.checkAndSetFarmAPR(s,u,r),i({farms:s,farm_round:f,oracle_data:r})}))}}async getEachFarmDataSerial(t,e,r,n){const i=new o.default(0),a=[],s=t.length,u=await this.getCurrentFarmingRound2(this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1());for(let o=0;o<t.length;o++){let s="";1===t[o].farm_group?s=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1():2===t[o].farm_group?s=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_2():5===t[o].farm_group&&(s=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_5());const c=await this.getFarmData(t[o],u,e,i,s,r,n);c.farm_group=t[o].farm_group,c.farm_contract=s,a.push(c)}return this.checkAndSetFarmAPR(a,s,r),{farms:a,farm_round:u,oracle_data:r}}delay(t){return new Promise((e=>setTimeout(e,t)))}async getEachFarmDataSerialDash(t,e,r,n,i,o=0){const a=[],s=t.length;for(let t=0;t<i;t++)a.push([]);const c=await this.getCurrentFarmingRound2(this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1());for(let f=Number(c);f<Number(c)+i;f++){for(let i=0;i<t.length;i++){const s=u.default.cloneDeep(t[i]);let h="";1===s.farm_group?h=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_1():2===s.farm_group?h=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_2():5===s.farm_group&&(h=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING2_5());const l=await this.getFarmDataMinimal(s,f,e,h,r,n);l.farm_group=s.farm_group,l.farm_contract=h,a[f-Number(c)].push(l),await this.delay(o)}this.checkAndSetFarmAPR_Dash(a[f-Number(c)],s,r)}return{farms:a,farm_round:c,oracle_data:r}}async getFarmData(t,e,r,n,i,a,s){switch(t.valid=!1,t.cur_round=e,s){case c.ONLY_BLOCKCHAIN:t.pair=await this.stackswap.poolManager.getPairDataFromContract(t.token_x,t.token_y);break;case c.WITH_SERVER:t.pair=(await this.stackswap.swapManager.findRouterAll(t.token_x,t.token_y,Number(r))).pair}t.pair.price=t.pair.balance_y/10**t.token_y.decimal/(t.pair.balance_x/10**t.token_x.decimal);const u=await this.getFarmBalance2(t.pair.token_lp,i),f=await this.stackswap.farmManager.getFarmBalance(t.pair.token_lp);t.TVL=this.getPoolUSDPriceFarm(t,new o.default(f).plus(u).toString(),a),t.total_locked_lp=new o.default(f).plus(u).toString(),t.farm_total_v2=(await this.getFarmingTotalPoolStatusCycle2(t.pair.token_lp.addr,e,i)).amountLP.value;const h=await this.getFarmingTotalStatusCycle2(e,i);t.reward=h.reward;const l=await this.getFarmingTotalPoolStatus2(t.pair.token_lp.addr,i);return t.weight=l.weight,n=n.plus(new o.default(this.getPoolUSDPriceFarm(t,t.total_locked_lp,a)).multipliedBy(t.weight)),t.valid=!0,t}async getFarmDataMinimal(t,e,r,n,i,o){if(t.valid=!1,t.cur_round=e,null==this.localCache[`${t.token_swapr}|FarmPairData`]||Number(this.localCache[`${t.token_swapr}|FarmPairData`].block_height)<Number(r)){switch(o){case c.ONLY_BLOCKCHAIN:t.pair=await this.stackswap.poolManager.getPairDataFromContract(t.token_x,t.token_y);break;case c.WITH_SERVER:t.pair=(await this.stackswap.swapManager.findRouterAll(t.token_x,t.token_y,Number(r))).pair}this.localCache[`${t.token_swapr}|FarmPairData`]={block_height:r,data:t.pair}}else t.pair=this.localCache[`${t.token_swapr}|FarmPairData`].data;t.pair.price=t.pair.balance_y/10**t.token_y.decimal/(t.pair.balance_x/10**t.token_x.decimal);const a=await this.getFarmingTotalPoolStatusCycle2(t.pair.token_lp.addr,e,n);if(t.total_locked_lp=a.amountLP.value,t.TVL=this.getPoolUSDPriceFarm(t,t.total_locked_lp,i),null==this.localCache[`${t.farm_group}|FarmReward`]||Number(this.localCache[`${t.farm_group}|FarmReward`].block_height)<Number(r)){const i=await this.getFarmingTotalStatusCycle2(e,n);t.reward=i.reward,this.localCache[`${t.farm_group}|FarmReward`]={block_height:r,data:i.reward}}else t.reward=this.localCache[`${t.farm_group}|FarmReward`].data;let s=null;return null==this.localCache[`${t.token_swapr}|'FarmTotalPool`]||Number(this.localCache[`${t.token_swapr}|'FarmTotalPool`].block_height)<Number(r)?(s=await this.getFarmingTotalPoolStatus2(t.pair.token_lp.addr,n),this.localCache[`${t.token_swapr}|'FarmTotalPool`]={block_height:r,data:s}):s=this.localCache[`${t.token_swapr}|'FarmTotalPool`].data,t.weight=s.weight,t.valid=!0,t}async getFarmUserData(t,e,r,n,i){t.isMigratable=await this.isUserMigratable2(t.pair.token_lp.addr,r),this.getFarmingStakerStatus2(t.pair.token_lp.addr,Number(e),r).then((a=>{t.isMigratable?(t.claimable_list=a.unclaimedList,t.pooled_stsw=a.pooledToken,t.stakedList=a.stakedList,t.user_TVL=this.getPoolUSDPriceFarm(t,t.pooled_stsw,n),this.getRewardBalanceFromFarming2(t.token_swapr,a.unclaimedList,r).then((e=>{t.total_reward=e,i(t)}))):this.stackswap.farmManager.getFarmingStakerStatus(t.pair.token_lp.addr,Number(e)).then((e=>{t.claimable_list=a.unclaimedList.concat(e.unclaimedList),t.pooled_stsw=new o.default(a.pooledToken).plus(e.pooledToken).toString(),t.stakedList=a.stakedList,t.user_TVL=this.getPoolUSDPriceFarm(t,t.pooled_stsw,n),this.getRewardBalanceFromFarming2(t.pair.token_lp.addr,a.unclaimedList,r).then((r=>{this.stackswap.farmManager.getRewardBalanceFromFarming(t.pair.token_lp.addr,e.unclaimedList).then((e=>{t.total_reward=new o.default(r).plus(e).toString(),i(t)}))}))}))}))}async getFarmUserData2(t,e,r,n,i){t.isMigratable=await this.isUserMigratable2(t.pair.token_lp.addr,r),this.getFarmingStakerStatus2(t.pair.token_lp.addr,Number(e),r).then((a=>{this.stackswap.farmManager.getFarmingStakerStatus(t.pair.token_lp.addr,Number(e)).then((s=>{t.claimable_list=a.unclaimedList.concat(s.unclaimedList),t.pooled_lp_v1=s.pooledToken,t.pooled_lp_v2=a.pooledToken;const u=[];for(const t of s.stakedList)t<e&&t>this.stackswap.config.FARM_V1_END_CYCLE()&&u.push(t);t.unstaked_v1=u,t.pooled_stsw=new o.default(a.pooledToken).plus(s.pooledToken).toString(),t.stakedList=a.stakedList,t.user_TVL=this.getPoolUSDPriceFarm(t,t.pooled_stsw,n),this.getRewardBalanceFromFarming2(t.pair.token_lp.addr,a.unclaimedList,r).then((e=>{this.stackswap.farmManager.getRewardBalanceFromFarming(t.pair.token_lp.addr,s.unclaimedList).then((r=>{t.total_reward=new o.default(e).plus(r).toString(),i(t)}))}))}))}))}}},9993:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Farm3Manager=e.Mode=void 0;const i=r(4760),o=n(r(1594)),a=r(668),s=r(8597),u=n(r(2543));var c;!function(t){t[t.WITH_SERVER=0]="WITH_SERVER",t[t.ONLY_BLOCKCHAIN=1]="ONLY_BLOCKCHAIN"}(c=e.Mode||(e.Mode={})),e.Farm3Manager=class{constructor(t){this.getStakingAmountAtRound=(t,e)=>t>Number(e.StartRound)?e.StakingLockedAmt:t===Number(e.StartRound)?e.StartRoundAmt:t<Number(e.StartRound)?0:void 0,this.localCache={},this.stackswap=t}async getFarmingRound3(t){try{return Math.floor((Number(t)-70843)/504)}catch(t){return 0}}async getCurrentFarmingRound3(){const t=await this.stackswap.getCurrentBlocks();return await this.getFarmingRound3(Number(t.tenure_block_height))}async getFarmingRoundFirstBlock3(t){return 70843+504*Number(t)}getPoolUSDPriceFarm(t,e,r){let n=0;switch(t.BASE){case"STX":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stx)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stx)).toNumber();break;case"STSW":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stsw)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r.oracle_stsw)).toNumber();break;case"lBTC":n=t.token_x.symbol===t.BASE?new o.default(t.pair.balance_x).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(r.oracle_lbtc)).toNumber():new o.default(t.pair.balance_y).multipliedBy(e).dividedBy(t.pair.share_total).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(r.oracle_lbtc)).toNumber();break;default:n=0}return n}async getLPUser(t){const e=t.split("."),r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getLPUserOrDefault",[(0,i.contractPrincipalCV)(e[0],e[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);try{return{ViewAmt:o.ViewAmt.value,StakingLockedAmt:o.StakingLockedAmt.value,StartRound:o.StartRound.value,StartRoundAmt:o.StartRoundAmt.value}}catch(t){return console.log(t),{ViewAmt:"0",StakingLockedAmt:"0",StartRound:"0",StartRoundAmt:"0"}}}async getFarmingStakerStatus3(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getLPUserOrDefault",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);try{const t=Number(a.StartRound.value),r=a.ViewAmt.value,n=[];for(let r=t;r<e;r++)n.push(r);return{pooledToken:r,unclaimedList:n,stakedList:n}}catch(t){return console.log(t),{pooledToken:0,unclaimedList:[],stakedList:[]}}}async getFarmingTotalStatusCycle3(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getGroupHistoryOrDefault",[(0,i.uintCV)(t),(0,i.uintCV)(e)]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);try{return{reward:o.GroupRewardAmt.value,value:o.GroupWeightedTVL.value}}catch(t){return{reward:0,value:0}}}async getFarmingTotalPoolStatus3(t){const e=t.split("."),r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getLPOrDefault",[(0,i.contractPrincipalCV)(e[0],e[1])]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);try{return{amountLP:"0",weight:o.CurWeight.value}}catch(t){return{amountLP:"0",weight:"1"}}}async getFarmingTotalPoolStatusCycle3(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getLPHistoryOrDefault",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.uintCV)(e)]),o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);try{return{value:a.WeightedTVL.value,weight:a.Weight.value,amountLP:a.LockedAmt.value,price:a.Price.value}}catch(t){return{value:0,weight:0,amountLP:0,price:0}}}async getFarmingTotalValue3(t){try{const e=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),"getGroupOrDefault",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).CurRewardAmt.value}catch(t){return 0}}async getFarmingUserRewardPerCycle3(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),"getUserStakingRewardAtRound",[(0,s.parseAddressToCV)(t),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n)}async getFarmingUserRewardList3(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),"getFarmingRewardFromList",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.listCV)(e)]);console.log("fkk",{addr:this.stackswap.getSenderAddress(),pool_address:t,unclaimed_list:e});const o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);return console.log("getFarmingUserRewardTotal",a),a}async getFarmBalance3(t){const e=(0,s.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3())]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t).value}catch(t){return 0}}async stakeFarmingContract3(t,e,r,n){const u=t.split("."),c=[],f=new o.default(e).multipliedBy(10**6).toFixed(0).toString();c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,f,i.FungibleConditionCode.Equal)),c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),this.stackswap.config.BASE_STSW_DATA().addr,new o.default(r).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal));const h=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),"stake",[(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.uintCV)(f),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],c,n);await(0,a.openContractCall)(h)}async claimFarmingContract3(t,e,r,n=!1){const u=t.split(".");if(n){const t=[];t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)),t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal));const n=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),"CLAIM_FROM_FARM",[(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],t,r);await(0,a.openContractCall)(n)}else{const t=[];t.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),this.stackswap.config.BASE_STSW_DATA().addr,new o.default(e).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal));const n=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),"claimReward",[(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],t,r);await(0,a.openContractCall)(n)}}async unstakeFarmingContract3(t,e,r,n){const u=t.split("."),c=[],f=new o.default(e).multipliedBy(10**6).toFixed();c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),t,f,i.FungibleConditionCode.Equal)),c.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_DATA_3(),this.stackswap.config.BASE_STSW_DATA().addr,new o.default(r).multipliedBy(10**6).toFixed(0),i.FungibleConditionCode.Equal));const h=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),"withdrawDirect",[(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.uintCV)(f),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],c,n);await(0,a.openContractCall)(h)}async getRewardBalanceFromFarming3(t,e){const r=[];for(const t of e)r.push((0,i.uintCV)(t));let n=new o.default(0);try{for(let e=0;e<r.length;e+=4){const i=await this.getFarmingUserRewardList3(t,r.slice(e,e+4<r.length?e+4:r.length));n=n.plus(new o.default(i.value.rewardSum.value))}return(0,s.num2decimal)(n.toString(),6)}catch(t){return console.log(t),(0,s.num2decimal)(n.toString(),6)}}getFarmingAPR(t,e,r,n){if(!t||new o.default(t)<=new o.default(0))return new o.default(r).dividedBy(10**12).multipliedBy(10400).multipliedBy(e).toFixed(3).toString();{const i=new o.default(t).multipliedBy(10**12);return new o.default(r).multipliedBy(e).div(i).multipliedBy(10400).multipliedBy(n).toFixed(3).toString()}}async getFarmDataFromData(t,e,r){const n=(await this.stackswap.lbtcManager.getPrice("STSW"))["last-price"].value,i=(await this.stackswap.lbtcManager.getPrice("STX"))["last-price"].value,o=(await this.stackswap.lbtcManager.getPrice("lBTC"))["last-price"].value,a=await this.stackswap.getCurrentBlocks();return await this.getEachFarmData(t,a.tenure_block_height,{oracle_stsw:n,oracle_lbtc:o,oracle_stx:i},e,r)}checkAndSetFarmAPR(t,e,r){if(t.length===e){const e={group1:"0",group2:"0",group5:"0"};for(const n of t)switch(n.farm_group){case 1:e.group1=new o.default(e.group1).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v3,r)).multipliedBy(n.weight)).toString();break;case 2:e.group2=new o.default(e.group2).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v3,r)).multipliedBy(n.weight)).toString();break;case 5:e.group5=new o.default(e.group5).plus(new o.default(this.getPoolUSDPriceFarm(n,n.farm_total_v3,r)).multipliedBy(n.weight)).toString()}for(const n of t)switch(n.farm_group){case 1:n.APR=this.getFarmingAPR(e.group1,r.oracle_stsw,n.reward,n.weight);break;case 2:n.APR=this.getFarmingAPR(e.group2,r.oracle_stsw,n.reward,n.weight);break;case 5:n.APR=this.getFarmingAPR(e.group5,r.oracle_stsw,n.reward,n.weight)}}return t}checkAndSetFarmAPR_Dash(t,e,r){if(t.length===e){const e={group1:"0",group2:"0",group5:"0"};for(const n of t){switch(n.farm_group){case 1:e.group1=new o.default(e.group1).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString();break;case 2:e.group2=new o.default(e.group2).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString();break;case 5:e.group5=new o.default(e.group5).plus(new o.default(this.getPoolUSDPriceFarm(n,n.total_locked_lp,r)).multipliedBy(n.weight)).toString()}n.value_per_1LP=new o.default(this.getPoolUSDPriceFarm(n,1e6,r)).multipliedBy(n.weight).toString()}for(const n of t)switch(n.farm_group){case 1:n.APR=this.getFarmingAPR(e.group1,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group1;break;case 2:n.APR=this.getFarmingAPR(e.group2,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group2;break;case 5:n.APR=this.getFarmingAPR(e.group5,r.oracle_stsw,n.reward,n.weight),n.group_value=e.group5}}return t}async getEachFarmData(t,e,r,n,i){const a=new o.default(0),s=[],u=t.length;for(let o=0;o<t.length;o++){const c=await this.getCurrentFarmingRound3();this.getFarmData(t[o],c,e,a,r,n).then((e=>{e.farm_group=t[o].farm_group,e.farm_contract=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),s.push(e),this.checkAndSetFarmAPR(s,u,r),i({farms:s,farm_round:c,oracle_data:r})}))}}async getEachFarmDataSerial(t,e,r,n){const i=new o.default(0),a=[],s=t.length,u=await this.getCurrentFarmingRound3();for(let o=0;o<t.length;o++){const s=await this.getFarmData(t[o],u,e,i,r,n);s.farm_group=t[o].farm_group,s.farm_contract=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),a.push(s)}return this.checkAndSetFarmAPR(a,s,r),{farms:a,farm_round:u,oracle_data:r}}delay(t){return new Promise((e=>setTimeout(e,t)))}async getEachFarmDataSerialDash(t,e,r,n,i,o=0){const a=[],s=t.length;for(let t=0;t<i;t++)a.push([]);let c=await this.getCurrentFarmingRound3();c<65&&(c=65);for(let f=Number(c);f<Number(c)+i;f++){for(let i=0;i<t.length;i++){const s=u.default.cloneDeep(t[i]),h=await this.getFarmDataMinimal(s,f,e,r,n,c);h.farm_group=s.farm_group,h.farm_contract=this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING_LOGIC_3(),a[f-Number(c)].push(h),await this.delay(o)}this.checkAndSetFarmAPR_Dash(a[f-Number(c)],s,r)}return{farms:a,farm_round:c,oracle_data:r}}async getFarmData(t,e,r,n,i,a){switch(t.valid=!1,t.cur_round=e,a){case c.ONLY_BLOCKCHAIN:t.pair=await this.stackswap.poolManager.getPairDataFromContract(t.token_x,t.token_y);break;case c.WITH_SERVER:t.pair=(await this.stackswap.swapManager.findRouterAll(t.token_x,t.token_y,Number(r))).pair}t.pair.price=t.pair.balance_y/10**t.token_y.decimal/(t.pair.balance_x/10**t.token_x.decimal);const s=await this.getFarmBalance3(t.pair.token_lp);t.TVL=this.getPoolUSDPriceFarm(t,new o.default(s).toString(),i),t.total_locked_lp=new o.default(s).toString(),t.farm_total_v3=(await this.getFarmingTotalPoolStatusCycle3(t.pair.token_lp.addr,e)).amountLP;const u=await this.getFarmingTotalValue3(t.farm_group);t.reward=u;const f=await this.getFarmingTotalPoolStatus3(t.pair.token_lp.addr);return t.weight=f.weight,n=n.plus(new o.default(this.getPoolUSDPriceFarm(t,t.total_locked_lp,i)).multipliedBy(t.weight)),t.valid=!0,t}async getFarmDataMinimal(t,e,r,n,i,o=null){if(t.valid=!1,t.cur_round=e,o&&Number(o)+1<Number(e)&&(e=Number(o)+1),null==this.localCache[`${t.token_swapr}|FarmPairData`]||Number(this.localCache[`${t.token_swapr}|FarmPairData`].block_height)<Number(r)){switch(i){case c.ONLY_BLOCKCHAIN:t.pair=await this.stackswap.poolManager.getPairDataFromContract(t.token_x,t.token_y);break;case c.WITH_SERVER:t.pair=(await this.stackswap.swapManager.findRouterAll(t.token_x,t.token_y,Number(r))).pair}this.localCache[`${t.token_swapr}|FarmPairData`]={block_height:r,data:t.pair}}else t.pair=this.localCache[`${t.token_swapr}|FarmPairData`].data;t.pair.price=t.pair.balance_y/10**t.token_y.decimal/(t.pair.balance_x/10**t.token_x.decimal);const a=await this.getFarmingTotalPoolStatusCycle3(t.pair.token_lp.addr,e);if(t.total_locked_lp=a.amountLP,t.TVL=this.getPoolUSDPriceFarm(t,t.total_locked_lp,n),null==this.localCache[`${t.farm_group}|FarmReward`]||Number(this.localCache[`${t.farm_group}|FarmReward`].block_height)<Number(r)){const e=await this.getFarmingTotalValue3(t.farm_group);t.reward=e,this.localCache[`${t.farm_group}|FarmReward`]={block_height:r,data:e}}else t.reward=this.localCache[`${t.farm_group}|FarmReward`].data;let s=null;return null==this.localCache[`${t.token_swapr}|'FarmTotalPool`]||Number(this.localCache[`${t.token_swapr}|'FarmTotalPool`].block_height)<Number(r)?(s=await this.getFarmingTotalPoolStatus3(t.pair.token_lp.addr),this.localCache[`${t.token_swapr}|'FarmTotalPool`]={block_height:r,data:s}):s=this.localCache[`${t.token_swapr}|'FarmTotalPool`].data,t.weight=s.weight,t.valid=!0,t}async getFarmUserData3(t,e,r,n){const i=await this.getFarmingStakerStatus3(t.pair.token_lp.addr,Number(e));t.claimable_list=i.unclaimedList,t.pooled_lp_v3=i.pooledToken,t.pooled_stsw=new o.default(i.pooledToken).toString(),t.stakedList=i.stakedList,t.user_TVL=this.getPoolUSDPriceFarm(t,t.pooled_stsw,r);const a=await this.getRewardBalanceFromFarming3(t.pair.token_lp.addr,i.unclaimedList);t.total_reward=new o.default(a).toString(),n(t)}async getFarmUserData3_seperate(t,e,r,n){const i=await this.getFarmingStakerStatus3(t.pair.token_lp.addr,Number(e)),a=i.pooledToken,s=new o.default(i.pooledToken).toString(),u=0==Number(a)?[]:i.unclaimedList,c=0==Number(a)?[]:i.stakedList,f=this.getPoolUSDPriceFarm(t,s,r),h=await this.getRewardBalanceFromFarming3(t.pair.token_lp.addr,u),l={claimable_list:u,pooled_lp_v3:a,pooled_lp:s,stakedList:c,user_TVL:f,total_reward:new o.default(h).toString()};return n&&n(l),l}}},3556:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GovernanceManager=void 0;const i=r(4760),o=r(668),a=n(r(1594)),s=r(8597);e.GovernanceManager=class{constructor(t){this.stackswap=t}async getProposalsList(){let t=[];for(const e of this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE_LIST()){let r=[];if(2==e.version){const t=[];for(let e=0;e<30;e++)t.push((0,i.uintCV)(e));r.push((0,i.listCV)(t))}const n=(0,s.getReadOptions)(this.stackswap,e.name,"get-proposals",r),o=await(0,i.callReadOnlyFunction)(n);(0,i.cvToValue)(o).value.forEach((r=>{0!=Number(r.value["end-block-height"])&&(r.value["contract-name"]=e.name),t.push(r.value)}))}return t}async getNumVoting(t,e=this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE()){const r=(0,s.getReadOptions)(this.stackswap,e,"get-votes-by-member-by-id",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);return[o["vote-count"].value,o.returned.value]}async txWithdrawVoting(t,e,r=null,n=this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE()){const a=[];a.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),this.stackswap.config.BASE_vSTSW_DATA().addr,e,i.FungibleConditionCode.Equal));const u=(0,s.getWriteOptions)(this.stackswap,n,"return-votes-to-member",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())],a,r);await(0,o.openContractCall)(u)}async txVote(t,e,r,n=null,u=this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE()){const c=new a.default(10**6).multipliedBy(parseFloat(r)).toFixed(0).toString(),f=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_vSTSW_DATA().addr,c,i.FungibleConditionCode.Equal)];let h=null;"For"===e?h=(0,s.getWriteOptions)(this.stackswap,u,"vote-for",[(0,i.uintCV)(t),(0,i.uintCV)(c)],f,n):"Against"===e&&(h=(0,s.getWriteOptions)(this.stackswap,u,"vote-against",[(0,i.uintCV)(t),(0,i.uintCV)(c)],f,n)),null!=h&&await(0,o.openContractCall)(h)}}},2643:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GroupFarmManager=e.Mode=void 0;const i=r(4760),o=n(r(1594)),a=r(668),s=r(8597),u=r(8921),c=n(r(6425));var f;(f=e.Mode||(e.Mode={}))[f.WITH_SERVER=0]="WITH_SERVER",f[f.ONLY_BLOCKCHAIN=1]="ONLY_BLOCKCHAIN",e.GroupFarmManager=class{constructor(t){this.stackswap=t}async getFarmCounts(){const t=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_GROUP_FARM(),"get-farm-counts",[]);try{return(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value}catch(t){return""}}async getFarmLists(t){const e=[];for(const r of t)e.push((0,i.uintCV)(r));const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_GROUP_FARM(),"get-farms",[(0,i.listCV)(e)]);try{return(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(r)).value}catch(t){return""}}async getAllDatas(t){const e=(0,s.getReadOptions)(this.stackswap,t,"getAllDatas",[]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getRewardData(t){const e=(0,s.getReadOptions)(this.stackswap,t,"getAllRewardData",[]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getFarmingRound(t,e){try{const r=(0,s.getReadOptions)(this.stackswap,e,"getRewardRound",[(0,i.uintCV)(t)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n).value}catch(t){return 0}}async getCurrentFarmingRound2(t){const e=await this.stackswap.getCurrentBlocks();return await this.getFarmingRound(Number(e.tenure_block_height),t)}async getFarmingRoundFirstBlock(t,e){const r=(0,s.getReadOptions)(this.stackswap,e,"getFirstBlockOfRound",[(0,i.uintCV)(t)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n)}async getFarmingStakerStatus(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getUserData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),a=await(0,i.callReadOnlyFunction)(o),u=(0,i.cvToValue)(a);try{const t=u.value.amountLP.value,r=[],n=[];for(const t of u.value.unclaimedList.value)t.value<e&&r.push(t.value),n.push(t.value);return{pooledToken:t,unclaimedList:r,stakedList:n}}catch(t){return{amountToken:{type:"uint",value:"0"},unclaimedList:{type:"(list 0 uint)",value:[]}}}}async getTotalData(t,e){const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,e,"getTotalData",[(0,i.contractPrincipalCV)(r[0],r[1])]),o=await(0,i.callReadOnlyFunction)(n),a=(0,i.cvToValue)(o);try{return a.value}catch(t){return 0}}async getRoundData(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getRoundData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o),u=(0,i.cvToValue)(a);try{return u.value}catch(t){return"0"}}async getUserData(t,e){try{const r=t.split("."),n=(0,s.getReadOptions)(this.stackswap,e,"getUserData",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o).value}catch(t){return{amountToken:{type:"uint",value:"0"},unclaimedList:{type:"(list 0 uint)",value:[]}}}}async getUserNFTData(t){try{const e=(0,s.getReadOptions)(this.stackswap,t,"getUserNFTData",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).value}catch(t){return{amountGold:{type:"uint",value:"0"},amountInCount:{type:"uint",value:"0"},amountSilver:{type:"uint",value:"0"},unclaimedList:{type:"(list 0 uint)",value:[]}}}}async getUserRoundData(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getUserRoundData",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a)}async getFarmingReward(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getFarmingReward",[(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a)}async getNFTFarmingReward(t){const e=(0,s.getReadOptions)(this.stackswap,t,"getNFTFarmingReward",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getFarmingUserRewardList2(t,e,r){const n=t.split("."),o=(0,s.getReadOptions)(this.stackswap,r,"getFarmingRewardFromList",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(n[0],n[1]),(0,i.listCV)(e)]),a=await(0,i.callReadOnlyFunction)(o);return(0,i.cvToValue)(a)}async getFarmBalance(t,e){const r=(0,s.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t).value}catch(t){return 0}}async stakeTokens(t,e,r,n,u){const c=new o.default(e).multipliedBy(10**t.decimal).toFixed(0).toString(),f=(0,s.getWriteOptions)(this.stackswap,u,"stakeTokens",[(0,i.uintCV)(c),(0,s.parseAddressToCV)(t.addr),(0,i.uintCV)(r)],[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.addr,c,i.FungibleConditionCode.Equal)],n);await(0,a.openContractCall)(f)}async claimStakingReward(t,e,r,n,c,f,h,l,d){const p=t.split("."),g=[];t===r?g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,t,new o.default(h.returnToken.value).plus(h.reward1.value).toFixed(0),i.FungibleConditionCode.Equal)):(g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,t,h.returnToken.value,i.FungibleConditionCode.Equal)),g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,r,h.reward1.value,i.FungibleConditionCode.Equal))),n!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,n,h.reward2.value,i.FungibleConditionCode.Equal)),c!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,c,h.reward3.value,i.FungibleConditionCode.Equal)),f!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&g.push(await(0,s.getPostConditionFromAsset)(this.stackswap,d,f,h.reward4.value,i.FungibleConditionCode.Equal));const y=(0,s.getWriteOptions)(this.stackswap,d,"claimStakingReward",[(0,i.uintCV)(e),(0,i.contractPrincipalCV)(p[0],p[1]),(0,s.parseAddressToCV)(r),(0,s.parseAddressToCV)(n),(0,s.parseAddressToCV)(c),(0,s.parseAddressToCV)(f)],g,l,!1);await(0,a.openContractCall)(y)}async getNFTAsset(t){const e=t.split("."),r=this.stackswap.config.STACKS_API_URL()+"/v2/contracts/interface/"+e[0]+"/"+e[1],n=await c.default.get(r);return n.data.non_fungible_tokens.length,t+"::"+n.data.non_fungible_tokens[0].name}async stakeNFTs(t,e,r,n){const o=[],u=[],c=[],f=await this.getNFTAsset(this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_GOLD_PASS()),h=await this.getNFTAsset(this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_SILVER_PASS());for(const e of t)o.push((0,i.uintCV)(e)),c.push((0,i.makeStandardNonFungiblePostCondition)(this.stackswap.getSenderAddress(),i.NonFungibleConditionCode.Sends,f,(0,i.uintCV)(e)));for(const t of e)u.push((0,i.uintCV)(t)),c.push((0,i.makeStandardNonFungiblePostCondition)(this.stackswap.getSenderAddress(),i.NonFungibleConditionCode.Sends,h,(0,i.uintCV)(t)));const l=(0,s.getWriteOptions)(this.stackswap,n,"stakeNFTs",[(0,i.listCV)(o),(0,i.listCV)(u)],c,r,!1);await(0,a.openContractCall)(l)}async claimNFTStakingReward(t,e,r,n,o,c,f){const h=[],l=await this.getNFTAsset(this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_GOLD_PASS());for(const t of o.returnNFTS.value)h.push((0,i.makeContractNonFungiblePostCondition)(f.split(".")[0],f.split(".")[1],i.NonFungibleConditionCode.Sends,l,(0,i.uintCV)(t.value)));t!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&h.push(await(0,s.getPostConditionFromAsset)(this.stackswap,f,t,o.reward1.value,i.FungibleConditionCode.Equal)),e!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&h.push(await(0,s.getPostConditionFromAsset)(this.stackswap,f,e,o.reward2.value,i.FungibleConditionCode.Equal)),r!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&h.push(await(0,s.getPostConditionFromAsset)(this.stackswap,f,r,o.reward3.value,i.FungibleConditionCode.Equal)),n!==u.Token.getBaseTokens(this.stackswap,u.BaseToken.NULL).addr&&h.push(await(0,s.getPostConditionFromAsset)(this.stackswap,f,n,o.reward4.value,i.FungibleConditionCode.Equal));const d=(0,s.getWriteOptions)(this.stackswap,f,"claimNFTStakingReward",[(0,s.parseAddressToCV)(t),(0,s.parseAddressToCV)(e),(0,s.parseAddressToCV)(r),(0,s.parseAddressToCV)(n)],h,c,!1);await(0,a.openContractCall)(d)}async getRewardBalanceFromFarming(t,e,r){const n={returnToken:{type:"uint",value:"0"},reward1:{type:"uint",value:"0"},reward2:{type:"uint",value:"0"},reward3:{type:"uint",value:"0"},reward4:{type:"uint",value:"0"}};try{for(const i of e){const e=await this.getFarmingReward(t,i,r);n.returnToken.value=new o.default(n.returnToken.value).plus(e.returnToken.value).toFixed(0),n.reward1.value=new o.default(n.reward1.value).plus(e.reward1.value).toFixed(0),n.reward2.value=new o.default(n.reward2.value).plus(e.reward2.value).toFixed(0),n.reward3.value=new o.default(n.reward3.value).plus(e.reward3.value).toFixed(0),n.reward4.value=new o.default(n.reward4.value).plus(e.reward4.value).toFixed(0)}return n}catch(t){return{returnToken:{type:"uint",value:"0"},reward1:{type:"uint",value:"0"},reward2:{type:"uint",value:"0"},reward3:{type:"uint",value:"0"},reward4:{type:"uint",value:"0"}}}}}},2748:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LaunchpadManager=void 0;const n=r(8597),i=r(4760),o=r(668);e.LaunchpadManager=class{constructor(t){this.stackswap=t}getRandomIntNum(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t))+t}async getLiquidityList(){const t=(0,n.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"get-liquidity-token-list",[]);try{const e=(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value;return e[this.getRandomIntNum(0,e.length-1)].value}catch(t){return""}}async getSoftTokenList(){const t=(0,n.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"get-soft-token-list",[]);try{const e=(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value;return e[this.getRandomIntNum(0,e.length-1)].value}catch(t){return""}}async getPOXLTokenList(){const t=(0,n.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"get-poxl-token-list",[]);try{const e=(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value;return e[this.getRandomIntNum(0,e.length-1)].value}catch(t){return""}}async getCITYTokenList(){const t=(0,n.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT_CITY(),"get-city-token-list",[]);try{const e=(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value;return e[this.getRandomIntNum(0,e.length-1)].value}catch(t){return""}}async getTemplatetFarmList(){const t=(0,n.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_GROUP_FARM(),"get-template-farm-list",[]);try{const e=(0,i.cvToValue)(await(0,i.callReadOnlyFunction)(t)).value;return e[this.getRandomIntNum(0,e.length-1)].value}catch(t){return""}}async mintSIPContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-sip10-token-with-stx",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STX-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async mintPOXLContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-poxl-token-with-stx",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STX-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount,r.token_decimal)),(0,i.uintCV)(r.first_stacking_block),(0,i.uintCV)(r.reward_cycle_block),(0,i.uintCV)(r.token_reward_maturity),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.coinbase_reward,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async mintCITYContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT_CITY(),"create-pair-new-city-token-with-stx",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STX-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount,r.token_decimal)),(0,i.uintCV)(r.first_stacking_block),(0,i.uintCV)(r.reward_cycle_block),(0,i.uintCV)(r.token_reward_maturity),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.coinbase_reward,r.token_decimal)),(0,i.uintCV)(r.token_reserve_ratio),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.minimum_mining_amount,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async mintSIPSTSWContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-sip10-token-with-stsw",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STSW-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountStringWithDecimal)(r.initial_amount,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async mintPOXLSTSWContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-poxl-token-with-stsw",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STSW-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount,r.token_decimal)),(0,i.uintCV)(r.first_stacking_block),(0,i.uintCV)(r.reward_cycle_block),(0,i.uintCV)(r.token_reward_maturity),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.coinbase_reward,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async mintCITYSTSWContractCall(t,e,r,a=null){const s=t.split("."),u=e.split("."),c=[];c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,(0,n.getAmountWithDecimalString)(r.initial_amount_x,6),i.FungibleConditionCode.Equal)),c.push(await(0,n.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,0,i.FungibleConditionCode.GreaterEqual));const f=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT_CITY(),"create-pair-new-city-token-with-stsw",[(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)("STSW-"+r.token_symbol),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_x,6)),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount_y,r.token_decimal)),(0,i.contractPrincipalCV)(s[0],s[1]),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.stringAsciiCV)(r.token_name),(0,i.stringAsciiCV)(r.token_symbol),(0,i.uintCV)(r.token_decimal),(0,i.stringUtf8CV)(r.token_uri),(0,i.stringUtf8CV)(r.token_website),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.initial_amount,r.token_decimal)),(0,i.uintCV)(r.first_stacking_block),(0,i.uintCV)(r.reward_cycle_block),(0,i.uintCV)(r.token_reward_maturity),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.coinbase_reward,r.token_decimal)),(0,i.uintCV)(r.token_reserve_ratio),(0,i.uintCV)((0,n.getAmountWithDecimalString)(r.minimum_mining_amount,r.token_decimal)),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP())],c,a);(0,o.openContractCall)(f)}async createGroupContractCall(t,e=null){const r=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_GROUP_FARM(),"initialize-farm",[(0,n.parseAddressToCV)(t.templateFarm),(0,i.stringAsciiCV)(t.name),(0,i.stringUtf8CV)(t.uri),(0,n.parseAddressToCV)(t.project_token),(0,n.parseAddressToCV)(t.project_lp_token),(0,i.uintCV)(t.lp_lock_amount),(0,n.parseAddressToCV)(t.reward_token_1_in),(0,n.parseAddressToCV)(t.reward_token_2_in),(0,n.parseAddressToCV)(t.reward_token_3_in),(0,n.parseAddressToCV)(t.reward_token_4_in),(0,i.listCV)([(0,i.uintCV)(t.reward1List[0]),(0,i.uintCV)(t.reward1List[1]),(0,i.uintCV)(t.reward1List[2]),(0,i.uintCV)(t.reward1List[3])]),(0,i.listCV)([(0,i.uintCV)(t.reward2List[0]),(0,i.uintCV)(t.reward2List[1]),(0,i.uintCV)(t.reward2List[2]),(0,i.uintCV)(t.reward2List[3])]),(0,i.listCV)([(0,i.uintCV)(t.reward3List[0]),(0,i.uintCV)(t.reward3List[1]),(0,i.uintCV)(t.reward3List[2]),(0,i.uintCV)(t.reward3List[3])]),(0,i.uintCV)(t.first_farming_block_in),(0,i.uintCV)(t.reward_round_length_in),(0,i.uintCV)(t.max_farming_rounds_in),(0,i.uintCV)(t.nft_end_block_in),(0,i.uintCV)(t.nft_count_limit_in),(0,i.uintCV)(t.nft_count_takes_in)],[],e,!0);(0,o.openContractCall)(r)}}},5199:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.LbtcManager=void 0;const i=r(8597),o=n(r(1594)),a=r(4760),s=r(668);e.LbtcManager=class{constructor(t){this.stackswap=t}async getPoxInfo(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_POX()+"pox","get-pox-info",[]),e=await(0,a.callReadOnlyFunction)(t);return(0,a.cvToValue)(e)}async getVaultTypeInfo(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES(),"get-collateral-type-by-name",[(0,a.stringAsciiCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r)}async getVaultIDFromUser(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vaults",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,a.callReadOnlyFunction)(t);return(0,a.cvToValue)(e)}async getVaultInfoFromID(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vault-by-id",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r)}async getVaultIDFromUser2(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vault-entries",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,a.callReadOnlyFunction)(t);return(0,a.cvToValue)(e)}async txCreateVaultWithSTX(t,e,r,n,o=null){let u=a.trueCV;u=n?a.trueCV:a.falseCV;const c=[];c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,t.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_MORTGAGER(),this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.LessEqual));const f=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"collateralize-and-mint",[(0,a.uintCV)(t.multipliedBy(10**6).toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),u(),(0,a.stringAsciiCV)(r),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STX_RESERVE()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],c,o);(0,s.openContractCall)(f)}async txCreateVaultWithSTSW(t,e,r,n=null){const o=[];o.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,t.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal)),o.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_MORTGAGER(),this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.LessEqual));const u=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"collateralize-and-mint",[(0,a.uintCV)(t.multipliedBy(10**6).toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),(0,a.falseCV)(),(0,a.stringAsciiCV)(r),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE()),(0,a.contractPrincipalCV)(this.stackswap.config.BASE_STSW_DATA().addr.split(".")[0],this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],o,n);(0,s.openContractCall)(u)}async txDepositCollateral(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];"STX"===r?u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal)):"STSW"===r&&u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"deposit",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**6).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,s.openContractCall)(c)}async txToggleStacking(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"toggle-stacking",[(0,a.uintCV)(t.toString())],[],e);(0,s.openContractCall)(r)}async txStackCollateral(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"stack-collateral",[(0,a.uintCV)(t.toString())],[],e);(0,s.openContractCall)(r)}resolveStacker(t){switch(t){case"stacker":default:return this.stackswap.config.CONTRACT_NAME_STACKER1();case"stacker-2":return this.stackswap.config.CONTRACT_NAME_STACKER2();case"stacker-3":return this.stackswap.config.CONTRACT_NAME_STACKER3();case"stacker-4":return this.stackswap.config.CONTRACT_NAME_STACKER4()}}async txEnableWithdraw(t,e,r=null){const n=(0,i.getWriteOptions)(this.stackswap,this.resolveStacker(e),"enable-vault-withdrawals",[(0,a.uintCV)(t.toString())],[],r);(0,s.openContractCall)(n)}async txWithdrawCollateral(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];"STX"===r?u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+o,this.stackswap.config.BASE_WSTX_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal)):"STSW"===r&&u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+o,this.stackswap.config.BASE_STSW_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"withdraw",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**6).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,s.openContractCall)(c)}async txMintDebt(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+o,this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.LessEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"mint",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,s.openContractCall)(c)}async txBurnDebt(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,s.openContractCall)(c)}async txCloseVault(t,e,r,n,u=null){let c=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();const f=[];"STX"===e?(c=this.stackswap.config.CONTRACT_NAME_STX_RESERVE(),f.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STX_RESERVE(),this.stackswap.config.BASE_WSTX_DATA().addr,r,a.FungibleConditionCode.Equal))):f.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE(),this.stackswap.config.BASE_STSW_DATA().addr,r,a.FungibleConditionCode.Equal)),f.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_LBTC_DATA().addr,new o.default(n).multipliedBy(10**8).multipliedBy(1.001).toFixed(0),a.FungibleConditionCode.LessEqual));const h=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"close-vault",[(0,a.uintCV)(t.toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),c),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],f,u);(0,s.openContractCall)(h)}async txFinalLiquidation(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"finalize-liquidation",[(0,a.uintCV)(t.toString())],[],e);(0,s.openContractCall)(r)}async txUnliquidationDeposit(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];"STX"===r?u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal)):"STSW"===r&&u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e.multipliedBy(10**6).toString(),a.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"deposit-to-unliquidate",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**6).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,s.openContractCall)(c)}async txUnliquidationBurn(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn-to-unliquidate",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,s.openContractCall)(c)}async txLiquidationWithdraw(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];"STX"===r?u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)):"STSW"===r&&u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"withdraw-liquidated",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**6).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,s.openContractCall)(c)}async txLiquidationBurn(t,e,r,n=null){let o=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(o=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const u=[];u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_LBTC_DATA().addr,e.multipliedBy(10**8).toString(),a.FungibleConditionCode.LessEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn-liquidated",[(0,a.uintCV)(t.toString()),(0,a.uintCV)(e.multipliedBy(10**8).toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,s.openContractCall)(c)}async txCloseVaultLiquidated(t,e,r=null){let n=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===e&&(n=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const o=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"close-vault-liquidated",[(0,a.uintCV)(t.toString()),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),n),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],[],r);(0,s.openContractCall)(o)}async getDebtRatio(t,e,r){let n=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();"STX"===r&&(n=this.stackswap.config.CONTRACT_NAME_STX_RESERVE());const o=(0,i.getReadOptions)(this.stackswap,n,"calculate-current-collateral-to-debt-ratio",[(0,a.stringAsciiCV)(r),(0,a.uintCV)(e.multipliedBy(10**8).toFixed(0)),(0,a.uintCV)(t.multipliedBy(10**6).toFixed(0)),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())]),s=await(0,a.callReadOnlyFunction)(o);return(0,a.cvToValue)(s)}async getPrice(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_ORACLE(),"get-price",[(0,a.stringAsciiCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r)}async getStabilityFee(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"get-stability-fee-for-vault",[(0,a.uintCV)(t),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r)}}},6959:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.LBTCStakingManager=void 0;const i=r(4760),o=n(r(6425)),a=r(668),s=n(r(1594)),u=r(8597),c=r(8921);e.LBTCStakingManager=class{constructor(t){this.stackswap=t}async getStackingRoundFirstBlock(t){const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"get-first-stacks-block-in-reward-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getStakingRound(t){try{const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"get-reward-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).value}catch(t){return 0}}async getCurrentStakingRound(){const t=await this.stackswap.getCurrentBlocks();return await this.getStakingRound(t.tenure_block_height)}async getStaker(){try{const t=Number(await this.getCurrentStakingRound()),e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(),"get-staker",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r).value,o=[],a=[];for(const e of n.staked_list.value)Number(e.value)<Number(t)&&o.push(e.value),a.push(e.value);return{unclaimedList:o,amount:n.amountReturn.value,stakedList:a}}catch(t){return{unclaimedList:[],amount:"0",stakedList:[]}}}async getRoundData(t){try{const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(),"get-staking-stats-at-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r).value;return{rewardBase:n.amountRewardBase.value,amount:n.amountReturn.value,value:n.amountlBTC.value}}catch(t){return{rewardBase:"0",amount:"0",value:"0"}}}async getRoundDataDefault(t){try{const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),"get-staking-stats-at-cycle-or-default",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r).value;return{rewardBase:n.amountRewardBase.value,amount:n.amountReturn.value,value:n.amountlBTC.value}}catch(t){return{amount:"0",value:"0",rewardBase:"0"}}}async getLBTCNFT(){const t=this.stackswap.config.STACKS_API_URL()+`/extended/v1/tokens/nft/holdings?principal=${this.stackswap.getSenderAddress()}&asset_identifiers=${this.stackswap.config.STACKSWAP_ADDRESS()}.${this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3()}::lBTC-staking-vault`,e=await o.default.get(t),r=[];try{for(const t of e.data.results)r.push(t.value.repr);return r}catch(t){return[]}}async getReward(t){const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"get-staking-reward-per-user",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getClaimRewardList(t){let e={},r=[];for(const n of t){const t=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(),"get-staking-vault",[(0,i.uintCV)(n)]),o=await(0,i.callReadOnlyFunction)(t),a=(0,i.cvToValue)(o);e[n]=a,r.push(n)}return[r,e]}async txStake(t,e,r=null){const n=new s.default(10**8).multipliedBy(t).toFixed(0).toString(),o=[];o.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_LBTC_DATA().addr,n,i.FungibleConditionCode.Equal));const c=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"stake-tokens",[(0,i.uintCV)(n),(0,i.uintCV)(e)],o,r);await(0,a.openContractCall)(c)}async txClaim(t,e,r=null){const n=[await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)];n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal));const o=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),"CLAIM_FROM_LBTC_STAKING",[(0,i.uintCV)(t)],n,r);await(0,a.openContractCall)(o)}async txUnstake(t,e=null){const r=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"unstake-tokens",[(0,i.uintCV)(t)],[],e);await(0,a.openContractCall)(r)}async txReclaim(t,e,r=null){const n=[],o=`${this.stackswap.config.STACKSWAP_ADDRESS()}.${this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3()}::lBTC-staking-vault`;n.push(await(0,i.makeStandardNonFungiblePostCondition)(this.stackswap.getSenderAddress(),i.NonFungibleConditionCode.Sends,o,(0,i.uintCV)(t))),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,`${this.stackswap.config.STACKSWAP_ADDRESS()}.${this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3()}`,this.stackswap.config.BASE_LBTC_DATA().addr,e,i.FungibleConditionCode.Equal));const s=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"reclaim-tokens",[(0,i.uintCV)(t)],n,r);await(0,a.openContractCall)(s)}async getRewardFromList(t){if(0===t.length)return 0;const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_LOGIC_V3(),"get-staking-reward-from-list",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.listCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).rewardSum.value}async getRewardOneByOne(t){const e=[];for(const r of t)e.push((0,i.uintCV)(r));let r=new s.default(0);try{for(let t=0;t<e.length;t++){const n=await this.getRewardFromList(e.slice(t,t+4<e.length?t+4:e.length));r=r.plus(n)}return(0,u.num2decimal)(r.toString(),6)}catch(t){return(0,u.num2decimal)(r.toString(),6)}}async getRewardTotal(t,e=4){const r=[];for(const e of t)r.push((0,i.uintCV)(e));let n=new s.default(0);try{for(let t=0;t<r.length;t+=e){const i=await this.getRewardFromList(r.slice(t,t+e<r.length?t+e:r.length));n=n.plus(i)}return(0,u.num2decimal)(n.toString(),6)}catch(t){return(0,u.num2decimal)(n.toString(),6)}}async getlbtcStakingData(t=-1,e="",r={},n=""){let i="";i=""!=e?e:(await this.stackswap.getCurrentBlocks()).tenure_block_height;const o=Number(i),a=t<0?Math.floor((o-38083)/4320):t,f=t<0?1:0,h=await this.getRoundData(a+f),l=h.value,d=h.rewardBase,p=Math.floor((o-38083)/4320),g=4320*a+38083,y=4320*p+38083,m=4320*(p+1)+38083-1,w=r.stsw?r.stsw:(0,u.num2decimal)((await this.stackswap.lbtcManager.getPrice("STSW"))["last-price"].value,6),b=r.lbtc?r.lbtc:(0,u.num2decimal)((await this.stackswap.lbtcManager.getPrice("lBTC"))["last-price"].value,6),v=""!=n?n:await this.stackswap.tokenManager.getBalanceOf(c.Token.getBaseTokens(this.stackswap,c.BaseToken.lBTC),this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3()),_=new s.default(d).multipliedBy(1e4).multipliedBy(w).dividedBy(new s.default(l).plus(1)).dividedBy(b);return{bh:i,round:a,round_data:h,tvl_apr:l,round_reward:d,this_round_start_block:g,next_round_start_block:y,next_round_end_block:m,max_apr:(0,u.numFormat_)(_.multipliedBy(8).toString(),3),min_apr:(0,u.numFormat_)(_.toString(),3),tvl_usd:(0,u.numFormat_)(new s.default(v).multipliedBy(b).div(10**8).toString(),2),tvl_lbtc:v}}async getUserStakingData(){const t=await this.getStaker();return{user_staked_amount:t.amount,stake_lbtc_claim_round_list:t.unclaimedList,total_reward:await this.getRewardTotal(t.unclaimedList)}}async getUserInfoRound(t,e){try{const r=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_LBTC_STACKING_DATA_V3(),"get-staker-at-cycle",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(e)]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n).value;return{amount:o.amountReturn.value,value:o.amountlBTC.value}}catch(t){return{amount:"0",value:"0"}}}}},8250:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultisigManager=void 0;const n=r(668),i=r(4760),o=r(8597);e.MultisigManager=class{constructor(t){this.stackswap=t}async deposit_vote_multisig(t){const e=(0,o.getWriteOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01","deposit-vote",[t?(0,i.trueCV)():(0,i.falseCV)()],[]);await(0,n.openContractCall)(e)}async withdraw_vote_multisig(t){const e=(0,o.getWriteOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01","withdraw-vote",[t?(0,i.trueCV)():(0,i.falseCV)()],[]);await(0,n.openContractCall)(e)}async deposit_multisig(t){const e=[await(0,o.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,t,i.FungibleConditionCode.Equal)],r=(0,o.getWriteOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01","deposit",[(0,i.uintCV)(t)],e);await(0,n.openContractCall)(r)}async withdraw_multisig(t,e){const r=[await(0,o.getPostConditionFromAsset)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01",this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)],a=(0,o.getWriteOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01","withdraw",[(0,o.parseAddressToCV)(t),(0,i.uintCV)(e)],r);await(0,n.openContractCall)(a)}async getMultisigSTSWAmount(){const t=(0,o.getReadOptions)(this.stackswap,this.stackswap.config.BASE_STSW_DATA().addr,"get-balance",[(0,o.parseAddressToCV)("SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01")]);try{const e=await(0,i.callReadOnlyFunction)(t);return(0,i.cvToValue)(e).value}catch(t){return"0"}}async getMultisigResult(t){const e=(0,o.getReadOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01",t,[]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}}},2208:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.NftManager=void 0;const i=r(8597),o=r(668),a=r(4760),s=n(r(1594)),u=n(r(6425));e.NftManager=class{constructor(t){this.stackswap=t}async getUserNFTListFromContract(t,e=this.stackswap.getSenderAddress()){const r=await this.getNFTAsset(t);return await this.getUserNFTList(r,e)}async getUserNFTList(t,e=this.stackswap.getSenderAddress()){const r=this.stackswap.config.STACKS_API_URL()+`/extended/v1/tokens/nft/holdings?principal=${e}&asset_identifiers=${t}`,n=await u.default.get(r),i=[];try{for(const t of n.data.results)i.push(t.value.repr);return i}catch(t){return[]}}async getNFTAsset(t){const e=t.split("."),r=this.stackswap.config.STACKS_API_URL()+"/v2/contracts/interface/"+e[0]+"/"+e[1],n=await u.default.get(r);return n.data.non_fungible_tokens.length,t+"::"+n.data.non_fungible_tokens[0].name}async getPostConditionFromAssetNFT(t,e,r,n){const i=await this.getNFTAsset(e);return(0,a.makeStandardNonFungiblePostCondition)(t,r,i,(0,a.uintCV)(n))}async mintNFT(t,e,r=null){const n=[];n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_WSTX_DATA().addr,t,a.FungibleConditionCode.Equal));const s=(0,i.getWriteOptions)(this.stackswap,e,"mint",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())],n,r);await(0,o.openContractCall)(s)}async batchMintNFT(t,e,r,n=null){const s=[],u=[];for(let t=0;t<r;t++)u.push((0,a.standardPrincipalCV)(this.stackswap.getSenderAddress()));s.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_WSTX_DATA().addr,t,a.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,e,"batch-mint",[(0,a.listCV)(u)],s,n);await(0,o.openContractCall)(c)}async mintNFT2(t,e=null){const r=[];r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_WSTX_DATA().addr,1e6*t,a.FungibleConditionCode.Equal)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_WSTX_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,a.FungibleConditionCode.GreaterEqual));const n=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"mint",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())],r,e);await(0,o.openContractCall)(n)}async batchSetMintPass(t,e,r=null){const n=(0,i.getWriteOptions)(this.stackswap,e,"batch-set-mint-pass",[(0,a.listCV)(t)],[],r);await(0,o.openContractCall)(n)}async listInUstx(t,e,r=this.stackswap.config.CONTRACT_NAME_COMMISSION(),n=null){const s=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"list-in-ustx",[(0,a.uintCV)(t),(0,a.uintCV)(e),this.stackswap.getQualifiedAddress(r)],[],n);await(0,o.openContractCall)(s)}async unlistInUstx(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"unlist-in-ustx",[(0,a.uintCV)(t)],[],e);await(0,o.openContractCall)(r)}async buyInUstx(t,e,r,n=this.stackswap.config.CONTRACT_NAME_COMMISSION(),u=null){const c=[];c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_WSTX_DATA().addr,new s.default(e).multipliedBy(1.075).toFixed(),a.FungibleConditionCode.LessEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_WSTX_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),c.push(await this.getPostConditionFromAssetNFT(r,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),a.NonFungibleConditionCode.Sends,""+t));const f=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"buy-in-ustx",[(0,a.uintCV)(t),(0,a.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),n)],c,u);await(0,o.openContractCall)(f)}async reTouchNFT(t,e,r=null){const n=[];n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,e,a.FungibleConditionCode.Equal)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_WSTX_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_STSW_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,a.FungibleConditionCode.GreaterEqual)),n.push(await this.getPostConditionFromAssetNFT(this.stackswap.getSenderAddress(),this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),a.NonFungibleConditionCode.Sends,""+t));const s=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"re-touch",[(0,a.uintCV)(t)],n,r);await(0,o.openContractCall)(s)}async regressNFT(t,e="90000000",r=null){const n=[];n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),this.stackswap.config.BASE_LBTC_DATA().addr,e,a.FungibleConditionCode.Equal)),n.push(await this.getPostConditionFromAssetNFT(this.stackswap.getSenderAddress(),this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),a.NonFungibleConditionCode.Sends,""+t));const s=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"regress-token",[(0,a.uintCV)(t)],n,r);await(0,o.openContractCall)(s)}async getNFTData(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-nft-data",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r).value}async getOwner(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-owner",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e),n=(0,a.cvToValue)(r);try{return n.value.value}catch(t){return""}}async getMintPass(t){const e=(0,i.getReadOptions)(this.stackswap,t,"get-mint-pass-balance",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,a.callReadOnlyFunction)(e),n=(0,a.cvToValue)(r);try{return n}catch(t){return""}}async getPassBalance(t){const e=(0,i.getReadOptions)(this.stackswap,t,"get-balance",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,a.callReadOnlyFunction)(e);try{return(0,a.cvToValue)(r)}catch(t){return"0"}}async getReserveAmount(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-reserve-amount",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r).value}async getTokenURI(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-token-uri",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e);return(0,a.cvToValue)(r).value}async getTotalList(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-total-list",[]),e=await(0,a.callReadOnlyFunction)(t);try{return(0,a.cvToValue)(e)}catch(t){return[]}}async getMarketList(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-market-list",[]),e=await(0,a.callReadOnlyFunction)(t);try{return(0,a.cvToValue)(e)}catch(t){return[]}}async getMarketListing(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-listing-in-ustx",[(0,a.uintCV)(t)]),r=await(0,a.callReadOnlyFunction)(e),n=(0,a.cvToValue)(r);try{return n.value.price.value}catch(t){return 0}}async getPASSData(t){const e=t?this.stackswap.config.CONTRACT_NAME_GOLD_PASS():this.stackswap.config.CONTRACT_NAME_SILVER_PASS(),r={id:0,name:"loading...",img_url:"loading...",json_url:t?"https://gateway.ipfs.io/ipfs/QmQtSMAPvKFEr11VfKio2NHqwayJk4CTUkfmkxgXTR7Q2w":"https://gateway.ipfs.io/ipfs/QmQMArAThFXsFtDUyBWBepThCUbANjomWSw9cnmLALLcaM",desc:"loading...",attr:{},price:0,owner:"loading...",locked_amt:0,addr:e,contract_name:this.stackswap.config.STACKSWAP_ADDRESS()+"."+e},n=await u.default.get(r.json_url);return r.desc=n.data.description,r.name=n.data.name,r.img_url="https://gateway.ipfs/ipfs/"+n.data.image.substr(7,n.data.image.length),r}async getNFTDataFromID(t){const e={id:t,name:"loading...",img_url:"loading...",json_url:`https://gateway.ipfs.io/ipfs/Qmaa5RRUMa9HQRHWJw3HWG3i1NUmb5VgJXT9Zqqg5VHQjX/${t}.json`,desc:"loading...",attr:{reTouch:0},price:0,owner:"loading...",locked_amt:0,contract_name:this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT()},r=await u.default.get(`https://gateway.ipfs.io/ipfs/Qmaa5RRUMa9HQRHWJw3HWG3i1NUmb5VgJXT9Zqqg5VHQjX/${t}.json`);return e.img_url="https://gateway.ipfs.io/ipfs/"+r.data.image.substr(7,r.data.image.length),e.desc=r.data.description,e.name=r.data.name,e.attr.reTouch=r.data.attributes[0].value,e.price=await this.getMarketListing(t),e.locked_amt=await this.getReserveAmount(t),e}}},1872:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.OperatorManager=void 0;const i=n(r(1594)),o=r(668),a=r(8597),s=r(4760);e.OperatorManager=class{constructor(t){this.stackswap=t}async collectSwapFees(t,e,r,n=null){const i=t.split("."),u=e.split("."),c=r.split("."),f=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"collect-fees",[(0,s.contractPrincipalCV)(i[0],i[1]),(0,s.contractPrincipalCV)(u[0],u[1]),(0,s.contractPrincipalCV)(c[0],c[1])],[],n);(0,o.openContractCall)(f)}async add_liquidity_dist(t,e,r,n=null){const i=(0,a.getWriteOptions)(this.stackswap,t,"add-liquidity",[(0,s.uintCV)(e),(0,s.uintCV)(r)],[],n);(0,o.openContractCall)(i)}async invest_to_farm_dist(t,e=null){const r=(0,a.getWriteOptions)(this.stackswap,t,"invest-to-farm",[(0,s.uintCV)(12)],[],e);(0,o.openContractCall)(r)}async STSWInvestTx(t,e=null){const r=new i.default(t).multipliedBy(10**6).toFixed(0).toString(),n=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,r,s.FungibleConditionCode.Equal)],u=(0,a.getWriteOptions)(this.stackswap,"distributor0001","invest",[(0,s.uintCV)(r)],n,e);return await(0,o.openContractCall)(u)}async farmClaimDistributor(t,e=null){const r=(0,a.getWriteOptions)(this.stackswap,"distributor0001","claim-from-farm",[(0,s.uintCV)(t)],[],e);return await(0,o.openContractCall)(r)}async STSWAwdDistributor(t,e=null){const r=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.BASE_STSW_DATA().addr,t,s.FungibleConditionCode.Equal)],n=(0,a.getWriteOptions)(this.stackswap,"distributor0001","awd-stsw",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,s.uintCV)(t)],r,e);return await(0,o.openContractCall)(n)}async STSWStaking(t,e="1",r=null){const n=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,t,s.FungibleConditionCode.Equal)],i=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"stake-tokens",[(0,s.uintCV)(t),(0,s.uintCV)(e)],n,r);return await(0,o.openContractCall)(i)}async distributorGetInvestor(){const t=(0,a.getReadOptions)(this.stackswap,"distributor0001","get-invester",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,s.callReadOnlyFunction)(t);return(0,s.cvToValue)(e).value}async distributorGetReclaim(){const t=(0,a.getReadOptions)(this.stackswap,"distributor0001","get-claimable-amount",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,s.callReadOnlyFunction)(t);return(0,s.cvToValue)(e)}async distributorReclaimLP(t,e=null){const r=new i.default(t).multipliedBy(10**6).toFixed(0).toString(),n=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.STX_STSW_LP(),r,s.FungibleConditionCode.Equal)],u=(0,a.getWriteOptions)(this.stackswap,"distributor0001","reclaim-lp-tokens",[(0,s.uintCV)(r)],n,e);return await(0,o.openContractCall)(u)}async distributorClaimSTSW(t,e=null){const r=new i.default(t).multipliedBy(10**6).toFixed(0).toString(),n=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.BASE_STSW_DATA().addr,r,s.FungibleConditionCode.Equal)],u=(0,a.getWriteOptions)(this.stackswap,"distributor0001","claim-stsw-tokens",[(0,s.uintCV)(r)],n,e);return await(0,o.openContractCall)(u)}async propose(t,e,r,n,i=null){const u=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"propose",[(0,s.uintCV)(t),(0,s.stringUtf8CV)(e),(0,s.stringUtf8CV)(r),(0,s.listCV)(n)],[],i);await(0,o.openContractCall)(u)}}},7450:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OtherManager=void 0;const n=r(668),i=r(4760),o=r(8597);e.OtherManager=class{constructor(t){this.stackswap=t}async getUserBeta01Data(t){try{const e=(0,o.getReadOptions)(this.stackswap,t,"get-user-rewards",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r).value}catch(t){return 0}}async claimUserBeta01Reward(t,e,r=null){try{const a=[await(0,o.getPostConditionFromAsset)(this.stackswap,t,this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)],s=(0,o.getWriteOptions)(this.stackswap,t,"claim-reward",[],a,r);return await(0,n.openContractCall)(s)}catch(t){return 0}}async get_pox_info(){const t=(0,o.getReadOptions)(this.stackswap,"SP000000000000000000002Q6VF78.pox","get-pox-info",[]),e=await(0,i.callReadOnlyFunction)(t);return(0,i.cvToValue)(e).value}async stack_stx_to_pox(t,e,r,n,i=null){return console.log(t,e,r,n,i),""}}},4574:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PoolManager=e.LiquidityPool=void 0;const i=r(4760),o=n(r(1594)),a=n(r(6425)),s=r(8597),u=r(8921);class c{constructor(t,e,r,n,i="0",o="0",a="0"){this.loaded=!1,this.balance_x="0",this.balance_y="0",this.share_total="0",this.name=t,this.token_x=e,this.token_y=r,this.token_lp=n,this.balance_x=i,this.balance_y=o,this.share_total=a}getTokenX(t=!0){return t?this.token_x:this.token_y}getTokenY(t=!0){return t?this.token_y:this.token_x}toString(){return""+{name:this.name,token_x:this.token_x.toString(),token_y:this.token_y.toString(),token_lp:this.token_lp.toString(),balance_x:this.balance_x,balance_y:this.balance_y,share_total:this.share_total,loaded:this.loaded}}static parsePoolFromJson(t){return null!=t.share_total?new c(t.name,u.Token.parseTokenFromJson(t.token_x),u.Token.parseTokenFromJson(t.token_y),u.Token.parseTokenFromJson(t.token_lp),t.balance_x,t.balance_y,t.share_total):new c(t.name,u.Token.parseTokenFromJson(t.token_x),u.Token.parseTokenFromJson(t.token_y),new u.Token(t.name,6,"",t.token_swapr,t.name))}static parsePoolsFromJsonList(t){const e=[];for(const r of t)e.push(c.parsePoolFromJson(r));return e}static parsePoolsFromServerData(t,e,r,n=!0){if(n){const n=new c(t.name.value,e,r,new u.Token(t.name.value,6,"",t["liquidity-token"].value,t.name.value),t["balance-x"].value,t["balance-y"].value,t["shares-total"].value);return n.loaded=!0,n}{const n=new c(t.name.value,r,e,new u.Token(t.name.value,6,"",t["liquidity-token"].value,t.name.value),t["balance-x"].value,t["balance-y"].value,t["shares-total"].value);return n.loaded=!0,n}}static parsePoolsFromServerData2(t,e,r,n=!0){if(n){const n=new c(t.name,e,r,new u.Token(t.name,6,"",t["liquidity-token"],t.name),t["balance-x"],t["balance-y"],t["shares-total"]);return n.loaded=!0,n}{const n=new c(t.name,r,e,new u.Token(t.name,6,"",t["liquidity-token"],t.name),t["balance-x"],t["balance-y"],t["shares-total"]);return n.loaded=!0,n}}static parsePoolsFromDBData(t){const e=new c(t.pair_name,u.Token.parseTokenFromJson(t.token_x),u.Token.parseTokenFromJson(t.token_y),new u.Token(t.pair_name,6,"",t.pair_addr,t.pair_name),(0,s.decimal2integer)(t.balance_token_x,t.token_x.decimal),(0,s.decimal2integer)(t.balance_token_y,t.token_y.decimal),t.total_lp_amt);return e.loaded=!0,e}getPoolPrice(t=!1,e="-1"){return"0"===this.share_total?{dy:"0",output_price:"0"}:t?(0,s.getPriceAndDY)(this,e,!1):(0,s.getPriceAndDY)(this,e,!0)}getPoolTVL(t,e,r,n,i){const a=e.token_x.addr,s=e.token_y.addr;let u=new o.default(-1),c=-1;return a===t.config.BASE_WSTX_DATA().addr?(u=new o.default(e.balance_x).dividedBy(new o.default(10**e.token_x.decimal)).multipliedBy(2),c=u.multipliedBy(r).toNumber()):s===t.config.BASE_WSTX_DATA().addr?(u=new o.default(e.balance_y).dividedBy(new o.default(10**e.token_y.decimal)).multipliedBy(2),c=u.multipliedBy(r).toNumber()):a===t.config.BASE_STSW_DATA().addr?(u=new o.default(e.balance_y).dividedBy(new o.default(10**e.token_x.decimal)).multipliedBy(2),c=u.multipliedBy(n).toNumber()):s===t.config.BASE_STSW_DATA().addr?(u=new o.default(e.balance_y).dividedBy(new o.default(10**e.token_y.decimal)).multipliedBy(2),c=u.multipliedBy(n).toNumber()):a===t.config.BASE_LBTC_DATA().addr?(u=new o.default(e.balance_x).dividedBy(new o.default(10**e.token_x.decimal)).multipliedBy(2),c=u.multipliedBy(i).toNumber()):s===t.config.BASE_LBTC_DATA().addr&&(u=new o.default(e.balance_y).dividedBy(new o.default(10**e.token_y.decimal)).multipliedBy(2),c=u.multipliedBy(i).toNumber()),c}getNewPoolShareRatio(t,e){if(!this.loaded)return 0;try{const r=new o.default(t),n=new o.default(e?this.balance_x:this.balance_y),i=r.plus(n),a=r.dividedBy(i).multipliedBy(100).toNumber();return isNaN(a)?0:a}catch(t){return 0}}}e.LiquidityPool=c,e.PoolManager=class{constructor(t){this.stackswap=t}async getPoolLists(){const t=this.stackswap.config.STACKS_BACKEND_URL()+"/stacks/pair/"+this.stackswap.config.STACKS_BACKEND_PARAM(),e=await a.default.get(t,{timeout:3e4});return c.parsePoolsFromJsonList(e.data)}async getPairDataFromContract(t,e){const r=(0,s.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"get-pair-details",[(0,s.parseAddressToCV)(t.addr),(0,s.parseAddressToCV)(e.addr)]);try{const n=await(0,i.callReadOnlyFunction)(r),o=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,(0,i.cvToValue)(n)["liquidity-token"].value,"get-lp-data",[]));return c.parsePoolsFromServerData((0,i.cvToValue)(o).value,t,e,!0)}catch(t){return null}}async getPoolDatasLegacy(t,e,r){const n=(0,s.getReadOptions)(this.stackswap,r,"get-pair-details",[(0,s.parseAddressToCV)(t.addr),(0,s.parseAddressToCV)(e.addr)]);try{const r=await(0,i.callReadOnlyFunction)(n),o=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,(0,i.cvToValue)(r)["liquidity-token"].value,"get-lp-data",[]));return c.parsePoolsFromServerData((0,i.cvToValue)(o).value,t,e,!0)}catch(t){return null}}}},1429:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PoxlManager=void 0;const i=n(r(6425)),o=r(668),a=r(8597),s=r(4760),u=r(8921);e.PoxlManager=class{constructor(t){this.stackswap=t}async minePOXLToken(t,e,r=null){const n=[];n.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),u.Token.getBaseTokens(this.stackswap,u.BaseToken.STX).addr,(0,a.decimal2integer)(e,6),s.FungibleConditionCode.Equal));const i=(0,a.getWriteOptions)(this.stackswap,t.addr,"mine-tokens",[(0,s.uintCV)((0,a.decimal2integer)(e,6)),(0,s.noneCV)()],n,r);await(0,o.openContractCall)(i)}async stackPOXLToken(t,e,r,n=null){const i=[];i.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.addr,(0,a.decimal2integer)(e,t.decimal),s.FungibleConditionCode.Equal));const u=(0,a.getWriteOptions)(this.stackswap,t.addr,"stack-tokens",[(0,s.uintCV)(e),(0,s.uintCV)(r)],i,n);await(0,o.openContractCall)(u)}async claimMiningReward(t,e,r=null){const n=(0,a.getWriteOptions)(this.stackswap,t.addr,"claim-token-reward",[(0,s.uintCV)(e)],[],r);await(0,o.openContractCall)(n)}async claimStackingReward(t,e,r=null){const n=(0,a.getWriteOptions)(this.stackswap,t.addr,"claim-stacking-reward",[(0,s.uintCV)(e)],[],r,!0);await(0,o.openContractCall)(n)}async getRandomInt(t,e){await(0,s.callReadOnlyFunction)((0,a.getReadOptions)(this.stackswap,t,"get-random-uint-at-block",[(0,s.uintCV)(e)]))}async getMinedBlock(t,e){const r=await i.default.get(this.stackswap.config.STACKS_API_URL()+"/extended/v2/address/"+this.stackswap.getSenderAddress()+"/transactions",{params:{limit:40,offset:e}}),n=r.data.total,o=r.data.results,a=[];for(const e of o)try{t===e.contract_call.contract_id&&"mine-tokens"===e.contract_call.function_name&&await this.canClaimCall(t,e.block_height)&&a.push(e.block_height)}catch(t){}return{total:n,mined_block:a}}async canClaimCall(t,e){const r=(0,a.getReadOptions)(this.stackswap,t,"can-claim-mining-reward",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,s.uintCV)(e)]),n=await(0,s.callReadOnlyFunction)(r);return(0,s.cvToValue)(n)}}},1905:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.StakingManager=void 0;const i=r(4760),o=n(r(6425)),a=r(668),s=n(r(1594)),u=r(8597);e.StakingManager=class{constructor(t){this.stackswap=t}async getStackingRoundFirstBlock(t){const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(),"get-first-stacks-block-in-reward-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async getStakingSTSWBalance(t){const e=(0,u.getReadOptions)(t,this.stackswap.config.BASE_STSW_DATA().addr,"get-balance",[(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_vSTSW_DATA().addr.split(".")[1])]);try{const t=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(t).value}catch(t){return 0}}async getRewardRoundID_V2(t){try{const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(),r=Number(await this.getCurrentStakingRound(e)),n=(0,u.getReadOptions)(t,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),"get-staker",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),o=await(0,i.callReadOnlyFunction)(n),a=[];for(const t of(0,i.cvToValue)(o).value)t.value<r&&a.push(t.value);return a}catch(t){return[]}}async getStakingRound(t,e){try{const t=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(),"get-reward-cycle",[(0,i.uintCV)(e)]),r=await(0,i.callReadOnlyFunction)(t);return(0,i.cvToValue)(r).value}catch(e){return console.log(t),0}}async getRoundData(t){try{const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),"get-staking-stats-at-cycle",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r).value;return{amount:n.amountSTSW.value,value:n.amountvSTSW.value,rewardBase:n.amountRewardBase.value}}catch(t){return{amount:"0",value:"0",rewardBase:"0"}}}async getRoundDataDefault(t){try{const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),"get-staking-stats-at-cycle-or-default",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r).value;return{amount:n.amountSTSW.value,value:n.amountvSTSW.value,rewardBase:n.amountRewardBase.value}}catch(t){return{amount:"0",value:"0",rewardBase:"0"}}}async getUserInfoRound(t,e){try{const r=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),"get-staker-at-cycle",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(e)]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n).value;return{amount:o.amountSTSW.value,value:o.amountvSTSW.value}}catch(t){return{amount:"0",value:"0"}}}async getCurrentStakingRound(t){const e=await this.stackswap.getCurrentBlocks();return await this.getStakingRound(t,e.tenure_block_height)}async getRewardRoundID(t){const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(),r=(await o.default.get(this.stackswap.config.STACKS_API_URL()+"/extended/v2/address/"+this.stackswap.getSenderAddress()+"/transactions",{params:{limit:50,offset:t}})).data.results,n=[];for(const t of r)if("contract_call"in t&&e===t.contract_call.contract_id&&"stake-tokens"===t.contract_call.function_name&&"success"===t.tx_status){const r=t.block_height;let i=await this.getStakingRound(e,r);i=parseInt(i)+1;const o=i+Number(t.contract_call.function_args[1].repr.replace("u",""))-1,a=this.range_number(i,o);n.push(...a)}return Array.from(new Set(n)).sort(((t,e)=>t-e))}range_number(t,e){let r=[];for(let n=t;n<=e;n++)r.push(n);return r}async getReward(t,e){t=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();const r=(0,u.getReadOptions)(this.stackswap,t,"get-staking-reward-per-user",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);return Number(o)}async txClaimReward(t,e,r=null){const n=[await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_DATA_V2(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)];n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,i.FungibleConditionCode.GreaterEqual)),n.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal));const o=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_REWARD_BALANCER(),"CLAIM_FROM_STSW_STAKING",[(0,i.uintCV)(t)],n,r);await(0,a.openContractCall)(o)}async getUserCountFromVSTSW(){const t=this.stackswap.config.BASE_vSTSW_DATA().addr.split(".");t[0],t[1];const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"get-user-count",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r);return null==n?0:parseInt(n.value.idx.value)}async getStakingBalanceFromVSTSW_V2(){const t=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"get-user-count",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,i.callReadOnlyFunction)(t),r=(0,i.cvToValue)(e);return null==r?0:new s.default(r.value.stakedSTX.value).dividedBy(new s.default(10).exponentiatedBy(this.stackswap.config.BASE_vSTSW_DATA().decimal))}async getClaimRewardListFromVSTSW(){let t={},e=[];const r=await this.getUserCountFromVSTSW();for(let n=1;n<=r;n++){const r=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"get-user-info",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(n)]),o=await(0,i.callReadOnlyFunction)(r),a=(0,i.cvToValue)(o);a.value.returned.value||(t[n]=a,e.push(n))}return[e,t]}async getStakingBalanceFromVSTSW(){let t=0;const e=await this.getUserCountFromVSTSW();for(let r=1;r<=e;r++){const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"get-user-info",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(r)]),n=await(0,i.callReadOnlyFunction)(e),o=(0,i.cvToValue)(n);!1===o.value.returned.value&&(t+=parseInt(o.value.amountSTSW.value))}return t}async txStakeFromStaking(t,e,r=null){const n=new s.default(10**6).multipliedBy(t).toFixed(0).toString(),o=[];o.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,n,i.FungibleConditionCode.Equal));const c=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2(),"stake-tokens",[(0,i.uintCV)(n),(0,i.uintCV)(e)],o,r);await(0,a.openContractCall)(c)}async txCooldownFromVSTSW(t,e=null){const r=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"unstake-tokens",[(0,i.uintCV)(t)],[],e);await(0,a.openContractCall)(r)}async txUnstakingFromVSTSW(t,e,r,n=null){const o=[];o.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_vSTSW_DATA().addr,r,i.FungibleConditionCode.Equal)),o.push(await(0,u.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal));const s=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"reclaim-tokens",[(0,i.uintCV)(t)],o,n);await(0,a.openContractCall)(s)}async getRewardBalanceFromStaking(){const t=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();let e=0;const r=await this.getCurrentStakingRound(t);for(let n=0;n<=r;n++)e+=await this.getReward(t,n);return e}async getRewardBalanceFromStakingFromList(t){const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();let r=0;const n=await this.getCurrentStakingRound(e),o=[];for(const e of t)e<Number(n)&&o.push((0,i.uintCV)(e));for(let t=0;t<=n;t++)r+=await this.getReward(e,t);return r}async getRewardFromList(t){const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();if(0===t.length)return 0;const r=(0,u.getReadOptions)(this.stackswap,e,"get-staking-reward-from-list",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.listCV)(t)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n).rewardSum.value}async getRewardTotal(t,e=4){const r=[];for(const e of t)r.push((0,i.uintCV)(e));let n=new s.default(0);try{for(let t=0;t<r.length;t+=e){const i=await this.getRewardFromList(r.slice(t,t+e<r.length?t+e:r.length));n=n.plus(i)}return(0,u.num2decimal)(n.toString(),6)}catch(t){return(0,u.num2decimal)(n.toString(),6)}}}},7263:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SwapManager=e.SwapType=void 0;const i=n(r(1594)),o=r(4760),a=r(668),s=r(8597),u=r(4574),c=r(8921),f=n(r(6425));var h;!function(t){t[t.NO_ROUTE=0]="NO_ROUTE",t[t.ON_LOADING=1]="ON_LOADING",t[t.SINGLE=2]="SINGLE",t[t.ROUTER_STX=10]="ROUTER_STX",t[t.ROUTER_STSW=11]="ROUTER_STSW",t[t.ROUTER_STX_STSW=20]="ROUTER_STX_STSW",t[t.ROUTER_STSW_STX=21]="ROUTER_STSW_STX"}(h=e.SwapType||(e.SwapType={})),e.SwapManager=class{constructor(t){this.stackswap=t}async findRouterAll(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap_all/"+t.addr+"/"+e.addr+"/"+r,i=(await f.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:h.NO_ROUTE}:"SWAP"===i.type?{valid:h.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData2(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?i.bridge_token==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:i.bridge_token==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr?{valid:h.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:"RouterSWAP2"===i.type?i.bridge_token[0]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr&&i.bridge_token[1]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STSW_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:i.bridge_token[1]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr&&i.bridge_token[0]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STX_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:{valid:h.NO_ROUTE}}async findRouter4(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap_v4/"+t.addr+"/"+e.addr+"/"+r,i=(await f.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:h.NO_ROUTE}:"SWAP"===i.type?{valid:h.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData2(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?i.bridge_token==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:i.bridge_token==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr?{valid:h.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:"RouterSWAP2"===i.type?i.bridge_token[0]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr&&i.bridge_token[1]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STSW_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:i.bridge_token[1]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr&&i.bridge_token[0]==c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr?{valid:h.ROUTER_STX_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:{valid:h.NO_ROUTE}}async findRouter3(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap_v3/"+t.addr+"/"+e.addr+"/"+r,i=(await f.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:h.NO_ROUTE}:"SWAP"===i.type?{valid:h.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData2(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?"STX"===i.bridge_token?{valid:h.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:"STSW"===i.bridge_token?{valid:h.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:"RouterSWAP2"===i.type?"STSW|STX"===i.bridge_token?{valid:h.ROUTER_STSW_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:"STX|STSW"===i.bridge_token?{valid:h.ROUTER_STX_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_bridge_pair:u.LiquidityPool.parsePoolsFromServerData2(i.bridge_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.bridge_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_bridge_mode:i.bridge_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:{valid:h.NO_ROUTE}}async findRouter2(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap_v2/"+t.addr+"/"+e.addr+"/"+r,i=(await f.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:h.NO_ROUTE}:"SWAP"===i.type?{valid:h.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData2(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?"STX"===i.bridge_token?{valid:h.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:"STSW"===i.bridge_token?{valid:h.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:{valid:h.NO_ROUTE}}async findRouter(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap/"+t.addr+"/"+e.addr+"/"+r,i=(await f.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:h.NO_ROUTE}:"SWAP"===i.type?{valid:h.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData2(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?"STX"===i.bridge_token?{valid:h.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:"STSW"===i.bridge_token?{valid:h.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData2(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData2(i.to_pair,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),e,i.to_direction),router_from_mode:i.from_direction,router_to_mode:i.to_direction}:{valid:h.NO_ROUTE}:{valid:h.NO_ROUTE}}async routerSwap2ContractCall(t,e,r,n,u,c,f,h,l,d,p,g=null){const y=h?u.token_x:u.token_y,m=h?u.token_y:u.token_x,w=l?c.token_x:c.token_y,b=l?c.token_y:c.token_x,v=new i.default(10**y.decimal).multipliedBy(t).integerValue(),_=new i.default(10**m.decimal).multipliedBy(r).integerValue(),S=new i.default(10**w.decimal).multipliedBy(n).integerValue(),A=new i.default(10**b.decimal).multipliedBy(e).integerValue(),T=_.multipliedBy(100-p).dividedBy(100).integerValue(),E=_.multipliedBy(100+p).dividedBy(100).integerValue(),k=S.multipliedBy(100-p).dividedBy(100).multipliedBy(100-p).dividedBy(100).integerValue(),C=S.multipliedBy(100+p).dividedBy(100).multipliedBy(100+p).dividedBy(100).integerValue(),O=A.multipliedBy(100-p).dividedBy(100).multipliedBy(100-p).dividedBy(100).multipliedBy(100-p).dividedBy(100).integerValue(),P=y.addr,M=m.addr,R=w.addr,N=b.addr,B=u.token_lp.addr,x=f.token_lp.addr,I=c.token_lp.addr,F=h?(0,o.trueCV)():(0,o.falseCV)(),L=d?(0,o.trueCV)():(0,o.falseCV)(),D=l?(0,o.trueCV)():(0,o.falseCV)(),U=[];U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),y.addr,v.toString(),o.FungibleConditionCode.Equal)),U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,B,m.addr,T.toString(),o.FungibleConditionCode.GreaterEqual)),U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),m.addr,E.toString(),o.FungibleConditionCode.LessEqual)),U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,x,w.addr,k.toString(),o.FungibleConditionCode.GreaterEqual)),U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),w.addr,C.toString(),o.FungibleConditionCode.LessEqual)),U.push(await(0,s.getPostConditionFromAsset)(this.stackswap,I,b.addr,O.toString(),o.FungibleConditionCode.GreaterEqual));const V=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ROUTER_SWAP2(),"exchange-router2",[(0,s.parseAddressToCV)(P),(0,s.parseAddressToCV)(M),(0,s.parseAddressToCV)(R),(0,s.parseAddressToCV)(N),(0,s.parseAddressToCV)(B),(0,s.parseAddressToCV)(x),(0,s.parseAddressToCV)(I),F,L,D,(0,o.uintCV)(v.toString()),(0,o.uintCV)(T.toString()),(0,o.uintCV)(k.toString()),(0,o.uintCV)(O.toString()),(0,s.parseAddressToCV)(this.stackswap.getSenderAddress())],U,g);(0,a.openContractCall)(V)}async routerSwapContractCall(t,e,r,n,u,c,f,h,l=null){const d=c?n.token_x:n.token_y,p=c?n.token_y:n.token_x,g=f?u.token_y:u.token_x,y=new i.default(10**d.decimal).multipliedBy(t).integerValue(),m=new i.default(10**p.decimal).multipliedBy(r).integerValue(),w=new i.default(10**g.decimal).multipliedBy(e).integerValue(),b=m.multipliedBy(100-h).dividedBy(100).integerValue(),v=m.multipliedBy(100+h).dividedBy(100).integerValue(),_=w.multipliedBy(100-h).dividedBy(100).multipliedBy(100-h).dividedBy(100).integerValue(),S=d.addr,A=p.addr,T=g.addr,E=n.token_lp.addr,k=u.token_lp.addr,C=c?(0,o.trueCV)():(0,o.falseCV)(),O=f?(0,o.trueCV)():(0,o.falseCV)(),P=[];P.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),d.addr,y.toString(),o.FungibleConditionCode.Equal)),P.push(await(0,s.getPostConditionFromAsset)(this.stackswap,E,p.addr,b.toString(),o.FungibleConditionCode.GreaterEqual)),P.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),p.addr,v.toString(),o.FungibleConditionCode.LessEqual)),P.push(await(0,s.getPostConditionFromAsset)(this.stackswap,k,g.addr,_.toString(),o.FungibleConditionCode.GreaterEqual));const M=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ROUTER_SWAP(),"router-swap",[(0,s.parseAddressToCV)(S),(0,s.parseAddressToCV)(A),(0,s.parseAddressToCV)(T),(0,s.parseAddressToCV)(E),(0,s.parseAddressToCV)(k),C,O,(0,o.uintCV)(y.toString()),(0,o.uintCV)(b.toString()),(0,o.uintCV)(_.toString())],P,l);(0,a.openContractCall)(M)}async swapContractCall(t,e,r,n,u,c=null){const f=n?r.token_x:r.token_y,h=n?r.token_y:r.token_x,l=new i.default(10**f.decimal).multipliedBy(t),d=new i.default(10**h.decimal).multipliedBy(e).multipliedBy(100-u).dividedBy(100),p=l.toFixed(0).toString(),g=d.toFixed(0).toString(),y=n?"swap-x-for-y":"swap-y-for-x",m=n?f.addr:h.addr,w=n?h.addr:f.addr,b=[];b.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),f.addr,p,o.FungibleConditionCode.Equal)),b.push(await(0,s.getPostConditionFromAsset)(this.stackswap,r.token_lp.addr,h.addr,g,o.FungibleConditionCode.GreaterEqual));const v=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),y,[(0,s.parseAddressToCV)(m),(0,s.parseAddressToCV)(w),(0,s.parseAddressToCV)(r.token_lp.addr),(0,o.uintCV)(p),(0,o.uintCV)(g)],b,c);(0,a.openContractCall)(v)}async importContractCall(t,e,r,n,u=null){const c=e?t.token_x:t.token_y,f=e?t.token_y:t.token_x,h=new i.default(10**c.decimal).multipliedBy(r),l=new i.default(10**f.decimal).multipliedBy(n),d=e?h:l,p=e?l:h,g=h.multipliedBy(1.2).toFixed(0).toString(),y=l.multipliedBy(1.2).toFixed(0).toString(),m=e?c.addr:f.addr,w=e?f.addr:c.addr,b=[];b.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),c.addr,g,o.FungibleConditionCode.LessEqual)),b.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),f.addr,y,o.FungibleConditionCode.LessEqual));const v=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"add-to-position",[(0,s.parseAddressToCV)(m),(0,s.parseAddressToCV)(w),(0,s.parseAddressToCV)(t.token_lp.addr),(0,o.uintCV)(d.toFixed(0).toString()),(0,o.uintCV)(p.toFixed(0).toString())],b,u);(0,a.openContractCall)(v)}async removeContractCall(t,e,r,n,u,c=this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),f=null){const h=t.token_x.addr,l=t.token_y.addr,d=t.token_lp.addr,p=[],g=new i.default(r).multipliedBy(1.01*e).div(100).toFixed(0).toString();p.push(await(0,s.getPostConditionFromAsset)(this.stackswap,t.token_lp.addr,t.token_x.addr,n,o.FungibleConditionCode.GreaterEqual)),p.push(await(0,s.getPostConditionFromAsset)(this.stackswap,t.token_lp.addr,t.token_y.addr,u,o.FungibleConditionCode.GreaterEqual)),p.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.token_lp.addr,g,o.FungibleConditionCode.LessEqual));const y=(0,s.getWriteOptions)(this.stackswap,c,"reduce-position",[(0,s.parseAddressToCV)(h),(0,s.parseAddressToCV)(l),(0,s.parseAddressToCV)(d),(0,o.uintCV)(e)],p,f);(0,a.openContractCall)(y)}async createContractCall(t,e,r,n,i,u=null){const c=t.addr,f=e.addr,h=i,l=[],d=(0,s.decimal2integer)(r,t.decimal),p=(0,s.decimal2integer)(n,e.decimal);l.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.addr,d,o.FungibleConditionCode.Equal)),l.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),e.addr,p,o.FungibleConditionCode.Equal));const g=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-liquidity-token",[(0,s.parseAddressToCV)(c),(0,s.parseAddressToCV)(f),(0,s.parseAddressToCV)(h),(0,o.stringAsciiCV)(t.symbol+"-"+e.symbol),(0,o.uintCV)(d),(0,o.uintCV)(p),(0,s.parseAddressToCV)(h),(0,s.parseAddressToCV)(this.stackswap.getQualifiedAddress(this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP()))],l,u);(0,a.openContractCall)(g)}price_impact(t,e,r){try{const n=t?e.balance_x:e.balance_y,o=t?e.token_x.decimal:e.token_y.decimal,a=e.balance_y,s=new i.default(r).multipliedBy(10**o);if(s.toNumber()>new i.default(n).toNumber())return 100;const u=new i.default(a).multipliedBy(s),c=new i.default(n).plus(s),f=u.toNumber()/c.toNumber(),h=new i.default(10**10).multipliedBy(new i.default(n)).dividedBy(new i.default(a));let l=new i.default(10**10).multipliedBy(new i.default(n)).plus(s).dividedBy(new i.default(a).minus(f)).minus(h).multipliedBy(1e4).dividedBy(h).toNumber();return l>=1e4&&(l=9999),(l/100).toFixed(5)}catch(t){return 0}}price_impact_router(t,e,r,n,o){try{const a=t?r.balance_x:r.balance_y,s=t?r.token_x.decimal:r.token_y.decimal,u=r.balance_y,c=new i.default(o).multipliedBy(10**s);if(c.toNumber()>new i.default(a).toNumber())return 100;const f=new i.default(u).multipliedBy(c),h=new i.default(a).plus(c),l=f.toNumber()/h.toNumber(),d=new i.default(10**10).multipliedBy(new i.default(a)).dividedBy(new i.default(u)),p=new i.default(10**10).multipliedBy(new i.default(a)).plus(c).dividedBy(new i.default(u).minus(l)).minus(d).multipliedBy(1e4).dividedBy(d),g=e?n.balance_x:n.balance_y,y=e?n.token_x.decimal:n.token_y.decimal,m=n.balance_y,w=new i.default(l).multipliedBy(10**y);if(w.toNumber()>new i.default(g).toNumber())return 100;const b=new i.default(m).multipliedBy(w),v=new i.default(g).plus(w),_=b.toNumber()/v.toNumber(),S=new i.default(10**10).multipliedBy(new i.default(g)).dividedBy(new i.default(m)),A=new i.default(10**10).multipliedBy(new i.default(g)).plus(w).dividedBy(new i.default(m).minus(_)).minus(S).multipliedBy(1e4).dividedBy(S);let T=p.toNumber()*A.toNumber();return T>=1e4&&(T=9999),(T/100).toFixed(5)}catch(t){return 0}}price_impact_router2(t,e,r,n,o,a,s){try{const u=t?n.balance_x:n.balance_y,c=t?n.token_x.decimal:n.token_y.decimal,f=n.balance_y,h=new i.default(s).multipliedBy(10**c);if(h.toNumber()>new i.default(u).toNumber())return 100;const l=new i.default(f).multipliedBy(h),d=new i.default(u).plus(h),p=l.toNumber()/d.toNumber(),g=new i.default(10**10).multipliedBy(new i.default(u)).dividedBy(new i.default(f)),y=new i.default(10**10).multipliedBy(new i.default(u)).plus(h).dividedBy(new i.default(f).minus(p)).minus(g).multipliedBy(1e4).dividedBy(g),m=e?o.balance_x:o.balance_y,w=e?o.token_x.decimal:o.token_y.decimal,b=o.balance_y,v=new i.default(p).multipliedBy(10**w);if(v.toNumber()>new i.default(m).toNumber())return 100;const _=new i.default(b).multipliedBy(v),S=new i.default(m).plus(v),A=_.toNumber()/S.toNumber(),T=new i.default(10**10).multipliedBy(new i.default(m)).dividedBy(new i.default(b)),E=new i.default(10**10).multipliedBy(new i.default(m)).plus(v).dividedBy(new i.default(b).minus(A)).minus(T).multipliedBy(1e4).dividedBy(T),k=r?a.balance_x:a.balance_y,C=r?a.token_x.decimal:a.token_y.decimal,O=a.balance_y,P=new i.default(A).multipliedBy(10**C);if(P.toNumber()>new i.default(k).toNumber())return 100;const M=new i.default(O).multipliedBy(P),R=new i.default(k).plus(P),N=M.toNumber()/R.toNumber(),B=new i.default(10**10).multipliedBy(new i.default(k)).dividedBy(new i.default(O)),x=new i.default(10**10).multipliedBy(new i.default(k)).plus(P).dividedBy(new i.default(O).minus(N)).minus(B).multipliedBy(1e4).dividedBy(B);let I=y.toNumber()*E.toNumber()*x.toNumber();return I>=1e4&&(I=9999),(I/100).toFixed(5)}catch(t){return 0}}getPriceString(t,e,r,n,o){try{return n<0?"dx exceed pool balance":null!=e&&null!=r?o?` 1 ${r.symbol} = ${new i.default(1/n).toFixed(e.decimal)} ${e.symbol}`:` 1 ${e.symbol} = ${new i.default(n).toFixed(r.decimal)} ${r.symbol}`:""}catch(t){return""}}getPricesWithSwapData(t,e,r){let n=-1;switch(t.valid){case h.SINGLE:try{const o=t.pair.getPoolPrice(!t.x_to_y,Number(e)<=0||""==e?"-1":e);"0"!==o.output_price&&(n=1/parseFloat(o.output_price));const a=this.getPriceString(t.pair,t.pair.getTokenX(t.x_to_y),t.pair.getTokenY(t.x_to_y),n,r);return{price:n,dy:new i.default(o.dy).toFixed(Number(t.pair.getTokenY(t.x_to_y).decimal)).toString(),price_strings:a}}catch(t){return{price:n,dy:"0",price_strings:""}}case h.ROUTER_STX:return this.getRouterDY_V1(t,e,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),r);case h.ROUTER_STSW:return this.getRouterDY_V1(t,e,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),r);case h.ROUTER_STX_STSW:return this.getRouterDY_V2(t,e,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),r);case h.ROUTER_STSW_STX:return this.getRouterDY_V2(t,e,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),r);default:return{price:n,dy:"0",price_strings:""}}}calcParamsFromSwapData(t,e,r,n){if(!t)return null;const o=this.stackswap.swapManager.getPricesWithSwapData(t,e,r);let a=0;return t.valid===h.ROUTER_STSW||t.valid===h.ROUTER_STX?a=Math.max(Number(this.stackswap.swapManager.price_impact(t.router_from_mode,t.router_from_pair,e)),Number(this.stackswap.swapManager.price_impact(t.router_to_mode,t.router_to_pair,o.bridge_amount.toString()))):t.valid===h.ROUTER_STSW_STX||t.valid===h.ROUTER_STX_STSW?a=Math.max(Number(this.stackswap.swapManager.price_impact(t.router_from_mode,t.router_from_pair,e)),Number(this.stackswap.swapManager.price_impact(t.router_bridge_mode,t.router_bridge_pair,o.bridge_amount1.toString())),Number(this.stackswap.swapManager.price_impact(t.router_to_mode,t.router_to_pair,o.bridge_amount2.toString()))):t.valid===h.SINGLE&&(a=Number(this.stackswap.swapManager.price_impact(t.x_to_y,t.pair,e))),a||(a=0),o.price_impact=a,o.min_dy=new i.default(o.dy).multipliedBy(100-n).dividedBy(100).toNumber(),o}getRouterDY_V1(t,e,r,n){let o=-1;const a=t.router_from_pair.getPoolPrice(!t.router_from_mode,Number(e)<=0||""==e?"1":e);let s=-1;"0"!==a.output_price&&(s=1/parseFloat(a.output_price));const u=new i.default(new i.default(a.dy).toFixed(Number(r.decimal))).toString(),c=t.router_to_pair.getPoolPrice(!t.router_to_mode,Number(u)<=0?"-1":u);let f=-1;return"0"!==c.output_price&&(f=1/parseFloat(c.output_price)),o=s*f,{price:o,dy:new i.default(c.dy).toFixed(Number(Number(e)<=0||""==e?0:t.router_to_pair.getTokenY(t.router_to_mode).decimal)).toString(),price_strings:this.getPriceString(t.pair,t.router_from_pair.getTokenX(t.router_from_mode),t.router_to_pair.getTokenY(t.router_to_mode),o,n),bridge_amount:u}}getRouterDY_V2(t,e,r,n,o){let a=-1;const s=t.router_from_pair.getPoolPrice(!t.router_from_mode,Number(e)<=0||""==e?"1":e);let u=-1;"0"!==s.output_price&&(u=1/parseFloat(s.output_price));const c=new i.default(new i.default(s.dy).toFixed(Number(r.decimal))).toString();let f=-1;const h=t.router_bridge_pair.getPoolPrice(!t.router_bridge_mode,Number(c)<=0||""==c?"1":c);"0"!==h.output_price&&(f=1/parseFloat(h.output_price));const l=new i.default(new i.default(h.dy).toFixed(Number(n.decimal))).toString(),d=t.router_to_pair.getPoolPrice(!t.router_to_mode,Number(l)<=0?"-1":l);let p=-1;return"0"!==d.output_price&&(p=1/parseFloat(d.output_price)),a=u*p*f,{price:a,dy:new i.default(d.dy).toFixed(Number(Number(e)<=0||""==e?0:t.router_to_pair.getTokenY(t.router_to_mode).decimal)).toString(),price_strings:this.getPriceString(t.pair,t.router_from_pair.getTokenX(t.router_from_mode),t.router_to_pair.getTokenY(t.router_to_mode),a,o),bridge_amount1:c,bridge_amount2:l}}async STX_transfer(t,e,r,n=null){const i=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_MULTICHAIN(),"STX_transfer",[(0,s.parseAddressToCV)(t),(0,o.uintCV)(e),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr),(0,s.parseAddressToCV)(this.stackswap.config.STX_STSW_LP()),(0,o.stringAsciiCV)(r)],[],n,!0);(0,a.openContractCall)(i)}async SingleSwap_Token_STX(t,e,r,n,i,u=null){const f=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_MULTICHAIN(),"SingleSwap_Token_STX",[(0,s.parseAddressToCV)(r),(0,s.parseAddressToCV)(n),(0,o.uintCV)(e),(0,s.parseAddressToCV)(t),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr),(0,s.parseAddressToCV)(this.stackswap.config.STX_STSW_LP()),(0,o.stringAsciiCV)(i)],[],u,!0);(0,a.openContractCall)(f)}async Router_Token_STSW_STX(t,e,r,n,i,u=null){const f=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_MULTICHAIN(),"Router_Token_STSW_STX",[(0,s.parseAddressToCV)(r),(0,s.parseAddressToCV)(n),(0,o.uintCV)(e),(0,s.parseAddressToCV)(t),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX).addr),(0,s.parseAddressToCV)(c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW).addr),(0,s.parseAddressToCV)(this.stackswap.config.STX_STSW_LP()),(0,o.stringAsciiCV)(i)],[],u,!0);(0,a.openContractCall)(f)}}},8921:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenManager=e.Token=e.BaseToken=e.TokenType=void 0;const i=r(4760),o=n(r(6425)),a=r(668),s=r(8597);var u,c;!function(t){t[t.VERIFIED=1]="VERIFIED",t[t.COMMUNITY=2]="COMMUNITY"}(u=e.TokenType||(e.TokenType={})),function(t){t[t.STX=0]="STX",t[t.STSW=1]="STSW",t[t.vSTSW=2]="vSTSW",t[t.lBTC=3]="lBTC",t[t.NULL=4]="NULL"}(c=e.BaseToken||(e.BaseToken={}));class f{constructor(t,e,r,n,i){this.name=t,this.decimal=e,this.icon=r,this.addr=n,this.symbol=i}toString(){return""+{name:this.name,decimal:this.decimal,icon:this.icon,addr:this.addr,symbol:this.symbol}}static parseTokenFromJson(t){return new f(t.name,t.decimal,t.icon,t.addr,t.symbol)}static parseTokenFromJsonList(t){const e=[];for(const r of t)e.push(f.parseTokenFromJson(r));return e}static getBaseTokens(t,e){switch(e){case c.STX:return f.parseTokenFromJson(t.config.BASE_WSTX_DATA());case c.STSW:return f.parseTokenFromJson(t.config.BASE_STSW_DATA());case c.vSTSW:return f.parseTokenFromJson(t.config.BASE_vSTSW_DATA());case c.lBTC:return f.parseTokenFromJson(t.config.BASE_LBTC_DATA());case c.NULL:return f.parseTokenFromJson(t.config.BASE_NULL_TOKEN_DATA())}}}e.Token=f,e.TokenManager=class{constructor(t){this.stackswap=t}async getTokenLists(t=u.VERIFIED){switch(t){case u.COMMUNITY:const t=this.stackswap.config.STACKS_BACKEND_URL()+"/stacks/communitytokens/"+this.stackswap.config.STACKS_BACKEND_PARAM(),e=await o.default.get(t,{timeout:3e4});return f.parseTokenFromJsonList(e.data);case u.VERIFIED:const r=this.stackswap.config.STACKS_BACKEND_URL()+"/stacks/tokens/"+this.stackswap.config.STACKS_BACKEND_PARAM(),n=await o.default.get(r,{timeout:3e4});return f.parseTokenFromJsonList(n.data)}}async transferSTSW(t,e,r=null){const n=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)],o=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_STSW_DATA().addr,"transfer",[(0,i.uintCV)(e),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),t),(0,i.noneCV)()],n,r);await(0,a.openContractCall)(o)}async getTokenData(t){try{const e=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,t,"get-name",[]));let r=(0,i.cvToValue)(e).value;const n=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,t,"get-symbol",[])),a=(0,i.cvToValue)(n).value,u=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,t,"get-decimals",[])),c=Number((0,i.cvToValue)(u).value),h=await(0,i.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,t,"get-token-uri",[])),l=(0,i.cvToValue)(h).value.value;let d="https://app.stackswap.org/icon/blank.svg";try{const t=await o.default.get(l);if(d)try{t.data.image&&(d=t.data.image)}catch(t){}try{t.data.vector&&(d=t.data.vector)}catch(t){}try{t.data.properties.image.description&&(d=t.data.properties.image.description)}catch(t){}try{t.data.properties.vector.description&&(d=t.data.properties.vector.description)}catch(t){}}catch(t){}return"wSTX"===r&&(r="STX"),new f(r,c,d,t,a)}catch(t){return null}}async getBalanceOf(t,e){const r=(0,s.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,s.parseAddressToCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t).value}catch(t){return"0"}}}},8597:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getAmountStringWithDecimal=e.getAmountWithDecimalString=e.getPriceAndDY=e.numFormat_=e.numWithComma=e.decimal2integer=e.num2decimal=e.getPostConditionFromAsset=e.getWriteOptions=e.getReadOptions=e.parseAddressToCV=void 0;const i=n(r(1594)),o=r(4760),a=n(r(6425));function s(t,e){return"string"==typeof t||"number"==typeof t?new i.default(t).toNumber().toLocaleString(void 0,{maximumFractionDigits:e}):i.default.isBigNumber(t)?t.toNumber().toLocaleString(void 0,{maximumFractionDigits:e}):"ERROR"}e.parseAddressToCV=function(t){if(t.includes(".")){const[e,r]=t.split(".");return(0,o.contractPrincipalCV)(e,r)}return(0,o.standardPrincipalCV)(t)},e.getReadOptions=function(t,e,r,n){if(e.includes(".")){const i=e.split(".");return{contractAddress:i[0],contractName:i[1],functionName:r,functionArgs:n,network:t.network,senderAddress:t.getSenderAddress()}}return{contractAddress:t.config.STACKSWAP_ADDRESS(),contractName:e,functionName:r,functionArgs:n,network:t.network,senderAddress:t.getSenderAddress()}},e.getWriteOptions=function(t,e,r,n,i=[],a=null,s=!1){if(e.includes(".")){const u=e.split(".");return{contractAddress:u[0],contractName:u[1],functionName:r,functionArgs:n,network:t.network,senderAddress:t.getSenderAddress(),postConditionMode:s?o.PostConditionMode.Allow:o.PostConditionMode.Deny,postConditions:i,appDetails:{name:"Stackswap",icon:window.location.origin+"/public/favicon.ico"},anchorMode:o.AnchorMode.Any,sponsored:!1,onFinish:t=>{try{a(null,t)}catch(t){a(t,null)}},onCancel:()=>{try{a("canceled",null)}catch(t){a(t,null)}}}}return{contractAddress:t.config.STACKSWAP_ADDRESS(),contractName:e,functionName:r,functionArgs:n,network:t.network,senderAddress:t.getSenderAddress(),postConditionMode:s?o.PostConditionMode.Allow:o.PostConditionMode.Deny,postConditions:i,appDetails:{name:"Stackswap",icon:window.location.origin+"/public/favicon.ico"},anchorMode:o.AnchorMode.Any,sponsored:!1,onFinish:t=>{try{a(null,t)}catch(t){a(t,null)}},onCancel:()=>{try{a("canceled",null)}catch(t){a(t,null)}}}},e.getPostConditionFromAsset=async function(t,e,r,n,i){const s=await async function(t,e){const r=e.split("."),n=t.config.STACKS_API_URL()+"/v2/contracts/interface/"+r[0]+"/"+r[1],i=await a.default.get(n);return 1===i.data.fungible_tokens.length?e+"::"+i.data.fungible_tokens[0].name:0===i.data.fungible_tokens.length?"wstx":e+"::"+i.data.fungible_tokens[0].name}(t,r);return"wstx"===s?(0,o.createSTXPostCondition)(e,i,n):(0,o.createFungiblePostCondition)(e,i,n,s)},e.num2decimal=function(t,e){return new i.default(t).dividedBy(10**e)},e.decimal2integer=function(t,e=6){return new i.default(t).multipliedBy(10**e).toFixed(0)},e.numWithComma=s,e.numFormat_=function(t,e=6){const r=new i.default(t);return r.isInteger()?s(r,0):s(r.toFixed(e,1),e)},e.getPriceAndDY=function(t,e="-1",r=!0){try{const n=r?t.balance_x:t.balance_y,o=r?t.balance_y:t.balance_x,a=r?t.token_x.decimal:t.token_y.decimal,s=r?t.token_y.decimal:t.token_x.decimal;let u=new i.default(10).exponentiatedBy(a).multipliedBy(e).multipliedBy(.997);if("-1"==e&&(u=new i.default(1)),u.comparedTo(n)>=0)return{dy:"0",output_price:"0"};const c=new i.default(o).multipliedBy(u).dividedBy(new i.default(n).plus(u)),f=(new i.default(10).exponentiatedBy(s).dividedBy(new i.default(10).exponentiatedBy(a)).toNumber()*(u.toNumber()/c.toNumber())).toString(),h=c.dividedBy(new i.default(10).exponentiatedBy(s)).toString();return"-1"==e?{dy:"0",output_price:f}:{dy:h,output_price:f}}catch(t){return{dy:"0",output_price:"0"}}},e.getAmountWithDecimalString=function(t,e){i.default.config({EXPONENTIAL_AT:40});try{return new i.default(10**e).multipliedBy(t).toString()}catch(r){return new i.default(10**e).multipliedBy(new i.default(t)).toString()}},e.getAmountStringWithDecimal=function(t,e){try{return new i.default(10**e).multipliedBy(t).toString()}catch(r){return new i.default(10**e).multipliedBy(new i.default(t)).toString()}}},1061:(t,e,r)=>{var n=r(2113);function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function o(t){return n.Nil(t)?"":i(t.constructor)}function a(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function s(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function u(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+s(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function c(t,e,r){r=r||o(e),this.message=u(t,e,r),a(this,c),this.__type=t,this.__value=e,this.__valueTypeName=r}function f(t,e,r,n,i){t?(i=i||o(n),this.message=function(t,e,r,n,i){var o='" of type ';return"key"===e&&(o='" with key type '),u('property "'+s(r)+o+s(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',a(this,c),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,f.prototype=Object.create(Error.prototype),f.prototype.constructor=c,t.exports={TfTypeError:c,TfPropertyTypeError:f,tfCustomError:function(t,e){return new c(t,{},e)},tfSubError:function(t,e,r){return t instanceof f?(e=e+"."+t.__property,t=new f(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof c&&(t=new f(t.__type,e,r,t.__value,t.__valueTypeName)),a(t),t},tfJSON:s,getValueTypeName:o}},9542:(t,e,r)=>{var n=r(8287).Buffer,i=r(2113),o=r(1061);function a(t){return n.isBuffer(t)}function s(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function u(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw o.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var c=u.bind(null,i.Array),f=u.bind(null,a),h=u.bind(null,s),l=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:c,Buffer:a,BufferN:f,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:s,HexN:h,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-d&&t<=d&&Math.floor(t)===t},Range:function(t,e,r){function n(n,i){return r(n,i)&&n>t&&n<e}return r=r||i.Number,n.toJSON=function(){return`${r.toJSON()} between [${t}, ${e}]`},n},StringN:l,UInt8:function(t){return(255&t)===t},UInt16:function(t){return(65535&t)===t},UInt32:function(t){return t>>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=d&&Math.floor(t)===t}};for(var g in p)p[g].toJSON=function(t){return t}.bind(null,g);t.exports=p},8676:(t,e,r)=>{var n=r(1061),i=r(2113),o=n.tfJSON,a=n.TfTypeError,s=n.TfPropertyTypeError,u=n.tfSubError,c=n.getValueTypeName,f={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&!i.Nil(r)&&!(void 0!==e.minLength&&r.length<e.minLength)&&!(void 0!==e.maxLength&&r.length>e.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return l(t,e,n)}catch(t){throw u(t,r)}}))}return t=h(t),e=e||{},r.toJSON=function(){var r="["+o(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=h(e),r.toJSON=function(){return"?"+o(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{e&&l(e,o,n)}catch(t){throw u(t,o,"key")}try{var a=r[o];l(t,a,n)}catch(t){throw u(t,o)}}return!0}return t=h(t),e&&(e=h(e)),r.toJSON=e?function(){return"{"+o(e)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=h(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e)l(e[n],t[n],r)}catch(t){throw u(t,n)}if(r)for(n in t)if(!e[n])throw new s(void 0,n);return!0}return n.toJSON=function(){return o(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.some((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.every((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join(" & ")},e},quacksLike:function(t){function e(e){return t===c(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return!i.Nil(e)&&!i.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,n){try{return l(t,e[n],r)}catch(t){throw u(t,n)}}))}return e.toJSON=function(){return"("+t.map(o).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function h(t){if(i.String(t))return"?"===t[0]?f.maybe(t.slice(1)):i[t]||f.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return f.arrayOf(t[0])}return f.object(t)}return i.Function(t)?t:f.value(t)}function l(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new a(n||t,e)}return l(h(t),e,r)}for(var d in f.oneOf=f.anyOf,i)l[d]=i[d];for(d in f)l[d]=f[d];var p=r(9542);for(d in p)l[d]=p[d];l.compile=h,l.TfTypeError=a,l.TfPropertyTypeError=s,t.exports=l},2113:t=>{var e={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var r in e.Null=e.Nil,e)e[r].toJSON=function(t){return t}.bind(null,r);t.exports=e},1270:function(t,e,r){var n;t=r.nmd(t),function(){e&&e.nodeType,t&&t.nodeType;var i="object"==typeof r.g&&r.g;i.global!==i&&i.window!==i&&i.self;var o,a=2147483647,s=36,u=/^xn--/,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,d=String.fromCharCode;function p(t){throw new RangeError(h[t])}function g(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function y(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+g((t=t.replace(f,".")).split("."),e).join(".")}function m(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function w(t){return g(t,(function(t){var e="";return t>65535&&(e+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+d(t)})).join("")}function b(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function v(t,e,r){var n=0;for(t=r?l(t/700):t>>1,t+=l(t/e);t>455;n+=s)t=l(t/35);return l(n+36*t/(t+38))}function _(t){var e,r,n,i,o,u,c,f,h,d,g,y=[],m=t.length,b=0,_=128,S=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&p("not-basic"),y.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<m;){for(o=b,u=1,c=s;i>=m&&p("invalid-input"),((f=(g=t.charCodeAt(i++))-48<10?g-22:g-65<26?g-65:g-97<26?g-97:s)>=s||f>l((a-b)/u))&&p("overflow"),b+=f*u,!(f<(h=c<=S?1:c>=S+26?26:c-S));c+=s)u>l(a/(d=s-h))&&p("overflow"),u*=d;S=v(b-o,e=y.length+1,0==o),l(b/e)>a-_&&p("overflow"),_+=l(b/e),b%=e,y.splice(b++,0,_)}return w(y)}function S(t){var e,r,n,i,o,u,c,f,h,g,y,w,_,S,A,T=[];for(w=(t=m(t)).length,e=128,r=0,o=72,u=0;u<w;++u)(y=t[u])<128&&T.push(d(y));for(n=i=T.length,i&&T.push("-");n<w;){for(c=a,u=0;u<w;++u)(y=t[u])>=e&&y<c&&(c=y);for(c-e>l((a-r)/(_=n+1))&&p("overflow"),r+=(c-e)*_,e=c,u=0;u<w;++u)if((y=t[u])<e&&++r>a&&p("overflow"),y==e){for(f=r,h=s;!(f<(g=h<=o?1:h>=o+26?26:h-o));h+=s)A=f-g,S=s-g,T.push(d(b(g+A%S,0))),f=l(A/S);T.push(d(b(f,0))),o=v(r,_,n==i),r=0,++n}++r,++e}return T.join("")}o={version:"1.4.1",ucs2:{decode:m,encode:w},decode:_,encode:S,toASCII:function(t){return y(t,(function(t){return c.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return y(t,(function(t){return u.test(t)?_(t.slice(4).toLowerCase()):t}))}},void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},8835:(t,e,r)=>{"use strict";var n=r(1270);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),f=["%","/","?",";","#"].concat(c),h=["/","?","#"],l=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=r(5373);i.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),a=-1!==i&&i<t.indexOf("#")?"?":"#",u=t.split(a);u[0]=u[0].replace(/\\/g,"/");var w=t=u.join(a);if(w=w.trim(),!r&&1===t.split("#").length){var b=s.exec(w);if(b)return this.path=w,this.href=w,this.pathname=b[1],b[2]?(this.search=b[2],this.query=e?m.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var v=o.exec(w);if(v){var _=(v=v[0]).toLowerCase();this.protocol=_,w=w.substr(v.length)}if(r||v||w.match(/^\/\/[^@/]+@[^@/]+/)){var S="//"===w.substr(0,2);!S||v&&g[v]||(w=w.substr(2),this.slashes=!0)}if(!g[v]&&(S||v&&!y[v])){for(var A,T,E=-1,k=0;k<h.length;k++)-1!==(C=w.indexOf(h[k]))&&(-1===E||C<E)&&(E=C);for(-1!==(T=-1===E?w.lastIndexOf("@"):w.lastIndexOf("@",E))&&(A=w.slice(0,T),w=w.slice(T+1),this.auth=decodeURIComponent(A)),E=-1,k=0;k<f.length;k++){var C;-1!==(C=w.indexOf(f[k]))&&(-1===E||C<E)&&(E=C)}-1===E&&(E=w.length),this.host=w.slice(0,E),w=w.slice(E),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var P=this.hostname.split(/\./),M=(k=0,P.length);k<M;k++){var R=P[k];if(R&&!R.match(l)){for(var N="",B=0,x=R.length;B<x;B++)R.charCodeAt(B)>127?N+="x":N+=R[B];if(!N.match(l)){var I=P.slice(0,k),F=P.slice(k+1),L=R.match(d);L&&(I.push(L[1]),F.unshift(L[2])),F.length&&(w="/"+F.join(".")+w),this.hostname=I.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+D,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!p[_])for(k=0,M=c.length;k<M;k++){var V=c[k];if(-1!==w.indexOf(V)){var j=encodeURIComponent(V);j===V&&(j=escape(V)),w=w.split(V).join(j)}}var W=w.indexOf("#");-1!==W&&(this.hash=w.substr(W),w=w.slice(0,W));var K=w.indexOf("?");if(-1!==K?(this.search=w.substr(K),this.query=w.substr(K+1),e&&(this.query=m.parse(this.query)),w=w.slice(0,K)):e&&(this.search="",this.query={}),w&&(this.pathname=w),y[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){D=this.pathname||"";var H=this.search||"";this.path=D+H}return this.href=this.format(),this},i.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(o=m.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||y[e])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+i+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+n},i.prototype.resolve=function(t){return this.resolveObject(function(t,e,r){if(t&&"object"==typeof t&&t instanceof i)return t;var n=new i;return n.parse(t,e,r),n}(t,!1,!0)).format()},i.prototype.resolveObject=function(t){if("string"==typeof t){var e=new i;e.parse(t,!1,!0),t=e}for(var r=new i,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(r[c]=t[c])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!y[t.protocol]){for(var f=Object.keys(t),h=0;h<f.length;h++){var l=f[h];r[l]=t[l]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||g[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",m=r.search||"";r.path=p+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var w=r.pathname&&"/"===r.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),v=b||w||r.host&&t.pathname,_=v,S=r.pathname&&r.pathname.split("/")||[],A=(d=t.pathname&&t.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(A&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),v=v&&(""===d[0]||""===S[0])),b)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=d;else if(d.length)S||(S=[]),S.pop(),S=S.concat(d),r.search=t.search,r.query=t.query;else if(null!=t.search)return A&&(r.host=S.shift(),r.hostname=r.host,(O=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)),r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=S.slice(-1)[0],E=(r.host||t.host||S.length>1)&&("."===T||".."===T)||""===T,k=0,C=S.length;C>=0;C--)"."===(T=S[C])?S.splice(C,1):".."===T?(S.splice(C,1),k++):k&&(S.splice(C,1),k--);if(!v&&!_)for(;k--;k)S.unshift("..");!v||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),E&&"/"!==S.join("/").substr(-1)&&S.push("");var O,P=""===S[0]||S[0]&&"/"===S[0].charAt(0);return A&&(r.hostname=P?"":S.length?S.shift():"",r.host=r.hostname,(O=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)),(v=v||r.host&&S.length)&&!P&&S.unshift(""),S.length>0?r.pathname=S.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},4643:(t,e,r)=>{function n(t){try{if(!r.g.localStorage)return!1}catch(t){return!1}var e=r.g.localStorage[t];return null!=e&&"true"===String(e).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)}}},8469:(t,e,r)=>{"use strict";var n=r(2861).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}t.exports={encode:function t(e,r,a){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return a||(a=0),e<253?(r.writeUInt8(e,a),t.bytes=1):e<=65535?(r.writeUInt8(253,a),r.writeUInt16LE(e,a+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,a),r.writeUInt32LE(e,a+1),t.bytes=5):(r.writeUInt8(255,a),r.writeUInt32LE(e>>>0,a+1),r.writeUInt32LE(e/4294967296|0,a+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var o=e.readUInt8(r);if(o<253)return t.bytes=1,o;if(253===o)return t.bytes=3,e.readUInt16LE(r+1);if(254===o)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var a=e.readUInt32LE(r+1),s=4294967296*e.readUInt32LE(r+5)+a;return i(s),s},encodingLength:o}},7513:(t,e,r)=>{var n=r(8287).Buffer,i=r(1889);function o(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}function a(t,e,r){var i=new n(r?34:33);return i.writeUInt8(t,0),e.copy(i,1),r&&(i[33]=1),i}t.exports={decode:function(t,e){return o(i.decode(t),e)},decodeRaw:o,encode:function(t,e,r){return"number"==typeof t?i.encode(a(t,e,r)):i.encode(a(t.version,t.privateKey,t.compressed))},encodeRaw:a}},4564:(t,e,r)=>{"use strict";Object.defineProperty(e,"t9",{enumerable:!0,get:function(){return n.makeZoneFile}}),Object.defineProperty(e,"CC",{enumerable:!0,get:function(){return i.parseZoneFile}});var n=r(6164),i=r(1719);r(3718)},6164:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeZoneFile=function(t,e=(0,n.getZoneFileTemplate)()){return e=function(t,e){let r="";return void 0!==t&&(r+="$ORIGIN "+t),e.replace("{$origin}",r)}(t.$origin,e),e=function(t,e){let r="";return void 0!==t&&(r+="$TTL "+t),e.replace("{$ttl}",r)}(t.$ttl,e),e=function(t,e){let r=e;if(void 0!==t){t.name=t.name||"@",t.ttl=t.ttl||"";for(const e in t){const n=t[e];r=r.replace("{"+e+"}",n+"\t")}}return r}(t.soa,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tNS\t"+e.host+"\n";return e.replace("{ns}",r)}(t.ns,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tA\t"+e.ip+"\n";return e.replace("{a}",r)}(t.a,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tAAAA\t"+e.ip+"\n";return e.replace("{aaaa}",r)}(t.aaaa,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tCNAME\t"+e.alias+"\n";return e.replace("{cname}",r)}(t.cname,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tMX\t"+e.preference+"\t"+e.host+"\n";return e.replace("{mx}",r)}(t.mx,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tPTR\t"+e.host+"\n";return e.replace("{ptr}",r)}(t.ptr,e),e=function(t,e){let r="";if(t)for(const e of t){r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tTXT\t";const t=e.txt;"string"==typeof t?r+='"'+t+'"':t instanceof Array&&(r+=t.map((function(t){return'"'+t+'"'})).join(" ")),r+="\n"}return e.replace("{txt}",r)}(t.txt,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tSRV\t"+e.priority+"\t",r+=e.weight+"\t",r+=e.port+"\t",r+=e.target+"\n";return e.replace("{srv}",r)}(t.srv,e),e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tSPF\t"+e.data+"\n";return e.replace("{spf}",r)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());const r=Math.round(Date.now()/1e3);return e.replace("{time}",`${r}`)}(t,e=function(t,e){let r="";if(t)for(const e of t)r+=(e.name||"@")+"\t",e.ttl&&(r+=e.ttl+"\t"),r+="IN\tURI\t"+e.priority+"\t",r+=e.weight+"\t",r+='"'+e.target+'"\n';return e.replace("{uri}",r)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")};var n=r(144)},1719:(t,e)=>{"use strict";function r(t){const e={},r=t.trim().split(/\s+/g),n=r.length;return e.name=r[0],e.minimum=parseInt(r[n-1],10),e.expire=parseInt(r[n-2],10),e.retry=parseInt(r[n-3],10),e.refresh=parseInt(r[n-4],10),e.serial=parseInt(r[n-5],10),e.rname=r[n-6],e.mname=r[n-7],isNaN(r[1])||(e.ttl=parseInt(r[1],10)),e}function n(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],host:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function i(t,e){const r=t.trim().split(/\s+/g),n=t.trim().toUpperCase().split(/\s+/g),i=r.length,o={name:r[0],ip:r[i-1]};return 0===n.lastIndexOf("A")&&(e.length?o.name=e[e.length-1].name:o.name="@"),isNaN(r[1])||(o.ttl=parseInt(r[1],10)),o}function o(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],ip:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function a(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],alias:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function s(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],preference:parseInt(e[r-2],10),host:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function u(t){const e=t.trim().match(/[^\s\"']+|\"[^\"]*\"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");const r=e.length,n=e.indexOf("TXT");function i(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t.indexOf('"')>-1&&(t=t.split('"')[1]),t}let o;o=r-n-1>1?e.slice(n+1).map(i):i(e[r-1]);const a={name:e[0],txt:o};return isNaN(e[1])||(a.ttl=parseInt(e[1],10)),a}function c(t,e,r){const n=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&n.unshift(e[e.length-1].name);const i=n.length,o={name:n[0],fullname:n[0]+"."+r,host:n[i-1]};return isNaN(n[1])||(o.ttl=parseInt(n[1],10)),o}function f(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1],priority:parseInt(e[r-4],10),weight:parseInt(e[r-3],10),port:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function h(t){const e=t.trim().split(/\s+/g),r={name:e[0],data:""};let n=e.length;for(;n-- >4;)r.data=e[n]+" "+r.data.trim();return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function l(t){const e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1].replace(/"/g,""),priority:parseInt(e[r-3],10),weight:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}Object.defineProperty(e,"__esModule",{value:!0}),e.parseZoneFile=function(t){return function(t){const e={},d=t.split("\n");for(const t of d){if(!t||!t.trim())continue;const d=t.toUpperCase();/\s+TXT\s+/.test(d)?(e.txt=e.txt||[],e.txt.push(u(t))):0===d.indexOf("$ORIGIN")?e.$origin=t.split(/\s+/g)[1]:0===d.indexOf("$TTL")?e.$ttl=parseInt(t.split(/\s+/g)[1],10):/\s+SOA\s+/.test(d)?e.soa=r(t):/\s+NS\s+/.test(d)?(e.ns=e.ns||[],e.ns.push(n(t))):/\s+A\s+/.test(d)?(e.a=e.a||[],e.a.push(i(t,e.a))):/\s+AAAA\s+/.test(d)?(e.aaaa=e.aaaa||[],e.aaaa.push(o(t))):/\s+CNAME\s+/.test(d)?(e.cname=e.cname||[],e.cname.push(a(t))):/\s+MX\s+/.test(d)?(e.mx=e.mx||[],e.mx.push(s(t))):/\s+PTR\s+/.test(d)?(e.ptr=e.ptr||[],e.ptr.push(c(t,e.ptr,e.$origin))):/\s+SRV\s+/.test(d)?(e.srv=e.srv||[],e.srv.push(f(t))):/\s+SPF\s+/.test(d)?(e.spf=e.spf||[],e.spf.push(h(t))):/\s+URI\s+/.test(d)&&(e.uri=e.uri||[],e.uri.push(l(t)))}return e}(t=function(t){const e=[],r=/\([\s\S]*?\)/gim;let n=r.exec(t);for(;null!==n;){const i=n[0].replace(/\s+/gm," ");e.push({match:n,replacement:i}),n=r.exec(t)}const i=t.split("");for(const t of e){const{match:e,replacement:r}=t;i.splice(e.index,e[0].length,r)}return i.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,(function(t,e){return e||""}))}(t)))}},3718:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZoneFile=void 0;var n=r(6164),i=r(1719);e.ZoneFile=class{constructor(t){"object"==typeof t?this.jsonZoneFile=JSON.parse(JSON.stringify(t)):"string"==typeof t&&(this.jsonZoneFile=(0,i.parseZoneFile)(t))}toJSON(){return this.jsonZoneFile}toString(){return(0,n.makeZoneFile)(this.toJSON())}}},144:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getZoneFileTemplate=function(){return"{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"}},495:()=>{},4923:()=>{},4300:()=>{},1046:()=>{},3776:()=>{},7406:()=>{},3640:()=>{},9368:()=>{},2632:()=>{},2634:()=>{},5340:()=>{},9838:()=>{},1451:()=>{},6425:(t,e,r)=>{"use strict";var n=r(8287).Buffer;function i(t,e){return function(){return t.apply(e,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:a}=Object,s=(u=Object.create(null),t=>{const e=o.call(t);return u[e]||(u[e]=e.slice(8,-1).toLowerCase())});var u;const c=t=>(t=t.toLowerCase(),e=>s(e)===t),f=t=>e=>typeof e===t,{isArray:h}=Array,l=f("undefined"),d=c("ArrayBuffer"),p=f("string"),g=f("function"),y=f("number"),m=t=>null!==t&&"object"==typeof t,w=t=>{if("object"!==s(t))return!1;const e=a(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},b=c("Date"),v=c("File"),_=c("Blob"),S=c("FileList"),A=c("URLSearchParams"),[T,E,k,C]=["ReadableStream","Request","Response","Headers"].map(c);function O(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),h(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(n=0;n<o;n++)a=i[n],e.call(null,t[a],a,t)}}function P(t,e){e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,R=t=>!l(t)&&t!==M,N=(B="undefined"!=typeof Uint8Array&&a(Uint8Array),t=>B&&t instanceof B);var B;const x=c("HTMLFormElement"),I=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),F=c("RegExp"),L=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};O(r,((r,i)=>{let o;!1!==(o=e(r,i,t))&&(n[i]=o||r)})),Object.defineProperties(t,n)},D="abcdefghijklmnopqrstuvwxyz",U="0123456789",V={DIGIT:U,ALPHA:D,ALPHA_DIGIT:D+D.toUpperCase()+U},j=c("AsyncFunction"),W=(K="function"==typeof setImmediate,H=g(M.postMessage),K?setImmediate:H?(q=`axios@${Math.random()}`,z=[],M.addEventListener("message",(({source:t,data:e})=>{t===M&&e===q&&z.length&&z.shift()()}),!1),t=>{z.push(t),M.postMessage(q,"*")}):t=>setTimeout(t));var K,H,q,z;const G="undefined"!=typeof queueMicrotask?queueMicrotask.bind(M):"undefined"!=typeof process&&process.nextTick||W;var $={isArray:h,isArrayBuffer:d,isBuffer:function(t){return null!==t&&!l(t)&&null!==t.constructor&&!l(t.constructor)&&g(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||g(t.append)&&("formdata"===(e=s(t))||"object"===e&&g(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&d(t.buffer),e},isString:p,isNumber:y,isBoolean:t=>!0===t||!1===t,isObject:m,isPlainObject:w,isReadableStream:T,isRequest:E,isResponse:k,isHeaders:C,isUndefined:l,isDate:b,isFile:v,isBlob:_,isRegExp:F,isFunction:g,isStream:t=>m(t)&&g(t.pipe),isURLSearchParams:A,isTypedArray:N,isFileList:S,forEach:O,merge:function t(){const{caseless:e}=R(this)&&this||{},r={},n=(n,i)=>{const o=e&&P(r,i)||i;w(r[o])&&w(n)?r[o]=t(r[o],n):w(n)?r[o]=t({},n):h(n)?r[o]=n.slice():r[o]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&O(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(O(e,((e,n)=>{r&&g(e)?t[n]=i(e,r):t[n]=e}),{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,o,s;const u={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],n&&!n(s,t,e)||u[s]||(e[s]=t[s],u[s]=!0);t=!1!==r&&a(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:c,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(h(t))return t;let e=t.length;if(!y(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:x,hasOwnProperty:I,hasOwnProp:I,reduceDescriptors:L,freezeMethods:t=>{L(t,((e,r)=>{if(g(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];g(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach((t=>{r[t]=!0}))};return h(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:P,global:M,isContextDefined:R,ALPHABET:V,generateString:(t=16,e=V.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&g(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(m(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const i=h(t)?[]:{};return O(t,((t,e)=>{const o=r(t,n+1);!l(o)&&(i[e]=o)})),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:j,isThenable:t=>t&&(m(t)||g(t))&&g(t.then)&&g(t.catch),setImmediate:W,asap:G};function X(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}$.inherits(X,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.status}}});const J=X.prototype,Y={};function Z(t){return $.isPlainObject(t)||$.isArray(t)}function Q(t){return $.endsWith(t,"[]")?t.slice(0,-2):t}function tt(t,e,r){return t?t.concat(e).map((function(t,e){return t=Q(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Y[t]={value:t}})),Object.defineProperties(X,Y),Object.defineProperty(J,"isAxiosError",{value:!0}),X.from=(t,e,r,n,i,o)=>{const a=Object.create(J);return $.toFlatObject(t,a,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),X.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,o&&Object.assign(a,o),a};const et=$.toFlatObject($,{},null,(function(t){return/^is[A-Z]/.test(t)}));function rt(t,e,r){if(!$.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const i=(r=$.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!$.isUndefined(e[t])}))).metaTokens,o=r.visitor||f,a=r.dots,s=r.indexes,u=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$.isSpecCompliantForm(e);if(!$.isFunction(o))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if($.isDate(t))return t.toISOString();if(!u&&$.isBlob(t))throw new X("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(t)||$.isTypedArray(t)?u&&"function"==typeof Blob?new Blob([t]):n.from(t):t}function f(t,r,n){let o=t;if(t&&!n&&"object"==typeof t)if($.endsWith(r,"{}"))r=i?r:r.slice(0,-2),t=JSON.stringify(t);else if($.isArray(t)&&function(t){return $.isArray(t)&&!t.some(Z)}(t)||($.isFileList(t)||$.endsWith(r,"[]"))&&(o=$.toArray(t)))return r=Q(r),o.forEach((function(t,n){!$.isUndefined(t)&&null!==t&&e.append(!0===s?tt([r],n,a):null===s?r:r+"[]",c(t))})),!1;return!!Z(t)||(e.append(tt(n,r,a),c(t)),!1)}const h=[],l=Object.assign(et,{defaultVisitor:f,convertValue:c,isVisitable:Z});if(!$.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!$.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),$.forEach(r,(function(r,i){!0===(!($.isUndefined(r)||null===r)&&o.call(e,r,$.isString(i)?i.trim():i,n,l))&&t(r,n?n.concat(i):[i])})),h.pop()}}(t),e}function nt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function it(t,e){this._pairs=[],t&&rt(t,this,e)}const ot=it.prototype;function at(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function st(t,e,r){if(!e)return t;const n=r&&r.encode||at,i=r&&r.serialize;let o;if(o=i?i(e,r):$.isURLSearchParams(e)?e.toString():new it(e,r).toString(n),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}ot.append=function(t,e){this._pairs.push([t,e])},ot.toString=function(t){const e=t?function(e){return t.call(this,e,nt)}:nt;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var ut=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){$.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},ct={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ft={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:it,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ht="undefined"!=typeof window&&"undefined"!=typeof document,lt="object"==typeof navigator&&navigator||void 0,dt=ht&&(!lt||["ReactNative","NativeScript","NS"].indexOf(lt.product)<0),pt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,gt=ht&&window.location.href||"http://localhost";var yt={...Object.freeze({__proto__:null,hasBrowserEnv:ht,hasStandardBrowserWebWorkerEnv:pt,hasStandardBrowserEnv:dt,navigator:lt,origin:gt}),...ft};function mt(t){function e(t,r,n,i){let o=t[i++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),s=i>=t.length;return o=!o&&$.isArray(n)?n.length:o,s?($.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!a):(n[o]&&$.isObject(n[o])||(n[o]=[]),e(t,r,n[o],i)&&$.isArray(n[o])&&(n[o]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],e[o]=t[o];return e}(n[o])),!a)}if($.isFormData(t)&&$.isFunction(t.entries)){const r={};return $.forEachEntry(t,((t,n)=>{e(function(t){return $.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),n,r,0)})),r}return null}const wt={transitional:ct,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=$.isObject(t);if(i&&$.isHTMLForm(t)&&(t=new FormData(t)),$.isFormData(t))return n?JSON.stringify(mt(t)):t;if($.isArrayBuffer(t)||$.isBuffer(t)||$.isStream(t)||$.isFile(t)||$.isBlob(t)||$.isReadableStream(t))return t;if($.isArrayBufferView(t))return t.buffer;if($.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return rt(t,new yt.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,n){return yt.isNode&&$.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=$.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return rt(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t){if($.isString(t))try{return(0,JSON.parse)(t),$.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||wt.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if($.isResponse(t)||$.isReadableStream(t))return t;if(t&&$.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw X.from(t,X.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yt.classes.FormData,Blob:yt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],(t=>{wt.headers[t]={}}));var bt=wt;const vt=$.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_t=Symbol("internals");function St(t){return t&&String(t).trim().toLowerCase()}function At(t){return!1===t||null==t?t:$.isArray(t)?t.map(At):String(t)}function Tt(t,e,r,n,i){return $.isFunction(n)?n.call(this,e,r):(i&&(e=r),$.isString(e)?$.isString(n)?-1!==e.indexOf(n):$.isRegExp(n)?n.test(e):void 0:void 0)}class Et{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=St(e);if(!i)throw new Error("header name must be a non-empty string");const o=$.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||e]=At(t))}const o=(t,e)=>$.forEach(t,((t,r)=>i(t,r,e)));if($.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if($.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))o((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&vt[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)})),e})(t),e);else if($.isHeaders(t))for(const[e,n]of t.entries())i(n,e,r);else null!=t&&i(e,t,r);return this}get(t,e){if(t=St(t)){const r=$.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if($.isFunction(e))return e.call(this,t,r);if($.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=St(t)){const r=$.findKey(this,t);return!(!r||void 0===this[r]||e&&!Tt(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=St(t)){const i=$.findKey(r,t);!i||e&&!Tt(0,r[i],i,e)||(delete r[i],n=!0)}}return $.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!Tt(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return $.forEach(this,((n,i)=>{const o=$.findKey(r,i);if(o)return e[o]=At(n),void delete e[i];const a=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(i):String(i).trim();a!==i&&delete e[i],e[a]=At(n),r[a]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return $.forEach(this,((r,n)=>{null!=r&&!1!==r&&(e[n]=t&&$.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[_t]=this[_t]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=St(t);e[n]||(function(t,e){const r=$.toCamelCase(" "+e);["get","set","has"].forEach((n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})}))}(r,t),e[n]=!0)}return $.isArray(t)?t.forEach(n):n(t),this}}Et.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$.reduceDescriptors(Et.prototype,(({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}})),$.freezeMethods(Et);var kt=Et;function Ct(t,e){const r=this||bt,n=e||r,i=kt.from(n.headers);let o=n.data;return $.forEach(t,(function(t){o=t.call(r,o,i.normalize(),e?e.status:void 0)})),i.normalize(),o}function Ot(t){return!(!t||!t.__CANCEL__)}function Pt(t,e,r){X.call(this,null==t?"canceled":t,X.ERR_CANCELED,e,r),this.name="CanceledError"}function Mt(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new X("Request failed with status code "+r.status,[X.ERR_BAD_REQUEST,X.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}$.inherits(Pt,X,{__CANCEL__:!0});const Rt=(t,e,r=3)=>{let n=0;const i=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,o=0,a=0;return e=void 0!==e?e:1e3,function(s){const u=Date.now(),c=n[a];i||(i=u),r[o]=s,n[o]=u;let f=a,h=0;for(;f!==o;)h+=r[f++],f%=t;if(o=(o+1)%t,o===a&&(a=(a+1)%t),u-i<e)return;const l=c&&u-c;return l?Math.round(1e3*h/l):void 0}}(50,250);return function(t,e){let r,n,i=0,o=1e3/e;const a=(e,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),t.apply(null,e)};return[(...t)=>{const e=Date.now(),s=e-i;s>=o?a(t,e):(r=t,n||(n=setTimeout((()=>{n=null,a(r)}),o-s)))},()=>r&&a(r)]}((r=>{const o=r.loaded,a=r.lengthComputable?r.total:void 0,s=o-n,u=i(s);n=o,t({loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&o<=a?(a-o)/u:void 0,event:r,lengthComputable:null!=a,[e?"download":"upload"]:!0})}),r)},Nt=(t,e)=>{const r=null!=t;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Bt=t=>(...e)=>$.asap((()=>t(...e)));var xt=yt.hasStandardBrowserEnv?function(){const t=yt.navigator&&/(msie|trident)/i.test(yt.navigator.userAgent),e=document.createElement("a");let r;function n(r){let n=r;return t&&(e.setAttribute("href",n),n=e.href),e.setAttribute("href",n),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=n(window.location.href),function(t){const e=$.isString(t)?n(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0},It=yt.hasStandardBrowserEnv?{write(t,e,r,n,i,o){const a=[t+"="+encodeURIComponent(e)];$.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),$.isString(n)&&a.push("path="+n),$.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ft(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Lt=t=>t instanceof kt?{...t}:t;function Dt(t,e){e=e||{};const r={};function n(t,e,r){return $.isPlainObject(t)&&$.isPlainObject(e)?$.merge.call({caseless:r},t,e):$.isPlainObject(e)?$.merge({},e):$.isArray(e)?e.slice():e}function i(t,e,r){return $.isUndefined(e)?$.isUndefined(t)?void 0:n(void 0,t,r):n(t,e,r)}function o(t,e){if(!$.isUndefined(e))return n(void 0,e)}function a(t,e){return $.isUndefined(e)?$.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function s(r,i,o){return o in e?n(r,i):o in t?n(void 0,r):void 0}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(t,e)=>i(Lt(t),Lt(e),!0)};return $.forEach(Object.keys(Object.assign({},t,e)),(function(n){const o=u[n]||i,a=o(t[n],e[n],n);$.isUndefined(a)&&o!==s||(r[n]=a)})),r}var Ut=t=>{const e=Dt({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:a,headers:s,auth:u}=e;if(e.headers=s=kt.from(s),e.url=st(Ft(e.baseURL,e.url),t.params,t.paramsSerializer),u&&s.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),$.isFormData(n))if(yt.hasStandardBrowserEnv||yt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[t,...e]=r?r.split(";").map((t=>t.trim())).filter(Boolean):[];s.setContentType([t||"multipart/form-data",...e].join("; "))}if(yt.hasStandardBrowserEnv&&(i&&$.isFunction(i)&&(i=i(e)),i||!1!==i&&xt(e.url))){const t=o&&a&&It.read(a);t&&s.set(o,t)}return e},Vt="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){const n=Ut(t);let i=n.data;const o=kt.from(n.headers).normalize();let a,s,u,c,f,{responseType:h,onUploadProgress:l,onDownloadProgress:d}=n;function p(){c&&c(),f&&f(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let g=new XMLHttpRequest;function y(){if(!g)return;const n=kt.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Mt((function(t){e(t),p()}),(function(t){r(t),p()}),{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:n,config:t,request:g}),g=null}g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout,"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(y)},g.onabort=function(){g&&(r(new X("Request aborted",X.ECONNABORTED,t,g)),g=null)},g.onerror=function(){r(new X("Network Error",X.ERR_NETWORK,t,g)),g=null},g.ontimeout=function(){let e=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ct;n.timeoutErrorMessage&&(e=n.timeoutErrorMessage),r(new X(e,i.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,t,g)),g=null},void 0===i&&o.setContentType(null),"setRequestHeader"in g&&$.forEach(o.toJSON(),(function(t,e){g.setRequestHeader(e,t)})),$.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),h&&"json"!==h&&(g.responseType=n.responseType),d&&([u,f]=Rt(d,!0),g.addEventListener("progress",u)),l&&g.upload&&([s,c]=Rt(l),g.upload.addEventListener("progress",s),g.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(a=e=>{g&&(r(!e||e.type?new Pt(null,t,g):e),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const m=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);m&&-1===yt.protocols.indexOf(m)?r(new X("Unsupported protocol "+m+":",X.ERR_BAD_REQUEST,t)):g.send(i||null)}))},jt=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let r,n=new AbortController;const i=function(t){if(!r){r=!0,a();const e=t instanceof Error?t:this.reason;n.abort(e instanceof X?e:new Pt(e instanceof Error?e.message:e))}};let o=e&&setTimeout((()=>{o=null,i(new X(`timeout ${e} of ms exceeded`,X.ETIMEDOUT))}),e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)})),t=null)};t.forEach((t=>t.addEventListener("abort",i)));const{signal:s}=n;return s.unsubscribe=()=>$.asap(a),s}};const Wt=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,i=0;for(;i<r;)n=i+e,yield t.slice(i,n),i=n},Kt=(t,e,r,n)=>{const i=async function*(t,e){for await(const r of async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}}(t))yield*Wt(r,e)}(t,e);let o,a=0,s=t=>{o||(o=!0,n&&n(t))};return new ReadableStream({async pull(t){try{const{done:e,value:n}=await i.next();if(e)return s(),void t.close();let o=n.byteLength;if(r){let t=a+=o;r(t)}t.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:t=>(s(t),i.return())},{highWaterMark:2})},Ht="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,qt=Ht&&"function"==typeof ReadableStream,zt=Ht&&("function"==typeof TextEncoder?(Gt=new TextEncoder,t=>Gt.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var Gt;const $t=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Xt=qt&&$t((()=>{let t=!1;const e=new Request(yt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),Jt=qt&&$t((()=>$.isReadableStream(new Response("").body))),Yt={stream:Jt&&(t=>t.body)};var Zt;Ht&&(Zt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Yt[t]&&(Yt[t]=$.isFunction(Zt[t])?e=>e[t]():(e,r)=>{throw new X(`Response type '${t}' is not supported`,X.ERR_NOT_SUPPORT,r)})})));const Qt={http:null,xhr:Vt,fetch:Ht&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:o,timeout:a,onDownloadProgress:s,onUploadProgress:u,responseType:c,headers:f,withCredentials:h="same-origin",fetchOptions:l}=Ut(t);c=c?(c+"").toLowerCase():"text";let d,p=jt([i,o&&o.toAbortSignal()],a);const g=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(u&&Xt&&"get"!==r&&"head"!==r&&0!==(y=await(async(t,e)=>{const r=$.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if($.isBlob(t))return t.size;if($.isSpecCompliantForm(t)){const e=new Request(yt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return $.isArrayBufferView(t)||$.isArrayBuffer(t)?t.byteLength:($.isURLSearchParams(t)&&(t+=""),$.isString(t)?(await zt(t)).byteLength:void 0)})(e):r})(f,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});if($.isFormData(n)&&(t=r.headers.get("content-type"))&&f.setContentType(t),r.body){const[t,e]=Nt(y,Rt(Bt(u)));n=Kt(r.body,65536,t,e)}}$.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;d=new Request(e,{...l,signal:p,method:r.toUpperCase(),headers:f.normalize().toJSON(),body:n,duplex:"half",credentials:i?h:void 0});let o=await fetch(d);const a=Jt&&("stream"===c||"response"===c);if(Jt&&(s||a&&g)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=o[e]}));const e=$.toFiniteNumber(o.headers.get("content-length")),[r,n]=s&&Nt(e,Rt(Bt(s),!0))||[];o=new Response(Kt(o.body,65536,r,(()=>{n&&n(),g&&g()})),t)}c=c||"text";let m=await Yt[$.findKey(Yt,c)||"text"](o,t);return!a&&g&&g(),await new Promise(((e,r)=>{Mt(e,r,{data:m,headers:kt.from(o.headers),status:o.status,statusText:o.statusText,config:t,request:d})}))}catch(e){if(g&&g(),e&&"TypeError"===e.name&&/fetch/i.test(e.message))throw Object.assign(new X("Network Error",X.ERR_NETWORK,t,d),{cause:e.cause||e});throw X.from(e,e&&e.code,t,d)}})};$.forEach(Qt,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const te=t=>`- ${t}`,ee=t=>$.isFunction(t)||null===t||!1===t;var re=t=>{t=$.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let o=0;o<e;o++){let e;if(r=t[o],n=r,!ee(r)&&(n=Qt[(e=String(r)).toLowerCase()],void 0===n))throw new X(`Unknown adapter '${e}'`);if(n)break;i[e||"#"+o]=n}if(!n){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new X("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(te).join("\n"):" "+te(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function ne(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pt(null,t)}function ie(t){return ne(t),t.headers=kt.from(t.headers),t.data=Ct.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),re(t.adapter||bt.adapter)(t).then((function(e){return ne(t),e.data=Ct.call(t,t.transformResponse,e),e.headers=kt.from(e.headers),e}),(function(e){return Ot(e)||(ne(t),e&&e.response&&(e.response.data=Ct.call(t,t.transformResponse,e.response),e.response.headers=kt.from(e.response.headers))),Promise.reject(e)}))}const oe={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{oe[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const ae={};oe.transitional=function(t,e,r){function n(t,e){return"[Axios v1.7.7] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,o)=>{if(!1===t)throw new X(n(i," has been removed"+(e?" in "+e:"")),X.ERR_DEPRECATED);return e&&!ae[i]&&(ae[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,o)}};var se={assertOptions:function(t,e,r){if("object"!=typeof t)throw new X("options must be an object",X.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const o=n[i],a=e[o];if(a){const e=t[o],r=void 0===e||a(e,o,t);if(!0!==r)throw new X("option "+o+" must be "+r,X.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new X("Unknown option "+o,X.ERR_BAD_OPTION)}},validators:oe};const ue=se.validators;class ce{constructor(t){this.defaults=t,this.interceptors={request:new ut,response:new ut}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Dt(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&se.assertOptions(r,{silentJSONParsing:ue.transitional(ue.boolean),forcedJSONParsing:ue.transitional(ue.boolean),clarifyTimeoutError:ue.transitional(ue.boolean)},!1),null!=n&&($.isFunction(n)?e.paramsSerializer={serialize:n}:se.assertOptions(n,{encode:ue.function,serialize:ue.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&$.merge(i.common,i[e.method]);i&&$.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=kt.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(s=s&&t.synchronous,a.unshift(t.fulfilled,t.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(t){u.push(t.fulfilled,t.rejected)}));let f,h=0;if(!s){const t=[ie.bind(this),void 0];for(t.unshift.apply(t,a),t.push.apply(t,u),f=t.length,c=Promise.resolve(e);h<f;)c=c.then(t[h++],t[h++]);return c}f=a.length;let l=e;for(h=0;h<f;){const t=a[h++],e=a[h++];try{l=t(l)}catch(t){e.call(this,t);break}}try{c=ie.call(this,l)}catch(t){return Promise.reject(t)}for(h=0,f=u.length;h<f;)c=c.then(u[h++],u[h++]);return c}getUri(t){return st(Ft((t=Dt(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}$.forEach(["delete","get","head","options"],(function(t){ce.prototype[t]=function(e,r){return this.request(Dt(r||{},{method:t,url:e,data:(r||{}).data}))}})),$.forEach(["post","put","patch"],(function(t){function e(e){return function(r,n,i){return this.request(Dt(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ce.prototype[t]=e(),ce.prototype[t+"Form"]=e(!0)}));var fe=ce;class he{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const n=new Promise((t=>{r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t,n,i){r.reason||(r.reason=new Pt(t,n,i),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new he((function(e){t=e})),cancel:t}}}var le=he;const de={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(de).forEach((([t,e])=>{de[e]=t}));var pe=de;const ge=function t(e){const r=new fe(e),n=i(fe.prototype.request,r);return $.extend(n,fe.prototype,r,{allOwnKeys:!0}),$.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Dt(e,r))},n}(bt);ge.Axios=fe,ge.CanceledError=Pt,ge.CancelToken=le,ge.isCancel=Ot,ge.VERSION="1.7.7",ge.toFormData=rt,ge.AxiosError=X,ge.Cancel=ge.CanceledError,ge.all=function(t){return Promise.all(t)},ge.spread=function(t){return function(e){return t.apply(null,e)}},ge.isAxiosError=function(t){return $.isObject(t)&&!0===t.isAxiosError},ge.mergeConfig=Dt,ge.AxiosHeaders=kt,ge.formToJSON=t=>mt($.isHTMLForm(t)?new FormData(t):t),ge.getAdapter=re,ge.HttpStatusCode=pe,ge.default=ge,t.exports=ge},8119:t=>{"use strict";t.exports=JSON.parse('{"OP_FALSE":0,"OP_0":0,"OP_PUSHDATA1":76,"OP_PUSHDATA2":77,"OP_PUSHDATA4":78,"OP_1NEGATE":79,"OP_RESERVED":80,"OP_TRUE":81,"OP_1":81,"OP_2":82,"OP_3":83,"OP_4":84,"OP_5":85,"OP_6":86,"OP_7":87,"OP_8":88,"OP_9":89,"OP_10":90,"OP_11":91,"OP_12":92,"OP_13":93,"OP_14":94,"OP_15":95,"OP_16":96,"OP_NOP":97,"OP_VER":98,"OP_IF":99,"OP_NOTIF":100,"OP_VERIF":101,"OP_VERNOTIF":102,"OP_ELSE":103,"OP_ENDIF":104,"OP_VERIFY":105,"OP_RETURN":106,"OP_TOALTSTACK":107,"OP_FROMALTSTACK":108,"OP_2DROP":109,"OP_2DUP":110,"OP_3DUP":111,"OP_2OVER":112,"OP_2ROT":113,"OP_2SWAP":114,"OP_IFDUP":115,"OP_DEPTH":116,"OP_DROP":117,"OP_DUP":118,"OP_NIP":119,"OP_OVER":120,"OP_PICK":121,"OP_ROLL":122,"OP_ROT":123,"OP_SWAP":124,"OP_TUCK":125,"OP_CAT":126,"OP_SUBSTR":127,"OP_LEFT":128,"OP_RIGHT":129,"OP_SIZE":130,"OP_INVERT":131,"OP_AND":132,"OP_OR":133,"OP_XOR":134,"OP_EQUAL":135,"OP_EQUALVERIFY":136,"OP_RESERVED1":137,"OP_RESERVED2":138,"OP_1ADD":139,"OP_1SUB":140,"OP_2MUL":141,"OP_2DIV":142,"OP_NEGATE":143,"OP_ABS":144,"OP_NOT":145,"OP_0NOTEQUAL":146,"OP_ADD":147,"OP_SUB":148,"OP_MUL":149,"OP_DIV":150,"OP_MOD":151,"OP_LSHIFT":152,"OP_RSHIFT":153,"OP_BOOLAND":154,"OP_BOOLOR":155,"OP_NUMEQUAL":156,"OP_NUMEQUALVERIFY":157,"OP_NUMNOTEQUAL":158,"OP_LESSTHAN":159,"OP_GREATERTHAN":160,"OP_LESSTHANOREQUAL":161,"OP_GREATERTHANOREQUAL":162,"OP_MIN":163,"OP_MAX":164,"OP_WITHIN":165,"OP_RIPEMD160":166,"OP_SHA1":167,"OP_SHA256":168,"OP_HASH160":169,"OP_HASH256":170,"OP_CODESEPARATOR":171,"OP_CHECKSIG":172,"OP_CHECKSIGVERIFY":173,"OP_CHECKMULTISIG":174,"OP_CHECKMULTISIGVERIFY":175,"OP_NOP1":176,"OP_NOP2":177,"OP_CHECKLOCKTIMEVERIFY":177,"OP_NOP3":178,"OP_CHECKSEQUENCEVERIFY":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}')},1636:t=>{"use strict";t.exports={rE:"6.6.1"}}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return r[t].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}return i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var a={};t=t||[null,e({}),e([]),e(e)];for(var s=2&n&&r;"object"==typeof s&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach((t=>a[t]=()=>r[t]));return a.default=()=>r,i.d(o,a),o},i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),i(7729)})()));
|