stackswap-front-api-test-02 1.0.35
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/506.index.umd.js +1 -0
- package/dist/esm/index.d.ts +77 -0
- package/dist/esm/index.js +110 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/stackswap/config.d.ts +84 -0
- package/dist/esm/stackswap/config.js +123 -0
- package/dist/esm/stackswap/config.js.map +1 -0
- package/dist/esm/stackswap/main.d.ts +1 -0
- package/dist/esm/stackswap/main.js +5 -0
- package/dist/esm/stackswap/main.js.map +1 -0
- package/dist/esm/stackswap/manager/farm.manager.d.ts +37 -0
- package/dist/esm/stackswap/manager/farm.manager.js +220 -0
- package/dist/esm/stackswap/manager/farm.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/farm2.manager.d.ts +37 -0
- package/dist/esm/stackswap/manager/farm2.manager.js +294 -0
- package/dist/esm/stackswap/manager/farm2.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/governance.manager.d.ts +9 -0
- package/dist/esm/stackswap/manager/governance.manager.js +54 -0
- package/dist/esm/stackswap/manager/governance.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/launchpad.manager.d.ts +13 -0
- package/dist/esm/stackswap/manager/launchpad.manager.js +148 -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/multisig.manager.d.ts +11 -0
- package/dist/esm/stackswap/manager/multisig.manager.js +52 -0
- package/dist/esm/stackswap/manager/multisig.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/nft.manager.d.ts +52 -0
- package/dist/esm/stackswap/manager/nft.manager.js +244 -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 +48 -0
- package/dist/esm/stackswap/manager/other.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/pool.manager.d.ts +33 -0
- package/dist/esm/stackswap/manager/pool.manager.js +160 -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 +25 -0
- package/dist/esm/stackswap/manager/staking.manager.js +234 -0
- package/dist/esm/stackswap/manager/staking.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/swap.manager.d.ts +35 -0
- package/dist/esm/stackswap/manager/swap.manager.js +291 -0
- package/dist/esm/stackswap/manager/swap.manager.js.map +1 -0
- package/dist/esm/stackswap/manager/token.manager.d.ts +31 -0
- package/dist/esm/stackswap/manager/token.manager.js +126 -0
- package/dist/esm/stackswap/manager/token.manager.js.map +1 -0
- package/dist/esm/stackswap/util.d.ts +37 -0
- package/dist/esm/stackswap/util.js +240 -0
- package/dist/esm/stackswap/util.js.map +1 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.LICENSE.txt +10 -0
- package/dist/stackswap/config.d.ts +84 -0
- package/dist/stackswap/config.js +127 -0
- package/dist/stackswap/config.js.map +1 -0
- package/dist/stackswap/main.d.ts +1 -0
- package/dist/stackswap/main.js +7 -0
- package/dist/stackswap/main.js.map +1 -0
- package/dist/stackswap/manager/farm.manager.d.ts +37 -0
- package/dist/stackswap/manager/farm.manager.js +228 -0
- package/dist/stackswap/manager/farm.manager.js.map +1 -0
- package/dist/stackswap/manager/farm2.manager.d.ts +37 -0
- package/dist/stackswap/manager/farm2.manager.js +301 -0
- package/dist/stackswap/manager/farm2.manager.js.map +1 -0
- package/dist/stackswap/manager/governance.manager.d.ts +9 -0
- package/dist/stackswap/manager/governance.manager.js +61 -0
- package/dist/stackswap/manager/governance.manager.js.map +1 -0
- package/dist/stackswap/manager/launchpad.manager.d.ts +13 -0
- package/dist/stackswap/manager/launchpad.manager.js +152 -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/multisig.manager.d.ts +11 -0
- package/dist/stackswap/manager/multisig.manager.js +56 -0
- package/dist/stackswap/manager/multisig.manager.js.map +1 -0
- package/dist/stackswap/manager/nft.manager.d.ts +52 -0
- package/dist/stackswap/manager/nft.manager.js +251 -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 +55 -0
- package/dist/stackswap/manager/other.manager.js.map +1 -0
- package/dist/stackswap/manager/pool.manager.d.ts +33 -0
- package/dist/stackswap/manager/pool.manager.js +168 -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 +25 -0
- package/dist/stackswap/manager/staking.manager.js +241 -0
- package/dist/stackswap/manager/staking.manager.js.map +1 -0
- package/dist/stackswap/manager/swap.manager.d.ts +35 -0
- package/dist/stackswap/manager/swap.manager.js +298 -0
- package/dist/stackswap/manager/swap.manager.js.map +1 -0
- package/dist/stackswap/manager/token.manager.d.ts +31 -0
- package/dist/stackswap/manager/token.manager.js +134 -0
- package/dist/stackswap/manager/token.manager.js.map +1 -0
- package/dist/stackswap/util.d.ts +37 -0
- package/dist/stackswap/util.js +259 -0
- package/dist/stackswap/util.js.map +1 -0
- package/package.json +43 -0
- package/src/index.ts +165 -0
- package/src/stackswap/config.ts +202 -0
- package/src/stackswap/main.ts +6 -0
- package/src/stackswap/manager/farm.manager.ts +310 -0
- package/src/stackswap/manager/farm2.manager.ts +407 -0
- package/src/stackswap/manager/governance.manager.ts +95 -0
- package/src/stackswap/manager/launchpad.manager.ts +190 -0
- package/src/stackswap/manager/lbtc.manager.ts +566 -0
- package/src/stackswap/manager/multisig.manager.ts +87 -0
- package/src/stackswap/manager/nft.manager.ts +311 -0
- package/src/stackswap/manager/operator.manager.ts +123 -0
- package/src/stackswap/manager/other.manager.ts +71 -0
- package/src/stackswap/manager/pool.manager.ts +188 -0
- package/src/stackswap/manager/poxl.manager.ts +99 -0
- package/src/stackswap/manager/staking.manager.ts +321 -0
- package/src/stackswap/manager/swap.manager.ts +351 -0
- package/src/stackswap/manager/token.manager.ts +156 -0
- package/src/stackswap/util.ts +269 -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,(function(){return(()=>{var t,e,r={2721:(t,e,r)=>{"use strict";var n,i;r.d(e,{oK:()=>n,Kn:()=>i,sM:()=>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={}));const o="https://hub.blockstack.org"},3930:(t,e,r)=>{"use strict";async function n(t,e){const r=Object.assign({referrer:"no-referrer",referrerPolicy:"no-referrer"},e);return await fetch(t,r)}r.d(e,{I:()=>n}),r(1905)},8608: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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9100).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)f*=e;this.imuln(f),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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,f=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;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[c]=0|f,u=0|h}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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}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=f[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:h[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!==s),this.toArrayLike(s,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 s,a,u="le"===e,c=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[o-a-1]=s}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 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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(0==(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(0==(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(0==(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,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),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,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],f=8191&h,l=h>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,_=b>>>13,S=0|s[4],A=8191&S,M=S>>>13,E=0|s[5],k=8191&E,T=E>>>13,C=0|s[6],O=8191&C,P=C>>>13,I=0|s[7],x=8191&I,N=I>>>13,B=0|s[8],R=8191&B,U=B>>>13,F=0|s[9],L=8191&F,D=F>>>13,j=0|a[0],V=8191&j,W=j>>>13,$=0|a[1],K=8191&$,H=$>>>13,q=0|a[2],z=8191&q,G=q>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,W))+Math.imul(g,V)|0,o=Math.imul(g,W);var yt=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,W))+Math.imul(w,V)|0,o=Math.imul(w,W),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,H)|0;var wt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,z)|0))<<13)|0;c=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,W))+Math.imul(_,V)|0,o=Math.imul(_,W),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,z)|0,o=o+Math.imul(g,G)|0;var bt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,V),i=(i=Math.imul(A,W))+Math.imul(M,V)|0,o=Math.imul(M,W),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,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,V),i=(i=Math.imul(k,W))+Math.imul(T,V)|0,o=Math.imul(T,W),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(O,V),i=(i=Math.imul(O,W))+Math.imul(P,V)|0,o=Math.imul(P,W),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,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(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,W))+Math.imul(N,V)|0,o=Math.imul(N,W),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|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(y,rt)|0,i=(i=i+Math.imul(y,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,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var At=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(R,V),i=(i=Math.imul(R,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,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(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|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 Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,W))+Math.imul(D,V)|0,o=Math.imul(D,W),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(L,K),i=(i=Math.imul(L,H))+Math.imul(D,K)|0,o=Math.imul(D,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(U,z)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|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(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(w,ft)|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(L,z),i=(i=Math.imul(L,G))+Math.imul(D,z)|0,o=Math.imul(D,G),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var Tt=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,J))+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Ct=(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)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,lt)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,lt)|0;var Pt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,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(L,ot),i=(i=Math.imul(L,st))+Math.imul(D,ot)|0,o=Math.imul(D,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var It=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,lt)|0;var xt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul(D,ft)|0,o=Math.imul(D,lt);var Nt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(c+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,gt))+Math.imul(D,pt)|0))<<13)|0;return c=((o=Math.imul(D,gt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Mt,u[9]=Et,u[10]=kt,u[11]=Tt,u[12]=Ct,u[13]=Ot,u[14]=Pt,u[15]=It,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(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 s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,f=(0|t.words[h])*(0|e.words[c]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.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},m.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},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var f=u,l=c,d=0;d<s;d++){var p=r[h+d],g=n[h+d],m=r[h+d+s],y=n[h+d+s],w=f*m-l*y;y=f*y+l*m,m=w,r[h+d]=p+m,n[h+d]=g+y,r[h+d+s]=p-m,n[h+d+s]=g-y,d!==a&&(w=u*f-c*l,l=u*l+c*f,f=w)}},m.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},m.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}},m.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},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,h,f,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,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 s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,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,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&a}return u&&0!==h&&(u.words[u.length++]=h),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,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):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,s,a},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),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,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,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).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 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(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,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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 y={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 M(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 s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}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(y[t])return y[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 y[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(0==(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),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new o(1).iushln(p-m-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}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],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var f=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=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 M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2102:(t,e,r)=>{"use strict";r.d(e,{b:()=>L,g:()=>T,h:()=>g,p:()=>c,r:()=>V});let n,i,o=!1;const s="undefined"!=typeof window?window:{},a=s.document||{head:{}},u={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,r,n)=>t.addEventListener(e,r,n),rel:(t,e,r,n)=>t.removeEventListener(e,r,n),ce:(t,e)=>new CustomEvent(t,e)},c=t=>Promise.resolve(t),h=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),f=new WeakMap,l=(t,e)=>"sc-"+t.$tagName$,d={},p=t=>"object"==(t=typeof t)||"function"===t,g=(t,e,...r)=>{let n=null,i=!1,o=!1,s=[];const a=e=>{for(let r=0;r<e.length;r++)n=e[r],Array.isArray(n)?a(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof t&&!p(n))&&(n=String(n)),i&&o?s[s.length-1].$text$+=n:s.push(i?m(null,n):n),o=i)};if(a(r),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const u=m(t,null);return u.$attrs$=e,s.length>0&&(u.$children$=s),u},m=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),y={},w=(t,e,r,n,i,o)=>{if(r!==n){let a=$(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,i=v(r),o=v(n);e.remove(...i.filter((t=>t&&!o.includes(t)))),e.add(...o.filter((t=>t&&!i.includes(t))))}else if(a||"o"!==e[0]||"n"!==e[1]){const s=p(n);if((a||s&&null!==n)&&!i)try{if(t.tagName.includes("-"))t[e]=n;else{let i=null==n?"":n;"list"===e?a=!1:null!=r&&t[e]==i||(t[e]=i)}}catch(t){}null==n||!1===n?!1===n&&""!==t.getAttribute(e)||t.removeAttribute(e):(!a||4&o||i)&&!s&&(n=!0===n?"":n,t.setAttribute(e,n))}else e="-"===e[2]?e.slice(3):$(s,c)?c.slice(2):c[2]+e.slice(3),r&&u.rel(t,e,r,!1),n&&u.ael(t,e,n,!1)}},b=/\s/,v=t=>t?t.split(b):[],_=(t,e,r,n)=>{const i=11===e.$elm$.nodeType&&e.$elm$.host?e.$elm$.host:e.$elm$,o=t&&t.$attrs$||d,s=e.$attrs$||d;for(n in o)n in s||w(i,n,o[n],void 0,r,e.$flags$);for(n in s)w(i,n,o[n],s[n],r,e.$flags$)},S=(t,e,r,i)=>{let o,s,u=e.$children$[r],c=0;if(null!==u.$text$)o=u.$elm$=a.createTextNode(u.$text$);else if(o=u.$elm$=a.createElement(u.$tag$),_(null,u,!1),null!=n&&o["s-si"]!==n&&o.classList.add(o["s-si"]=n),u.$children$)for(c=0;c<u.$children$.length;++c)s=S(t,u,c),s&&o.appendChild(s);return o},A=(t,e,r,n,o,s)=>{let a,u=t;for(u.shadowRoot&&u.tagName===i&&(u=u.shadowRoot);o<=s;++o)n[o]&&(a=S(null,r,o),a&&(n[o].$elm$=a,u.insertBefore(a,e)))},M=(t,e,r,n,i)=>{for(;e<=r;++e)(n=t[e])&&n.$elm$.remove()},E=(t,e)=>t.$tag$===e.$tag$,k=(t,e)=>{const r=e.$elm$=t.$elm$,n=t.$children$,i=e.$children$,o=e.$text$;null===o?(_(t,e,!1),null!==n&&null!==i?((t,e,r,n)=>{let i,o=0,s=0,a=e.length-1,u=e[0],c=e[a],h=n.length-1,f=n[0],l=n[h];for(;o<=a&&s<=h;)null==u?u=e[++o]:null==c?c=e[--a]:null==f?f=n[++s]:null==l?l=n[--h]:E(u,f)?(k(u,f),u=e[++o],f=n[++s]):E(c,l)?(k(c,l),c=e[--a],l=n[--h]):E(u,l)?(k(u,l),t.insertBefore(u.$elm$,c.$elm$.nextSibling),u=e[++o],l=n[--h]):E(c,f)?(k(c,f),t.insertBefore(c.$elm$,u.$elm$),c=e[--a],f=n[++s]):(i=S(e&&e[s],r,s),f=n[++s],i&&u.$elm$.parentNode.insertBefore(i,u.$elm$));o>a?A(t,null==n[h+1]?null:n[h+1].$elm$,r,n,s,h):s>h&&M(e,o,a)})(r,n,e,i):null!==i?(null!==t.$text$&&(r.textContent=""),A(r,null,e,i,0,i.length-1)):null!==n&&M(n,0,n.length-1)):t.$text$!==o&&(r.data=o)},T=t=>j(t).$hostElement$,C=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.$onRenderResolve$=e)))},O=(t,e)=>{if(t.$flags$|=16,!(4&t.$flags$))return C(t,t.$ancestorComponent$),tt((()=>P(t,e)));t.$flags$|=512},P=(t,e)=>{const r=(t.$cmpMeta$.$tagName$,()=>{}),n=t.$lazyInstance$;return r(),R(void 0,(()=>I(t,n,e)))},I=async(t,e,r)=>{const n=t.$hostElement$,i=(t.$cmpMeta$.$tagName$,()=>{}),o=n["s-rc"];r&&(t=>{const e=t.$cmpMeta$,r=t.$hostElement$,n=e.$flags$,i=(e.$tagName$,()=>{}),o=((t,e,r,n)=>{let i=l(e),o=z.get(i);if(t=11===t.nodeType?t:a,o)if("string"==typeof o){t=t.head||t;let e,r=f.get(t);r||f.set(t,r=new Set),r.has(i)||(e=a.createElement("style"),e.innerHTML=o,t.insertBefore(e,t.querySelector("link")),r&&r.add(i))}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return i})(r.shadowRoot?r.shadowRoot:r.getRootNode(),e);10&n&&(r["s-sc"]=o,r.classList.add(o+"-h")),i()})(t);const s=(t.$cmpMeta$.$tagName$,()=>{});x(t,e),o&&(o.map((t=>t())),n["s-rc"]=void 0),s(),i();{const e=n["s-p"],r=()=>N(t);0===e.length?r():(Promise.all(e).then(r),t.$flags$|=4,e.length=0)}},x=(t,e,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,((t,e)=>{const r=t.$hostElement$,o=t.$vnode$||m(null,null),s=(a=e)&&a.$tag$===y?e:g(null,null,e);var a;i=r.tagName,s.$tag$=null,s.$flags$|=4,t.$vnode$=s,s.$elm$=o.$elm$=r.shadowRoot||r,n=r["s-sc"],k(o,s)})(t,e)}catch(e){K(e,t.$hostElement$)}return null},N=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,r=t.$ancestorComponent$;64&t.$flags$||(t.$flags$|=64,U(e),t.$onReadyResolve$(e),r||B()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&Q((()=>O(t,!1))),t.$flags$&=-517},B=t=>{U(a.documentElement),Q((()=>((t,e,r)=>{const n=u.ce("appload",{detail:{namespace:"connect-ui"}});return t.dispatchEvent(n),n})(s)))},R=(t,e)=>t&&t.then?t.then(e):e(),U=t=>t.classList.add("hydrated"),F=(t,e,r)=>{if(e.$members$){const n=Object.entries(e.$members$),i=t.prototype;n.map((([t,[e]])=>{(31&e||2&r&&32&e)&&Object.defineProperty(i,t,{get(){return e=t,j(this).$instanceValues$.get(e);var e},set(e){((t,e,r,n)=>{const i=j(t),o=i.$instanceValues$.get(e),s=i.$flags$,a=i.$lazyInstance$;var u;null==(u=r)||p(u),r=u,8&s&&void 0!==o||r===o||(i.$instanceValues$.set(e,r),a&&2==(18&s)&&O(i,!1))})(this,t,e)},configurable:!0,enumerable:!0})}))}return t},L=(t,e={})=>{const r=[],n=e.exclude||[],i=s.customElements,o=a.head,c=o.querySelector("meta[charset]"),f=a.createElement("style"),d=[];let p,g=!0;Object.assign(u,e),u.$resourcesUrl$=new URL(e.resourcesUrl||"./",a.baseURI).href,t.map((t=>t[1].map((e=>{const o={$flags$:e[0],$tagName$:e[1],$members$:e[2],$listeners$:e[3]};o.$members$=e[2];const s=o.$tagName$,a=class extends HTMLElement{constructor(t){super(t),W(t=this,o),1&o.$flags$&&t.attachShadow({mode:"open"})}connectedCallback(){p&&(clearTimeout(p),p=null),g?d.push(this):u.jmp((()=>(t=>{if(0==(1&u.$flags$)){const e=j(t),r=e.$cmpMeta$,n=(r.$tagName$,()=>{});if(!(1&e.$flags$)){e.$flags$|=1;{let r=t;for(;r=r.parentNode||r.host;)if(r["s-p"]){C(e,e.$ancestorComponent$=r);break}}r.$members$&&Object.entries(r.$members$).map((([e,[r]])=>{if(31&r&&t.hasOwnProperty(e)){const r=t[e];delete t[e],t[e]=r}})),(async(t,e,r,n,i)=>{if(0==(32&e.$flags$)){{if(e.$flags$|=32,(i=q(r)).then){const t=()=>{};i=await i,t()}i.isProxied||(F(i,r,2),i.isProxied=!0);const t=(r.$tagName$,()=>{});e.$flags$|=8;try{new i(e)}catch(t){K(t)}e.$flags$&=-9,t()}if(i.style){let t=i.style;const e=l(r);if(!z.has(e)){const n=(r.$tagName$,()=>{});((t,e,r)=>{let n=z.get(t);h&&r?(n=n||new CSSStyleSheet,n.replace(e)):n=e,z.set(t,n)})(e,t,!!(1&r.$flags$)),n()}}}const o=e.$ancestorComponent$,s=()=>O(e,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(0,e,r)}n()}})(this)))}disconnectedCallback(){u.jmp((()=>(this,void(0==(1&u.$flags$)&&j(this)))))}componentOnReady(){return j(this).$onReadyPromise$}};o.$lazyBundleId$=t[0],n.includes(s)||i.get(s)||(r.push(s),i.define(s,F(a,o,1)))})))),f.innerHTML=r+"{visibility:hidden}.hydrated{visibility:inherit}",f.setAttribute("data-styles",""),o.insertBefore(f,c?c.nextSibling:o.firstChild),g=!1,d.length?d.map((t=>t.connectedCallback())):u.jmp((()=>p=setTimeout(B,30)))},D=new WeakMap,j=t=>D.get(t),V=(t,e)=>D.set(e.$lazyInstance$=t,e),W=(t,e)=>{const r={$flags$:0,$hostElement$:t,$cmpMeta$:e,$instanceValues$:new Map};return r.$onReadyPromise$=new Promise((t=>r.$onReadyResolve$=t)),t["s-p"]=[],t["s-rc"]=[],D.set(t,r)},$=(t,e)=>e in t,K=(t,e)=>(0,console.error)(t,e),H=new Map,q=(t,e,n)=>{const i=t.$tagName$.replace(/-/g,"_"),o=t.$lazyBundleId$,s=H.get(o);return s?s[i]:r(3993)(`./${o}.entry.js`).then((t=>(H.set(o,t),t[i])),K)},z=new Map,G=[],X=[],Z=(t,e)=>r=>{t.push(r),o||(o=!0,e&&4&u.$flags$?Q(Y):u.raf(Y))},J=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){K(t)}t.length=0},Y=()=>{J(G),J(X),(o=G.length>0)&&u.raf(Y)},Q=t=>c().then(t),tt=Z(X,!0)},3993:(t,e,r)=>{var n={"./connect-modal.entry.js":[2506,506]};function i(t){if(!r.o(n,t))return Promise.resolve().then((()=>{var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}));var e=n[t],i=e[0];return r.e(e[1]).then((()=>r(i)))}i.keys=()=>Object.keys(n),i.id=3993,t.exports=i},7138:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AppConfig:()=>C,BLOCKSTACK_APP_PRIVATE_KEY_LABEL:()=>u,BLOCKSTACK_HANDLER:()=>n,BLOCKSTACK_STORAGE_LABEL:()=>i,ContractCallArgumentType:()=>Ue,DEFAULT_BLOCKSTACK_HOST:()=>o,DEFAULT_CORE_NODE:()=>c,DEFAULT_PROFILE:()=>s,DEFAULT_SCOPE:()=>a,LOCALSTORAGE_SESSION_KEY:()=>f,NAME_LOOKUP_PATH:()=>h,TransactionTypes:()=>Be,UserSession:()=>ge,authenticate:()=>We,decryptPrivateKey:()=>mt,defaultAuthURL:()=>xe,doPublicKeysMatchIssuer:()=>Mt,doPublicKeysMatchUsername:()=>Et,doSignaturesMatchPublicKeys:()=>At,fetchAppManifest:()=>_t,getAddressFromDID:()=>V,getAuthRequestFromURL:()=>vt,getDIDType:()=>j,getOrCreateUserSession:()=>Ve,getStacksProvider:()=>Me,getUserData:()=>$e,isExpirationDateValid:()=>Tt,isIssuanceDateValid:()=>kt,isManifestUriValid:()=>Ct,isMobile:()=>De,isRedirectUriValid:()=>Ot,isStacksWalletInstalled:()=>Ee,lookupProfile:()=>Ae,makeAuthRequest:()=>pt,makeAuthResponse:()=>yt,makeContractCallToken:()=>Dn,makeContractDeployToken:()=>jn,makeDIDFromAddress:()=>L,makeDIDFromPublicKey:()=>D,makeSTXTransferToken:()=>Vn,openContractCall:()=>Kn,openContractDeploy:()=>Hn,openSTXTransfer:()=>qn,shouldUsePopup:()=>je,showBlockstackConnect:()=>Xn,showConnect:()=>Gn,verifyAuthRequest:()=>Pt,verifyAuthRequestAndLoadManifest:()=>It,verifyAuthResponse:()=>xt});const n="blockstack",i="blockstack",o="https://browser.blockstack.org/auth",s={"@type":"Person","@context":"http://schema.org"},a=["store_write"],u="blockstack-transit-private-key",c="https://core.blockstack.org",h="/v1/names",f="blockstack-session",l=["debug","info","warn","error","none"],d={},p={};for(let t=0;t<l.length;t++){const e=l[t];d[e]=t,p[t]=e}class g{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return d.debug<=d[t]}}var m=r(8764),y=r(8608),w=r.n(y),b=r(8764).Buffer;const v=void 0!==b?b:m.Buffer;function _(){return new Date((new Date).setMonth((new Date).getMonth()+1))}function S(t,e){void 0!==t&&""!==t||(t="0.0.0"),void 0!==e&&""!==t||(e="0.0.0");const r=t.split(".").map((t=>parseInt(t,10))),n=e.split(".").map((t=>parseInt(t,10)));for(let i=0;i<e.length;i++)if(i>=t.length&&n.push(0),r[i]<n[i])return!1;return!0}function A(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function M(t,e){try{const r=new URL(t),n=new URL(e),i=0|parseInt(r.port||"0",10)||("https:"===r.protocol?443:80),o=0|parseInt(n.port||"0",10)||("https:"===n.protocol?443:80),s={scheme:r.protocol===n.protocol,hostname:r.hostname===n.hostname,port:i===o,absolute:(t.includes("http://")||t.includes("https://"))&&(e.includes("http://")||e.includes("https://"))};return s.scheme&&s.hostname&&s.port&&s.absolute}catch(t){return console.log(t),console.log("Parsing error in same URL origin check"),!1}}function E(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:i}={}){let o;try{if(o=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")}(),o){const e=o[t];if(e)return e}}catch(e){g.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=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.`}(o,t.toString(),n);throw g.error(e),new Error(e)}if(i)return{}}function k(t,e,r){return function(t,e){const r=T(t,e);return new(w())(r.toString())}(t,e).toArrayLike(v,"be",r)}function T(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.");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=v.from(t,"hex")}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||v.isBuffer(r)){if(e){const t=new(w())(r,"be").fromTwos(8*r.byteLength);return BigInt(t.toString())}return BigInt(new(w())(r,"be").toString())}if(r instanceof w()||w().isBN(r))return BigInt(r.toString());throw new TypeError("Invalid value type. Must be a number, bigint, integer-string, hex-string, BN.js instance, or Buffer.")}class C{constructor(t,e,r,n,i,s){var u;void 0===t&&(t=a.slice()),void 0===e&&(e=null===(u=E("location",{returnEmptyObject:!0}))||void 0===u?void 0:u.origin),void 0===r&&(r=""),void 0===n&&(n="/manifest.json"),void 0===i&&(i=void 0),void 0===s&&(s=o),this.appDomain=e,this.scopes=t,this.redirectPath=r,this.manifestPath=n,this.coreNode=i,this.authenticatorURL=s}redirectURI(){return`${this.appDomain}${this.redirectPath}`}manifestURI(){return`${this.appDomain}${this.manifestPath}`}}r(1905);var O=r(6080);const P={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(P);class I extends Error{constructor(t){super();let e=t.message,r=`Error Code: ${t.code}`,n=this.stack;if(n)r+=`Stack Trace:\n${n}`;else try{throw new Error}catch(t){n=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${r}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class x extends I{constructor(t,e=""){super({code:P.MISSING_PARAMETER,message:e,parameter:t}),this.name="MissingParametersError"}}class N extends I{constructor(t=""){super({code:P.INVALID_DID_ERROR,message:t}),this.name="InvalidDIDError"}}class B extends I{constructor(t){const e=`Failed to login: ${t}`;super({code:P.LOGIN_FAILED_ERROR,message:e}),this.message=e,this.name="LoginFailedError"}}class R extends I{constructor(t="Unable to decrypt cipher object."){super({code:P.FAILED_DECRYPTION_ERROR,message:t}),this.message=t,this.name="FailedDecryptionError"}}class U extends I{constructor(t){super({code:P.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class F extends I{constructor(t){super({code:P.INVALID_STATE,message:t}),this.message=t,this.name="NoSessionDataError"}}function L(t){return`did:btc-addr:${t}`}function D(t){return`did:ecdsa-pub:${t}`}function j(t){const e=t.split(":");if(3!==e.length)throw new N("Decentralized IDs must have 3 parts");if("did"!==e[0].toLowerCase())throw new N('Decentralized IDs must start with "did"');return e[1].toLowerCase()}function V(t){if(t)return"btc-addr"===j(t)?t.split(":")[2]:void 0}var W=r(7656),$=r(1798),K=r.n($),H=r(9072);function q(t){const e=new H.sha256;return e.update(t),e.digest()}var z=r(4574);async function G(){if("undefined"!=typeof crypto&&void 0!==crypto.subtle)return{lib:crypto.subtle,name:"subtleCrypto"};try{return{lib:r(8859),name:"nodeCrypto"}}catch(t){throw new Error('Crypto lib not found. Either the WebCrypto "crypto.subtle" or Node.js "crypto" module must be available.')}}class X{digest(t){const e=new z.Z;e.update(t);const r=e.digest();return Array.isArray(r)?v.from(r):v.from(r.buffer)}}class Z{constructor(t){this.nodeCryptoCreateHash=t}digest(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 X).digest(t)}}}}function J(t){return t||(t=32),K()(t)}function Y(t){const e=(n=q(v.isBuffer(t)?t:v.from(t,"hex")),function(){const t=function(t){try{const e=r(8859);return!!e&&(!t||t(e))}catch(t){return!1}}((t=>"function"==typeof t.createHash&&t.createHash));return t?new Z(t):new X}().digest(n));var n;return W.Lk.toBase58Check(e,W.QW.bitcoin.pubKeyHash)}function Q(t){const e=v.isBuffer(t)?t:v.from(t,"hex");return W.rn.fromPrivateKey(e).publicKey.toString("hex")}var tt=r(6266);class et{constructor(t){this.createHmac=t}async digest(t,e){const r=this.createHmac("sha256",t).update(e).digest();return Promise.resolve(r)}}class rt{constructor(t){this.subtleCrypto=t}async digest(t,e){const r=await this.subtleCrypto.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),n=await this.subtleCrypto.sign({name:"HMAC",hash:"SHA-256"},r,e);return v.from(n)}}class nt{constructor(t,e){this.createCipher=t,this.createDecipher=e}async encrypt(t,e,r,n){if("aes-128-cbc"!==t&&"aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);const i=this.createCipher(t,e,r),o=v.concat([i.update(n),i.final()]);return Promise.resolve(o)}async decrypt(t,e,r,n){if("aes-128-cbc"!==t&&"aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);const i=this.createDecipher(t,e,r),o=v.concat([i.update(n),i.final()]);return Promise.resolve(o)}}class it{constructor(t){this.subtleCrypto=t}async encrypt(t,e,r,n){let i,o;if("aes-128-cbc"===t)i="AES-CBC",o=128;else{if("aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);i="AES-CBC",o=256}const s=await this.subtleCrypto.importKey("raw",e,{name:i,length:o},!1,["encrypt"]),a=await this.subtleCrypto.encrypt({name:i,iv:r},s,n);return v.from(a)}async decrypt(t,e,r,n){let i,o;if("aes-128-cbc"===t)i="AES-CBC",o=128;else{if("aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);i="AES-CBC",o=256}const s=await this.subtleCrypto.importKey("raw",e,{name:i,length:o},!1,["decrypt"]),a=await this.subtleCrypto.decrypt({name:i,iv:r},s,n);return v.from(a)}}async function ot(){const t=await G();return"subtleCrypto"===t.name?new it(t.lib):new nt(t.lib.createCipheriv,t.lib.createDecipheriv)}const st=new tt.ec("secp256k1");var at;async function ut(t,e){return(await async function(){const t=await G();return"subtleCrypto"===t.name?new rt(t.lib):new et(t.lib.createHmac)}()).digest(t,e)}function ct(t){const e=function(t){const e=new H.sha512;return e.update(t),e.digest()}(t);return{encryptionKey:e.slice(0,32),hmacKey:e.slice(32)}}function ht(t){const e=t.toArrayLike(v,"be",32);if(32!==e.byteLength)throw new Error("Failed to generate a 32-byte BN");return e}async function ft(t,e,r,n){const i=function(t){const e={result:!1,reason_data:"Invalid public key format",reason:at.InvalidFormat},r={result:!1,reason_data:"Public key is not a point",reason:at.IsNotPoint};if(66!==t.length&&130!==t.length)return e;const n=t.slice(0,2);if(130===t.length&&"04"!==n)return e;if(66===t.length&&"02"!==n&&"03"!==n)return e;if(null===t.match(/^[0-9a-f]+$/i))return e;const i=new tt.ec("secp256k1");try{const e=i.keyFromPublic(v.from(t,"hex")).validate();return{result:e.result,reason_data:e.reason,reason:e.result?null:at.IsNotPoint}}catch(t){return r}}(t);if(!i.result)throw i;const o=st.keyFromPublic(t,"hex").getPublic(),s=st.genKeyPair(),a=v.from(s.getPublic().encodeCompressed()),u=ct(ht(s.derive(o))),c=K()(16),h=await async function(t,e,r){const n=await ot();return await n.encrypt("aes-256-cbc",e,t,r)}(c,u.encryptionKey,e),f=v.concat([c,a,h]),l=await ut(u.hmacKey,f);let d;if(n&&"hex"!==n){if("base64"!==n)throw new Error(`Unexpected cipherTextEncoding "${n}"`);d=h.toString("base64")}else d=h.toString("hex");const p={iv:c.toString("hex"),ephemeralPK:a.toString("hex"),cipherText:d,mac:l.toString("hex"),wasString:!!r};return n&&"hex"!==n&&(p.cipherTextEncoding=n),p}async function lt(t,e){const r=st.keyFromPrivate(t,"hex");let n=null;try{n=st.keyFromPublic(e.ephemeralPK,"hex").getPublic()}catch(t){throw new R("Unable to get public key from cipher object. You might be trying to decrypt an unencrypted object.")}const i=ct(ht(r.derive(n))),o=v.from(e.iv,"hex");let s;if(e.cipherTextEncoding&&"hex"!==e.cipherTextEncoding){if("base64"!==e.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${e.cipherText}"`);s=v.from(e.cipherText,"base64")}else s=v.from(e.cipherText,"hex");const a=v.concat([o,v.from(n.encodeCompressed()),s]),u=await ut(i.hmacKey,a);if(!function(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return 0===r}(v.from(e.mac,"hex"),u))throw new R("Decryption failed: failure in MAC check");const c=await async function(t,e,r){const n=await ot();return await n.decrypt("aes-256-cbc",e,t,r)}(o,i.encryptionKey,s);return e.wasString?c.toString():c}!function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(at||(at={}));const dt="1.3.1";function pt(t,e,r,n=a.slice(),i,o=_().getTime(),s={}){const u=t=>{const e=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"));const c=Object.assign({},s,{jti:A(),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:dt,do_not_include_profile:!0,supports_hub_url:!0,scopes:n}),h=O.SECP256K1Client.derivePublicKey(t);c.public_keys=[h];const f=Y(h);return c.iss=L(f),new O.TokenSigner("ES256k",t).sign(c)}async function gt(t,e){const r=await ft(t,v.from(e),!0),n=JSON.stringify(r);return v.from(n).toString("hex")}async function mt(t,e){const r=v.from(e,"hex").toString(),n=JSON.parse(r),i=await lt(t,n);if("string"!=typeof i)throw new Error("Unable to correctly decrypt private key");return i}async function yt(t,e={},r=null,n,i=null,o=null,s=_().getTime(),a=null,u=null,c=null,h=null){const f=O.SECP256K1Client.derivePublicKey(t),l=Y(f);let d=o,p=i,g={};null!=o&&(null!=a&&(d=await gt(a,o),null!=i&&(p=await gt(a,i))),g={email:(null==n?void 0:n.email)?n.email:null,profile_url:(null==n?void 0:n.profileUrl)?n.profileUrl:null,hubUrl:u,blockstackAPIUrl:c,associationToken:h,version:dt});const m=Object.assign({},{jti:A(),iat:Math.floor((new Date).getTime()/1e3),exp:Math.floor(s/1e3),iss:L(l),private_key:d,public_keys:[f],profile:e,username:r,core_token:p},g);return new O.TokenSigner("ES256k",t).sign(m)}var wt=r(7563),bt=r(3930);function vt(){const t=E("location",{throwIfUnavailable:!0,usageDesc:"getAuthRequestFromURL"});if(null==t?void 0:t.search){const e=wt.parse(null==t?void 0:t.search);return e.authRequest?e.authRequest.split("blockstack:").join(""):null}return null}async function _t(t){if(!t)throw new Error("Invalid auth request");const e=(0,O.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");const r=e.manifest_uri;try{const t=await(0,bt.I)(r),e=await t.text(),n=JSON.parse(e);return Object.assign(Object.assign({},n),{manifestURI:r})}catch(t){throw console.log(t),new Error("Could not fetch manifest.json")}}var St=r(7701);function At(t){const e=(0,O.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");const r=e.public_keys;if(1!==r.length)throw new Error("Multiple public keys are not supported");{const e=r[0];try{return new O.TokenVerifier("ES256k",e).verify(t)}catch(t){return!1}}}function Mt(t){const e=(0,O.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");const r=e.public_keys,n=V(e.iss);if(1!==r.length)throw new Error("Multiple public keys are not supported");return Y(r[0])===n}async function Et(t,e){try{const r=(0,O.decodeToken)(t).payload;if("string"==typeof r)throw new Error("Unexpected token payload type of string");if(!r.username)return!0;if(null===r.username)return!0;if(null===e)return!1;const n=r.username,i=`${e.replace(/\/$/,"")}/${n}`,o=await(0,bt.I)(i),s=await o.text(),a=JSON.parse(s);if(a.hasOwnProperty("address")){const t=a.address;let e=t;try{e=(0,St.xs)(t,0)}catch(t){}return e===V(r.iss)}return!1}catch(t){return console.log(t),console.log("Error checking `doPublicKeysMatchUsername`"),!1}}function kt(t){const e=(0,O.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;const t=new Date(1e3*e.iat);return!((new Date).getTime()<t.getTime())}return!0}function Tt(t){const e=(0,O.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;const t=new Date(1e3*e.exp);return!((new Date).getTime()>t.getTime())}return!0}function Ct(t){const e=(0,O.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");return M(e.domain_name,e.manifest_uri)}function Ot(t){const e=(0,O.decodeToken)(t).payload;if("string"==typeof e)throw new Error("Unexpected token payload type of string");return M(e.domain_name,e.redirect_uri)}async function Pt(t){if("none"===(0,O.decodeToken)(t).header.alg)throw new Error("Token must be signed in order to be verified");return(await Promise.all([Tt(t),kt(t),At(t),Mt(t),Ct(t),Ot(t)])).every((t=>t))}async function It(t){if(!await Pt(t))throw new Error("Token is an invalid auth request");return _t(t)}async function xt(t,e,r){const n=await Promise.all([Tt(t),kt(t),At(t),Mt(t)]);return!!(await Promise.all([e].concat(r||[]).map((e=>Et(t,e))))).includes(!0)&&n.every((t=>t))}const Nt="1.0.0";class Bt{constructor(t){this.version=Nt,this.userData=t.userData,this.transitKey=t.transitKey,this.etags=t.etags?t.etags:{}}static fromJSON(t){if(t.version!==Nt)throw new U(`JSON data version ${t.version} not supported by SessionData`);const e={coreNode:t.coreNode,userData:t.userData,transitKey:t.transitKey,etags:t.etags};return new Bt(e)}toString(){return JSON.stringify(this)}}class Rt{constructor(t){if(t){const e=new Bt(t);this.setSessionData(e)}}getSessionData(){throw new Error("Abstract class")}setSessionData(t){throw new Error("Abstract class")}deleteSessionData(){throw new Error("Abstract class")}}class Ut extends Rt{constructor(t){super(t),this.sessionData||this.setSessionData(new Bt({}))}getSessionData(){if(!this.sessionData)throw new F("No session data was found.");return this.sessionData}setSessionData(t){return this.sessionData=t,!0}deleteSessionData(){return this.setSessionData(new Bt({})),!0}}class Ft extends Rt{constructor(t){if(super(t),t&&t.storeOptions&&t.storeOptions.localStorageKey&&"string"==typeof t.storeOptions.localStorageKey?this.key=t.storeOptions.localStorageKey:this.key=f,!localStorage.getItem(this.key)){const t=new Bt({});this.setSessionData(t)}}getSessionData(){const t=localStorage.getItem(this.key);if(!t)throw new F("No session data was found in localStorage");const e=JSON.parse(t);return Bt.fromJSON(e)}setSessionData(t){return localStorage.setItem(this.key,t.toString()),!0}deleteSessionData(){return localStorage.removeItem(this.key),this.setSessionData(new Bt({})),!0}}var Lt,Dt,jt,Vt,Wt,$t,Kt,Ht,qt,zt,Gt,Xt,Zt,Jt,Yt,Qt,te,ee,re,ne,ie,oe,se,ae,ue=r(2721);!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(Lt||(Lt={})),Lt.Mainnet,(Kt=Dt||(Dt={}))[Kt.Address=0]="Address",Kt[Kt.Principal=1]="Principal",Kt[Kt.LengthPrefixedString=2]="LengthPrefixedString",Kt[Kt.MemoString=3]="MemoString",Kt[Kt.AssetInfo=4]="AssetInfo",Kt[Kt.PostCondition=5]="PostCondition",Kt[Kt.PublicKey=6]="PublicKey",Kt[Kt.LengthPrefixedList=7]="LengthPrefixedList",Kt[Kt.Payload=8]="Payload",Kt[Kt.MessageSignature=9]="MessageSignature",Kt[Kt.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"}(jt||(jt={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(Vt||(Vt={})),($t=Wt||(Wt={}))[$t.Mainnet=0]="Mainnet",$t[$t.Testnet=128]="Testnet",Wt.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Ht||(Ht={})),(ae=qt||(qt={}))[ae.STX=0]="STX",ae[ae.Fungible=1]="Fungible",ae[ae.NonFungible=2]="NonFungible",(se=zt||(zt={}))[se.Standard=4]="Standard",se[se.Sponsored=5]="Sponsored",(oe=Gt||(Gt={}))[oe.SerializeP2PKH=0]="SerializeP2PKH",oe[oe.SerializeP2SH=1]="SerializeP2SH",oe[oe.SerializeP2WPKH=2]="SerializeP2WPKH",oe[oe.SerializeP2WSH=3]="SerializeP2WSH",(ie=Xt||(Xt={}))[ie.MainnetSingleSig=22]="MainnetSingleSig",ie[ie.MainnetMultiSig=20]="MainnetMultiSig",ie[ie.TestnetSingleSig=26]="TestnetSingleSig",ie[ie.TestnetMultiSig=21]="TestnetMultiSig",(ne=Zt||(Zt={}))[ne.Compressed=0]="Compressed",ne[ne.Uncompressed=1]="Uncompressed",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"}(Jt||(Jt={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(Yt||(Yt={})),(re=Qt||(Qt={}))[re.Origin=1]="Origin",re[re.Standard=2]="Standard",re[re.Contract=3]="Contract",function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(te||(te={})),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"}(ee||(ee={})),r(4098);var ce=r(361),he=r.n(ce);function fe(t,e=Wt.Mainnet){var r;return t="string"==typeof t?t:t.toString("hex"),r=function(t,e){return{type:Dt.Address,version:t,hash160:e}}(function(t,e){switch(t){case Gt.SerializeP2PKH:switch(e){case Wt.Mainnet:return Xt.MainnetSingleSig;case Wt.Testnet:return Xt.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case Gt.SerializeP2SH:case Gt.SerializeP2WPKH:case Gt.SerializeP2WSH:switch(e){case Wt.Mainnet:return Xt.MainnetMultiSig;case Wt.Testnet:return Xt.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}(Gt.SerializeP2PKH,e),(t=>{const e=(new H.sha256).update(t).digest();return v.from((new z.Z).update(e).digest())})(v.from(t,"hex")).toString("hex")),(0,St.H4)(r.version,r.hash160).toString()}function le(t,e=null){let r;r=e?function(t,e){const r=(0,O.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");const i=n.issuer.publicKey,o=fe(i);if(e===i);else if(e!==o)throw new Error("Token issuer public key does not match the verifying value");const s=new O.TokenVerifier(r.header.alg,i);if(!s)throw new Error("Invalid token verifier");if(!s.verify(t))throw new Error("Token verification failed");return r}(t,e):(0,O.decodeToken)(t);let n={};if(r.hasOwnProperty("payload")){const t=r.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(n=t.claim)}return n}var de=r(663);const pe="_blockstackDidCheckEchoReply";class ge{constructor(t){let e=!0;if("undefined"==typeof window&&"undefined"==typeof self&&(e=!1),t&&t.appConfig)this.appConfig=t.appConfig;else{if(!e)throw new x("You need to specify options.appConfig");this.appConfig=new C}t&&t.sessionStore?this.store=t.sessionStore:this.store=e?t?new Ft(t.sessionOptions):new Ft:t?new Ut(t.sessionOptions):new Ut}makeAuthRequest(t,e,r,n,i,o=function(){return new Date((new Date).setHours((new Date).getHours()+1))}().getTime(),s={}){const a=this.appConfig;if(!a)throw new U("Missing AppConfig");return pt(t=t||this.generateAndStoreTransitKey(),e=e||a.redirectURI(),r=r||a.manifestURI(),n=n||a.scopes,i=i||a.appDomain,o,s)}generateAndStoreTransitKey(){const t=this.store.getSessionData(),e=W.rn.makeRandom({rng:J}).privateKey.toString("hex");return t.transitKey=e,this.store.setSessionData(t),e}getAuthResponseToken(){var t;const e=null===(t=E("location",{throwIfUnavailable:!0,usageDesc:"getAuthResponseToken"}))||void 0===t?void 0:t.search;if(e){const t=wt.parse(e);return t.authResponse?t.authResponse:""}return""}isSignInPending(){try{if(function(){let t;if("undefined"!=typeof self)t=self;else{if("undefined"==typeof window)return!1;t=window}if(!t.location||!t.localStorage)return!1;const e=t[pe];if("boolean"==typeof e)return e;const r=(n=t.location.search)?(/^[?#]/.test(n)?n.slice(1):n).split("&").reduce(((t,e)=>{const[r,n]=e.split("=");return t[r]=n?decodeURIComponent(n.replace(/\+/g," ")):"",t}),{}):{};var n;const i=r.echoReply;if(i){t[pe]=!0;const e=`echo-reply-${i}`;return t.localStorage.setItem(e,"success"),t.setTimeout((()=>{const e=r.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()}isUserSignedIn(){return!!this.store.getSessionData().userData}async handlePendingSignIn(t=this.getAuthResponseToken()){const e=this.store.getSessionData();if(e.userData)throw new B("Existing user session found.");const r=this.store.getSessionData().transitKey;let n=this.appConfig&&this.appConfig.coreNode;n||(n=(new de.StacksMainnet).bnsLookupUrl);const i=(0,O.decodeToken)(t).payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");const o=`${n}${h}`,a=[`https://stacks-node-api.stacks.co${h}`,`https://registrar.stacks.co${h}`].filter((t=>t!==o));if(!await xt(t,o,a))throw new B("Invalid authentication response.");let u=i.private_key,c=i.core_token;if(S(i.version,"1.1.0")){if(void 0===r||null==r)throw new B("Authenticating with protocol > 1.1.0 requires transit key, and none found.");if(void 0!==i.private_key&&null!==i.private_key)try{u=await mt(r,i.private_key)}catch(t){g.warn("Failed decryption of appPrivateKey, will try to use as given");try{!function(t,e){const r={network:W.QW.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 W.rn.fromPrivateKey(v.from(t.slice(0,64),"hex"),r)}if(64===t.length)return r.compressed=!1,W.rn.fromPrivateKey(v.from(t,"hex"),r);throw new Error("Improperly formatted private-key hex string: length should be 64 or 66.")}(i.private_key)}catch(t){throw new B("Failed decrypting appPrivateKey. Usually means that the transit key has changed during login.")}}if(null!=c)try{c=await mt(r,c)}catch(t){g.info("Failed decryption of coreSessionToken, will try to use as given")}}let f,l=ue.sM;S(i.version,"1.2.0")&&null!==i.hubUrl&&void 0!==i.hubUrl&&(l=i.hubUrl),S(i.version,"1.3.0")&&null!==i.associationToken&&void 0!==i.associationToken&&(f=i.associationToken);const d={username:i.username,profile:i.profile,email:i.email,decentralizedID:i.iss,identityAddress:V(i.iss),appPrivateKey:u,coreSessionToken:c,authResponseToken:t,hubUrl:l,coreNode:i.blockstackAPIUrl,gaiaAssociationToken:f},p=i.profile_url;if(!d.profile&&p){const t=await(0,bt.I)(p);if(t.ok){const e=await t.text(),r=JSON.parse(e);d.profile=le(r[0].token)}else d.profile=Object.assign({},s)}else d.profile=i.profile;return e.userData=d,this.store.setSessionData(e),d}loadUserData(){const t=this.store.getSessionData().userData;if(!t)throw new U("No user data found. Did the user sign in?");return t}encryptContent(t,e){const r=Object.assign({},e);return r.privateKey||(r.privateKey=this.loadUserData().appPrivateKey),async function(t,e){const r=Object.assign({},e);let n,i;if(!r.publicKey){if(!r.privateKey)throw new Error("Either public key or private key must be supplied for encryption.");r.publicKey=Q(r.privateKey)}i="boolean"==typeof r.wasString?r.wasString:"string"==typeof t;const o="string"==typeof t?v.from(t):t,s=await ft(r.publicKey,o,i,r.cipherTextEncoding);let a=JSON.stringify(s);if(r.sign){"string"==typeof r.sign?n=r.sign:n||(n=r.privateKey);const t=function(t,e){const r=e instanceof v?e:v.from(e),n=st.keyFromPrivate(t,"hex"),i=Q(t),o=q(r);return{signature:n.sign(o).toDER("hex"),publicKey:i}}(n,a),e={signature:t.signature,publicKey:t.publicKey,cipherText:a};a=JSON.stringify(e)}return a}(t,r)}decryptContent(t,e){const r=Object.assign({},e);return r.privateKey||(r.privateKey=this.loadUserData().appPrivateKey),function(t,e){const r=Object.assign({},e);if(!r.privateKey)throw new Error("Private key is required for decryption.");try{const e=JSON.parse(t);return lt(r.privateKey,e)}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)}signUserOut(t){this.store.deleteSessionData(),t&&"undefined"!=typeof location&&location.href&&(location.href=t)}}function me(t,e){let r;return e.proof&&e.proof.url&&(r=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:r}}var ye=r(3624),we=r(2324);const be={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class ve{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,e,r,n,i="ES256K",o=new Date,s=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==i)throw new Error("Signing algorithm not supported");const a=O.SECP256K1Client.derivePublicKey(e);r||(r={publicKey:a}),n||(n={publicKey:a});const u=new O.TokenSigner(i,e),c={jti:A(),iat:o.toISOString(),exp:s.toISOString(),subject:r,issuer:n,claim:t};return u.sign(c)}(this.toJSON(),t)}static validateSchema(t,e=!1){return be.strict=e,we.validate(be,t)}static fromToken(t,e=null){const r=le(t,e);return new ve(r)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const 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,ye.ar)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const _e={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class Se extends ve{constructor(t={}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return _e.strict=e,we.validate(be,t)}static fromToken(t,e=null){const r=le(t,e);return new Se(r)}static fromLegacyFormat(t){const e=function(t){const 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});const 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}]);const 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(me("twitter",t.twitter)),t.facebook&&t.facebook.username&&n.push(me("facebook",t.facebook)),t.github&&t.github.username&&n.push(me("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);return new Se(e)}toJSON(){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()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let 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())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map((t=>"avatar"===t.name?(e=t.contentUrl,e):null)),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const r=[];return t.hasOwnProperty("account")&&e&&t.account.map((t=>{let n=!1,i=null;return e.map((e=>(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)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const 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())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let r=null;if(t.hasOwnProperty("birthDate")){const n=new Date(t.birthDate);r=`${e[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`}return r}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}function Ae(t){if(!t.username)return Promise.reject();const e=t.network?t.network:new de.StacksMainnet;let r;if(t.zoneFileLookupURL){const e=`${t.zoneFileLookupURL.replace(/\/$/,"")}/${t.username}`;r=(0,bt.I)(e).then((t=>t.json()))}else r=e.getNameInfo(t.username);return r.then((t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return e=t.zonefile,r=t.address,new Promise(((t,n)=>{let i=null;try{i=(0,ye.FW)(e),i.hasOwnProperty("$origin")||(i=null)}catch(t){n(t)}let 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;const e=t.uri[0];if(!e.hasOwnProperty("target"))return null;let r=e.target;return r.startsWith("https")||r.startsWith("http")||(r=`https://${r}`),r}(i),o?(0,bt.I)(o).then((t=>t.text())).then((t=>JSON.parse(t))).then((e=>{const n=le(e[0].token,r);t(n)})).catch((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{let r=null;try{r=JSON.parse(e),r=Se.fromLegacyFormat(r).profile()}catch(t){n(t)}t(r)}}));var e,r;throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}function Me(){return window.StacksProvider||window.BlockstackProvider}function Ee(){return!!Me()}function ke(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function Te(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){ke(o,n,i,s,a,"next",t)}function a(t){ke(o,n,i,s,a,"throw",t)}s(void 0)}))}}function Ce(){return Ce=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},Ce.apply(this,arguments)}function Oe(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 Pe=r(5666),Ie=r.n(Pe),xe="https://app.blockstack.org",Ne="6.4.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=Ne);var Be,Re,Ue,Fe,Le,De=function(){var t=navigator.userAgent;return!!/android/i.test(t)||!!/iPad|iPhone|iPod/.test(t)||/windows phone/i.test(t)},je=function(){return!De()},Ve=function(t){if(!t){var e=new C(["store_write"],document.location.href);t=new ge({appConfig:e})}return t},We=function(){var t=Te(Ie().mark((function t(e){var r,n,i,o,s,a,u,c,h,f,l,d,p,g,m,y,w;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=Me()){t.next=3;break}throw new Error("Unable to authenticate without Hiro Wallet extension");case 3:return n=e.redirectTo,i=void 0===n?"/":n,o=e.manifestPath,s=e.onFinish,a=e.onCancel,u=e.sendToSignIn,c=void 0!==u&&u,h=e.userSession,f=e.appDetails,(l=Ve(h)).isUserSignedIn()&&l.signUserOut(),d=l.generateAndStoreTransitKey(),p=l.makeAuthRequest(d,""+document.location.origin+i,""+document.location.origin+o,l.appConfig.scopes,void 0,void 0,{sendToSignIn:c,appDetails:f,connectVersion:Ne}),t.prev=8,t.next=11,r.authenticationRequest(p);case 11:return g=t.sent,t.next=14,l.handlePendingSignIn(g);case 14:m=(0,O.decodeToken)(g),y=null==m?void 0:m.payload,w=y,null==s||s({authResponse:g,authResponsePayload:w,userSession:l}),t.next=24;break;case 20:t.prev=20,t.t0=t.catch(8),console.error("[Connect] Error during auth request",t.t0),null==a||a();case 24:case"end":return t.stop()}}),t,null,[[8,20]])})));return function(e){return t.apply(this,arguments)}}(),$e=function(){var t=Te(Ie().mark((function t(e){return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=Ve(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)}}();(Re=Be||(Be={})).ContractCall="contract_call",Re.ContractDeploy="smart_contract",Re.STXTransfer="token_transfer",(Fe=Ue||(Ue={})).BUFFER="buffer",Fe.UINT="uint",Fe.INT="int",Fe.PRINCIPAL="principal",Fe.BOOL="bool",function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(Le||(Le={}));const Ke=Le.Mainnet;var He,qe,ze,Ge,Xe,Ze,Je,Ye,Qe,tr,er,rr,nr,ir,or;!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.TransactionAuthField=10]="TransactionAuthField"}(He||(He={})),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"}(qe||(qe={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(ze||(ze={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(Ge||(Ge={})),Ge.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Xe||(Xe={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Ze||(Ze={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(Je||(Je={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(Ye||(Ye={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(Qe||(Qe={})),function(t){t[t.Compressed=0]="Compressed",t[t.Uncompressed=1]="Uncompressed"}(tr||(tr={})),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"}(er||(er={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(rr||(rr={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(nr||(nr={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(ir||(ir={})),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"}(or||(or={}));class sr{constructor(){this._value=[]}get value(){return this._value}appendHexString(t){this.value.push(v.from(t,"hex"))}push(t){return this._value.push(t)}appendByte(t){if(!Number.isInteger(t)||t<0||t>255)throw new Error(`Value ${t} is not a valid byte`);this.value.push(v.from([t]))}concatBuffer(){return v.concat(this.value)}}const ar=(t,e)=>t.padStart(e,"0"),ur=(t,e=8)=>t.toString(16).padStart(2*e,"0"),cr=t=>parseInt(t,16),hr=(t,e)=>!!t&&v.from(t).length>e;function fr(t){return he()(t)}class lr extends H.sha512{constructor(){super(),Object.assign(this,{_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})}digest(t){const e=super.digest().slice(0,32);return t?e.toString(t):e}}const dr=t=>(new lr).update(t).digest("hex"),pr=t=>{const e=(new H.sha256).update(t).digest();return v.from((new z.Z).update(e).digest())};class gr extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class mr extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}Error;class yr extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class wr extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}function br(t){if(65!=v.from(t,"hex").byteLength)throw Error("Invalid signature");return{type:He.MessageSignature,data:t}}function vr(){return{type:He.MessageSignature,data:v.alloc(65,0).toString("hex")}}function _r(t){const e=new sr;return e.appendHexString(t.data),e.concatBuffer()}function Sr(t){return br(t.readBuffer(65).toString("hex"))}var Ar,Mr,Er;function kr(t,e){return{pubKeyEncoding:t,type:He.TransactionAuthField,contents:e}}function Tr(t){const e=t.readUInt8Enum(Ar,(t=>{throw new mr(`Could not read ${t} as AuthFieldType`)}));switch(e){case Ar.PublicKeyCompressed:return kr(tr.Compressed,$r(t));case Ar.PublicKeyUncompressed:return kr(tr.Uncompressed,$r(t));case Ar.SignatureCompressed:return kr(tr.Compressed,Sr(t));case Ar.SignatureUncompressed:return kr(tr.Uncompressed,Sr(t));default:throw new Error(`Unknown auth field type: ${JSON.stringify(e)}`)}}function Cr(t,e,r,n){const i=fn(0,t,1,[jr(e)]).hash160,o=Vr(jr(e))?tr.Compressed:tr.Uncompressed;return{hashMode:t,signer:i,nonce:T(r,!1),fee:T(n,!1),keyEncoding:o,signature:vr()}}function Or(t){return"signature"in t}function Pr(t){const e=fr(t);return e.nonce=0,e.fee=0,Or(e)?e.signature=vr():e.fields=[],Object.assign(Object.assign({},e),{nonce:BigInt(0),fee:BigInt(0)})}function Ir(t){return Or(t)?function(t){const e=new sr;return e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(k(t.nonce,!1,8)),e.push(k(t.fee,!1,8)),e.appendByte(t.keyEncoding),e.push(_r(t.signature)),e.concatBuffer()}(t):function(t){const e=new sr;e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(k(t.nonce,!1,8)),e.push(k(t.fee,!1,8));const r=Sn(t.fields);e.push(An(r));const n=v.alloc(2);return n.writeUInt16BE(t.signaturesRequired,0),e.push(n),e.concatBuffer()}(t)}function xr(t){const e=t.readUInt8Enum(Ye,(t=>{throw new mr(`Could not parse ${t} as AddressHashMode`)}));return e===Ye.SerializeP2PKH||e===Ye.SerializeP2WPKH?function(t,e){const r=e.readBuffer(20).toString("hex"),n=BigInt("0x"+e.readBuffer(8).toString("hex")),i=BigInt("0x"+e.readBuffer(8).toString("hex")),o=e.readUInt8Enum(tr,(t=>{throw new mr(`Could not parse ${t} as PubKeyEncoding`)}));if(t===Ye.SerializeP2WPKH&&o!=tr.Compressed)throw new mr("Failed to parse singlesig spending condition: incomaptible hash mode and key encoding");return{hashMode:t,signer:r,nonce:n,fee:i,keyEncoding:o,signature:Sr(e)}}(e,t):function(t,e){const r=e.readBuffer(20).toString("hex"),n=BigInt("0x"+e.readBuffer(8).toString("hex")),i=BigInt("0x"+e.readBuffer(8).toString("hex")),o=Mn(e,He.TransactionAuthField).values;let s=!1,a=0;for(const t of o)switch(t.contents.type){case He.PublicKey:Vr(t.contents)||(s=!0);break;case He.MessageSignature:if(t.pubKeyEncoding===tr.Uncompressed&&(s=!0),a+=1,65536===a)throw new wr("Failed to parse multisig spending condition: too many signatures")}const u=e.readUInt16BE();if(a!==u)throw new wr("Incorrect number of signatures");if(s&&t===Ye.SerializeP2SH)throw new wr("Uncompressed keys are not allowed in this hash mode");return{hashMode:t,signer:r,nonce:n,fee:i,fields:o,signaturesRequired:u}}(e,t)}function Nr(t,e,r,n){const i=t+v.from([e]).toString("hex")+k(r,!1,8).toString("hex")+k(n,!1,8).toString("hex");if(49!==v.from(i,"hex").byteLength)throw Error("Invalid signature hash length");return dr(v.from(i,"hex"))}function Br(t,e,r){const n=t+((i=(Vr(e)?tr.Compressed:tr.Uncompressed).toString(16)).length%2==0?i:`0${i}`)+r.data;var i;const o=v.from(n,"hex");if(o.byteLength>98)throw Error("Invalid signature hash length");return dr(o)}function Rr(t,e,r,n,i){const o=Nr(t,e,r,n),s=function(t,e){const r=new tt.ec("secp256k1").keyFromPrivate(t.data.toString("hex").slice(0,64),"hex").sign(e,"hex",{canonical:!0}),n=ar(r.r.toString("hex"),64),i=ar(r.s.toString("hex"),64);if(void 0===r.recoveryParam||null===r.recoveryParam)throw new Error('"signature.recoveryParam" is not set');return br(ur(r.recoveryParam,1)+n+i)}(i,o),a=function(t){return function(t){const e=function(t){const e="string"==typeof t?v.from(t,"hex"):t;let r;if(33===e.length){if(1!==e[e.length-1])throw new Error("Improperly formatted private-key. 33 byte length usually indicates compressed key, but last byte must be == 0x01");r=!0}else{if(32!==e.length)throw new Error(`Improperly formatted private-key hex string: length should be 32 or 33 bytes, provided with length ${e.length}`);r=!1}return{data:e,compressed:r}}(t);return jr(new tt.ec("secp256k1").keyFromPrivate(e.data.toString("hex").slice(0,64),"hex").getPublic(e.compressed,"hex"))}(t.data)}(i);return{nextSig:s,nextSigHash:Br(o,a,s)}}function Ur(t,e,r,n,i,o){const s=Nr(t,e,r,n),a=jr(function(t,e,r=tr.Compressed){const n=new tt.ec("secp256k1"),i=n.keyFromPrivate(t,"hex").getPrivate().toString(10),o=function(t){if(t.length<129)throw new Error("Invalid signature");const e=t.substr(0,2),r=t.substr(2,64),n=t.substr(66,64);return{recoveryParam:cr(e),r,s:n}}(e.data),s=n.recoverPubKey(i,o,o.recoveryParam,"hex");return r==tr.Uncompressed?s.encode("hex"):s.encodeCompressed("hex")}(s,o,i));return{pubKey:a,nextSigHash:Br(s,a,o)}}function Fr(t){return{authType:Je.Standard,spendingCondition:t}}function Lr(t,e){return{authType:Je.Sponsored,spendingCondition:t,sponsorSpendingCondition:e||Cr(Ye.SerializeP2PKH,"0".repeat(66),0,0)}}function Dr(t){if(t.spendingCondition)switch(t.authType){case Je.Standard:return Fr(Pr(t.spendingCondition));case Je.Sponsored:return Lr(Pr(t.spendingCondition),function(){const t=Cr(Ye.SerializeP2PKH,"",0,0);return t.signer=(He.Address,Qe.MainnetSingleSig,"0".repeat(40)),t.keyEncoding=tr.Compressed,t.signature=vr(),t}());default:throw new yr("Unexpected authorization type for signing")}throw new Error("Authorization missing SpendingCondition")}function jr(t){return{type:He.PublicKey,data:v.from(t,"hex")}}function Vr(t){return!t.data.toString("hex").startsWith("04")}function Wr(t){const e=new sr;return e.push(t.data),e.concatBuffer()}function $r(t){const e=t.readUInt8(),r=4!==e?32:64;return n=v.concat([v.from([e]),t.readBuffer(r)]),{type:He.PublicKey,data:n};var n}!function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}(Ar||(Ar={})),(Er=Mr||(Mr={}))[Er.Int=0]="Int",Er[Er.UInt=1]="UInt",Er[Er.Buffer=2]="Buffer",Er[Er.BoolTrue=3]="BoolTrue",Er[Er.BoolFalse=4]="BoolFalse",Er[Er.PrincipalStandard=5]="PrincipalStandard",Er[Er.PrincipalContract=6]="PrincipalContract",Er[Er.ResponseOk=7]="ResponseOk",Er[Er.ResponseErr=8]="ResponseErr",Er[Er.OptionalNone=9]="OptionalNone",Er[Er.OptionalSome=10]="OptionalSome",Er[Er.List=11]="List",Er[Er.Tuple=12]="Tuple",Er[Er.StringASCII=13]="StringASCII",Er[Er.StringUTF8=14]="StringUTF8";var Kr=r(2040),Hr=r.n(Kr);function qr(t,e){const r=v.from([t]);return v.concat([r,e])}function zr(t,e){const r=new sr,n=v.from(t.data,e),i=v.alloc(4);return i.writeUInt32BE(n.length,0),r.push(i),r.push(n),qr(t.type,r.concatBuffer())}function Gr(t){switch(t.type){case Mr.BoolTrue:case Mr.BoolFalse:return function(t){return v.from([t.type])}(t);case Mr.OptionalNone:case Mr.OptionalSome:return(e=t).type===Mr.OptionalNone?v.from([e.type]):qr(e.type,Gr(e.value));case Mr.Buffer:return function(t){const e=v.alloc(4);return e.writeUInt32BE(t.buffer.length,0),qr(t.type,v.concat([e,t.buffer]))}(t);case Mr.UInt:return function(t){const e=new(Hr())(t.value.toString()).toArrayLike(v,"be",16);return qr(t.type,e)}(t);case Mr.Int:return function(t){const e=new(Hr())(t.value.toString()).toTwos(128).toArrayLike(v,"be",16);return qr(t.type,e)}(t);case Mr.PrincipalStandard:return function(t){return qr(t.type,ln(t.address))}(t);case Mr.PrincipalContract:return function(t){return qr(t.type,v.concat([ln(t.address),mn(t.contractName)]))}(t);case Mr.ResponseOk:case Mr.ResponseErr:return function(t){return qr(t.type,Gr(t.value))}(t);case Mr.List:return function(t){const e=new sr,r=v.alloc(4);r.writeUInt32BE(t.list.length,0),e.push(r);for(const r of t.list){const t=Gr(r);e.push(t)}return qr(t.type,e.concatBuffer())}(t);case Mr.Tuple:return function(t){const e=new sr,r=v.alloc(4);r.writeUInt32BE(Object.keys(t.data).length,0),e.push(r);const n=Object.keys(t.data).sort(((t,e)=>{const r=v.from(t),n=v.from(e);return r.compare(n)}));for(const r of n){const n=gn(r);e.push(mn(n));const i=Gr(t.data[r]);e.push(i)}return qr(t.type,e.concatBuffer())}(t);case Mr.StringASCII:return function(t){return zr(t,"ascii")}(t);case Mr.StringUTF8:return function(t){return zr(t,"utf8")}(t);default:throw new gr("Unable to serialize. Invalid Clarity Value.")}var e}const Xr=BigInt(2)**BigInt(128)-BigInt(1),Zr=BigInt(0),Jr=BigInt(2)**BigInt(127)-BigInt(1),Yr=BigInt(-2)**BigInt(127);function Qr(t,e){if(v.byteLength(e.content)>=128)throw new Error("Contract name must be less than 128 bytes");return{type:Mr.PrincipalContract,address:t,contractName:e}}var tn=r(3717);const en=new Map;function rn(t,e){const r=en.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 en.set(t,n),rn(t,e)}class nn{constructor(t){v.isBuffer(t)?this.smartBuffer=new tn.$({buff:t}):this.smartBuffer=new tn.$(t)}static fromBuffer(t){return new nn({buff:t})}readBuffer(t){return this.smartBuffer.readBuffer(t)}readUInt32BE(t){return this.smartBuffer.readUInt32BE(t)}readUInt8(){return this.smartBuffer.readUInt8()}readUInt16BE(){return this.smartBuffer.readUInt16BE()}readBigUIntLE(t){const e=v.from(this.smartBuffer.readBuffer(t)).reverse().toString();return BigInt(`0x${e}`)}readBigUIntBE(t){const e=this.smartBuffer.readBuffer(t).toString("hex");return BigInt(`0x${e}`)}readBigUInt64BE(){return this.smartBuffer.readBigUInt64BE()}readString(t,e){return this.smartBuffer.readString(t,e)}get readOffset(){return this.smartBuffer.readOffset}set readOffset(t){this.smartBuffer.readOffset=t}get internalBuffer(){return this.smartBuffer.internalBuffer}readUInt8Enum(t,e){const r=this.smartBuffer.readUInt8();if(rn(t,r))return r;throw e(r)}}function on(t){let e;if("string"==typeof t){const r="0x"===t.slice(0,2).toLowerCase();e=new nn(v.from(r?t.slice(2):t,"hex"))}else e=v.isBuffer(t)?new nn(t):t;switch(e.readUInt8Enum(Mr,(t=>{throw new mr(`Cannot recognize Clarity Type: ${t}`)}))){case Mr.Int:return(t=>{const e=T(t,!0);if(e>Jr)throw new RangeError(`Cannot construct clarity integer from value greater than ${Jr.toString()}`);if(e<Yr)throw new RangeError(`Cannot construct clarity integer form value less than ${Yr.toString()}`);return{type:Mr.Int,value:e}})(e.readBuffer(16));case Mr.UInt:return(t=>{const e=T(t,!1);if(e<Zr)throw new RangeError("Cannot construct unsigned clarity integer from negative value");if(e>Xr)throw new RangeError(`Cannot construct unsigned clarity integer greater than ${Xr.toString()}`);return{type:Mr.UInt,value:e}})(e.readBuffer(16));case Mr.Buffer:const t=e.readUInt32BE();return(t=>{if(t.length>1e6)throw new Error("Cannot construct clarity buffer that is greater than 1MB");return{type:Mr.Buffer,buffer:t}})(e.readBuffer(t));case Mr.BoolTrue:return{type:Mr.BoolTrue};case Mr.BoolFalse:return{type:Mr.BoolFalse};case Mr.PrincipalStandard:return r=dn(e),{type:Mr.PrincipalStandard,address:r};case Mr.PrincipalContract:return Qr(dn(e),yn(e));case Mr.ResponseOk:return o=on(e),{type:Mr.ResponseOk,value:o};case Mr.ResponseErr:return function(t){return{type:Mr.ResponseErr,value:t}}(on(e));case Mr.OptionalNone:return{type:Mr.OptionalNone};case Mr.OptionalSome:return function(t){return{type:Mr.OptionalSome,value:t}}(on(e));case Mr.List:const s=e.readUInt32BE(),a=[];for(let t=0;t<s;t++)a.push(on(e));return i=a,{type:Mr.List,list:i};case Mr.Tuple:const u=e.readUInt32BE(),c={};for(let t=0;t<u;t++){const t=yn(e).content;if(void 0===t)throw new mr('"content" is undefined');c[t]=on(e)}return function(t){for(const r in t)if(!(/^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/.test(e=r)&&e.length<128))throw new Error(`"${r}" is not a valid Clarity name`);var e;return{type:Mr.Tuple,data:t}}(c);case Mr.StringASCII:const h=e.readUInt32BE();return(t=>({type:Mr.StringASCII,data:t}))(e.readBuffer(h).toString("ascii"));case Mr.StringUTF8:const f=e.readUInt32BE();return n=e.readBuffer(f).toString("utf8"),{type:Mr.StringUTF8,data:n};default:throw new mr("Unable to deserialize Clarity Value from buffer. Could not find valid Clarity Type.")}var r,n,i,o}function sn(t){const e=new sr;switch(e.appendByte(t.payloadType),t.payloadType){case qe.TokenTransfer:e.push(Gr(t.recipient)),e.push(k(t.amount,!1,8)),e.push(un(t.memo));break;case qe.ContractCall:e.push(un(t.contractAddress)),e.push(un(t.contractName)),e.push(un(t.functionName));const r=v.alloc(4);r.writeUInt32BE(t.functionArgs.length,0),e.push(r),t.functionArgs.forEach((t=>{e.push(Gr(t))}));break;case qe.SmartContract:e.push(un(t.contractName)),e.push(un(t.codeBody));break;case qe.PoisonMicroblock:break;case qe.Coinbase:e.push(t.coinbaseBuffer)}return e.concatBuffer()}function an(t){switch(t.readUInt8Enum(qe,(t=>{throw new Error(`Cannot recognize PayloadType: ${t}`)}))){case qe.TokenTransfer:return n=on(t),i=T(t.readBuffer(8),!1),o=bn(t),"string"==typeof n&&(n=function(t){if(t.includes(".")){const[e,r]=t.split(".");return function(t,e){return Qr(cn(t),gn(e))}(e,r)}return function(t){const e=cn(t);return{type:Mr.PrincipalStandard,address:e}}(t)}(n)),"string"==typeof o&&(o=wn(o)),{type:He.Payload,payloadType:qe.TokenTransfer,recipient:n,amount:T(i,!1),memo:null!=o?o:wn("")};case qe.ContractCall:const s=dn(t),a=yn(t),u=yn(t),c=[],h=t.readUInt32BE();for(let e=0;e<h;e++){const e=on(t);c.push(e)}return function(t,e,r,n){return"string"==typeof t&&(t=cn(t)),"string"==typeof e&&(e=gn(e)),"string"==typeof r&&(r=gn(r)),{type:He.Payload,payloadType:qe.ContractCall,contractAddress:t,contractName:e,functionName:r,functionArgs:n}}(s,a,u,c);case qe.SmartContract:return e=yn(t),r=yn(t,4,1e5),"string"==typeof e&&(e=gn(e)),"string"==typeof r&&(r=gn(r,4,1e5)),{type:He.Payload,payloadType:qe.SmartContract,contractName:e,codeBody:r};case qe.PoisonMicroblock:return{type:He.Payload,payloadType:qe.PoisonMicroblock};case qe.Coinbase:return function(t){if(32!=t.byteLength)throw Error("Coinbase buffer size must be 32 bytes");return{type:He.Payload,payloadType:qe.Coinbase,coinbaseBuffer:t}}(t.readBuffer(32))}var e,r,n,i,o}function un(t){switch(t.type){case He.Address:return ln(t);case He.Principal:return pn(t);case He.LengthPrefixedString:return mn(t);case He.MemoString:return function(t){const e=new sr,r=(68,v.from(t.content).toString("hex").padEnd(68,"0"));return e.push(v.from(r,"hex")),e.concatBuffer()}(t);case He.AssetInfo:return vn(t);case He.PostCondition:return En(t);case He.PublicKey:return Wr(t);case He.LengthPrefixedList:return An(t);case He.Payload:return sn(t);case He.TransactionAuthField:return function(t){const e=new sr;switch(t.contents.type){case He.PublicKey:t.pubKeyEncoding==tr.Compressed?(e.appendByte(Ar.PublicKeyCompressed),e.push(Wr(t.contents))):(e.appendByte(Ar.PublicKeyUncompressed),e.push(Wr((r=t.contents.data,jr(new tt.ec("secp256k1").keyFromPublic(r).getPublic(!0,"hex"))))));break;case He.MessageSignature:t.pubKeyEncoding==tr.Compressed?e.appendByte(Ar.SignatureCompressed):e.appendByte(Ar.SignatureUncompressed),e.push(_r(t.contents))}var r;return e.concatBuffer()}(t);case He.MessageSignature:return _r(t)}}function cn(t){const e=(0,St.yI)(t);return{type:He.Address,version:e[0],hash160:e[1]}}function hn(t,e){return{type:He.Address,version:t,hash160:e}}function fn(t,e,r,n){if(0===n.length)throw Error("Invalid number of public keys");if(!(e!==Ye.SerializeP2PKH&&e!==Ye.SerializeP2WPKH||1===n.length&&1===r))throw Error("Invalid number of public keys or signatures");if(e===Ye.SerializeP2WPKH||e===Ye.SerializeP2WSH)for(let t=0;t<n.length;t++)if(!Vr(n[t]))throw Error("Public keys must be compressed for segwit");switch(e){case Ye.SerializeP2PKH:return hn(t,(i=n[0].data,pr(i).toString("hex")));case Ye.SerializeP2WPKH:return hn(t,(t=>{const e=pr(t),r=new sr;r.appendByte(0),r.appendByte(e.length),r.push(e);const n=r.concatBuffer();return pr(n).toString("hex")})(n[0].data));case Ye.SerializeP2SH:return hn(t,((t,e)=>{if(t>15||e.length>15)throw Error("P2SH multisig address can only contain up to 15 public keys");const r=new sr;r.appendByte(80+t),e.forEach((t=>{r.appendByte(t.length),r.push(t)})),r.appendByte(80+e.length),r.appendByte(174);const n=r.concatBuffer();return pr(n).toString("hex")})(r,n.map(Wr)));case Ye.SerializeP2WSH:return hn(t,((t,e)=>{if(t>15||e.length>15)throw Error("P2WSH multisig address can only contain up to 15 public keys");const r=new sr;r.appendByte(80+t),e.forEach((t=>{r.appendByte(t.length),r.push(t)})),r.appendByte(80+e.length),r.appendByte(174);const n=r.concatBuffer(),i=(new H.sha256).update(n).digest(),o=new sr;o.appendByte(0),o.appendByte(i.length),o.push(i);const s=o.concatBuffer();return pr(s).toString("hex")})(r,n.map(Wr)))}var i}function ln(t){const e=new sr;return e.appendHexString(ur(t.version,1)),e.appendHexString(t.hash160),e.concatBuffer()}function dn(t){const e=cr(t.readBuffer(1).toString("hex")),r=t.readBuffer(20).toString("hex");return{type:He.Address,version:e,hash160:r}}function pn(t){const e=new sr;return e.push(v.from([t.prefix])),e.push(ln(t.address)),t.prefix===nr.Contract&&e.push(mn(t.contractName)),e.concatBuffer()}function gn(t,e,r){const n=e||1,i=r||128;if(hr(t,i))throw new Error(`String length exceeds maximum bytes ${i.toString()}`);return{type:He.LengthPrefixedString,content:t,lengthPrefixBytes:n,maxLengthBytes:i}}function mn(t){const e=new sr,r=v.from(t.content),n=r.byteLength;return e.appendHexString(ur(n,t.lengthPrefixBytes)),e.push(r),e.concatBuffer()}function yn(t,e,r){e=e||1;const n=cr(t.readBuffer(e).toString("hex"));return gn(t.readBuffer(n).toString(),e,null!=r?r:128)}function wn(t){if(t&&hr(t,34))throw new Error(`Memo exceeds maximum length of ${34..toString()} bytes`);return{type:He.MemoString,content:t}}function bn(t){const e=t.readBuffer(34).toString();return{type:He.MemoString,content:e}}function vn(t){const e=new sr;return e.push(ln(t.address)),e.push(mn(t.contractName)),e.push(mn(t.assetName)),e.concatBuffer()}function _n(t){return{type:He.AssetInfo,address:dn(t),contractName:yn(t),assetName:yn(t)}}function Sn(t,e){return{type:He.LengthPrefixedList,lengthPrefixBytes:e||4,values:t}}function An(t){const e=t.values,r=new sr;r.appendHexString(ur(e.length,t.lengthPrefixBytes));for(let t=0;t<e.length;t++)r.push(un(e[t]));return r.concatBuffer()}function Mn(t,e,r){const n=cr(t.readBuffer(r||4).toString("hex")),i=[];for(let r=0;r<n;r++)switch(e){case He.Address:i.push(dn(t));break;case He.LengthPrefixedString:i.push(yn(t));break;case He.MemoString:i.push(bn(t));break;case He.AssetInfo:i.push(_n(t));break;case He.PostCondition:i.push(kn(t));break;case He.PublicKey:i.push($r(t));break;case He.TransactionAuthField:i.push(Tr(t))}return Sn(i,r)}function En(t){const e=new sr;return e.appendByte(t.conditionType),e.push(pn(t.principal)),t.conditionType!==Ze.Fungible&&t.conditionType!==Ze.NonFungible||e.push(vn(t.assetInfo)),t.conditionType===Ze.NonFungible&&e.push(Gr(t.assetName)),e.appendByte(t.conditionCode),t.conditionType!==Ze.STX&&t.conditionType!==Ze.Fungible||e.push(k(t.amount,!1,8)),e.concatBuffer()}function kn(t){const e=t.readUInt8Enum(Ze,(t=>{throw new mr(`Could not read ${t} as PostConditionType`)})),r=function(t){const e=t.readUInt8Enum(nr,(t=>{throw new mr("Unexpected Principal payload type: ${n}")})),r=dn(t);if(e===nr.Standard)return{type:He.Principal,prefix:e,address:r};const n=yn(t);return{type:He.Principal,prefix:e,address:r,contractName:n}}(t);let n,i,o;switch(e){case Ze.STX:return n=t.readUInt8Enum(er,(t=>{throw new mr(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt("0x"+t.readBuffer(8).toString("hex")),{type:He.PostCondition,conditionType:Ze.STX,principal:r,conditionCode:n,amount:o};case Ze.Fungible:return i=_n(t),n=t.readUInt8Enum(er,(t=>{throw new mr(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt("0x"+t.readBuffer(8).toString("hex")),{type:He.PostCondition,conditionType:Ze.Fungible,principal:r,conditionCode:n,amount:o,assetInfo:i};case Ze.NonFungible:i=_n(t);const e=on(t);return n=t.readUInt8Enum(rr,(t=>{throw new mr(`Could not read ${t} as FungibleConditionCode`)})),{type:He.PostCondition,conditionType:Ze.NonFungible,principal:r,conditionCode:n,assetInfo:i,assetName:e}}}class Tn{constructor(t,e,r,n,i,o,s){if(this.version=t,this.auth=e,this.payload="amount"in r?Object.assign(Object.assign({},r),{amount:T(r.amount,!1)}):r,this.chainId=null!=s?s:Ke,this.postConditionMode=null!=i?i:Xe.Deny,this.postConditions=null!=n?n:Sn([]),o)this.anchorMode=o;else switch(r.payloadType){case qe.Coinbase:case qe.PoisonMicroblock:this.anchorMode=ze.OnChainOnly;break;case qe.ContractCall:case qe.SmartContract:case qe.TokenTransfer:this.anchorMode=ze.Any}}signBegin(){const t=fr(this);return t.auth=Dr(t.auth),t.txid()}verifyBegin(){const t=fr(this);return t.auth=Dr(t.auth),t.txid()}verifyOrigin(){return function(t,e){switch(t.authType){case Je.Standard:case Je.Sponsored:return function(t,e,r){return Or(t)?function(t,e,r){const{pubKey:n,nextSigHash:i}=Ur(e,r,t.fee,t.nonce,t.keyEncoding,t.signature),o=fn(0,t.hashMode,1,[n]).hash160;if(o!==t.signer)throw new wr(`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,s=0;for(const e of t.fields){let a;switch(e.contents.type){case He.PublicKey:Vr(e.contents)||(o=!0),a=e.contents;break;case He.MessageSignature:e.pubKeyEncoding===tr.Uncompressed&&(o=!0);const{pubKey:n,nextSigHash:u}=Ur(i,r,t.fee,t.nonce,e.pubKeyEncoding,e.contents);if(i=u,a=n,s+=1,65536===s)throw new wr("Too many signatures")}n.push(a)}if(s!==t.signaturesRequired)throw new wr("Incorrect number of signatures");if(o&&t.hashMode===Ye.SerializeP2SH)throw new wr("Uncompressed keys are not allowed in this hash mode");const a=fn(0,t.hashMode,t.signaturesRequired,n).hash160;if(a!==t.signer)throw new wr(`Signer hash does not equal hash of public key(s): ${a} != ${t.signer}`);return i}(t,e,r)}(t.spendingCondition,e,Je.Standard);default:throw new yr("Invalid origin auth type")}}(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,Je.Standard,e)}signNextSponsor(t,e){if(this.auth.authType===Je.Sponsored)return this.signAndAppend(this.auth.sponsorSpendingCondition,t,Je.Sponsored,e);throw new Error('"auth.sponsorSpendingCondition" is undefined')}appendPubkey(t){const e=this.auth.spendingCondition;if(!e||Or(e))throw new Error("Can't append public key to a singlesig condition");{const r=Vr(t);e.fields.push(kr(r?tr.Compressed:tr.Uncompressed,t))}}signAndAppend(t,e,r,n){const{nextSig:i,nextSigHash:o}=Rr(e,r,t.fee,t.nonce,n);if(Or(t))t.signature=i;else{const e=n.data.toString("hex").endsWith("01");t.fields.push(kr(e?tr.Compressed:tr.Uncompressed,i))}return o}txid(){const t=this.serialize();return dr(t)}setSponsor(t){if(this.auth.authType!=Je.Sponsored)throw new yr("Cannot sponsor sign a non-sponsored transaction");this.auth=function(t,e){const r=Object.assign(Object.assign({},e),{nonce:T(e.nonce,!1),fee:T(e.fee,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:r})}(this.auth,t)}setFee(t){this.auth=function(t,e){switch(t.authType){case Je.Standard:const r=Object.assign(Object.assign({},t.spendingCondition),{fee:T(e,!1)});return Object.assign(Object.assign({},t),{spendingCondition:r});case Je.Sponsored:const n=Object.assign(Object.assign({},t.sponsorSpendingCondition),{fee:T(e,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:n})}}(this.auth,t)}setNonce(t){this.auth=function(t,e){const r=Object.assign(Object.assign({},t.spendingCondition),{nonce:T(e,!1)});return Object.assign(Object.assign({},t),{spendingCondition:r})}(this.auth,t)}setSponsorNonce(t){if(this.auth.authType!=Je.Sponsored)throw new yr("Cannot sponsor sign a non-sponsored transaction");this.auth=function(t,e){const r=Object.assign(Object.assign({},t.sponsorSpendingCondition),{nonce:T(e,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:r})}(this.auth,t)}serialize(){if(void 0===this.version)throw new gr('"version" is undefined');if(void 0===this.chainId)throw new gr('"chainId" is undefined');if(void 0===this.auth)throw new gr('"auth" is undefined');if(void 0===this.anchorMode)throw new gr('"anchorMode" is undefined');if(void 0===this.payload)throw new gr('"payload" is undefined');const t=new sr;t.appendByte(this.version);const e=v.alloc(4);return e.writeUInt32BE(this.chainId,0),t.push(e),t.push(function(t){const e=new sr;switch(e.appendByte(t.authType),t.authType){case Je.Standard:e.push(Ir(t.spendingCondition));break;case Je.Sponsored:e.push(Ir(t.spendingCondition)),e.push(Ir(t.sponsorSpendingCondition))}return e.concatBuffer()}(this.auth)),t.appendByte(this.anchorMode),t.appendByte(this.postConditionMode),t.push(An(this.postConditions)),t.push(sn(this.payload)),t.concatBuffer()}}function Cn(t){let e;e="string"==typeof t?"0x"===t.slice(0,2).toLowerCase()?new nn(v.from(t.slice(2),"hex")):new nn(v.from(t,"hex")):v.isBuffer(t)?new nn(t):t;const r=e.readUInt8Enum(Ge,(t=>{throw new Error(`Could not parse ${t} as TransactionVersion`)})),n=e.readUInt32BE(),i=function(t){let e;switch(t.readUInt8Enum(Je,(t=>{throw new mr(`Could not parse ${t} as AuthType`)}))){case Je.Standard:return e=xr(t),Fr(e);case Je.Sponsored:return e=xr(t),Lr(e,xr(t))}}(e),o=e.readUInt8Enum(ze,(t=>{throw new Error(`Could not parse ${t} as AnchorMode`)})),s=e.readUInt8Enum(Xe,(t=>{throw new Error(`Could not parse ${t} as PostConditionMode`)})),a=Mn(e,He.PostCondition),u=an(e);return new Tn(r,i,u,a,s,o,n)}var On=r(8764).Buffer,Pn=["functionArgs","appDetails","userSession"],In=["appDetails","userSession"],xn=["amount","appDetails","userSession"],Nn=function(t){var e=t;if(!e){var r=new C(["store_write"],document.location.href);e=new ge({appConfig:r})}return e},Bn=function(t){var e=Nn(t).loadUserData().appPrivateKey;return{privateKey:e,publicKey:O.SECP256K1Client.derivePublicKey(e)}};function Rn(t){var e,r,n=t.stxAddress,i=t.userSession,o=t.network;if(n)return n;if(i&&o){var s=null==i||null==(e=i.loadUserData().profile)?void 0:e.stxAddress,a=((r={})[Le.Mainnet]="mainnet",r[Le.Testnet]="testnet",r);return null==s?void 0:s[a[o.chainId]]}}function Un(t){var e=Ce({},t,{network:t.network||new de.StacksTestnet,userSession:Nn(t.userSession)});return Ce({stxAddress:Rn(e)},e)}var Fn=function(){var t=Te(Ie().mark((function t(e,r){var n,i;return Ie().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 En(t).toString("hex")}))),i=new O.TokenSigner("ES256k",r),t.abrupt("return",i.signAsync(Ce({},e,{postConditions:n})));case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),Ln=function(){var t=Te(Ie().mark((function t(e){var r,n,i,o,s,a,u;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.token,n=e.options,i=Me()){t.next=4;break}throw new Error("Hiro Wallet not installed.");case 4:return t.prev=4,t.next=7,i.transactionRequest(r);case 7:if(o=t.sent,s=o.txRaw,a=On.from(s.replace(/^0x/,""),"hex"),u=Cn(new nn(a)),!("sponsored"in n)||!n.sponsored){t.next=14;break}return null==n.onFinish||n.onFinish(Ce({},o,{stacksTransaction:u})),t.abrupt("return");case 14:null==n.onFinish||n.onFinish(Ce({},o,{stacksTransaction:u})),t.next=21;break;case 17:t.prev=17,t.t0=t.catch(4),console.error("[Connect] Error during transaction request",t.t0),null==n.onCancel||n.onCancel();case 21:case"end":return t.stop()}}),t,null,[[4,17]])})));return function(e){return t.apply(this,arguments)}}(),Dn=function(){var t=Te(Ie().mark((function t(e){var r,n,i,o,s,a,u,c,h;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.functionArgs,n=e.appDetails,i=e.userSession,o=Oe(e,Pn),s=Bn(i),a=s.privateKey,u=s.publicKey,c=r.map((function(t){return"string"==typeof t?t:Gr(t).toString("hex")})),h=Ce({},o,{functionArgs:c,txType:Be.ContractCall,publicKey:u}),n&&(h.appDetails=n),t.abrupt("return",Fn(h,a));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),jn=function(){var t=Te(Ie().mark((function t(e){var r,n,i,o,s,a,u;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appDetails,n=e.userSession,i=Oe(e,In),o=Bn(n),s=o.privateKey,a=o.publicKey,u=Ce({},i,{publicKey:a,txType:Be.ContractDeploy}),r&&(u.appDetails=r),t.abrupt("return",Fn(u,s));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Vn=function(){var t=Te(Ie().mark((function t(e){var r,n,i,o,s,a,u,c;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.amount,n=e.appDetails,i=e.userSession,o=Oe(e,xn),s=Bn(i),a=s.privateKey,u=s.publicKey,c=Ce({},o,{amount:r.toString(10),publicKey:u,txType:Be.STXTransfer}),n&&(c.appDetails=n),t.abrupt("return",Fn(c,a));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();function Wn(t,e){return $n.apply(this,arguments)}function $n(){return($n=Te(Ie().mark((function t(e,r){var n;return Ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r(Ce({},Un(e),e));case 2:return n=t.sent,t.abrupt("return",Ln({token:n,options:e}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(t){return Wn(t,Dn)}function Hn(t){return Wn(t,jn)}function qn(t){return Wn(t,Vn)}var zn=r(2102);!function(){if("undefined"!=typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var t=HTMLElement;window.HTMLElement=function(){return Reflect.construct(t,[],this.constructor)},HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}}();var Gn=function(t){if(Me())We(t);else if(void 0!==typeof window){window,"undefined"==typeof window?Promise.resolve():(0,zn.p)().then((()=>(0,zn.b)([["connect-modal",[[1,"connect-modal",{authOptions:[16],hasOpenedInstall:[32]}]]]],r)));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())}))}var r},Xn=function(t){return Gn(t)}},2040: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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(874).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)f*=e;this.imuln(f),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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,f=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;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[c]=0|f,u=0|h}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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}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=f[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:h[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!==s),this.toArrayLike(s,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 s,a,u="le"===e,c=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[o-a-1]=s}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 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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(0==(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(0==(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(0==(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,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),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,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],f=8191&h,l=h>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,_=b>>>13,S=0|s[4],A=8191&S,M=S>>>13,E=0|s[5],k=8191&E,T=E>>>13,C=0|s[6],O=8191&C,P=C>>>13,I=0|s[7],x=8191&I,N=I>>>13,B=0|s[8],R=8191&B,U=B>>>13,F=0|s[9],L=8191&F,D=F>>>13,j=0|a[0],V=8191&j,W=j>>>13,$=0|a[1],K=8191&$,H=$>>>13,q=0|a[2],z=8191&q,G=q>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,W))+Math.imul(g,V)|0,o=Math.imul(g,W);var yt=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,W))+Math.imul(w,V)|0,o=Math.imul(w,W),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,H)|0;var wt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,z)|0))<<13)|0;c=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,W))+Math.imul(_,V)|0,o=Math.imul(_,W),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,z)|0,o=o+Math.imul(g,G)|0;var bt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,V),i=(i=Math.imul(A,W))+Math.imul(M,V)|0,o=Math.imul(M,W),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,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,V),i=(i=Math.imul(k,W))+Math.imul(T,V)|0,o=Math.imul(T,W),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(O,V),i=(i=Math.imul(O,W))+Math.imul(P,V)|0,o=Math.imul(P,W),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,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(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,W))+Math.imul(N,V)|0,o=Math.imul(N,W),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|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(y,rt)|0,i=(i=i+Math.imul(y,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,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var At=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(R,V),i=(i=Math.imul(R,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,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(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|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 Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,W))+Math.imul(D,V)|0,o=Math.imul(D,W),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(L,K),i=(i=Math.imul(L,H))+Math.imul(D,K)|0,o=Math.imul(D,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(U,z)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|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(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(w,ft)|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(L,z),i=(i=Math.imul(L,G))+Math.imul(D,z)|0,o=Math.imul(D,G),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var Tt=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,J))+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Ct=(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)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,lt)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,lt)|0;var Pt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,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(L,ot),i=(i=Math.imul(L,st))+Math.imul(D,ot)|0,o=Math.imul(D,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var It=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,lt)|0;var xt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul(D,ft)|0,o=Math.imul(D,lt);var Nt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(c+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,gt))+Math.imul(D,pt)|0))<<13)|0;return c=((o=Math.imul(D,gt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Mt,u[9]=Et,u[10]=kt,u[11]=Tt,u[12]=Ct,u[13]=Ot,u[14]=Pt,u[15]=It,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(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 s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,f=(0|t.words[h])*(0|e.words[c]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.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},m.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},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var f=u,l=c,d=0;d<s;d++){var p=r[h+d],g=n[h+d],m=r[h+d+s],y=n[h+d+s],w=f*m-l*y;y=f*y+l*m,m=w,r[h+d]=p+m,n[h+d]=g+y,r[h+d+s]=p-m,n[h+d+s]=g-y,d!==a&&(w=u*f-c*l,l=u*l+c*f,f=w)}},m.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},m.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}},m.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},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,h,f,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,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 s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,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,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&a}return u&&0!==h&&(u.words[u.length++]=h),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,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):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,s,a},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),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,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,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).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 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(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,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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 y={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 M(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 s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}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(y[t])return y[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 y[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(0==(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),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new o(1).iushln(p-m-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}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],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var f=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=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 M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},663:(t,e,r)=>{"use strict";r.r(e),r.d(e,{HIRO_MAINNET_DEFAULT:()=>o,HIRO_REGTEST_DEFAULT:()=>s,HIRO_TESTNET_DEFAULT:()=>a,HIRO_MOCKNET_DEFAULT:()=>u,StacksMainnet:()=>c,StacksTestnet:()=>h,StacksMocknet:()=>f,StacksRegtest:()=>l});var n=r(2721),i=r(3930);const o="https://stacks-node-api.mainnet.stacks.co",s="https://stacks-node-api.regtest.stacks.co",a="https://stacks-node-api.testnet.stacks.co",u="http://localhost:3999";class c{constructor(t={url:o}){this.version=n.Kn.Mainnet,this.chainId=n.oK.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",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=()=>this.version===n.Kn.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,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._coreApiUrl=t.url}get coreApiUrl(){return this._coreApiUrl}set coreApiUrl(t){throw new Error("Cannot modify property `coreApiUrl` after object initialization")}getNameInfo(t){const e=`${this.bnsLookupUrl}/v1/names/${t}`;return(0,i.I)(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))}}class h extends c{constructor(t={url:a}){super(t),this.version=n.Kn.Testnet,this.chainId=n.oK.Testnet}}class f extends c{constructor(t={url:u}){super(t),this.version=n.Kn.Testnet,this.chainId=n.oK.Testnet}}class l extends c{constructor(t={url:s}){super(t),this.version=n.Kn.Testnet,this.chainId=n.oK.Testnet}}},5014:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AddressHashMode:()=>x,AddressVersion:()=>N,AnchorMode:()=>E,AssetType:()=>L,AuthFieldType:()=>ae,AuthType:()=>I,BufferArray:()=>$e,BufferReader:()=>zt,CLARITY_INT_BYTE_SIZE:()=>m,CLARITY_INT_SIZE:()=>g,COINBASE_BUFFER_LENGTH_BYTES:()=>y,COMPRESSED_PUBKEY_LENGTH_BYTES:()=>b,ChainID:()=>f,ClarityAbiTypeId:()=>tn,ClarityType:()=>j,DEFAULT_CHAIN_ID:()=>d,DEFAULT_CORE_NODE_API_URL:()=>S,DEFAULT_TRANSACTION_VERSION:()=>C,FungibleConditionCode:()=>R,MAX_STRING_LENGTH_BYTES:()=>p,MEMO_MAX_LENGTH_BYTES:()=>_,NonFungibleConditionCode:()=>U,PayloadType:()=>M,PostConditionMode:()=>O,PostConditionPrincipalID:()=>F,PostConditionType:()=>P,PubKeyEncoding:()=>B,RECOVERABLE_ECDSA_SIG_LENGTH_BYTES:()=>w,StacksMessageType:()=>A,StacksTransaction:()=>Lr,TransactionSigner:()=>yn,TransactionVersion:()=>k,TxRejectedReason:()=>D,UNCOMPRESSED_PUBKEY_LENGTH_BYTES:()=>v,abiFunctionToString:()=>dn,addressFromHashMode:()=>me,addressFromPublicKeys:()=>ye,addressFromVersionHash:()=>G,addressHashModeToVersion:()=>z,addressToString:()=>X,broadcastRawTransaction:()=>Sn,broadcastTransaction:()=>_n,bufferCV:()=>Ct,bufferCVFromString:()=>Ot,callReadOnlyFunction:()=>Dn,cloneDeep:()=>Ze,codeBodyString:()=>Me,compressPublicKey:()=>ot,contractPrincipalCV:()=>Rt,contractPrincipalCVFromAddress:()=>Ut,contractPrincipalCVFromStandard:()=>Ft,createAddress:()=>wt,createAssetInfo:()=>yt,createContractPrincipal:()=>vt,createEmptyAddress:()=>ge,createFungiblePostCondition:()=>Vr,createLPList:()=>Pe,createLPString:()=>mt,createMemoString:()=>Ee,createMessageSignature:()=>q,createMultiSigSpendingCondition:()=>pr,createNonFungiblePostCondition:()=>Wr,createSTXPostCondition:()=>jr,createSingleSigSpendingCondition:()=>dr,createSponsoredAuth:()=>Cr,createStacksPrivateKey:()=>at,createStacksPublicKey:()=>Y,createStandardAuth:()=>Tr,createStandardPrincipal:()=>_t,createTransactionAuthField:()=>ce,cvToHex:()=>ar,cvToJSON:()=>Hr,cvToString:()=>$r,cvToValue:()=>Kr,deserializeAddress:()=>be,deserializeAssetInfo:()=>Oe,deserializeAuthorization:()=>Fr,deserializeCV:()=>ee,deserializeLPList:()=>xe,deserializeLPString:()=>Ae,deserializeMemoString:()=>Te,deserializeMessageSignature:()=>ue,deserializeMultiSigSpendingCondition:()=>vr,deserializePostCondition:()=>Be,deserializePrincipal:()=>_e,deserializePublicKey:()=>st,deserializeSingleSigSpendingCondition:()=>br,deserializeSpendingCondition:()=>Sr,deserializeStacksMessage:()=>pe,deserializeTransaction:()=>Dr,deserializeTransactionAuthField:()=>he,emptyMessageSignature:()=>lr,encodeClarityValue:()=>fn,estimateContractDeploy:()=>Tn,estimateContractFunctionCall:()=>Pn,estimateTransaction:()=>vn,estimateTransfer:()=>bn,exceedsMaxLengthBytes:()=>Xe,falseCV:()=>It,fetchPrivate:()=>sr,getAbi:()=>An,getAddressFromPrivateKey:()=>Z,getAddressFromPublicKey:()=>J,getCVTypeString:()=>qr,getFee:()=>xr,getNonce:()=>wn,getPublicKey:()=>lt,getSignatureRecoveryParam:()=>ht,getTypeString:()=>ln,getTypeUnion:()=>hn,hash160:()=>tr,hashP2PKH:()=>er,hashP2SH:()=>nr,hashP2WPKH:()=>rr,hashP2WSH:()=>ir,hexStringToInt:()=>Ge,hexToCV:()=>ur,intCV:()=>kt,intToHexString:()=>ze,intoInitialSighashAuth:()=>Or,isClarityAbiBuffer:()=>rn,isClarityAbiList:()=>cn,isClarityAbiOptional:()=>an,isClarityAbiPrimitive:()=>en,isClarityAbiResponse:()=>sn,isClarityAbiStringAscii:()=>nn,isClarityAbiStringUtf8:()=>on,isClarityAbiTuple:()=>un,isClarityName:()=>or,isCompressed:()=>et,isSingleSig:()=>gr,leftPadHex:()=>Ke,leftPadHexToLength:()=>He,listCV:()=>Wt,makeContractCall:()=>xn,makeContractDeploy:()=>Cn,makeContractFungiblePostCondition:()=>Un,makeContractNonFungiblePostCondition:()=>Ln,makeContractSTXPostCondition:()=>Bn,makeRandomPrivKey:()=>ut,makeSTXTokenTransfer:()=>kn,makeSigHashPreSign:()=>Ar,makeStandardFungiblePostCondition:()=>Rn,makeStandardNonFungiblePostCondition:()=>Fn,makeStandardSTXPostCondition:()=>Nn,makeUnsignedContractCall:()=>In,makeUnsignedContractDeploy:()=>On,makeUnsignedSTXTokenTransfer:()=>En,nextSignature:()=>Er,nextVerification:()=>kr,noneCV:()=>jt,omit:()=>Je,parseAssetInfoString:()=>gt,parsePrincipalString:()=>bt,parseReadOnlyResponse:()=>cr,parseRecoverableSignature:()=>ft,parseToCV:()=>mn,privateKeyToString:()=>dt,pubKeyfromPrivKey:()=>it,publicKeyFromBuffer:()=>tt,publicKeyFromSignature:()=>Q,publicKeyToAddress:()=>pt,publicKeyToString:()=>rt,randomBytes:()=>$(),responseErrorCV:()=>Lt,responseOkCV:()=>Dt,rightPadHexToLength:()=>qe,serializeAddress:()=>we,serializeAssetInfo:()=>Ce,serializeAuthorization:()=>Ur,serializeCV:()=>Fe,serializeLPList:()=>Ie,serializeLPString:()=>Se,serializeMemoString:()=>ke,serializeMessageSignature:()=>fe,serializeMultiSigSpendingCondition:()=>wr,serializePostCondition:()=>Ne,serializePrincipal:()=>ve,serializePublicKey:()=>nt,serializeSingleSigSpendingCondition:()=>yr,serializeSpendingCondition:()=>_r,serializeStacksMessage:()=>de,serializeTransactionAuthField:()=>le,setFee:()=>Ir,setNonce:()=>Nr,setSponsor:()=>Rr,setSponsorNonce:()=>Br,sha512_256:()=>Ye,signWithKey:()=>ct,someCV:()=>Vt,sponsorTransaction:()=>jn,standardPrincipalCV:()=>Nt,standardPrincipalCVFromAddress:()=>Bt,stringAsciiCV:()=>Qt,stringUtf8CV:()=>te,trueCV:()=>Pt,tupleCV:()=>$t,txidFromData:()=>Qe,uintCV:()=>Tt,validateContractCall:()=>gn,validateStacksAddress:()=>hr,validateTxId:()=>fr,verifyOrigin:()=>Pr});var n=r(8764),i=r(7476),o=r.n(i),s=r(8764).Buffer;const a=void 0!==s?s:n.Buffer;function u(t,e,r){return function(t,e){const r=c(t,e);return new(o())(r.toString())}(t,e).toArrayLike(a,"be",r)}function c(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.");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=a.from(t,"hex")}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||a.isBuffer(r)){if(e){const t=new(o())(r,"be").fromTwos(8*r.byteLength);return BigInt(t.toString())}return BigInt(new(o())(r,"be").toString())}if(r instanceof o()||o().isBN(r))return BigInt(r.toString());throw new TypeError("Invalid value type. Must be a number, bigint, integer-string, hex-string, BN.js instance, or Buffer.")}function h(t){return t.startsWith("0x")?t:`0x${t}`}var f,l;(l=f||(f={}))[l.Testnet=2147483648]="Testnet",l[l.Mainnet=1]="Mainnet";const d=f.Mainnet,p=128,g=128,m=16,y=32,w=65,b=32,v=64,_=34,S="https://stacks-node-api.mainnet.stacks.co";var A,M,E,k,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.TransactionAuthField=10]="TransactionAuthField"}(A||(A={})),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"}(M||(M={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(E||(E={})),(T=k||(k={}))[T.Mainnet=0]="Mainnet",T[T.Testnet=128]="Testnet";const C=k.Mainnet;var O,P,I,x,N,B,R,U,F,L,D;!function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(O||(O={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(P||(P={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(I||(I={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(x||(x={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(N||(N={})),function(t){t[t.Compressed=0]="Compressed",t[t.Uncompressed=1]="Uncompressed"}(B||(B={})),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"}(R||(R={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(U||(U={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(F||(F={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(L||(L={})),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"}(D||(D={}));var j,V=r(9072),W=r(1798),$=r.n(W),K=r(6266),H=r(7701);function q(t){if(a.from(t,"hex").byteLength!=w)throw Error("Invalid signature");return{type:A.MessageSignature,data:t}}function z(t,e){switch(t){case x.SerializeP2PKH:switch(e){case k.Mainnet:return N.MainnetSingleSig;case k.Testnet:return N.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case x.SerializeP2SH:case x.SerializeP2WPKH:case x.SerializeP2WSH:switch(e){case k.Mainnet:return N.MainnetMultiSig;case k.Testnet:return N.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}function G(t,e){return{type:A.Address,version:t,hash160:e}}function X(t){return(0,H.H4)(t.version,t.hash160).toString()}function Z(t,e=k.Mainnet){return J(it(t).data,e)}function J(t,e=k.Mainnet){return t="string"==typeof t?t:t.toString("hex"),X(G(z(x.SerializeP2PKH,e),er(a.from(t,"hex"))))}function Y(t){return{type:A.PublicKey,data:a.from(t,"hex")}}function Q(t,e,r=B.Compressed){const n=new K.ec("secp256k1"),i=n.keyFromPrivate(t,"hex").getPrivate().toString(10),o=ft(e.data),s=n.recoverPubKey(i,o,o.recoveryParam,"hex");return r==B.Uncompressed?s.encode("hex"):s.encodeCompressed("hex")}function tt(t){return{type:A.PublicKey,data:t}}function et(t){return!t.data.toString("hex").startsWith("04")}function rt(t){return t.data.toString("hex")}function nt(t){const e=new $e;return e.push(t.data),e.concatBuffer()}function it(t){const e=at(t);return Y(new K.ec("secp256k1").keyFromPrivate(e.data.toString("hex").slice(0,64),"hex").getPublic(e.compressed,"hex"))}function ot(t){return Y(new K.ec("secp256k1").keyFromPublic(t).getPublic(!0,"hex"))}function st(t){const e=t.readUInt8(),r=4!==e?b:v;return tt(a.concat([a.from([e]),t.readBuffer(r)]))}function at(t){const e="string"==typeof t?a.from(t,"hex"):t;let r;if(33===e.length){if(1!==e[e.length-1])throw new Error("Improperly formatted private-key. 33 byte length usually indicates compressed key, but last byte must be == 0x01");r=!0}else{if(32!==e.length)throw new Error(`Improperly formatted private-key hex string: length should be 32 or 33 bytes, provided with length ${e.length}`);r=!1}return{data:e,compressed:r}}function ut(t){const e=new K.ec("secp256k1"),r={entropy:t||$()(32)};return at(e.genKeyPair(r).getPrivate().toString("hex",32))}function ct(t,e){const r=new K.ec("secp256k1").keyFromPrivate(t.data.toString("hex").slice(0,64),"hex").sign(e,"hex",{canonical:!0}),n=He(r.r.toString("hex"),64),i=He(r.s.toString("hex"),64);if(void 0===r.recoveryParam||null===r.recoveryParam)throw new Error('"signature.recoveryParam" is not set');return q(ze(r.recoveryParam,1)+n+i)}function ht(t){if(t.length<129)throw new Error("Invalid signature");const e=t.substr(0,2);return Ge(e)}function ft(t){if(t.length<129)throw new Error("Invalid signature");const e=t.substr(0,2),r=t.substr(2,64),n=t.substr(66,64);return{recoveryParam:Ge(e),r,s:n}}function lt(t){return it(t.data)}function dt(t){return t.data.toString("hex")}function pt(t,e){return(0,H.H4)(t,tr(e.data).toString("hex"))}function gt(t){const[e,r,n]=t.split(/\.|::/);return yt(e,r,n)}function mt(t,e,r){const n=e||1,i=r||p;if(Xe(t,i))throw new Error(`String length exceeds maximum bytes ${i.toString()}`);return{type:A.LengthPrefixedString,content:t,lengthPrefixBytes:n,maxLengthBytes:i}}function yt(t,e,r){return{type:A.AssetInfo,address:wt(t),contractName:mt(e),assetName:mt(r)}}function wt(t){const e=(0,H.yI)(t);return{type:A.Address,version:e[0],hash160:e[1]}}function bt(t){if(t.includes(".")){const[e,r]=t.split(".");return vt(e,r)}return _t(t)}function vt(t,e){const r=wt(t),n=mt(e);return{type:A.Principal,prefix:F.Contract,address:r,contractName:n}}function _t(t){const e=wt(t);return{type:A.Principal,prefix:F.Standard,address:e}}!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"}(j||(j={}));const St=BigInt("0xffffffffffffffffffffffffffffffff"),At=BigInt(0),Mt=BigInt("0x7fffffffffffffffffffffffffffffff"),Et=BigInt("-170141183460469231731687303715884105728"),kt=t=>{const e=c(t,!0);if(e>Mt)throw new RangeError(`Cannot construct clarity integer from value greater than ${Mt.toString()}`);if(e<Et)throw new RangeError(`Cannot construct clarity integer form value less than ${Et.toString()}`);return{type:j.Int,value:e}},Tt=t=>{const e=c(t,!1);if(e<At)throw new RangeError("Cannot construct unsigned clarity integer from negative value");if(e>St)throw new RangeError(`Cannot construct unsigned clarity integer greater than ${St.toString()}`);return{type:j.UInt,value:e}},Ct=t=>{if(t.length>1e6)throw new Error("Cannot construct clarity buffer that is greater than 1MB");return{type:j.Buffer,buffer:t}},Ot=t=>Ct(a.from(t)),Pt=()=>({type:j.BoolTrue}),It=()=>({type:j.BoolFalse});function xt(t){if(t.type===j.PrincipalStandard)return X(t.address);if(t.type===j.PrincipalContract)return`${X(t.address)}.${t.contractName.content}`;throw new Error(`Unexpected principal data: ${JSON.stringify(t)}`)}function Nt(t){const e=wt(t);return{type:j.PrincipalStandard,address:e}}function Bt(t){return{type:j.PrincipalStandard,address:t}}function Rt(t,e){return Ut(wt(t),mt(e))}function Ut(t,e){if(a.byteLength(e.content)>=128)throw new Error("Contract name must be less than 128 bytes");return{type:j.PrincipalContract,address:t,contractName:e}}function Ft(t,e){const r=mt(e);return{type:j.PrincipalContract,address:t.address,contractName:r}}function Lt(t){return{type:j.ResponseErr,value:t}}function Dt(t){return{type:j.ResponseOk,value:t}}function jt(){return{type:j.OptionalNone}}function Vt(t){return{type:j.OptionalSome,value:t}}function Wt(t){return{type:j.List,list:t}}function $t(t){for(const e in t)if(!or(e))throw new Error(`"${e}" is not a valid Clarity name`);return{type:j.Tuple,data:t}}var Kt=r(3717);const Ht=new Map;function qt(t,e){const r=Ht.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 Ht.set(t,n),qt(t,e)}class zt{constructor(t){a.isBuffer(t)?this.smartBuffer=new Kt.$({buff:t}):this.smartBuffer=new Kt.$(t)}static fromBuffer(t){return new zt({buff:t})}readBuffer(t){return this.smartBuffer.readBuffer(t)}readUInt32BE(t){return this.smartBuffer.readUInt32BE(t)}readUInt8(){return this.smartBuffer.readUInt8()}readUInt16BE(){return this.smartBuffer.readUInt16BE()}readBigUIntLE(t){const e=a.from(this.smartBuffer.readBuffer(t)).reverse().toString();return BigInt(`0x${e}`)}readBigUIntBE(t){const e=this.smartBuffer.readBuffer(t).toString("hex");return BigInt(`0x${e}`)}readBigUInt64BE(){return this.smartBuffer.readBigUInt64BE()}readString(t,e){return this.smartBuffer.readString(t,e)}get readOffset(){return this.smartBuffer.readOffset}set readOffset(t){this.smartBuffer.readOffset=t}get internalBuffer(){return this.smartBuffer.internalBuffer}readUInt8Enum(t,e){const r=this.smartBuffer.readUInt8();if(qt(t,r))return r;throw e(r)}}class Gt extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Xt extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Zt extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Jt extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Yt extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const Qt=t=>({type:j.StringASCII,data:t}),te=t=>({type:j.StringUTF8,data:t});function ee(t){let e;if("string"==typeof t){const r="0x"===t.slice(0,2).toLowerCase();e=new zt(a.from(r?t.slice(2):t,"hex"))}else e=a.isBuffer(t)?new zt(t):t;switch(e.readUInt8Enum(j,(t=>{throw new Xt(`Cannot recognize Clarity Type: ${t}`)}))){case j.Int:return kt(e.readBuffer(16));case j.UInt:return Tt(e.readBuffer(16));case j.Buffer:const t=e.readUInt32BE();return Ct(e.readBuffer(t));case j.BoolTrue:return Pt();case j.BoolFalse:return It();case j.PrincipalStandard:return Bt(be(e));case j.PrincipalContract:return Ut(be(e),Ae(e));case j.ResponseOk:return Dt(ee(e));case j.ResponseErr:return Lt(ee(e));case j.OptionalNone:return jt();case j.OptionalSome:return Vt(ee(e));case j.List:const r=e.readUInt32BE(),n=[];for(let t=0;t<r;t++)n.push(ee(e));return Wt(n);case j.Tuple:const i=e.readUInt32BE(),o={};for(let t=0;t<i;t++){const t=Ae(e).content;if(void 0===t)throw new Xt('"content" is undefined');o[t]=ee(e)}return $t(o);case j.StringASCII:const s=e.readUInt32BE(),a=e.readBuffer(s).toString("ascii");return Qt(a);case j.StringUTF8:const u=e.readUInt32BE(),c=e.readBuffer(u).toString("utf8");return te(c);default:throw new Xt("Unable to deserialize Clarity Value from buffer. Could not find valid Clarity Type.")}}function re(t,e,r){return"string"==typeof t&&(t=function(t){if(t.includes(".")){const[e,r]=t.split(".");return Rt(e,r)}return Nt(t)}(t)),"string"==typeof r&&(r=Ee(r)),{type:A.Payload,payloadType:M.TokenTransfer,recipient:t,amount:c(e,!1),memo:null!=r?r:Ee("")}}function ne(t,e,r,n){return"string"==typeof t&&(t=wt(t)),"string"==typeof e&&(e=mt(e)),"string"==typeof r&&(r=mt(r)),{type:A.Payload,payloadType:M.ContractCall,contractAddress:t,contractName:e,functionName:r,functionArgs:n}}function ie(t,e){return"string"==typeof t&&(t=mt(t)),"string"==typeof e&&(e=Me(e)),{type:A.Payload,payloadType:M.SmartContract,contractName:t,codeBody:e}}function oe(t){const e=new $e;switch(e.appendByte(t.payloadType),t.payloadType){case M.TokenTransfer:e.push(Fe(t.recipient)),e.push(u(t.amount,!1,8)),e.push(de(t.memo));break;case M.ContractCall:e.push(de(t.contractAddress)),e.push(de(t.contractName)),e.push(de(t.functionName));const r=a.alloc(4);r.writeUInt32BE(t.functionArgs.length,0),e.push(r),t.functionArgs.forEach((t=>{e.push(Fe(t))}));break;case M.SmartContract:e.push(de(t.contractName)),e.push(de(t.codeBody));break;case M.PoisonMicroblock:break;case M.Coinbase:e.push(t.coinbaseBuffer)}return e.concatBuffer()}function se(t){switch(t.readUInt8Enum(M,(t=>{throw new Error(`Cannot recognize PayloadType: ${t}`)}))){case M.TokenTransfer:return re(ee(t),c(t.readBuffer(8),!1),Te(t));case M.ContractCall:const e=be(t),r=Ae(t),n=Ae(t),i=[],o=t.readUInt32BE();for(let e=0;e<o;e++){const e=ee(t);i.push(e)}return ne(e,r,n,i);case M.SmartContract:return ie(Ae(t),Ae(t,4,1e5));case M.PoisonMicroblock:return{type:A.Payload,payloadType:M.PoisonMicroblock};case M.Coinbase:return function(t){if(t.byteLength!=y)throw Error(`Coinbase buffer size must be ${y} bytes`);return{type:A.Payload,payloadType:M.Coinbase,coinbaseBuffer:t}}(t.readBuffer(y))}}var ae;function ue(t){return q(t.readBuffer(w).toString("hex"))}function ce(t,e){return{pubKeyEncoding:t,type:A.TransactionAuthField,contents:e}}function he(t){const e=t.readUInt8Enum(ae,(t=>{throw new Xt(`Could not read ${t} as AuthFieldType`)}));switch(e){case ae.PublicKeyCompressed:return ce(B.Compressed,st(t));case ae.PublicKeyUncompressed:return ce(B.Uncompressed,st(t));case ae.SignatureCompressed:return ce(B.Compressed,ue(t));case ae.SignatureUncompressed:return ce(B.Uncompressed,ue(t));default:throw new Error(`Unknown auth field type: ${JSON.stringify(e)}`)}}function fe(t){const e=new $e;return e.appendHexString(t.data),e.concatBuffer()}function le(t){const e=new $e;switch(t.contents.type){case A.PublicKey:t.pubKeyEncoding==B.Compressed?(e.appendByte(ae.PublicKeyCompressed),e.push(nt(t.contents))):(e.appendByte(ae.PublicKeyUncompressed),e.push(nt(ot(t.contents.data))));break;case A.MessageSignature:t.pubKeyEncoding==B.Compressed?e.appendByte(ae.SignatureCompressed):e.appendByte(ae.SignatureUncompressed),e.push(fe(t.contents))}return e.concatBuffer()}function de(t){switch(t.type){case A.Address:return we(t);case A.Principal:return ve(t);case A.LengthPrefixedString:return Se(t);case A.MemoString:return ke(t);case A.AssetInfo:return Ce(t);case A.PostCondition:return Ne(t);case A.PublicKey:return nt(t);case A.LengthPrefixedList:return Ie(t);case A.Payload:return oe(t);case A.TransactionAuthField:return le(t);case A.MessageSignature:return fe(t)}}function pe(t,e,r){switch(e){case A.Address:return be(t);case A.Principal:return _e(t);case A.LengthPrefixedString:return Ae(t);case A.MemoString:return Te(t);case A.AssetInfo:return Oe(t);case A.PostCondition:return Be(t);case A.PublicKey:return st(t);case A.Payload:return se(t);case A.LengthPrefixedList:if(!r)throw new Xt("No List Type specified");return xe(t,r);case A.MessageSignature:return ue(t);default:throw new Error("Could not recognize StacksMessageType")}}function ge(){return{type:A.Address,version:N.MainnetSingleSig,hash160:"0".repeat(40)}}function me(t,e,r){return G(z(t,e),r)}function ye(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)for(let t=0;t<n.length;t++)if(!et(n[t]))throw Error("Public keys must be compressed for segwit");switch(e){case x.SerializeP2PKH:return G(t,er(n[0].data));case x.SerializeP2WPKH:return G(t,rr(n[0].data));case x.SerializeP2SH:return G(t,nr(r,n.map(nt)));case x.SerializeP2WSH:return G(t,ir(r,n.map(nt)))}}function we(t){const e=new $e;return e.appendHexString(ze(t.version,1)),e.appendHexString(t.hash160),e.concatBuffer()}function be(t){const e=Ge(t.readBuffer(1).toString("hex")),r=t.readBuffer(20).toString("hex");return{type:A.Address,version:e,hash160:r}}function ve(t){const e=new $e;return e.push(a.from([t.prefix])),e.push(we(t.address)),t.prefix===F.Contract&&e.push(Se(t.contractName)),e.concatBuffer()}function _e(t){const e=t.readUInt8Enum(F,(t=>{throw new Xt("Unexpected Principal payload type: ${n}")})),r=be(t);if(e===F.Standard)return{type:A.Principal,prefix:e,address:r};const n=Ae(t);return{type:A.Principal,prefix:e,address:r,contractName:n}}function Se(t){const e=new $e,r=a.from(t.content),n=r.byteLength;return e.appendHexString(ze(n,t.lengthPrefixBytes)),e.push(r),e.concatBuffer()}function Ae(t,e,r){e=e||1;const n=Ge(t.readBuffer(e).toString("hex"));return mt(t.readBuffer(n).toString(),e,null!=r?r:128)}function Me(t){return mt(t,4,1e5)}function Ee(t){if(t&&Xe(t,_))throw new Error(`Memo exceeds maximum length of ${_.toString()} bytes`);return{type:A.MemoString,content:t}}function ke(t){const e=new $e,r=a.from(t.content),n=qe(r.toString("hex"),2*_);return e.push(a.from(n,"hex")),e.concatBuffer()}function Te(t){const e=t.readBuffer(_).toString();return{type:A.MemoString,content:e}}function Ce(t){const e=new $e;return e.push(we(t.address)),e.push(Se(t.contractName)),e.push(Se(t.assetName)),e.concatBuffer()}function Oe(t){return{type:A.AssetInfo,address:be(t),contractName:Ae(t),assetName:Ae(t)}}function Pe(t,e){return{type:A.LengthPrefixedList,lengthPrefixBytes:e||4,values:t}}function Ie(t){const e=t.values,r=new $e;r.appendHexString(ze(e.length,t.lengthPrefixBytes));for(let t=0;t<e.length;t++)r.push(de(e[t]));return r.concatBuffer()}function xe(t,e,r){const n=Ge(t.readBuffer(r||4).toString("hex")),i=[];for(let r=0;r<n;r++)switch(e){case A.Address:i.push(be(t));break;case A.LengthPrefixedString:i.push(Ae(t));break;case A.MemoString:i.push(Te(t));break;case A.AssetInfo:i.push(Oe(t));break;case A.PostCondition:i.push(Be(t));break;case A.PublicKey:i.push(st(t));break;case A.TransactionAuthField:i.push(he(t))}return Pe(i,r)}function Ne(t){const e=new $e;return e.appendByte(t.conditionType),e.push(ve(t.principal)),t.conditionType!==P.Fungible&&t.conditionType!==P.NonFungible||e.push(Ce(t.assetInfo)),t.conditionType===P.NonFungible&&e.push(Fe(t.assetName)),e.appendByte(t.conditionCode),t.conditionType!==P.STX&&t.conditionType!==P.Fungible||e.push(u(t.amount,!1,8)),e.concatBuffer()}function Be(t){const e=t.readUInt8Enum(P,(t=>{throw new Xt(`Could not read ${t} as PostConditionType`)})),r=_e(t);let n,i,o;switch(e){case P.STX:return n=t.readUInt8Enum(R,(t=>{throw new Xt(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt("0x"+t.readBuffer(8).toString("hex")),{type:A.PostCondition,conditionType:P.STX,principal:r,conditionCode:n,amount:o};case P.Fungible:return i=Oe(t),n=t.readUInt8Enum(R,(t=>{throw new Xt(`Could not read ${t} as FungibleConditionCode`)})),o=BigInt("0x"+t.readBuffer(8).toString("hex")),{type:A.PostCondition,conditionType:P.Fungible,principal:r,conditionCode:n,amount:o,assetInfo:i};case P.NonFungible:i=Oe(t);const e=ee(t);return n=t.readUInt8Enum(U,(t=>{throw new Xt(`Could not read ${t} as FungibleConditionCode`)})),{type:A.PostCondition,conditionType:P.NonFungible,principal:r,conditionCode:n,assetInfo:i,assetName:e}}}function Re(t,e){const r=a.from([t]);return a.concat([r,e])}function Ue(t,e){const r=new $e,n=a.from(t.data,e),i=a.alloc(4);return i.writeUInt32BE(n.length,0),r.push(i),r.push(n),Re(t.type,r.concatBuffer())}function Fe(t){switch(t.type){case j.BoolTrue:case j.BoolFalse:return function(t){return a.from([t.type])}(t);case j.OptionalNone:case j.OptionalSome:return(e=t).type===j.OptionalNone?a.from([e.type]):Re(e.type,Fe(e.value));case j.Buffer:return function(t){const e=a.alloc(4);return e.writeUInt32BE(t.buffer.length,0),Re(t.type,a.concat([e,t.buffer]))}(t);case j.UInt:return function(t){const e=new(o())(t.value.toString()).toArrayLike(a,"be",m);return Re(t.type,e)}(t);case j.Int:return function(t){const e=new(o())(t.value.toString()).toTwos(g).toArrayLike(a,"be",m);return Re(t.type,e)}(t);case j.PrincipalStandard:return function(t){return Re(t.type,we(t.address))}(t);case j.PrincipalContract:return function(t){return Re(t.type,a.concat([we(t.address),Se(t.contractName)]))}(t);case j.ResponseOk:case j.ResponseErr:return function(t){return Re(t.type,Fe(t.value))}(t);case j.List:return function(t){const e=new $e,r=a.alloc(4);r.writeUInt32BE(t.list.length,0),e.push(r);for(const r of t.list){const t=Fe(r);e.push(t)}return Re(t.type,e.concatBuffer())}(t);case j.Tuple:return function(t){const e=new $e,r=a.alloc(4);r.writeUInt32BE(Object.keys(t.data).length,0),e.push(r);const n=Object.keys(t.data).sort(((t,e)=>{const r=a.from(t),n=a.from(e);return r.compare(n)}));for(const r of n){const n=mt(r);e.push(Se(n));const i=Fe(t.data[r]);e.push(i)}return Re(t.type,e.concatBuffer())}(t);case j.StringASCII:return function(t){return Ue(t,"ascii")}(t);case j.StringUTF8:return function(t){return Ue(t,"utf8")}(t);default:throw new Gt("Unable to serialize. Invalid Clarity Value.")}var e}!function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}(ae||(ae={}));var Le=r(4574),De=r(4098),je=r.n(De),Ve=r(5889),We=r.n(Ve);class $e{constructor(){this._value=[]}get value(){return this._value}appendHexString(t){this.value.push(a.from(t,"hex"))}push(t){return this._value.push(t)}appendByte(t){if(!Number.isInteger(t)||t<0||t>255)throw new Error(`Value ${t} is not a valid byte`);this.value.push(a.from([t]))}concatBuffer(){return a.concat(this.value)}}const Ke=t=>t.length%2==0?t:`0${t}`,He=(t,e)=>t.padStart(e,"0"),qe=(t,e)=>t.padEnd(e,"0"),ze=(t,e=8)=>t.toString(16).padStart(2*e,"0"),Ge=t=>parseInt(t,16),Xe=(t,e)=>!!t&&a.from(t).length>e;function Ze(t){return We()(t)}function Je(t,e){const r=Ze(t);return delete r[e],r}class Ye extends V.sha512{constructor(){super(),Object.assign(this,{_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})}digest(t){const e=super.digest().slice(0,32);return t?e.toString(t):e}}const Qe=t=>(new Ye).update(t).digest("hex"),tr=t=>{const e=(new V.sha256).update(t).digest();return a.from((new Le.Z).update(e).digest())},er=t=>tr(t).toString("hex"),rr=t=>{const e=tr(t),r=new $e;r.appendByte(0),r.appendByte(e.length),r.push(e);const n=r.concatBuffer();return tr(n).toString("hex")},nr=(t,e)=>{if(t>15||e.length>15)throw Error("P2SH multisig address can only contain up to 15 public keys");const r=new $e;r.appendByte(80+t),e.forEach((t=>{r.appendByte(t.length),r.push(t)})),r.appendByte(80+e.length),r.appendByte(174);const n=r.concatBuffer();return tr(n).toString("hex")},ir=(t,e)=>{if(t>15||e.length>15)throw Error("P2WSH multisig address can only contain up to 15 public keys");const r=new $e;r.appendByte(80+t),e.forEach((t=>{r.appendByte(t.length),r.push(t)})),r.appendByte(80+e.length),r.appendByte(174);const n=r.concatBuffer(),i=(new V.sha256).update(n).digest(),o=new $e;o.appendByte(0),o.appendByte(i.length),o.push(i);const s=o.concatBuffer();return tr(s).toString("hex")};function or(t){return/^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$/.test(t)&&t.length<128}async function sr(t,e){const r=Object.assign({referrer:"no-referrer",referrerPolicy:"no-referrer"},e);return await je()(t,r)}function ar(t){return`0x${Fe(t).toString("hex")}`}function ur(t){return ee(t)}const cr=t=>{if(t.okay)return ur(t.result);throw new Error(t.cause)},hr=t=>{try{return(0,H.yI)(t),!0}catch(t){return!1}},fr=t=>{if("success"===t)return!0;const e=h(t).toLowerCase();return 66===e.length&&h(BigInt(e).toString(16).padStart(64,"0"))===e};function lr(){return{type:A.MessageSignature,data:a.alloc(w,0).toString("hex")}}function dr(t,e,r,n){const i=ye(0,t,1,[Y(e)]).hash160,o=et(Y(e))?B.Compressed:B.Uncompressed;return{hashMode:t,signer:i,nonce:c(r,!1),fee:c(n,!1),keyEncoding:o,signature:lr()}}function pr(t,e,r,n,i){return{hashMode:t,signer:ye(0,t,e,r.map(Y)).hash160,nonce:c(n,!1),fee:c(i,!1),fields:[],signaturesRequired:e}}function gr(t){return"signature"in t}function mr(t){const e=Ze(t);return e.nonce=0,e.fee=0,gr(e)?e.signature=lr():e.fields=[],Object.assign(Object.assign({},e),{nonce:BigInt(0),fee:BigInt(0)})}function yr(t){const e=new $e;return e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(u(t.nonce,!1,8)),e.push(u(t.fee,!1,8)),e.appendByte(t.keyEncoding),e.push(fe(t.signature)),e.concatBuffer()}function wr(t){const e=new $e;e.appendByte(t.hashMode),e.appendHexString(t.signer),e.push(u(t.nonce,!1,8)),e.push(u(t.fee,!1,8));const r=Pe(t.fields);e.push(Ie(r));const n=a.alloc(2);return n.writeUInt16BE(t.signaturesRequired,0),e.push(n),e.concatBuffer()}function br(t,e){const r=e.readBuffer(20).toString("hex"),n=BigInt("0x"+e.readBuffer(8).toString("hex")),i=BigInt("0x"+e.readBuffer(8).toString("hex")),o=e.readUInt8Enum(B,(t=>{throw new Xt(`Could not parse ${t} as PubKeyEncoding`)}));if(t===x.SerializeP2WPKH&&o!=B.Compressed)throw new Xt("Failed to parse singlesig spending condition: incomaptible hash mode and key encoding");return{hashMode:t,signer:r,nonce:n,fee:i,keyEncoding:o,signature:ue(e)}}function vr(t,e){const r=e.readBuffer(20).toString("hex"),n=BigInt("0x"+e.readBuffer(8).toString("hex")),i=BigInt("0x"+e.readBuffer(8).toString("hex")),o=xe(e,A.TransactionAuthField).values;let s=!1,a=0;for(const t of o)switch(t.contents.type){case A.PublicKey:et(t.contents)||(s=!0);break;case A.MessageSignature:if(t.pubKeyEncoding===B.Uncompressed&&(s=!0),a+=1,65536===a)throw new Yt("Failed to parse multisig spending condition: too many signatures")}const u=e.readUInt16BE();if(a!==u)throw new Yt("Incorrect number of signatures");if(s&&t===x.SerializeP2SH)throw new Yt("Uncompressed keys are not allowed in this hash mode");return{hashMode:t,signer:r,nonce:n,fee:i,fields:o,signaturesRequired:u}}function _r(t){return gr(t)?yr(t):wr(t)}function Sr(t){const e=t.readUInt8Enum(x,(t=>{throw new Xt(`Could not parse ${t} as AddressHashMode`)}));return e===x.SerializeP2PKH||e===x.SerializeP2WPKH?br(e,t):vr(e,t)}function Ar(t,e,r,n){const i=t+a.from([e]).toString("hex")+u(r,!1,8).toString("hex")+u(n,!1,8).toString("hex");if(49!==a.from(i,"hex").byteLength)throw Error("Invalid signature hash length");return Qe(a.from(i,"hex"))}function Mr(t,e,r){const n=33+w,i=et(e)?B.Compressed:B.Uncompressed,o=t+Ke(i.toString(16))+r.data,s=a.from(o,"hex");if(s.byteLength>n)throw Error("Invalid signature hash length");return Qe(s)}function Er(t,e,r,n,i){const o=Ar(t,e,r,n),s=ct(i,o);return{nextSig:s,nextSigHash:Mr(o,lt(i),s)}}function kr(t,e,r,n,i,o){const s=Ar(t,e,r,n),a=Y(Q(s,o,i));return{pubKey:a,nextSigHash:Mr(s,a,o)}}function Tr(t){return{authType:I.Standard,spendingCondition:t}}function Cr(t,e){return{authType:I.Sponsored,spendingCondition:t,sponsorSpendingCondition:e||dr(x.SerializeP2PKH,"0".repeat(66),0,0)}}function Or(t){if(t.spendingCondition)switch(t.authType){case I.Standard:return Tr(mr(t.spendingCondition));case I.Sponsored:return Cr(mr(t.spendingCondition),function(){const t=dr(x.SerializeP2PKH,"",0,0);return t.signer=ge().hash160,t.keyEncoding=B.Compressed,t.signature=lr(),t}());default:throw new Jt("Unexpected authorization type for signing")}throw new Error("Authorization missing SpendingCondition")}function Pr(t,e){switch(t.authType){case I.Standard:case I.Sponsored:return function(t,e,r){return gr(t)?function(t,e,r){const{pubKey:n,nextSigHash:i}=kr(e,r,t.fee,t.nonce,t.keyEncoding,t.signature),o=ye(0,t.hashMode,1,[n]).hash160;if(o!==t.signer)throw new Yt(`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,s=0;for(const e of t.fields){let a;switch(e.contents.type){case A.PublicKey:et(e.contents)||(o=!0),a=e.contents;break;case A.MessageSignature:e.pubKeyEncoding===B.Uncompressed&&(o=!0);const{pubKey:n,nextSigHash:u}=kr(i,r,t.fee,t.nonce,e.pubKeyEncoding,e.contents);if(i=u,a=n,s+=1,65536===s)throw new Yt("Too many signatures")}n.push(a)}if(s!==t.signaturesRequired)throw new Yt("Incorrect number of signatures");if(o&&t.hashMode===x.SerializeP2SH)throw new Yt("Uncompressed keys are not allowed in this hash mode");const a=ye(0,t.hashMode,t.signaturesRequired,n).hash160;if(a!==t.signer)throw new Yt(`Signer hash does not equal hash of public key(s): ${a} != ${t.signer}`);return i}(t,e,r)}(t.spendingCondition,e,I.Standard);default:throw new Jt("Invalid origin auth type")}}function Ir(t,e){switch(t.authType){case I.Standard:const r=Object.assign(Object.assign({},t.spendingCondition),{fee:c(e,!1)});return Object.assign(Object.assign({},t),{spendingCondition:r});case I.Sponsored:const n=Object.assign(Object.assign({},t.sponsorSpendingCondition),{fee:c(e,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:n})}}function xr(t){switch(t.authType){case I.Standard:return t.spendingCondition.fee;case I.Sponsored:return t.sponsorSpendingCondition.fee}}function Nr(t,e){const r=Object.assign(Object.assign({},t.spendingCondition),{nonce:c(e,!1)});return Object.assign(Object.assign({},t),{spendingCondition:r})}function Br(t,e){const r=Object.assign(Object.assign({},t.sponsorSpendingCondition),{nonce:c(e,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:r})}function Rr(t,e){const r=Object.assign(Object.assign({},e),{nonce:c(e.nonce,!1),fee:c(e.fee,!1)});return Object.assign(Object.assign({},t),{sponsorSpendingCondition:r})}function Ur(t){const e=new $e;switch(e.appendByte(t.authType),t.authType){case I.Standard:e.push(_r(t.spendingCondition));break;case I.Sponsored:e.push(_r(t.spendingCondition)),e.push(_r(t.sponsorSpendingCondition))}return e.concatBuffer()}function Fr(t){let e;switch(t.readUInt8Enum(I,(t=>{throw new Xt(`Could not parse ${t} as AuthType`)}))){case I.Standard:return e=Sr(t),Tr(e);case I.Sponsored:return e=Sr(t),Cr(e,Sr(t))}}class Lr{constructor(t,e,r,n,i,o,s){if(this.version=t,this.auth=e,this.payload="amount"in r?Object.assign(Object.assign({},r),{amount:c(r.amount,!1)}):r,this.chainId=null!=s?s:d,this.postConditionMode=null!=i?i:O.Deny,this.postConditions=null!=n?n:Pe([]),o)this.anchorMode=o;else switch(r.payloadType){case M.Coinbase:case M.PoisonMicroblock:this.anchorMode=E.OnChainOnly;break;case M.ContractCall:case M.SmartContract:case M.TokenTransfer:this.anchorMode=E.Any}}signBegin(){const t=Ze(this);return t.auth=Or(t.auth),t.txid()}verifyBegin(){const t=Ze(this);return t.auth=Or(t.auth),t.txid()}verifyOrigin(){return Pr(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,I.Standard,e)}signNextSponsor(t,e){if(this.auth.authType===I.Sponsored)return this.signAndAppend(this.auth.sponsorSpendingCondition,t,I.Sponsored,e);throw new Error('"auth.sponsorSpendingCondition" is undefined')}appendPubkey(t){const e=this.auth.spendingCondition;if(!e||gr(e))throw new Error("Can't append public key to a singlesig condition");{const r=et(t);e.fields.push(ce(r?B.Compressed:B.Uncompressed,t))}}signAndAppend(t,e,r,n){const{nextSig:i,nextSigHash:o}=Er(e,r,t.fee,t.nonce,n);if(gr(t))t.signature=i;else{const e=n.data.toString("hex").endsWith("01");t.fields.push(ce(e?B.Compressed:B.Uncompressed,i))}return o}txid(){const t=this.serialize();return Qe(t)}setSponsor(t){if(this.auth.authType!=I.Sponsored)throw new Jt("Cannot sponsor sign a non-sponsored transaction");this.auth=Rr(this.auth,t)}setFee(t){this.auth=Ir(this.auth,t)}setNonce(t){this.auth=Nr(this.auth,t)}setSponsorNonce(t){if(this.auth.authType!=I.Sponsored)throw new Jt("Cannot sponsor sign a non-sponsored transaction");this.auth=Br(this.auth,t)}serialize(){if(void 0===this.version)throw new Gt('"version" is undefined');if(void 0===this.chainId)throw new Gt('"chainId" is undefined');if(void 0===this.auth)throw new Gt('"auth" is undefined');if(void 0===this.anchorMode)throw new Gt('"anchorMode" is undefined');if(void 0===this.payload)throw new Gt('"payload" is undefined');const t=new $e;t.appendByte(this.version);const e=a.alloc(4);return e.writeUInt32BE(this.chainId,0),t.push(e),t.push(Ur(this.auth)),t.appendByte(this.anchorMode),t.appendByte(this.postConditionMode),t.push(Ie(this.postConditions)),t.push(oe(this.payload)),t.concatBuffer()}}function Dr(t){let e;e="string"==typeof t?"0x"===t.slice(0,2).toLowerCase()?new zt(a.from(t.slice(2),"hex")):new zt(a.from(t,"hex")):a.isBuffer(t)?new zt(t):t;const r=e.readUInt8Enum(k,(t=>{throw new Error(`Could not parse ${t} as TransactionVersion`)})),n=e.readUInt32BE(),i=Fr(e),o=e.readUInt8Enum(E,(t=>{throw new Error(`Could not parse ${t} as AnchorMode`)})),s=e.readUInt8Enum(O,(t=>{throw new Error(`Could not parse ${t} as PostConditionMode`)})),u=xe(e,A.PostCondition),c=se(e);return new Lr(r,i,c,u,s,o,n)}function jr(t,e,r){return"string"==typeof t&&(t=bt(t)),{type:A.PostCondition,conditionType:P.STX,principal:t,conditionCode:e,amount:c(r,!1)}}function Vr(t,e,r,n){return"string"==typeof t&&(t=bt(t)),"string"==typeof n&&(n=gt(n)),{type:A.PostCondition,conditionType:P.Fungible,principal:t,conditionCode:e,amount:c(r,!1),assetInfo:n}}function Wr(t,e,r,n){return"string"==typeof t&&(t=bt(t)),"string"==typeof r&&(r=gt(r)),{type:A.PostCondition,conditionType:P.NonFungible,principal:t,conditionCode:e,assetInfo:r,assetName:n}}function $r(t,e="hex"){switch(t.type){case j.BoolTrue:return"true";case j.BoolFalse:return"false";case j.Int:return t.value.toString();case j.UInt:return`u${t.value.toString()}`;case j.Buffer:if("tryAscii"===e){const e=t.buffer.toString("ascii");if(/[ -~]/.test(e))return JSON.stringify(e)}return`0x${t.buffer.toString("hex")}`;case j.OptionalNone:return"none";case j.OptionalSome:return`(some ${$r(t.value,e)})`;case j.ResponseErr:return`(err ${$r(t.value,e)})`;case j.ResponseOk:return`(ok ${$r(t.value,e)})`;case j.PrincipalStandard:case j.PrincipalContract:return xt(t);case j.List:return`(list ${t.list.map((t=>$r(t,e))).join(" ")})`;case j.Tuple:return`(tuple ${Object.keys(t.data).map((r=>`(${r} ${$r(t.data[r],e)})`)).join(" ")})`;case j.StringASCII:return`"${t.data}"`;case j.StringUTF8:return`u"${t.data}"`}}function Kr(t,e=!1){switch(t.type){case j.BoolTrue:return!0;case j.BoolFalse:return!1;case j.Int:case j.UInt:return e?t.value.toString():t.value;case j.Buffer:return`0x${t.buffer.toString("hex")}`;case j.OptionalNone:return null;case j.OptionalSome:case j.ResponseErr:case j.ResponseOk:return Hr(t.value);case j.PrincipalStandard:case j.PrincipalContract:return xt(t);case j.List:return t.list.map((t=>Hr(t)));case j.Tuple:const r={};return Object.keys(t.data).forEach((e=>{r[e]=Hr(t.data[e])})),r;case j.StringASCII:case j.StringUTF8:return t.data}}function Hr(t){switch(t.type){case j.ResponseErr:return{type:qr(t),value:Kr(t,!0),success:!1};case j.ResponseOk:return{type:qr(t),value:Kr(t,!0),success:!0};default:return{type:qr(t),value:Kr(t,!0)}}}function qr(t){switch(t.type){case j.BoolTrue:case j.BoolFalse:return"bool";case j.Int:return"int";case j.UInt:return"uint";case j.Buffer:return`(buff ${t.buffer.length})`;case j.OptionalNone:return"(optional none)";case j.OptionalSome:return`(optional ${qr(t.value)})`;case j.ResponseErr:return`(response UnknownType ${qr(t.value)})`;case j.ResponseOk:return`(response ${qr(t.value)} UnknownType)`;case j.PrincipalStandard:case j.PrincipalContract:return"principal";case j.List:return`(list ${t.list.length} ${t.list.length?qr(t.list[0]):"UnknownType"})`;case j.Tuple:return`(tuple ${Object.keys(t.data).map((e=>`(${e} ${qr(t.data[e])})`)).join(" ")})`;case j.StringASCII:return`(string-ascii ${a.from(t.data,"ascii").length})`;case j.StringUTF8:return`(string-utf8 ${a.from(t.data,"utf8").length})`}}var zr,Gr;async function Xr(t,e){const r=Object.assign({referrer:"no-referrer",referrerPolicy:"no-referrer"},e);return await fetch(t,r)}r(1905),function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(zr||(zr={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(Gr||(Gr={}));const Zr=["mainnet","testnet"];class Jr{constructor(t){this.version=Gr.Mainnet,this.chainId=zr.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",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===Gr.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.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.coreApiUrl=t.url}getNameInfo(t){return Xr(`${this.bnsLookupUrl}/v1/names/${t}`).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))}}Jr.fromName=t=>{switch(t){case"mainnet":return new Yr;case"testnet":return new Qr;default:throw new Error(`Invalid network name provided. Must be one of the following: ${Zr.join(", ")}`)}},Jr.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:Jr.fromName(t);class Yr extends Jr{constructor(t={url:"https://stacks-node-api.mainnet.stacks.co"}){super(t),this.version=Gr.Mainnet,this.chainId=zr.Mainnet}}class Qr extends Jr{constructor(t={url:"https://stacks-node-api.testnet.stacks.co"}){super(t),this.version=Gr.Testnet,this.chainId=zr.Testnet}}var tn;!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"}(tn||(tn={}));const en=t=>"string"==typeof t,rn=t=>void 0!==t.buffer,nn=t=>void 0!==t["string-ascii"],on=t=>void 0!==t["string-utf8"],sn=t=>void 0!==t.response,an=t=>void 0!==t.optional,un=t=>void 0!==t.tuple,cn=t=>void 0!==t.list;function hn(t){if(en(t)){if("uint128"===t)return{id:tn.ClarityAbiTypeUInt128,type:t};if("int128"===t)return{id:tn.ClarityAbiTypeInt128,type:t};if("bool"===t)return{id:tn.ClarityAbiTypeBool,type:t};if("principal"===t)return{id:tn.ClarityAbiTypePrincipal,type:t};if("trait_reference"===t)return{id:tn.ClarityAbiTypeTraitReference,type:t};if("none"===t)return{id:tn.ClarityAbiTypeNone,type:t};throw new Error(`Unexpected Clarity ABI type primitive: ${JSON.stringify(t)}`)}if(rn(t))return{id:tn.ClarityAbiTypeBuffer,type:t};if(sn(t))return{id:tn.ClarityAbiTypeResponse,type:t};if(an(t))return{id:tn.ClarityAbiTypeOptional,type:t};if(un(t))return{id:tn.ClarityAbiTypeTuple,type:t};if(cn(t))return{id:tn.ClarityAbiTypeList,type:t};if(nn(t))return{id:tn.ClarityAbiTypeStringAscii,type:t};if(on(t))return{id:tn.ClarityAbiTypeStringUtf8,type:t};throw new Error(`Unexpected Clarity ABI type: ${JSON.stringify(t)}`)}function fn(t,e){let r;switch(r=void 0!==t.id?t:hn(t),r.id){case tn.ClarityAbiTypeUInt128:return Tt(e);case tn.ClarityAbiTypeInt128:return kt(e);case tn.ClarityAbiTypeBool:if("false"===e||"0"===e)return It();if("true"===e||"1"===e)return Pt();throw new Error(`Unexpected Clarity bool value: ${JSON.stringify(e)}`);case tn.ClarityAbiTypePrincipal:if(e.includes(".")){const[t,r]=e.split(".");return Rt(t,r)}return Nt(e);case tn.ClarityAbiTypeTraitReference:const[t,n]=e.split(".");return Rt(t,n);case tn.ClarityAbiTypeNone:return jt();case tn.ClarityAbiTypeBuffer:return Ct(a.from(e,"utf8"));case tn.ClarityAbiTypeStringAscii:return Qt(e);case tn.ClarityAbiTypeStringUtf8:return te(e);case tn.ClarityAbiTypeResponse:case tn.ClarityAbiTypeOptional:case tn.ClarityAbiTypeTuple:case tn.ClarityAbiTypeList:throw new Zt(`Unsupported encoding for Clarity type: ${r.id}`);default:throw new Error(`Unexpected Clarity type ID: ${JSON.stringify(r)}`)}}function ln(t){if(en(t))return"int128"===t?"int":"uint128"===t?"uint":t;if(rn(t))return`(buff ${t.buffer.length})`;if(nn(t))return`(string-ascii ${t["string-ascii"].length})`;if(on(t))return`(string-utf8 ${t["string-utf8"].length})`;if(sn(t))return`(response ${ln(t.response.ok)} ${ln(t.response.error)})`;if(an(t))return`(optional ${ln(t.optional)})`;if(un(t))return`(tuple ${t.tuple.map((t=>`(${t.name} ${ln(t.type)})`)).join(" ")})`;if(cn(t))return`(list ${t.list.length} ${ln(t.list.type)})`;throw new Error(`Type string unsupported for Clarity type: ${JSON.stringify(t)}`)}function dn(t){return`(define-${"read_only"===t.access?"read-only":t.access} (${t.name} ${t.args.map((t=>`(${t.name} ${ln(t.type)})`)).join(" ")}))`}function pn(t,e){const r=hn(e);switch(t.type){case j.BoolTrue:case j.BoolFalse:return r.id===tn.ClarityAbiTypeBool;case j.Int:return r.id===tn.ClarityAbiTypeInt128;case j.UInt:return r.id===tn.ClarityAbiTypeUInt128;case j.Buffer:return r.id===tn.ClarityAbiTypeBuffer&&r.type.buffer.length>=t.buffer.length;case j.StringASCII:return r.id===tn.ClarityAbiTypeStringAscii&&r.type["string-ascii"].length>=t.data.length;case j.StringUTF8:return r.id===tn.ClarityAbiTypeStringUtf8&&r.type["string-utf8"].length>=t.data.length;case j.OptionalNone:return r.id===tn.ClarityAbiTypeNone||r.id===tn.ClarityAbiTypeOptional;case j.OptionalSome:return r.id===tn.ClarityAbiTypeOptional&&pn(t.value,r.type.optional);case j.ResponseErr:return r.id===tn.ClarityAbiTypeResponse&&pn(t.value,r.type.response.error);case j.ResponseOk:return r.id===tn.ClarityAbiTypeResponse&&pn(t.value,r.type.response.ok);case j.PrincipalContract:return r.id===tn.ClarityAbiTypePrincipal||r.id===tn.ClarityAbiTypeTraitReference;case j.PrincipalStandard:return r.id===tn.ClarityAbiTypePrincipal;case j.List:return r.id==tn.ClarityAbiTypeList&&r.type.list.length>=t.list.length&&t.list.every((t=>pn(t,r.type.list.type)));case j.Tuple:if(r.id==tn.ClarityAbiTypeTuple){const e=Ze(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(!pn(o,n.type))return!1;delete e[i]}return!0}return!1;default:return!1}}function gn(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(!pn(n,i.type)){const e=r+1;throw new Error(`Clarity function \`${t.functionName.content}\` expects argument ${e} to be of type ${ln(i.type)}, not ${qr(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 mn(t,e){const r=ln(e);if(en(e)){if("uint128"===e)return Tt(t);if("int128"===e)return kt(t);if("bool"===e){if("true"===t.toLowerCase())return Pt();if("false"===t.toLowerCase())return It();throw new Error(`Invalid bool value: ${t}`)}if("principal"===e){if(t.includes(".")){const[e,r]=t.split(".");return Rt(e,r)}return Nt(t)}throw new Error(`Contract function contains unsupported Clarity ABI type: ${r}`)}if(rn(e)){if(a.from(t).byteLength>e.buffer.length)throw new Error(`Input exceeds specified buffer length limit of ${e.buffer.length}`);return Ot(t)}throw sn(e)||an(e)||un(e)||cn(e),new Error(`Contract function contains unsupported Clarity ABI type: ${r}`)}class yn{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&&!gr(e)){if(e.fields.filter((t=>t.contents.type===A.MessageSignature)).length>=e.signaturesRequired)throw new Error("SpendingCondition has more signatures than are expected");e.fields.forEach((r=>{if(r.contents.type===A.MessageSignature){const n=r.contents,i=kr(this.sigHash,t.auth.authType,e.fee,e.nonce,B.Compressed,n);this.sigHash=i.nextSigHash}}))}}static createSponsorSigner(t,e){if(t.auth.authType!=I.Sponsored)throw new Jt("Cannot add sponsor to non-sponsored transaction");const r=Ze(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 Jt("Cannot sign origin after sponsor key");if(void 0===this.transaction.auth)throw new Jt('"transaction.auth" is undefined');if(void 0===this.transaction.auth.spendingCondition)throw new Jt('"transaction.auth.spendingCondition" is undefined');if(!gr(this.transaction.auth.spendingCondition)){const t=this.transaction.auth.spendingCondition;if(this.checkOversign&&t.fields.filter((t=>t.contents.type===A.MessageSignature)).length>=t.signaturesRequired)throw new Error("Origin would have too many signatures")}const e=this.transaction.signNextOrigin(this.sigHash,t);this.sigHash=e}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 Jt('"transaction.auth" is undefined');if(this.transaction.auth.authType!==I.Sponsored)throw new Jt('"transaction.auth.authType" is not AuthType.Sponsored');const e=this.transaction.signNextSponsor(this.sigHash,t);this.sigHash=e,this.originDone=!0}getTxInComplete(){return Ze(this.transaction)}resume(t){this.transaction=Ze(t),this.sigHash=t.signBegin()}}async function wn(t,e){const r=new Yr,n=e?Jr.fromNameOrNetwork(e).getAccountApiUrl(t):r.getAccountApiUrl(t),i=await Xr(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(),s=JSON.parse(o);return BigInt(s.nonce)}async function bn(t,e){if(t.payload.payloadType!==M.TokenTransfer)throw new Error(`Transaction fee estimation only possible with ${M[M.TokenTransfer]} transactions. Invoked with: ${M[t.payload.payloadType]}`);const r=null!=e?e:Mn(t),n=Jr.fromNameOrNetwork(r).getTransferFeeEstimateApiUrl(),i=await Xr(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(),s=BigInt(t.serialize().byteLength);return BigInt(o)*s}async function vn(t,e,r){const n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({transaction_payload:oe(t).toString("hex")},e?{estimated_len:e}:{}))},i=new Yr,o=r?Jr.fromNameOrNetwork(r).getTransactionFeeEstimateApiUrl():i.getTransactionFeeEstimateApiUrl(),s=await Xr(o,n);if(!s.ok){let t="";try{t=await s.text()}catch(t){}throw new Error(`Error estimating transaction fee. Response ${s.status}: ${s.statusText}. Attempted to fetch ${o} and failed with the message: "${t}"`)}return(await s.json()).estimations}async function _n(t,e,r){const n=t.serialize(),i=null!=e?e:Mn(t);return Sn(n,Jr.fromNameOrNetwork(i).getBroadcastApiUrl(),r)}async function Sn(t,e,r){const n={method:"POST",headers:{"Content-Type":r?"application/json":"application/octet-stream"},body:r?JSON.stringify({tx:t.toString("hex"),attachment:r.toString("hex")}):t},i=await Xr(e,n);if(!i.ok)try{return await i.json()}catch(t){throw Error(`Failed to broadcast transaction: ${t.message}`)}const o=await i.text(),s=o.replace(/["]+/g,"");if(!fr(s))throw new Error(o);return{txid:s}}async function An(t,e,r){const n=Jr.fromNameOrNetwork(r).getAbiApiUrl(t,e),i=await Xr(n,{method:"GET"});if(!i.ok){const r=await i.text().catch((()=>""));throw new Error(`Error fetching contract ABI for contract "${e}" at address ${t}. Response ${i.status}: ${i.statusText}. Attempted to fetch ${n} and failed with the message: "${r}"`)}return JSON.parse(await i.text())}function Mn(t){switch(t.version){case k.Mainnet:return new Yr;case k.Testnet:return new Qr}}async function En(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Yr,postConditionMode:O.Deny,memo:"",sponsored:!1},r=Object.assign(e,t),n=re(r.recipient,r.amount,r.memo);let i=null,o=null;o="publicKey"in r?dr(x.SerializeP2PKH,r.publicKey,r.nonce,r.fee):pr(x.SerializeP2SH,r.numSignatures,r.publicKeys,r.nonce,r.fee),i=r.sponsored?Cr(o):Tr(o);const s=Jr.fromNameOrNetwork(r.network),a=[];r.postConditions&&r.postConditions.length>0&&r.postConditions.forEach((t=>{a.push(t)}));const u=Pe(a),c=new Lr(s.version,i,n,u,r.postConditionMode,r.anchorMode,s.chainId);if(void 0===t.fee||null===t.fee){const t=c.serialize().byteLength,e=await vn(n,t,r.network);c.setFee(e[1].fee)}if(void 0===t.nonce||null===t.nonce){const t=r.network.version===k.Mainnet?N.MainnetSingleSig:N.TestnetSingleSig,e=(0,H.H4)(t,c.auth.spendingCondition.signer),n=await wn(e,r.network);c.setNonce(n)}return c}async function kn(t){if("senderKey"in t){const e=rt(lt(at(t.senderKey))),r=Je(t,"senderKey"),n=await En(Object.assign({publicKey:e},r)),i=at(t.senderKey);return new yn(n).signOrigin(i),n}{const e=Je(t,"signerKeys"),r=await En(e),n=new yn(r);let i=t.publicKeys;for(const e of t.signerKeys){const t=it(e);i=i.filter((e=>e!==t.data.toString("hex"))),n.signOrigin(at(e))}for(const t of i)n.appendOrigin(tt(a.from(t,"hex")));return r}}async function Tn(t,e){if(t.payload.payloadType!==M.SmartContract)throw new Error(`Contract deploy fee estimation only possible with ${M[M.SmartContract]} transactions. Invoked with: ${M[t.payload.payloadType]}`);const r=null!=e?e:Mn(t),n=Jr.fromNameOrNetwork(r).getTransferFeeEstimateApiUrl(),i=await Xr(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=c(t.serialize().byteLength,!1);return c(o,!1)*s}async function Cn(t){const e=at(t.senderKey),r=rt(lt(e)),n=Object.assign(Object.assign({},t),{publicKey:r}),i=await On(n);return t.senderKey&&new yn(i).signOrigin(e),i}async function On(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Yr,postConditionMode:O.Deny,sponsored:!1},r=Object.assign(e,t),n=ie(r.contractName,r.codeBody),i=x.SerializeP2PKH,o=Y(r.publicKey);let s=null;const a=dr(i,rt(o),r.nonce,r.fee);s=r.sponsored?Cr(a):Tr(a);const u=Jr.fromNameOrNetwork(r.network),c=[];r.postConditions&&r.postConditions.length>0&&r.postConditions.forEach((t=>{c.push(t)}));const h=Pe(c),f=new Lr(u.version,s,n,h,r.postConditionMode,r.anchorMode,u.chainId);if(void 0===t.fee||null===t.fee){const t=f.serialize().byteLength,e=await vn(n,t,r.network);f.setFee(e[1].fee)}if(void 0===t.nonce||null===t.nonce){const t=pt(r.network.version===k.Mainnet?N.MainnetSingleSig:N.TestnetSingleSig,o),e=await wn(t,r.network);f.setNonce(e)}return f}async function Pn(t,e){if(t.payload.payloadType!==M.ContractCall)throw new Error(`Contract call fee estimation only possible with ${M[M.ContractCall]} transactions. Invoked with: ${M[t.payload.payloadType]}`);const r=null!=e?e:Mn(t),n=Jr.fromNameOrNetwork(r).getTransferFeeEstimateApiUrl(),i=await Xr(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=c(t.serialize().byteLength,!1);return c(o,!1)*s}async function In(t){const e={fee:BigInt(0),nonce:BigInt(0),network:new Yr,postConditionMode:O.Deny,sponsored:!1},r=Object.assign(e,t),n=ne(r.contractAddress,r.contractName,r.functionName,r.functionArgs);if(null==r?void 0:r.validateWithAbi){let t;if("boolean"==typeof r.validateWithAbi){if(!(null==r?void 0:r.network))throw new Error("Network option must be provided in order to validate with ABI");t=await An(r.contractAddress,r.contractName,r.network)}else t=r.validateWithAbi;gn(n,t)}let i=null,o=null;i="publicKey"in r?dr(x.SerializeP2PKH,r.publicKey,r.nonce,r.fee):pr(x.SerializeP2SH,r.numSignatures,r.publicKeys,r.nonce,r.fee),o=r.sponsored?Cr(i):Tr(i);const s=Jr.fromNameOrNetwork(r.network),a=[];r.postConditions&&r.postConditions.length>0&&r.postConditions.forEach((t=>{a.push(t)}));const u=Pe(a),c=new Lr(s.version,o,n,u,r.postConditionMode,r.anchorMode,s.chainId);if(void 0===t.fee||null===t.fee){const t=c.serialize().byteLength,e=await vn(n,t,s);c.setFee(e[1].fee)}if(void 0===t.nonce||null===t.nonce){const t=s.version===k.Mainnet?N.MainnetSingleSig:N.TestnetSingleSig,e=(0,H.H4)(t,c.auth.spendingCondition.signer),r=await wn(e,s);c.setNonce(r)}return c}async function xn(t){if("senderKey"in t){const e=rt(lt(at(t.senderKey))),r=Je(t,"senderKey"),n=await In(Object.assign({publicKey:e},r)),i=at(t.senderKey);return new yn(n).signOrigin(i),n}{const e=Je(t,"signerKeys"),r=await In(e),n=new yn(r);let i=t.publicKeys;for(const e of t.signerKeys){const t=it(e);i=i.filter((e=>e!==t.data.toString("hex"))),n.signOrigin(at(e))}for(const t of i)n.appendOrigin(tt(a.from(t,"hex")));return r}}function Nn(t,e,r){return jr(_t(t),e,r)}function Bn(t,e,r,n){return jr(vt(t,e),r,n)}function Rn(t,e,r,n){return Vr(_t(t),e,r,n)}function Un(t,e,r,n,i){return Vr(vt(t,e),r,n,i)}function Fn(t,e,r,n){return Wr(_t(t),e,r,n)}function Ln(t,e,r,n,i){return Wr(vt(t,e),r,n,i)}async function Dn(t){const e={network:new Yr},r=Object.assign(e,t),{contractName:n,contractAddress:i,functionName:o,functionArgs:s,senderAddress:a}=r,u=Jr.fromNameOrNetwork(r.network).getReadOnlyFunctionCallApiUrl(i,n,o),c=s.map((t=>ar(t))),h=JSON.stringify({sender:a,arguments:c}),f=await Xr(u,{method:"POST",body:h,headers:{"Content-Type":"application/json"}});if(!f.ok){const t=await f.text().catch((()=>""));throw new Error(`Error calling read-only function. Response ${f.status}: ${f.statusText}. Attempted to fetch ${u} and failed with the message: "${t}"`)}return f.json().then((t=>cr(t)))}async function jn(t){const e={fee:0,sponsorNonce:0,sponsorAddressHashmode:x.SerializeP2PKH,network:t.transaction.version===k.Mainnet?new Yr:new Qr},r=Object.assign(e,t),n=Jr.fromNameOrNetwork(r.network),i=it(r.sponsorPrivateKey);if(void 0===t.fee||null===t.fee){let t=0;switch(r.transaction.payload.payloadType){case M.TokenTransfer:case M.SmartContract:case M.ContractCall:const e=r.transaction.serialize().byteLength;try{t=(await vn(r.transaction.payload,e,n))[1].fee}catch(t){throw t}break;default:throw new Error(`Sponsored transactions not supported for transaction type ${M[r.transaction.payload.payloadType]}`)}r.transaction.setFee(t),r.fee=t}if(void 0===t.sponsorNonce||null===t.sponsorNonce){const t=pt(n.version===k.Mainnet?N.MainnetSingleSig:N.TestnetSingleSig,i),e=await wn(t,n);r.sponsorNonce=e}const o=dr(r.sponsorAddressHashmode,rt(i),r.sponsorNonce,r.fee);r.transaction.setSponsor(o);const s=at(r.sponsorPrivateKey),a=yn.createSponsorSigner(r.transaction,o);return a.signSponsor(s),a.transaction}},7476: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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4243).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)f*=e;this.imuln(f),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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,f=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;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[c]=0|f,u=0|h}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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}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=f[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:h[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!==s),this.toArrayLike(s,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 s,a,u="le"===e,c=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[o-a-1]=s}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 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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(0==(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(0==(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(0==(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,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),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,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],f=8191&h,l=h>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,_=b>>>13,S=0|s[4],A=8191&S,M=S>>>13,E=0|s[5],k=8191&E,T=E>>>13,C=0|s[6],O=8191&C,P=C>>>13,I=0|s[7],x=8191&I,N=I>>>13,B=0|s[8],R=8191&B,U=B>>>13,F=0|s[9],L=8191&F,D=F>>>13,j=0|a[0],V=8191&j,W=j>>>13,$=0|a[1],K=8191&$,H=$>>>13,q=0|a[2],z=8191&q,G=q>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,W))+Math.imul(g,V)|0,o=Math.imul(g,W);var yt=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,W))+Math.imul(w,V)|0,o=Math.imul(w,W),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,H)|0;var wt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,z)|0))<<13)|0;c=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,W))+Math.imul(_,V)|0,o=Math.imul(_,W),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,z)|0,o=o+Math.imul(g,G)|0;var bt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,V),i=(i=Math.imul(A,W))+Math.imul(M,V)|0,o=Math.imul(M,W),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,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,V),i=(i=Math.imul(k,W))+Math.imul(T,V)|0,o=Math.imul(T,W),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(O,V),i=(i=Math.imul(O,W))+Math.imul(P,V)|0,o=Math.imul(P,W),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,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(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,W))+Math.imul(N,V)|0,o=Math.imul(N,W),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|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(y,rt)|0,i=(i=i+Math.imul(y,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,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var At=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(R,V),i=(i=Math.imul(R,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,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(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|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 Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,W))+Math.imul(D,V)|0,o=Math.imul(D,W),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(L,K),i=(i=Math.imul(L,H))+Math.imul(D,K)|0,o=Math.imul(D,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(U,z)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|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(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(w,ft)|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(L,z),i=(i=Math.imul(L,G))+Math.imul(D,z)|0,o=Math.imul(D,G),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var Tt=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,J))+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Ct=(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)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,lt)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,lt)|0;var Pt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,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(L,ot),i=(i=Math.imul(L,st))+Math.imul(D,ot)|0,o=Math.imul(D,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var It=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,lt)|0;var xt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul(D,ft)|0,o=Math.imul(D,lt);var Nt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(c+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,gt))+Math.imul(D,pt)|0))<<13)|0;return c=((o=Math.imul(D,gt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Mt,u[9]=Et,u[10]=kt,u[11]=Tt,u[12]=Ct,u[13]=Ot,u[14]=Pt,u[15]=It,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(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 s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,f=(0|t.words[h])*(0|e.words[c]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.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},m.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},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var f=u,l=c,d=0;d<s;d++){var p=r[h+d],g=n[h+d],m=r[h+d+s],y=n[h+d+s],w=f*m-l*y;y=f*y+l*m,m=w,r[h+d]=p+m,n[h+d]=g+y,r[h+d+s]=p-m,n[h+d+s]=g-y,d!==a&&(w=u*f-c*l,l=u*l+c*f,f=w)}},m.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},m.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}},m.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},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,h,f,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,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 s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,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,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&a}return u&&0!==h&&(u.words[u.length++]=h),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,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):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,s,a},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),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,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,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).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 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(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,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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 y={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 M(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 s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}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(y[t])return y[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 y[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(0==(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),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new o(1).iushln(p-m-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}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],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var f=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=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 M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2044: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 s(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var a="function"==typeof setImmediate&&setImmediate,u="object"==typeof process&&"function"==typeof process.nextTick;function c(t){setTimeout(t,0)}function h(t){return function(e){var r=n(arguments,1);t((function(){e.apply(null,r)}))}}var f=h(a?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)}s(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){f(p,t)}}function p(t){throw t}var g="function"==typeof Symbol;function m(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function y(t){return m(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){y(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,M=A.hasOwnProperty,E=A.toString,k=S?S.toStringTag:void 0;var T=Object.prototype.toString;var C=S?S.toStringTag:void 0;function O(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":C&&C in Object(t)?function(t){var e=M.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 T.call(t)}(t)}function P(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function I(t){return null!=t&&P(t.length)&&!function(t){if(!s(t))return!1;var e=O(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var x={};function N(){}function B(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var R="function"==typeof Symbol&&Symbol.iterator;function U(t){return null!=t&&"object"==typeof t}function F(t){return U(t)&&"[object Arguments]"==O(t)}var L=Object.prototype,D=L.hasOwnProperty,j=L.propertyIsEnumerable,V=F(function(){return arguments}())?F:function(t){return U(t)&&D.call(t,"callee")&&!j.call(t,"callee")},W=Array.isArray;var $="object"==typeof e&&e&&!e.nodeType&&e,K=$&&t&&!t.nodeType&&t,H=K&&K.exports===$?_.Buffer:void 0,q=(H?H.isBuffer:void 0)||function(){return!1},z=/^(?:0|[1-9]\d*)$/;function G(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&z.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 Z,J="object"==typeof e&&e&&!e.nodeType&&e,Y=J&&t&&!t.nodeType&&t,Q=Y&&Y.exports===J&&b.process,tt=function(){try{return Y&&Y.require&&Y.require("util").types||Q&&Q.binding&&Q.binding("util")}catch(t){}}(),et=tt&&tt.isTypedArray,rt=et?(Z=et,function(t){return Z(t)}):function(t){return U(t)&&P(t.length)&&!!X[O(t)]},nt=Object.prototype.hasOwnProperty;function it(t,e){var r=W(t),n=!r&&V(t),i=!r&&!n&&q(t),o=!r&&!n&&!i&&rt(t),s=r||n||i||o,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=a.length;for(var c in t)!e&&!nt.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||G(c,u))||a.push(c);return a}var ot=Object.prototype;var st=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),at=Object.prototype.hasOwnProperty;function ut(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||ot))return st(t);var e,r,n=[];for(var i in Object(t))at.call(t,i)&&"constructor"!=i&&n.push(i);return n}function ct(t){return I(t)?it(t):ut(t)}function ht(t){if(I(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 R&&t[R]&&t[R]()}(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(){var t=r[++n];return n<i?{value:e[t],key:t}:null})}function ft(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=B(n||N),t<=0||!e)return n(null);var i=ht(e),o=!1,s=0,a=!1;function u(t,e){if(s-=1,t)o=!0,n(t);else{if(e===x||o&&s<=0)return o=!0,n(null);a||c()}}function c(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&n(null));s+=1,r(e.value,e.key,ft(u))}a=!1}c()}}function dt(t,e,r,n){lt(e)(t,y(r),n)}function pt(t,e){return function(r,n,i){return t(r,e,n,i)}}function gt(t,e,r){r=B(r||N);var n=0,i=0,o=t.length;function s(t,e){t?r(t):++i!==o&&e!==x||r(null)}for(0===o&&r(null);n<o;n++)e(t[n],n,ft(s))}var mt=pt(dt,1/0),yt=function(t,e,r){(I(t)?gt:mt)(t,y(e),r)};function wt(t){return function(e,r,n){return t(yt,e,y(r),n)}}function bt(t,e,r,n){n=n||N,e=e||[];var i=[],o=0,s=y(r);t(e,(function(t,e,r){var n=o++;s(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,y(n),i)}}var At=St(bt),Mt=pt(At,1),Et=w(Mt);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 Tt,Ct=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),s=o.length;s--;){var a=o[Tt?s:++n];if(!1===e(i[a],a,i))break}return t};function Ot(t,e){return t&&Ct(t,e,ct)}function Pt(t){return t!=t}function It(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,Pt,r)}var xt=function(t,e,r){"function"==typeof e&&(r=e,e=null),r=B(r||N);var i=ct(t).length;if(!i)return r(null);e||(e=i);var o={},s=0,a=!1,u=Object.create(null),c=[],h=[],f={};function l(t,e){c.push((function(){!function(t,e){if(!a){var i=ft((function(e,i){if(s--,arguments.length>2&&(i=n(arguments,1)),e){var c={};Ot(o,(function(t,e){c[e]=t})),c[t]=i,a=!0,u=Object.create(null),r(e,c)}else o[t]=i,p(t)}));s++;var c=y(e[e.length-1]);e.length>1?c(o,i):c(i)}}(t,e)}))}function d(){if(0===c.length&&0===s)return r(null,o);for(;c.length&&s<e;)c.shift()()}function p(t){kt(u[t]||[],(function(t){t()})),d()}function g(e){var r=[];return Ot(t,(function(t,n){W(t)&&It(t,e,0)>=0&&r.push(n)})),r}Ot(t,(function(e,r){if(!W(e))return l(r,[e]),void h.push(r);var n=e.slice(0,e.length-1),i=n.length;if(0===i)return l(r,e),void h.push(r);f[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 s,a,c;a=function(){0==--i&&l(r,e)},(c=u[s=o])||(c=u[s]=[]),c.push(a)}))})),function(){for(var t=0;h.length;)t++,kt(g(h.pop()),(function(t){0==--f[t]&&h.push(t)}));if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),d()};function Nt(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 Bt=S?S.prototype:void 0,Rt=Bt?Bt.toString:void 0;function Ut(t){if("string"==typeof t)return t;if(W(t))return Nt(t,Ut)+"";if(function(t){return"symbol"==typeof t||U(t)&&"[object Symbol]"==O(t)}(t))return Rt?Rt.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Ft(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 Lt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Dt="[\\ud800-\\udfff]",jt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Vt="\\ud83c[\\udffb-\\udfff]",Wt="[^\\ud800-\\udfff]",$t="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ht="(?:"+jt+"|"+Vt+")?",qt="[\\ufe0e\\ufe0f]?",zt=qt+Ht+("(?:\\u200d(?:"+[Wt,$t,Kt].join("|")+")"+qt+Ht+")*"),Gt="(?:"+[Wt+jt+"?",jt,$t,Kt,Dt].join("|")+")",Xt=RegExp(Vt+"(?="+Vt+")|"+Gt+zt,"g");function Zt(t){return function(t){return Lt.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.split("")}(t)}var Jt=/^\s+|\s+$/g;function Yt(t,e,r){if((t=null==(n=t)?"":Ut(n))&&(r||void 0===e))return t.replace(Jt,"");var n;if(!t||!(e=Ut(e)))return t;var i=Zt(t),o=Zt(e);return Ft(i,function(t,e){for(var r=-1,n=t.length;++r<n&&It(e,t[r],0)>-1;);return r}(i,o),function(t,e){for(var r=t.length;r--&&It(e,t[r],0)>-1;);return r}(i,o)+1).join("")}var Qt=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,te=/,/,ee=/(=.+)?(\s*)$/,re=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ne(t,e){var r={};Ot(t,(function(t,e){var n,i=m(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?s:t);else if(o)r[e]=t;else{if(n=function(t){return(t=(t=(t=t.toString().replace(re,"")).match(Qt)[2].replace(" ",""))?t.split(te):[]).map((function(t){return Yt(t.replace(ee,""))}))}(t),0===t.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[e]=n.concat(s)}function s(e,r){var i=Nt(n,(function(t){return e[t]}));i.push(r),y(t).apply(null,i)}})),xt(r,e)}function ie(){this.head=this.tail=null,this.length=0}function oe(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=y(t),i=0,o=[],s=!1;function a(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(h.started=!0,W(t)||(t=[t]),0===t.length&&h.idle())return f((function(){h.drain()}));for(var n=0,i=t.length;n<i;n++){var o={data:t[n],callback:r||N};e?h._tasks.unshift(o):h._tasks.push(o)}s||(s=!0,f((function(){s=!1,h.process()})))}function u(t){return function(e){i-=1;for(var r=0,n=t.length;r<n;r++){var s=t[r],a=It(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&h.error(e,s.data)}i<=h.concurrency-h.buffer&&h.unsaturated(),h.idle()&&h.drain(),h.process()}}var c=!1,h={_tasks:new ie,concurrency:e,payload:r,saturated:N,unsaturated:N,buffer:e/4,empty:N,drain:N,error:N,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){h.drain=N,h._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){h._tasks.remove(t)},process:function(){if(!c){for(c=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var t=[],e=[],r=h._tasks.length;h.payload&&(r=Math.min(r,h.payload));for(var s=0;s<r;s++){var a=h._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===h._tasks.length&&h.empty(),i===h.concurrency&&h.saturated();var f=ft(u(t));n(e,f)}c=!1}},length:function(){return h._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return h._tasks.length+i===0},pause:function(){h.paused=!0},resume:function(){!1!==h.paused&&(h.paused=!1,f(h.process))}};return h}function ae(t,e){return se(t,1,e)}ie.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},ie.prototype.empty=function(){for(;this.head;)this.shift();return this},ie.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},ie.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},ie.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):oe(this,t)},ie.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):oe(this,t)},ie.prototype.shift=function(){return this.head&&this.removeLink(this.head)},ie.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},ie.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},ie.prototype.remove=function(t){for(var e=this.head;e;){var r=e.next;t(e)&&this.removeLink(e),e=r}return this};var ue=pt(dt,1);function ce(t,e,r,n){n=B(n||N);var i=y(r);ue(t,(function(t,r,n){i(e,t,(function(t,r){e=r,n(t)}))}),(function(t){n(t,e)}))}function he(){var t=Nt(arguments,y);return function(){var e=n(arguments),r=this,i=e[e.length-1];"function"==typeof i?e.pop():i=N,ce(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 fe=function(){return he.apply(null,n(arguments).reverse())},le=Array.prototype.concat,de=function(t,e,r,i){i=i||N;var o=y(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=le.apply(r,e[n]));return i(t,r)}))},pe=pt(de,1/0),ge=pt(de,1),me=function(){var t=n(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function ye(t){return t}function we(t,e){return function(r,n,i,o){o=o||N;var s,a=!1;r(n,(function(r,n,o){i(r,(function(n,i){n?o(n):t(i)&&!s?(a=!0,s=e(!0,r),o(null,x)):o()}))}),(function(t){t?o(t):o(null,a?s:e(!1))}))}}function be(t,e){return e}var ve=wt(we(ye,be)),_e=St(we(ye,be)),Se=pt(_e,1);function Ae(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)})))})),y(e).apply(null,r)}}var Me=Ae("dir");function Ee(t,e,r){r=ft(r||N);var i=y(t),o=y(e);function s(t){if(t)return r(t);var e=n(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?r(t):e?void i(s):r(null)}a(null,!0)}function ke(t,e,r){r=ft(r||N);var i=y(t),o=function(t){if(t)return r(t);var s=n(arguments,1);if(e.apply(this,s))return i(o);r.apply(null,[null].concat(s))};i(o)}function Te(t,e,r){ke(t,(function(){return!e.apply(this,arguments)}),r)}function Ce(t,e,r){r=ft(r||N);var n=y(e),i=y(t);function o(t){if(t)return r(t);i(s)}function s(t,e){return t?r(t):e?void n(o):r(null)}i(s)}function Oe(t){return function(e,r,n){return t(e,n)}}function Pe(t,e,r){yt(t,Oe(y(e)),r)}function Ie(t,e,r,n){lt(e)(t,Oe(y(r)),n)}var xe=pt(Ie,1);function Ne(t){return m(t)?t:o((function(e,r){var n=!0;e.push((function(){var t=arguments;n?f((function(){r.apply(null,t)})):r.apply(null,t)})),t.apply(this,e),n=!1}))}function Be(t){return!t}var Re=wt(we(Be,Be)),Ue=St(we(Be,Be)),Fe=pt(Ue,1);function Le(t){return function(e){return null==e?void 0:e[t]}}function De(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,Nt(i.sort((function(t,e){return t.index-e.index})),Le("value")))}))}function Ve(t,e,r,n){(I(e)?De:je)(t,e,y(r),n||N)}var We=wt(Ve),$e=St(Ve),Ke=pt($e,1);function He(t,e){var r=ft(e||N),n=y(Ne(t));!function t(e){if(e)return r(e);n(t)}()}var qe=function(t,e,r,n){n=n||N;var i=y(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 s=e[o].key,a=e[o].val;i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)}))},ze=pt(qe,1/0),Ge=pt(qe,1),Xe=Ae("log");function Ze(t,e,r,n){n=B(n||N);var i={},o=y(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 Je=pt(Ze,1/0),Ye=pt(Ze,1);function Qe(t,e){return e in t}function tr(t,e){var r=Object.create(null),i=Object.create(null);e=e||ye;var s=y(t),a=o((function(t,o){var a=e.apply(null,t);Qe(r,a)?f((function(){o.apply(null,r[a])})):Qe(i,a)?i[a].push(o):(i[a]=[o],s.apply(null,t.concat((function(){var t=n(arguments);r[a]=t;var e=i[a];delete i[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)}))))}));return a.memo=r,a.unmemoized=t,a}var er=h(u?process.nextTick:a?setImmediate:c);function rr(t,e,r){r=r||N;var i=I(e)?[]:{};t(e,(function(t,e,r){y(t)((function(t,o){arguments.length>2&&(o=n(arguments,1)),i[e]=o,r(t)}))}),(function(t){r(t,i)}))}function nr(t,e){rr(yt,t,e)}function ir(t,e,r){rr(lt(e),t,r)}var or=function(t,e){var r=y(t);return se((function(t,e){r(t[0],e)}),e,1)},sr=function(t,e){var r=or(t,e);return r.push=function(t,e,n){if(null==n&&(n=N),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,W(t)||(t=[t]),0===t.length)return f((function(){r.drain()}));e=e||0;for(var i=r._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:n};i?r._tasks.insertBefore(i,a):r._tasks.push(a)}f(r.process)},delete r.unshift,r};function ar(t,e){if(e=B(e||N),!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++)y(t[r])(e)}function ur(t,e,r,i){ce(n(t).reverse(),e,r,i)}function cr(t){var e=y(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=Nt(t,cr):(e={},Ot(t,(function(t,r){e[r]=cr.call(this,t)}))),e}function fr(t,e,r,n){Ve(t,e,(function(t,e){r(t,(function(t,r){e(t,!r)}))}),n)}var lr=wt(fr),dr=St(fr),pr=pt(dr,1);function gr(t){return function(){return t}}function mr(t,e,r){var n=5,i=0,o={times:n,intervalFunc:gr(i)};function s(t,e){if("object"==typeof e)t.times=+e.times||n,t.intervalFunc="function"==typeof e.interval?e.interval:gr(+e.interval||i),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||n}}if(arguments.length<3&&"function"==typeof t?(r=e||N,e=t):(s(o,t),r=r||N),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var a=y(e),u=1;function c(){a((function(t){t&&u++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(c,o.intervalFunc(u)):r.apply(null,arguments)}))}c()}var yr=function(t,e){e||(e=t,t=null);var r=y(e);return o((function(e,n){function i(t){r.apply(null,e.concat(t))}t?mr(t,i,n):mr(i,n)}))};function wr(t,e){rr(ue,t,e)}var br=wt(we(Boolean,ye)),vr=St(we(Boolean,ye)),_r=pt(vr,1);function Sr(t,e,r){var n=y(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,Nt(e.sort(i),Le("value")))}))}function Ar(t,e,r){var n=y(t);return o((function(i,o){var s,a=!1;i.push((function(){a||(o.apply(null,arguments),clearTimeout(s))})),s=setTimeout((function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)}),e),n.apply(null,i)}))}var Mr=Math.ceil,Er=Math.max;function kr(t,e,r,n){var i=y(r);At(function(t,e,r,n){for(var i=-1,o=Er(Mr((e-t)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=t,t+=r;return s}(0,t,1),e,i,n)}var Tr=pt(kr,1/0),Cr=pt(kr,1);function Or(t,e,r,n){arguments.length<=3&&(n=r,r=e,e=W(t)?[]:{}),n=B(n||N);var i=y(r);yt(t,(function(t,r,n){i(e,t,r,n)}),(function(t){n(t,e)}))}function Pr(t,e){var r,i=null;e=e||N,xe(t,(function(t,e){y(t)((function(t,o){r=arguments.length>2?n(arguments,1):o,i=t,e(!t)}))}),(function(){e(i,r)}))}function Ir(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function xr(t,e,r){r=ft(r||N);var i=y(e);if(!t())return r(null);var o=function(e){if(e)return r(e);if(t())return i(o);var s=n(arguments,1);r.apply(null,[null].concat(s))};i(o)}function Nr(t,e,r){xr((function(){return!t.apply(this,arguments)}),e,r)}var Br=function(t,e){if(e=B(e||N),!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=y(t[r++]);e.push(ft(o)),n.apply(null,e)}function o(o){if(o||r===t.length)return e.apply(null,arguments);i(n(arguments,1))}i([])},Rr={apply:i,applyEach:_t,applyEachSeries:Et,asyncify:l,auto:xt,autoInject:ne,cargo:ae,compose:fe,concat:pe,concatLimit:de,concatSeries:ge,constant:me,detect:ve,detectLimit:_e,detectSeries:Se,dir:Me,doDuring:Ee,doUntil:Te,doWhilst:ke,during:Ce,each:Pe,eachLimit:Ie,eachOf:yt,eachOfLimit:dt,eachOfSeries:ue,eachSeries:xe,ensureAsync:Ne,every:Re,everyLimit:Ue,everySeries:Fe,filter:We,filterLimit:$e,filterSeries:Ke,forever:He,groupBy:ze,groupByLimit:qe,groupBySeries:Ge,log:Xe,map:vt,mapLimit:At,mapSeries:Mt,mapValues:Je,mapValuesLimit:Ze,mapValuesSeries:Ye,memoize:tr,nextTick:er,parallel:nr,parallelLimit:ir,priorityQueue:sr,queue:or,race:ar,reduce:ce,reduceRight:ur,reflect:cr,reflectAll:hr,reject:lr,rejectLimit:dr,rejectSeries:pr,retry:mr,retryable:yr,seq:he,series:wr,setImmediate:f,some:br,someLimit:vr,someSeries:_r,sortBy:Sr,timeout:Ar,times:Tr,timesLimit:kr,timesSeries:Cr,transform:Or,tryEach:Pr,unmemoize:Ir,until:Nr,waterfall:Br,whilst:xr,all:Re,allLimit:Ue,allSeries:Fe,any:br,anyLimit:vr,anySeries:_r,find:ve,findLimit:_e,findSeries:Se,forEach:Pe,forEachSeries:xe,forEachLimit:Ie,forEachOf:yt,forEachOfSeries:ue,forEachOfLimit:dt,inject:ce,foldl:ce,foldr:ur,select:We,selectLimit:$e,selectSeries:Ke,wrapSync:l};e.default=Rr,e.apply=i,e.applyEach=_t,e.applyEachSeries=Et,e.asyncify=l,e.auto=xt,e.autoInject=ne,e.cargo=ae,e.compose=fe,e.concat=pe,e.concatLimit=de,e.concatSeries=ge,e.constant=me,e.detect=ve,e.detectLimit=_e,e.detectSeries=Se,e.dir=Me,e.doDuring=Ee,e.doUntil=Te,e.doWhilst=ke,e.during=Ce,e.each=Pe,e.eachLimit=Ie,e.eachOf=yt,e.eachOfLimit=dt,e.eachOfSeries=ue,e.eachSeries=xe,e.ensureAsync=Ne,e.every=Re,e.everyLimit=Ue,e.everySeries=Fe,e.filter=We,e.filterLimit=$e,e.filterSeries=Ke,e.forever=He,e.groupBy=ze,e.groupByLimit=qe,e.groupBySeries=Ge,e.log=Xe,e.map=vt,e.mapLimit=At,e.mapSeries=Mt,e.mapValues=Je,e.mapValuesLimit=Ze,e.mapValuesSeries=Ye,e.memoize=tr,e.nextTick=er,e.parallel=nr,e.parallelLimit=ir,e.priorityQueue=sr,e.queue=or,e.race=ar,e.reduce=ce,e.reduceRight=ur,e.reflect=cr,e.reflectAll=hr,e.reject=lr,e.rejectLimit=dr,e.rejectSeries=pr,e.retry=mr,e.retryable=yr,e.seq=he,e.series=wr,e.setImmediate=f,e.some=br,e.someLimit=vr,e.someSeries=_r,e.sortBy=Sr,e.timeout=Ar,e.times=Tr,e.timesLimit=kr,e.timesSeries=Cr,e.transform=Or,e.tryEach=Pr,e.unmemoize=Ir,e.until=Nr,e.waterfall=Br,e.whilst=xr,e.all=Re,e.allLimit=Ue,e.allSeries=Fe,e.any=br,e.anyLimit=vr,e.anySeries=_r,e.find=ve,e.findLimit=_e,e.findSeries=Se,e.forEach=Pe,e.forEachSeries=xe,e.forEachLimit=Ie,e.forEachOf=yt,e.forEachOfSeries=ue,e.forEachOfLimit=dt,e.inject=ce,e.foldl=ce,e.foldr=ur,e.select=We,e.selectLimit=$e,e.selectSeries=Ke,e.wrapSync=l,Object.defineProperty(e,"__esModule",{value:!0})}(e)},9669:(t,e,r)=>{t.exports=r(1609)},5448:(t,e,r)=>{"use strict";var n=r(4867),i=r(6026),o=r(4372),s=r(5327),a=r(4097),u=r(4109),c=r(7985),h=r(5061);t.exports=function(t){return new Promise((function(e,r){var f=t.data,l=t.headers,d=t.responseType;n.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(t.auth){var g=t.auth.username||"",m=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";l.Authorization="Basic "+btoa(g+":"+m)}var y=a(t.baseURL,t.url);function w(){if(p){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,o={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:t,request:p};i(e,r,o),p=null}}if(p.open(t.method.toUpperCase(),s(y,t.params,t.paramsSerializer),!0),p.timeout=t.timeout,"onloadend"in p?p.onloadend=w:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(w)},p.onabort=function(){p&&(r(h("Request aborted",t,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(h("Network Error",t,null,p)),p=null},p.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(h(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var b=(t.withCredentials||c(y))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;b&&(l[t.xsrfHeaderName]=b)}"setRequestHeader"in p&&n.forEach(l,(function(t,e){void 0===f&&"content-type"===e.toLowerCase()?delete l[e]:p.setRequestHeader(e,t)})),n.isUndefined(t.withCredentials)||(p.withCredentials=!!t.withCredentials),d&&"json"!==d&&(p.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&p.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){p&&(p.abort(),r(t),p=null)})),f||(f=null),p.send(f)}))}},1609:(t,e,r)=>{"use strict";var n=r(4867),i=r(1849),o=r(321),s=r(7185);function a(t){var e=new o(t),r=i(o.prototype.request,e);return n.extend(r,o.prototype,e),n.extend(r,e),r}var u=a(r(5655));u.Axios=o,u.create=function(t){return a(s(u.defaults,t))},u.Cancel=r(5263),u.CancelToken=r(4972),u.isCancel=r(6502),u.all=function(t){return Promise.all(t)},u.spread=r(8713),u.isAxiosError=r(6268),t.exports=u,t.exports.default=u},5263:t=>{"use strict";function e(t){this.message=t}e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,t.exports=e},4972:(t,e,r)=>{"use strict";var n=r(5263);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;t((function(t){r.reason||(r.reason=new n(t),e(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},6502:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},321:(t,e,r)=>{"use strict";var n=r(4867),i=r(5327),o=r(782),s=r(3572),a=r(7185),u=r(4875),c=u.validators;function h(t){this.defaults=t,this.interceptors={request:new o,response:new o}}h.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&u.assertOptions(e,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(t){o.push(t.fulfilled,t.rejected)})),!n){var h=[s,void 0];for(Array.prototype.unshift.apply(h,r),h=h.concat(o),i=Promise.resolve(t);h.length;)i=i.then(h.shift(),h.shift());return i}for(var f=t;r.length;){var l=r.shift(),d=r.shift();try{f=l(f)}catch(t){d(t);break}}try{i=s(f)}catch(t){return Promise.reject(t)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},h.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(t){h.prototype[t]=function(e,r){return this.request(a(r||{},{method:t,url:e,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(t){h.prototype[t]=function(e,r,n){return this.request(a(n||{},{method:t,url:e,data:r}))}})),t.exports=h},782:(t,e,r)=>{"use strict";var n=r(4867);function i(){this.handlers=[]}i.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){n.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},4097:(t,e,r)=>{"use strict";var n=r(1793),i=r(7303);t.exports=function(t,e){return t&&!n(e)?i(t,e):e}},5061:(t,e,r)=>{"use strict";var n=r(481);t.exports=function(t,e,r,i,o){var s=new Error(t);return n(s,e,r,i,o)}},3572:(t,e,r)=>{"use strict";var n=r(4867),i=r(8527),o=r(6502),s=r(5655);function a(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return a(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return a(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(a(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},481:t=>{"use strict";t.exports=function(t,e,r,n,i){return t.config=e,r&&(t.code=r),t.request=n,t.response=i,t.isAxiosError=!0,t.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:this.config,code:this.code}},t}},7185:(t,e,r)=>{"use strict";var n=r(4867);t.exports=function(t,e){e=e||{};var r={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(t,e){return n.isPlainObject(t)&&n.isPlainObject(e)?n.merge(t,e):n.isPlainObject(e)?n.merge({},e):n.isArray(e)?e.slice():e}function c(i){n.isUndefined(e[i])?n.isUndefined(t[i])||(r[i]=u(void 0,t[i])):r[i]=u(t[i],e[i])}n.forEach(i,(function(t){n.isUndefined(e[t])||(r[t]=u(void 0,e[t]))})),n.forEach(o,c),n.forEach(s,(function(i){n.isUndefined(e[i])?n.isUndefined(t[i])||(r[i]=u(void 0,t[i])):r[i]=u(void 0,e[i])})),n.forEach(a,(function(n){n in e?r[n]=u(t[n],e[n]):n in t&&(r[n]=u(void 0,t[n]))}));var h=i.concat(o).concat(s).concat(a),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===h.indexOf(t)}));return n.forEach(f,c),r}},6026:(t,e,r)=>{"use strict";var n=r(5061);t.exports=function(t,e,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},8527:(t,e,r)=>{"use strict";var n=r(4867),i=r(5655);t.exports=function(t,e,r){var o=this||i;return n.forEach(r,(function(r){t=r.call(o,t,e)})),t}},5655:(t,e,r)=>{"use strict";var n=r(4867),i=r(6016),o=r(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(t,e){!n.isUndefined(t)&&n.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(5448)),u),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),n.isFormData(t)||n.isArrayBuffer(t)||n.isBuffer(t)||n.isStream(t)||n.isFile(t)||n.isBlob(t)?t:n.isArrayBufferView(t)?t.buffer:n.isURLSearchParams(t)?(a(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):n.isObject(t)||e&&"application/json"===e["Content-Type"]?(a(e,"application/json"),function(t,e,r){if(n.isString(t))try{return(0,JSON.parse)(t),n.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||i&&n.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(t){c.headers[t]={}})),n.forEach(["post","put","patch"],(function(t){c.headers[t]=n.merge(s)})),t.exports=c},1849:t=>{"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},5327:(t,e,r)=>{"use strict";var n=r(4867);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,r){if(!e)return t;var o;if(r)o=r(e);else if(n.isURLSearchParams(e))o=e.toString();else{var s=[];n.forEach(e,(function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,(function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},7303:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},4372:(t,e,r)=>{"use strict";var n=r(4867);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,r,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},6268:t=>{"use strict";t.exports=function(t){return"object"==typeof t&&!0===t.isAxiosError}},7985:(t,e,r)=>{"use strict";var n=r(4867);t.exports=n.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=n.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}},6016:(t,e,r)=>{"use strict";var n=r(4867);t.exports=function(t,e){n.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))}},4109:(t,e,r)=>{"use strict";var n=r(4867),i=["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.exports=function(t){var e,r,o,s={};return t?(n.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=n.trim(t.substr(0,o)).toLowerCase(),r=n.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s}},8713:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},4875:(t,e,r)=>{"use strict";var n=r(8593),i={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){i[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var o={},s=n.version.split(".");function a(t,e){for(var r=e?e.split("."):s,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}i.transitional=function(t,e,r){var i=e&&a(e);function s(t,e){return"[Axios v"+n.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,a){if(!1===t)throw new Error(s(n," has been removed in "+e));return i&&!o[n]&&(o[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,a)}},t.exports={isOlderVersion:a,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var o=n[i],s=e[o];if(s){var a=t[o],u=void 0===a||s(a,o,t);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:i}},4867:(t,e,r)=>{"use strict";var n=r(1849),i=Object.prototype.toString;function o(t){return"[object Array]"===i.call(t)}function s(t){return void 0===t}function a(t){return null!==t&&"object"==typeof t}function u(t){if("[object Object]"!==i.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function c(t){return"[object Function]"===i.call(t)}function h(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),o(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}t.exports={isArray:o,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:function(t){return null!==t&&!s(t)&&null!==t.constructor&&!s(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isPlainObject:u,isUndefined:s,isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:c,isStream:function(t){return a(t)&&c(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:h,merge:function t(){var e={};function r(r,n){u(e[n])&&u(r)?e[n]=t(e[n],r):u(r)?e[n]=t({},r):o(r)?e[n]=r.slice():e[n]=r}for(var n=0,i=arguments.length;n<i;n++)h(arguments[n],r);return e},extend:function(t,e,r){return h(e,(function(e,i){t[i]=r&&"function"==typeof e?n(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}}},8162:(t,e,r)=>{"use strict";var n=r(9509).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),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),c=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function f(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 s=(t.length-r)*c+1>>>0,h=new Uint8Array(s);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var l=0,d=s-1;(0!==f||l<o)&&-1!==d;d--,l++)f+=a*h[d]>>>0,h[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===h[p];)p++;var g=n.allocUnsafe(i+(s-p));g.fill(0,0,i);for(var m=i;p!==s;)g[m++]=h[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,s=e.length;o!==s&&0===e[o];)o++,r++;for(var c=(s-o)*h+1>>>0,f=new Uint8Array(c);o!==s;){for(var l=e[o],d=0,p=c-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*f[p]>>>0,f[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var g=c-i;g!==c&&0===f[g];)g++;for(var m=u.repeat(r);g<c;++g)m+=t.charAt(f[g]);return m},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},9742:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],a=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,f=a>0?s-4:s;for(r=0;r<f;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[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[h++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));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+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(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 c(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2240:(t,e,r)=>{"use strict";var n=r(8764).Buffer,i=r(1518);function o(t,e){return void 0===e&&(e="utf8"),n.isBuffer(t)?a(t.toString("base64")):a(n.from(t,e).toString("base64"))}function s(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function a(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(s(t),"base64").toString(e)},u.toBase64=s,u.fromBase64=a,u.toBuffer=function(t){return n.from(s(t),"base64")},e.default=u},1518:(t,e,r)=>{"use strict";var n=r(8764).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,s=e+o,a=n.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}},3363:(t,e,r)=>{t.exports=r(2240).default,t.exports.default=t.exports},2882:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<e.length;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&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(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 a(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 a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;var u=t.slice(0,a),c=t.slice(a+1);if(c.length<6)return"Data too short";var h=s(u);if("string"==typeof h)return h;for(var f=[],l=0;l<c.length;++l){var d=c.charAt(l),p=r[d];if(void 0===p)return"Unknown character "+d;h=o(h)^p,l+6>=c.length||f.push(p)}return 1!==h?"Invalid checksum for "+t:{prefix:u,words:f}}function u(t,e,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}t.exports={decodeUnsafe:function(){var t=a.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=a.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=s(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=t+"1",u=0;u<r.length;++u){var c=r[u];if(c>>5!=0)throw new Error("Non 5-bit word");i=o(i)^c,a+=e.charAt(c)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)a+=e.charAt(i>>5*(5-u)&31);return a},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)}}},4431:function(t,e,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",h=c+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,m=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function w(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=l-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function b(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,u=t.e,c=e.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function v(t,e,r,n){if(t<e||t>r||t!==u(t))throw Error(c+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return y(t.e/l)==e&&t.c[e]%2!=0}function S(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function A(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}o=function t(e){var r,n,i,o,M,E,k,T,C,O,P=K.prototype={constructor:K,toString:null,valueOf:null},I=new K(1),x=20,N=4,B=-7,R=21,U=-1e7,F=1e7,L=!1,D=1,j=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},W="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function K(t,e){var r,o,a,c,f,p,g,m,y=this;if(!(y instanceof K))return new K(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>F?y.c=y.e=null:t.e<U?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(c=0,f=t;f>=10;f/=10,c++);return void(c>F?y.c=y.e=null:(y.e=c,y.c=[t]))}m=String(t)}else{if(!s.test(m=String(t)))return i(y,m,p);y.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(c=m.indexOf("."))>-1&&(m=m.replace(".","")),(f=m.search(/e/i))>0?(c<0&&(c=f),c+=+m.slice(f+1),m=m.substring(0,f)):c<0&&(c=m.length)}else{if(v(e,2,W.length,"Base"),10==e&&$)return G(y=new K(t),x+y.e+1,N);if(m=String(t),p="number"==typeof t){if(0*t!=0)return i(y,m,p,e);if(y.s=1/t<0?(m=m.slice(1),-1):1,K.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(h+t)}else y.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=W.slice(0,e),c=f=0,g=m.length;f<g;f++)if(r.indexOf(o=m.charAt(f))<0){if("."==o){if(f>c){c=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,f=-1,c=0;continue}return i(y,String(t),p,e)}p=!1,(c=(m=n(m,e,10,y.s)).indexOf("."))>-1?m=m.replace(".",""):c=m.length}for(f=0;48===m.charCodeAt(f);f++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(f,++g)){if(g-=f,p&&K.DEBUG&&g>15&&(t>d||t!==u(t)))throw Error(h+y.s*t);if((c=c-f-1)>F)y.c=y.e=null;else if(c<U)y.c=[y.e=0];else{if(y.e=c,y.c=[],f=(c+1)%l,c<0&&(f+=l),f<g){for(f&&y.c.push(+m.slice(0,f)),g-=l;f<g;)y.c.push(+m.slice(f,f+=l));f=l-(m=m.slice(f)).length}else f-=g;for(;f--;m+="0");y.c.push(+m)}}else y.c=[y.e=0]}function H(t,e,r,n){var i,o,s,a,u;if(null==r?r=N:v(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)u=w(t.c),u=1==n||2==n&&(s<=B||s>=R)?S(u,s):A(u,s,"0");else if(o=(t=G(new K(t),e,r)).e,a=(u=w(t.c)).length,1==n||2==n&&(e<=o||o<=B)){for(;a<e;u+="0",a++);u=S(u,o)}else if(e-=s,u=A(u,o,"0"),o+1>a){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function q(t,e){for(var r,n=1,i=new K(t[0]);n<t.length;n++){if(!(r=new K(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function z(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*l-1)>F?t.c=t.e=null:r<U?t.c=[t.e=0]:(t.e=r,t.c=e),t}function G(t,e,r,n){var i,o,s,c,h,d,g,m=t.c,y=p;if(m){t:{for(i=1,c=m[0];c>=10;c/=10,i++);if((o=e-i)<0)o+=l,s=e,g=(h=m[d=0])/y[i-s-1]%10|0;else if((d=a((o+1)/l))>=m.length){if(!n)break t;for(;m.length<=d;m.push(0));h=g=0,i=1,s=(o%=l)-l+1}else{for(h=c=m[d],i=1;c>=10;c/=10,i++);g=(s=(o%=l)-l+i)<0?0:h/y[i-s-1]%10|0}if(n=n||e<0||null!=m[d+1]||(s<0?h:h%y[i-s-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?s>0?h/y[i-s]:0:m[d-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,n?(e-=t.e+1,m[0]=y[(l-e%l)%l],t.e=-e||0):m[0]=t.e=0,t;if(0==o?(m.length=d,c=1,d--):(m.length=d+1,c=y[l-o],m[d]=s>0?u(h/y[i-s]%y[s])*c:0),n)for(;;){if(0==d){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(t.e++,m[0]==f&&(m[0]=1));break}if(m[d]+=c,m[d]!=f)break;m[d--]=0,c=1}for(o=m.length;0===m[--o];m.pop());}t.e>F?t.c=t.e=null:t.e<U&&(t.c=[t.e=0])}return t}function X(t){var e,r=t.e;return null===r?t.toString():(e=w(t.c),e=r<=B||r>=R?S(e,r):A(e,r,"0"),t.s<0?"-"+e:e)}return K.clone=t,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(c+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(v(r=t[e],0,m,e),x=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(v(r=t[e],0,8,e),N=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(v(r[0],-m,0,e),v(r[1],0,m,e),B=r[0],R=r[1]):(v(r,-m,m,e),B=-(R=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)v(r[0],-m,-1,e),v(r[1],1,m,e),U=r[0],F=r[1];else{if(v(r,-m,m,e),!r)throw Error(c+e+" cannot be zero: "+r);U=-(F=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(c+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(c+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(v(r=t[e],0,9,e),D=r),t.hasOwnProperty(e="POW_PRECISION")&&(v(r=t[e],0,m,e),j=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(c+e+" not an object: "+r);V=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(c+e+" invalid: "+r);$="0123456789"==r.slice(0,10),W=r}}return{DECIMAL_PLACES:x,ROUNDING_MODE:N,EXPONENTIAL_AT:[B,R],RANGE:[U,F],CRYPTO:L,MODULO_MODE:D,POW_PRECISION:j,FORMAT:V,ALPHABET:W}},K.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!K.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>=-m&&i<=m&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=f||r!==u(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+t)},K.maximum=K.max=function(){return q(arguments,P.lt)},K.minimum=K.min=function(){return q(arguments,P.gt)},K.random=(o=9007199254740992,M=Math.random()*o&2097151?function(){return u(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,h=[],f=new K(I);if(null==t?t=x:v(t,0,m),i=a(t/l),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(h.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(c+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(h.push(o%1e14),s+=7);s=i/7}if(!L)for(;s<i;)(o=M())<9e15&&(h[s++]=o%1e14);for(i=h[--s],t%=l,i&&t&&(o=p[l-t],h[s]=u(i/o)*o);0===h[s];h.pop(),s--);if(s<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=l);for(s=1,o=h[0];o>=10;o/=10,s++);s<l&&(n-=l-s)}return f.e=n,f.c=h,f}),K.sum=function(){for(var t=1,e=arguments,r=new K(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,s=[0],a=0,u=t.length;a<u;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,c,h,f,l,d,p,g,m=n.indexOf("."),y=x,b=N;for(m>=0&&(f=j,j=0,n=n.replace(".",""),d=(g=new K(i)).pow(n.length-m),j=f,g.c=e(A(w(d.c),d.e,"0"),10,o,t),g.e=g.c.length),h=f=(p=e(n,i,o,a?(u=W,t):(u=t,W))).length;0==p[--f];p.pop());if(!p[0])return u.charAt(0);if(m<0?--h:(d.c=p,d.e=h,d.s=s,p=(d=r(d,g,y,b,o)).c,l=d.r,h=d.e),m=p[c=h+y+1],f=o/2,l=l||c<0||null!=p[c+1],l=b<4?(null!=m||l)&&(0==b||b==(d.s<0?3:2)):m>f||m==f&&(4==b||l||6==b&&1&p[c-1]||b==(d.s<0?8:7)),c<1||!p[0])n=l?A(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(p.length=c,l)for(--o;++p[--c]>o;)p[c]=0,c||(++h,p=[1].concat(p));for(f=p.length;!p[--f];);for(m=0,n="";m<=f;n+=u.charAt(p[m++]));n=A(n,h,u.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,u=t.length,c=e%g,h=e/g|0;for(t=t.slice();u--;)a=((i=c*(o=t[u]%g)+(n=h*o+(s=t[u]/g|0)*c)%g*g+a)/r|0)+(n/g|0)+h*s,t[u]=i%r;return a&&(t=[a].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,s,a){var c,h,d,p,g,m,w,b,v,_,S,A,M,E,k,T,C,O=n.s==i.s?1:-1,P=n.c,I=i.c;if(!(P&&P[0]&&I&&I[0]))return new K(n.s&&i.s&&(P?!I||P[0]!=I[0]:I)?P&&0==P[0]||!I?0*O:O/0:NaN);for(v=(b=new K(O)).c=[],O=o+(h=n.e-i.e)+1,a||(a=f,h=y(n.e/l)-y(i.e/l),O=O/l|0),d=0;I[d]==(P[d]||0);d++);if(I[d]>(P[d]||0)&&h--,O<0)v.push(1),p=!0;else{for(E=P.length,T=I.length,d=0,O+=2,(g=u(a/(I[0]+1)))>1&&(I=t(I,g,a),P=t(P,g,a),T=I.length,E=P.length),M=T,S=(_=P.slice(0,T)).length;S<T;_[S++]=0);C=I.slice(),C=[0].concat(C),k=I[0],I[1]>=a/2&&k++;do{if(g=0,(c=e(I,_,T,S))<0){if(A=_[0],T!=S&&(A=A*a+(_[1]||0)),(g=u(A/k))>1)for(g>=a&&(g=a-1),w=(m=t(I,g,a)).length,S=_.length;1==e(m,_,w,S);)g--,r(m,T<w?C:I,w,a),w=m.length,c=1;else 0==g&&(c=g=1),w=(m=I.slice()).length;if(w<S&&(m=[0].concat(m)),r(_,m,S,a),S=_.length,-1==c)for(;e(I,_,T,S)<1;)g++,r(_,T<S?C:I,S,a),S=_.length}else 0===c&&(g++,_=[0]);v[d++]=g,_[0]?_[S++]=P[M]||0:(_=[P[M]],S=1)}while((M++<E||null!=_[0])&&O--);p=null!=_[0],v[0]||v.splice(0,1)}if(a==f){for(d=1,O=v[0];O>=10;O/=10,d++);G(b,o+(b.e=d+h*l-1)+1,s,p)}else b.e=h,b.r=+p;return b}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,T=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(O,"");if(C.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(T,"0.$1")),e!=o))return new K(o,i);if(K.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new K(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return b(this,new K(t,e))},P.decimalPlaces=P.dp=function(t,e){var r,n,i,o=this;if(null!=t)return v(t,0,m),null==e?e=N:v(e,0,8),G(new K(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-y(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},P.dividedBy=P.div=function(t,e){return r(this,new K(t,e),x,N)},P.dividedToIntegerBy=P.idiv=function(t,e){return r(this,new K(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var r,n,i,o,s,h,f,d,p=this;if((t=new K(t)).c&&!t.isInteger())throw Error(c+"Exponent not an integer: "+X(t));if(null!=e&&(e=new K(e)),s=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 K(Math.pow(+X(p),s?2-_(t):+X(t))),e?d.mod(e):d;if(h=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new K(NaN);(n=!h&&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||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new K(h?1/o:o);j&&(o=a(j/l+2))}for(s?(r=new K(.5),h&&(t.s=1),f=_(t)):f=(i=Math.abs(+X(t)))%2,d=new K(I);;){if(f){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=u(i/2)))break;f=i%2}else if(G(t=t.times(r),t.e+1,1),t.e>14)f=_(t);else{if(0==(i=+X(t)))break;f=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:(h&&(d=I.div(d)),e?d.mod(e):o?G(d,j,N,void 0):d)},P.integerValue=function(t){var e=new K(this);return null==t?t=N:v(t,0,8),G(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===b(this,new K(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return b(this,new K(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=b(this,new K(t,e)))||0===e},P.isInteger=function(){return!!this.c&&y(this.e/l)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return b(this,new K(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=b(this,new K(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new K(t,e)).s,!a||!e)return new K(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/l,c=t.e/l,h=s.c,d=t.c;if(!u||!c){if(!h||!d)return h?(t.s=-e,t):new K(d?s:NaN);if(!h[0]||!d[0])return d[0]?(t.s=-e,t):new K(h[0]?s:3==N?-0:0)}if(u=y(u),c=y(c),h=h.slice(),a=u-c){for((o=a<0)?(a=-a,i=h):(c=u,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=h.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(h[e]!=d[e]){o=h[e]<d[e];break}if(o&&(i=h,h=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=h.length))>0)for(;e--;h[r++]=0);for(e=f-1;n>a;){if(h[--n]<d[n]){for(r=n;r&&!h[--r];h[r]=e);--h[r],h[n]+=f}h[n]-=d[n]}for(;0==h[0];h.splice(0,1),--c);return h[0]?z(t,h,c):(t.s=3==N?-1:1,t.c=[t.e=0],t)},P.modulo=P.mod=function(t,e){var n,i,o=this;return t=new K(t,e),!o.c||!t.s||t.c&&!t.c[0]?new K(NaN):!t.c||o.c&&!o.c[0]?new K(o):(9==D?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,D),(t=o.minus(n.times(t))).c[0]||1!=D||(t.s=o.s),t)},P.multipliedBy=P.times=function(t,e){var r,n,i,o,s,a,u,c,h,d,p,m,w,b,v,_=this,S=_.c,A=(t=new K(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/l)+y(t.e/l),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=g,i=d;--i>=0;){for(r=0,p=A[i]%v,m=A[i]/v|0,o=i+(s=u);o>i;)r=((c=p*(c=S[--s]%v)+(a=m*c+(h=S[s]/v|0)*p)%v*v+w[o]+r)/b|0)+(a/v|0)+m*h,w[o--]=c%b;w[o]=r}return r?++n:w.splice(0,1),z(t,w,n)},P.negated=function(){var t=new K(this);return t.s=-t.s||null,t},P.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new K(t,e)).s,!i||!e)return new K(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/l,s=t.e/l,a=n.c,u=t.c;if(!o||!s){if(!a||!u)return new K(i/0);if(!a[0]||!u[0])return u[0]?t:new K(a[0]?n:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=u.length)<0&&(r=u,u=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/f|0,a[e]=f===a[e]?0:a[e]%f;return i&&(a=[i].concat(a),++s),z(t,a,s)},P.precision=P.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return v(t,1,m),null==e?e=N:v(e,0,8),G(new K(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*l+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},P.shiftedBy=function(t){return v(t,-9007199254740991,d),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,u=s.s,c=s.e,h=x+4,f=new K("0.5");if(1!==u||!a||!a[0])return new K(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+X(s)))||u==1/0?(((e=w(a)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),n=new K(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new K(u+""),n.c[0])for((u=(c=n.e)+h)<3&&(u=0);;)if(o=n,n=f.times(o.plus(r(s,o,h,1))),w(o.c).slice(0,u)===(e=w(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))||(G(n,n.e+x+2,1),t=!n.times(n).eq(s));break}if(!i&&(G(o,o.e+x+2,0),o.times(o).eq(s))){n=o;break}h+=4,u+=4,i=1}return G(n,n.e+x+1,N,t)},P.toExponential=function(t,e){return null!=t&&(v(t,0,m),t++),H(this,t,e,1)},P.toFixed=function(t,e){return null!=t&&(v(t,0,m),t=t+this.e+1),H(this,t,e)},P.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=V;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,h=r.groupSeparator||"",f=s[0],l=s[1],d=i.s<0,p=d?f.slice(1):f,g=p.length;if(u&&(o=a,a=u,u=o,g-=o),a>0&&g>0){for(o=g%a||a,f=p.substr(0,o);o<g;o+=a)f+=h+p.substr(o,a);u>0&&(f+=h+p.slice(o)),d&&(f="-"+f)}n=l?f+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):f}return(r.prefix||"")+n+(r.suffix||"")},P.toFraction=function(t){var e,n,i,o,s,a,u,h,f,d,g,m,y=this,b=y.c;if(null!=t&&(!(u=new K(t)).isInteger()&&(u.c||1!==u.s)||u.lt(I)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+X(u));if(!b)return new K(y);for(e=new K(I),f=n=new K(I),i=h=new K(I),m=w(b),s=e.e=m.length-y.e-1,e.c[0]=p[(a=s%l)<0?l+a:a],t=!t||u.comparedTo(e)>0?s>0?e:f:u,a=F,F=1/0,u=new K(m),h.c[0]=0;d=r(u,e,0,1),1!=(o=n.plus(d.times(i))).comparedTo(t);)n=i,i=o,f=h.plus(d.times(o=f)),h=o,e=u.minus(d.times(o=e)),u=o;return o=r(t.minus(n),i,0,1),h=h.plus(o.times(f)),n=n.plus(o.times(i)),h.s=f.s=y.s,g=r(f,i,s*=2,N).minus(y).abs().comparedTo(r(h,n,s,N).minus(y).abs())<1?[f,i]:[h,n],F=a,g},P.toNumber=function(){return+X(this)},P.toPrecision=function(t,e){return null!=t&&v(t,1,m),H(this,t,e,2)},P.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<=B||o>=R?S(w(r.c),o):A(w(r.c),o,"0"):10===t&&$?e=A(w((r=G(new K(r),x+o+1,N)).c),r.e,"0"):(v(t,2,W.length,"Base"),e=n(A(w(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return X(this)},P._isBigNumber=!0,null!=e&&K.set(e),K}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},2190:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6574);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 s(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),a=t.slice(1);if(0===a.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=s(r.globalKeyVals),h=r.inputKeyVals.map(s),f=r.outputKeyVals.map(s);for(const t of a){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 a=n.psbtToKeyVals(t);s(a.globalKeyVals).forEach(i(c,r.globalKeyVals,a.globalKeyVals)),a.inputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(h[e],r.inputKeyVals[e],a.inputKeyVals[e])))),a.outputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(f[e],r.outputKeyVals[e],a.outputKeyVals[e]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},4041:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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("/"),s=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(s,0);let a=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),s.writeUInt32LE(r,a),a+=4})),{key:r,value:s}},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)}},4480:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);e.encode=function(t){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}},1528:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1847),i=r(4041),o=r(4480),s=r(859),a=r(8248),u=r(537),c=r(1511),h=r(5896),f=r(1243),l=r(2954),d=r(4799),p=r(9595),g=r(9705),m=r(6327),y={unsignedTx:o,globalXpub:i,checkPubkey:p.makeChecker([])};e.globals=y;const w={nonWitnessUtxo:u,partialSig:c,sighashType:f,finalScriptSig:s,finalScriptWitness:a,porCommitment:h,witnessUtxo:l,bip32Derivation:d.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:g.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION])};e.inputs=w;const b={bip32Derivation:d.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:g.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.OutputTypes.BIP32_DERIVATION])};e.outputs=b},859:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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}},8248:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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}},537:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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}},1511:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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)}},5896:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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}},1243:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847);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}},2954:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1847),o=r(9254),s=r(3493);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=s.decode(t.value,r);r+=s.encodingLength(n);const a=t.value.slice(r);if(a.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:a,value:e}},e.encode=function(t){const{script:e,value:r}=t,a=s.encodingLength(e.length),u=n.allocUnsafe(8+a+e.length);return o.writeUInt64LE(u,r,0),s.encode(e.length,u,8),e.copy(u,8+a),{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}},4799:(t,e,r)=>{"use strict";var n=r(8764).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 bip32Derivation with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const r=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),pubkey:r,path:"m"};for(const t of(i=e.value.length/4-1,[...Array(i).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var i;return n},encode:function(e){const r=n.from([t]),i=n.concat([r,e.pubkey]),o=e.path.split("/"),s=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(s,0);let a=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),s.writeUInt32LE(r,a),a+=4})),{key:i,value:s}},check:function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.masterFingerprint)&&"string"==typeof t.path&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&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)}}}},9595:(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}}},9705:(t,e,r)=>{"use strict";var n=r(8764).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}}}},6327:(t,e,r)=>{"use strict";var n=r(8764).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}}}},9254:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3493);function o(t){const e=t.key.length,r=t.value.length,o=i.encodingLength(e),s=i.encodingLength(r),a=n.allocUnsafe(o+e+s+r);return i.encode(e,a,0),t.key.copy(a,o),i.encode(r,a,o+e),t.value.copy(a,o+e+s),a}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")}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,s(n+r,9007199254740991),n+r},e.writeUInt64LE=function(t,e,r){return s(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}},3493:(t,e,r)=>{"use strict";var n=r(8764).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,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),Object.assign(t,{bytes:1})):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),Object.assign(t,{bytes:3})):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),Object.assign(t,{bytes:5})):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+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},2974:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1528),o=r(9254),s=r(3493),a=r(1847);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 s={unsignedTx:t};let c=0;for(const t of e)switch(t.key[0]){case a.GlobalTypes.UNSIGNED_TX:if(u("global",t.key,a.GlobalTypes.UNSIGNED_TX),c>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");c++;break;case a.GlobalTypes.GLOBAL_XPUB:void 0===s.globalXpub&&(s.globalXpub=[]),s.globalXpub.push(i.globals.globalXpub.decode(t));break;default:s.unknownKeyVals||(s.unknownKeyVals=[]),s.unknownKeyVals.push(t)}const h=r.length,f=n.length,l=[],d=[];for(const t of o.range(h)){const e={};for(const n of r[t])switch(i.inputs.checkPubkey(n),n.key[0]){case a.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,a.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 a.InputTypes.WITNESS_UTXO:if(u("input",n.key,a.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 a.InputTypes.PARTIAL_SIG:void 0===e.partialSig&&(e.partialSig=[]),e.partialSig.push(i.inputs.partialSig.decode(n));break;case a.InputTypes.SIGHASH_TYPE:if(u("input",n.key,a.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 a.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,a.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 a.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,a.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 a.InputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case a.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,a.InputTypes.FINAL_SCRIPTSIG),e.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case a.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,a.InputTypes.FINAL_SCRIPTWITNESS),e.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case a.InputTypes.POR_COMMITMENT:u("input",n.key,a.InputTypes.POR_COMMITMENT),e.porCommitment=i.inputs.porCommitment.decode(n);break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(n)}l.push(e)}for(const t of o.range(f)){const e={};for(const r of n[t])switch(i.outputs.checkPubkey(r),r.key[0]){case a.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,a.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 a.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,a.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 a.OutputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(r)}d.push(e)}return{globalMap:s,inputs:l,outputs:d}}e.psbtFromBuffer=function(t,e){let r=0;function n(){const e=s.decode(t,r);r+=s.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 h=[],f={};for(;!u();){const t=i(),e=t.key.toString("hex");if(f[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);f[e]=1,h.push(t)}const l=h.filter((t=>t.key[0]===a.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(),m=[],y=[];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)}m.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)}y.push(r)}return c(d,{globalMapKeyVals:h,inputKeyVals:m,outputKeyVals:y})},e.checkKeyBuffer=u,e.psbtFromKeyVals=c},6574:(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(2974)),n(r(5312))},5312:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1528),o=r(9254);e.psbtToBuffer=function({globalMap:t,inputs:e,outputs:r}){const{globalKeyVals:i,inputKeyVals:s,outputKeyVals:a}=u({globalMap:t,inputs:e,outputs:r}),c=o.keyValsToBuffer(i),h=t=>0===t.length?[n.from([0])]:t.map(o.keyValsToBuffer),f=h(s),l=h(a),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,c].concat(f,l))};const s=(t,e)=>t.key.compare(e.key);function a(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 s=(Array.isArray(i)?i:[i]).map(o.encode);return s.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(s)}),[]),i=t.unknownKeyVals?t.unknownKeyVals.filter((t=>!r.has(t.key.toString("hex")))):[];return n.concat(i).sort(s)}function u({globalMap:t,inputs:e,outputs:r}){return{globalKeyVals:a(t,i.globals),inputKeyVals:e.map((t=>a(t,i.inputs))),outputKeyVals:r.map((t=>a(t,i.outputs)))}}e.psbtToKeyVals=u},5011:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2190),o=r(6574),s=r(1847),a=r(6403);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 a.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=a.checkForInput(this.inputs,t);return a.updateInput(e,r),this}updateOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return a.checkHasKey(t,this.globalMap.unknownKeyVals,a.getEnumLength(s.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=a.checkForInput(this.inputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.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))),a.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.addUnknownKeyValToInput(r,t))),a.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=a.checkForInput(this.inputs,t);a.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()}}},1847:(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",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment"],(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",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation"]},6403:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1528);function o(t,e){const r=t[e];if(void 0===r)throw new Error(`No input #${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 a(t){return(e,r)=>{for(const n of Object.keys(e)){const o=e[n],{canAdd:a,canAddToArray:u,check:c,expected:h}=i[t+"s"][n]||{},f=!!u;if(c)if(f){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,h,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,h,o),!a(r,o))throw new Error(`Can not add duplicate data to ${t}`);r[n]=o}}}}e.checkForInput=o,e.checkForOutput=function(t,e){const r=t[e];if(void 0===r)throw new Error(`No output #${e}`);return r},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,s=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&s}if(!1===r)throw new Error(`Input #${t} has too much or too little data to clean`)},e.updateGlobal=a("global"),e.updateInput=a("input"),e.updateOutput=a("output"),e.addInputAttributes=function(t,r){const n=o(t,t.length-1);e.updateInput(r,n)},e.addOutputAttributes=function(t,r){const n=o(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}},4090:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6903),o=r(8334),s=r(5892),a=r(2401),u=r(7174),c=a.BufferN(32),h=a.compile({wif:a.UInt8,bip32:{public:a.UInt32,private:a.UInt32}}),f={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 a.String(t)&&null!==t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function g(t){return a.UInt32(t)&&t<=d}class m{constructor(t,e,r,n,i=0,o=0,s=0){this.__D=t,this.__Q=e,this.chainCode=r,this.network=n,this.__DEPTH=i,this.__INDEX=o,this.__PARENT_FINGERPRINT=s,a(h,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=s.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){a(a.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(!s.isPrivate(u))return this.derive(t+1);let h;if(this.isNeutered()){const e=s.pointAddScalar(this.publicKey,u,!0);if(null===e)return this.derive(t+1);h=b(e,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const e=s.privateAdd(this.privateKey,u);if(null==e)return this.derive(t+1);h=w(e,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return h}deriveHardened(t){return a(g,t),this.derive(t+l)}derivePath(t){a(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 s.sign(t,this.privateKey);{let e=s.sign(t,this.privateKey);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.privateKey,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function y(t,e,r){return w(t,e,r)}function w(t,e,r,n,i,o){if(a({privateKey:c,chainCode:c},{privateKey:t,chainCode:e}),r=r||f,!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return new m(t,void 0,e,r,n,i,o)}function b(t,e,r,n,i,o){if(a({publicKey:a.BufferN(33),chainCode:c},{publicKey:t,chainCode:e}),r=r||f,!s.isPoint(t))throw new TypeError("Point is not on the curve");return new m(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||f;const n=r.readUInt32BE(0);if(n!==e.bip32.private&&n!==e.bip32.public)throw new TypeError("Invalid network version");const i=r[4],s=r.readUInt32BE(5);if(0===i&&0!==s)throw new TypeError("Invalid parent fingerprint");const a=r.readUInt32BE(9);if(0===i&&0!==a)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,a,s)}else c=b(r.slice(45,78),u,e,i,a,s);return c},e.fromPrivateKey=y,e.fromPublicKey=function(t,e,r){return b(t,e,r)},e.fromSeed=function(t,e){if(a(a.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||f;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),t);return y(r.slice(0,32),r.slice(32),e)}},6903:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3482),i=r(8355);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()}},7786:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4090);e.fromSeed=n.fromSeed,e.fromBase58=n.fromBase58,e.fromPublicKey=n.fromPublicKey,e.fromPrivateKey=n.fromPrivateKey},3027:(t,e,r)=>{var n=r(9509).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}}},2920:(t,e,r)=>{var n=r(9991),i={};for(var o in n)i[n[o]]=o;t.exports=i},5488:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(4378),o=r(3348),s=r(3357),a=r(1838),u=r(2882),c=r(8334),h=r(2401);function f(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=f,e.fromBech32=l,e.toBase58Check=function(t,e){h(a.tuple(a.Hash160bit,a.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(s.toASM(t)+" has no matching Address")},e.toOutputScript=function(t,e){let r,n;e=e||i.bitcoin;try{r=f(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")}},7949:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9357),o=r(5525),s=r(2737),a=r(1838),u=r(3673),c=r(2401),h=r(7795),f=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=s.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 a=r.getWitnessCommit();return a&&(r.witnessCommit=a),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:a.Function}],t),0===t.length)throw f;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+h.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||(h.encode(this.transactions.length,e,r.offset),r.offset+=h.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 f;const t=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw f;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},9357:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1838),o=r(2401),s=r(7795);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")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,a(n+r,9007199254740991),n+r}function c(t,e,r){return a(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){s.encode(t,this.buffer,this.offset),this.offset+=s.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=s.decode(this.buffer,this.offset);return this.offset+=s.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}}},7129:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(8800),o=r(2334),s=r(7114),a=r(3645),u=r(6484),c=r(9920),h=r(8529),f=r(2476),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(h.output.check(t))return l.P2WPKH;if(f.output.check(t))return l.P2WSH;if(a.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:s.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 a.input.check(r)?l.P2PKH:u.input.check(r,e)?l.P2SH:i.input.check(r,e)?l.P2MS:s.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 h.input.check(r)?l.P2WPKH:f.input.check(r,e)?l.P2WSH:l.NONSTANDARD}},5525:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3482);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))}},4018:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(4378),o=r(1838),s=r(5892),a=r(1798),u=r(2401),c=r(7174),h=u.maybe(u.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));class f{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=s.pointCompress(e,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=s.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 s.sign(t,this.__D);{let e=s.sign(t,this.__D);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.__D,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function l(t,e){if(u(o.Buffer256bit,t),!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return u(h,e),new f(t,void 0,e)}e.fromPrivateKey=l,e.fromPublicKey=function(t,e){return u(s.isPoint,t),u(h,e),new f(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(h,t),void 0===t&&(t={});const e=t.rng||a;let r;do{r=e(32),u(o.Buffer256bit,r)}while(!s.isPrivate(r));return l(r,t)}},7656:(t,e,r)=>{"use strict";r(7786);const n=r(5488);e.Lk=n,r(5525);const i=r(4018);e.rn=i;const o=r(4378);e.QW=o,r(3348),r(3357),r(7949).Block,r(9930).Psbt,r(3357).OPS,r(2737).Transaction,r(1473).TransactionBuilder},4378:(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}},6648:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4378),i=r(3357),o=r(2691),s=r(2401),a=i.OPS;e.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),data:s.maybe(s.arrayOf(s.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(o.prop(r,"output",(()=>{if(t.data)return i.compile([a.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]!==a.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(s.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)}},3348:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6648);e.embed=n.p2data;const i=r(8793);e.p2ms=i.p2ms;const o=r(7759);e.p2pk=o.p2pk;const s=r(4483);e.p2pkh=s.p2pkh;const a=r(1160);e.p2sh=a.p2sh;const u=r(8810);e.p2wpkh=u.p2wpkh;const c=r(6924);e.p2wsh=c.p2wsh},2691:(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)}},8793:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4378),i=r(3357),o=r(2691),s=i.OPS,a=r(2401),u=r(5892),c=s.OP_RESERVED;function h(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===s.OP_0)}e=Object.assign({validate:!0},e||{}),a({network:a.maybe(a.Object),m:a.maybe(a.Number),n:a.maybe(a.Number),output:a.maybe(a.Buffer),pubkeys:a.maybe(a.arrayOf(u.isPoint)),signatures:a.maybe(a.arrayOf(r)),input:a.maybe(a.Buffer)},t);const f={network:t.network||n.bitcoin};let l=[],d=!1;function p(t){d||(d=!0,l=i.decompile(t),f.m=l[0]-c,f.n=l[l.length-2]-c,f.pubkeys=l.slice(1,-2))}if(o.prop(f,"output",(()=>{if(t.m&&f.n&&t.pubkeys)return i.compile([].concat(c+t.m,t.pubkeys,c+f.n,s.OP_CHECKMULTISIG))})),o.prop(f,"m",(()=>{if(f.output)return p(f.output),f.m})),o.prop(f,"n",(()=>{if(f.pubkeys)return f.pubkeys.length})),o.prop(f,"pubkeys",(()=>{if(t.output)return p(t.output),f.pubkeys})),o.prop(f,"signatures",(()=>{if(t.input)return i.decompile(t.input).slice(1)})),o.prop(f,"input",(()=>{if(t.signatures)return i.compile([s.OP_0].concat(t.signatures))})),o.prop(f,"witness",(()=>{if(f.input)return[]})),o.prop(f,"name",(()=>{if(f.m&&f.n)return`p2ms(${f.m} of ${f.n})`})),e.validate){if(t.output){if(p(t.output),!a.Number(l[0]))throw new TypeError("Output is invalid");if(!a.Number(l[l.length-2]))throw new TypeError("Output is invalid");if(l[l.length-1]!==s.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(f.m<=0||f.n>16||f.m>f.n||f.n!==l.length-3)throw new TypeError("Output is invalid");if(!f.pubkeys.every((t=>u.isPoint(t))))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==f.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==f.n)throw new TypeError("n mismatch");if(t.pubkeys&&!h(t.pubkeys,f.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(f.n=t.pubkeys.length,f.n<f.m)throw new TypeError("Pubkey count cannot be less than m")}if(t.signatures){if(t.signatures.length<f.m)throw new TypeError("Not enough signatures provided");if(t.signatures.length>f.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==s.OP_0)throw new TypeError("Input is invalid");if(0===f.signatures.length||!f.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!h(t.signatures,f.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(f,t)}},7759:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4378),i=r(3357),o=r(2691),s=r(2401),a=i.OPS,u=r(5892);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||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),pubkey:s.maybe(u.isPoint),signature:s.maybe(i.isCanonicalScriptSignature),input:s.maybe(s.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,a.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]!==a.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)}},4483:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5525),o=r(4378),s=r(3357),a=r(2691),u=r(2401),c=s.OPS,h=r(5892),f=r(8334);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(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),input:u.maybe(u.Buffer)},t);const r=a.value((()=>{const e=f.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),l=a.value((()=>s.decompile(t.input))),d=t.network||o.bitcoin,p={name:"p2pkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(d.pubKeyHash,0),p.hash.copy(t,1),f.encode(t)})),a.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)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([c.OP_DUP,c.OP_HASH160,p.hash,c.OP_EQUALVERIFY,c.OP_CHECKSIG])})),a.prop(p,"pubkey",(()=>{if(t.input)return l()[1]})),a.prop(p,"signature",(()=>{if(t.input)return l()[0]})),a.prop(p,"input",(()=>{if(t.pubkey&&t.signature)return s.compile([t.signature,t.pubkey])})),a.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(!s.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!h.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)}},1160:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5525),o=r(4378),s=r(3357),a=r(2691),u=r(2401),c=s.OPS,h=r(8334);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 f={network:r},l=a.value((()=>{const e=h.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),d=a.value((()=>s.decompile(t.input))),p=a.value((()=>{const e=d();return{network:r,output:e[e.length-1],input:s.compile(e.slice(0,-1)),witness:t.witness||[]}}));if(a.prop(f,"address",(()=>{if(!f.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(f.network.scriptHash,0),f.hash.copy(t,1),h.encode(t)})),a.prop(f,"hash",(()=>t.output?t.output.slice(2,22):t.address?l().hash:f.redeem&&f.redeem.output?i.hash160(f.redeem.output):void 0)),a.prop(f,"output",(()=>{if(f.hash)return s.compile([c.OP_HASH160,f.hash,c.OP_EQUAL])})),a.prop(f,"redeem",(()=>{if(t.input)return p()})),a.prop(f,"input",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return s.compile([].concat(s.decompile(t.redeem.input),t.redeem.output))})),a.prop(f,"witness",(()=>f.redeem&&f.redeem.witness?f.redeem.witness:f.input?[]:void 0)),a.prop(f,"name",(()=>{const t=["p2sh"];return void 0!==f.redeem&&t.push(f.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=s.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=s.decompile(t.input);if(!s.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(f,t)}},8810:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5525),o=r(4378),s=r(3357),a=r(2691),u=r(2401),c=s.OPS,h=r(5892),f=r(2882),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(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=a.value((()=>{const e=f.decode(t.address),r=e.words.shift(),i=f.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),d=t.network||o.bitcoin,p={name:"p2wpkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=f.toWords(p.hash);return t.unshift(0),f.encode(d.bech32,t)})),a.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)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([c.OP_0,p.hash])})),a.prop(p,"pubkey",(()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0)),a.prop(p,"signature",(()=>{if(t.witness)return t.witness[0]})),a.prop(p,"input",(()=>{if(p.witness)return l})),a.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,!h.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(!s.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!h.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)}},6924:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5525),o=r(4378),s=r(3357),a=r(2691),u=r(2401),c=s.OPS,h=r(5892),f=r(2882),l=n.alloc(0);function d(t){return!(!n.isBuffer(t)||65!==t.length||4!==t[0]||!h.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=a.value((()=>{const e=f.decode(t.address),r=e.words.shift(),i=f.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),h=a.value((()=>s.decompile(t.redeem.input)));let p=t.network;p||(p=t.redeem&&t.redeem.network||o.bitcoin);const g={network:p};if(a.prop(g,"address",(()=>{if(!g.hash)return;const t=f.toWords(g.hash);return t.unshift(0),f.encode(p.bech32,t)})),a.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)),a.prop(g,"output",(()=>{if(g.hash)return s.compile([c.OP_0,g.hash])})),a.prop(g,"redeem",(()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:l,witness:t.witness.slice(0,-1)}})),a.prop(g,"input",(()=>{if(g.witness)return l})),a.prop(g,"witness",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=s.toStack(h());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)})),a.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===s.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&&!s.isPushOnly(h()))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&&h().some(d)||t.redeem.output&&(s.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)||(s.decompile(e)||[]).some(d))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(g,t)}},9930:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5011),o=r(3493),s=r(6403),a=r(5488),u=r(9357),c=r(5525),h=r(4018),f=r(4378),l=r(3348),d=r(3357),p=r(2737),g={network:f.bitcoin,maximumFeeRate:5e3};class m{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,y),n=new m(e,r);var o,s;return o=n.__CACHE.__TX,s=n.__CACHE,o.ins.forEach((t=>{N(s,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=a.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=m.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){P(t),this.opts.maximumFeeRate=t}setVersion(t){P(t),I(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){P(t),I(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){P(e),I(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]");I(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t),N(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&$(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]");I(this.data.inputs,"addOutput");const{address:e}=t;if("string"==typeof e){const{network:r}=this.opts,n=a.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 K(this.data.inputs,r,e,!0),r}getFeeRate(){return F("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return F("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return s.checkForInput(this.data.inputs,0),Y(this.data.inputs.length).forEach((t=>this.finalizeInput(t))),this}finalizeInput(t,e=L){const r=s.checkForInput(this.data.inputs,t),{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=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=H(r,e,t),s=n.ins[t].index;i.script=o.outs[s].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,a,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=s.checkForInput(this.data.inputs,t),r=G(q(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)&&!z(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!z(r)&&d.decompile(r)?r:void 0}(e.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+J(r.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=q(r,e,n),{meaningfulScript:o}=G(i,r,"input",e.redeemScript,e.witnessScript);return Z(t,o)}(e,s.checkForInput(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=s.checkForInput(this.data.inputs,t),n=O(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}=G(i,r,"output",e.redeemScript,e.witnessScript);return Z(t,o)}(e,s.checkForOutput(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=s.checkForOutput(this.data.outputs,t),n=O(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(){return s.checkForInput(this.data.inputs,0),Y(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 s,a,u;for(const e of i){const n=d.signature.decode(e.signature),{hash:i,script:c}=u!==n.hashType?j(t,Object.assign({},r,{sighashType:n.hashType}),this.__CACHE,!0):{hash:s,script:a};u=n.hashType,s=i,a=c,x(e.pubkey,c,"verify");const f=h.fromPublicKey(e.pubkey);o.push(f.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 Y(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 Y(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 V(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=V(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 Y(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}=D(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}=D(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&&$(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=m;const y=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=h.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),M=S(l.p2pk),E=S(l.p2pkh),k=S(l.p2wpkh),T=S(l.p2wsh),C=S(l.p2sh);function O(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function P(t){if("number"!=typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function I(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 x(t,e,r){if(!Z(t,e))throw new Error(`Can not ${r} for this input with the key ${t.toString("hex")}`)}function N(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 B(t,e){return(r,n,i,o)=>{const s=t({redeem:{output:i}}).output;if(!n.equals(s))throw new Error(`${e} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const R=B(l.p2sh,"Redeem script"),U=B(l.p2wsh,"Witness script");function F(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(),K(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function L(t,e,r,i,s,a){const u=J(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,s,a){let u,c;const h=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),f=a?l.p2wsh({redeem:h}):null,d=s?l.p2sh({redeem:f||h}):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 s;return r((s=t).length),s.forEach(i),e}(f?f.witness:h.witness),d&&(u=d.input)):u=d?d.input:h.input,{finalScriptSig:u,finalScriptWitness:c}}(r,u,e.partialSig,i,s,a)}function D(t,e,r,n,i){const o=s.checkForInput(t,e),{hash:a,sighashType:u,script:c}=j(e,o,n,!1,i);return x(r,c,"sign"),{hash:a,sighashType:u}}function j(t,e,r,n,i){const o=r.__TX,s=e.sighashType||p.Transaction.SIGHASH_ALL;if(i&&i.indexOf(s)<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}(s);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}let a,u;if(e.nonWitnessUtxo){const n=H(r,e,t),i=o.ins[t].hash,s=n.getHash();if(!i.equals(s))throw new Error(`Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`);const a=o.ins[t].index;u=n.outs[a]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=e.witnessUtxo}const{meaningfulScript:c,type:h}=G(u.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(h)>=0)a=o.hashForWitnessV0(t,c,u.value,s);else if(k(c)){const e=l.p2pkh({hash:c.slice(2)}).output;a=o.hashForWitnessV0(t,e,u.value,s)}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*********************"),a=o.hashForSignature(t,c,s)}return{script:c,sighashType:s,hash:a}}function V(t,e,r){const n=s.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 s=0;s<n;s++)i.push((o=void 0,o=r(),e+=o,t.slice(e-o,e)));var o;return i}()}function $(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 K(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=H(r,t,o),s=e.ins[o].index,a=n.outs[s];i+=a.value}}));const o=e.outs.reduce(((t,e)=>t+e.value),0),s=i-o;if(s<0)throw new Error("Outputs are spending more than Inputs");const a=e.virtualSize();r.__FEE=s,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(s/a)}function H(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||$(t,e,r),n[r]}function q(t,e,r){if(void 0!==e.witnessUtxo)return e.witnessUtxo.script;if(void 0!==e.nonWitnessUtxo)return H(r,e,t).outs[r.__TX.ins[t].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function z(t){return 33===t.length&&d.isCanonicalPubKey(t)}function G(t,e,r,n,i){const o=C(t),s=o&&n&&T(n),a=T(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((a||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return s?(u=i,R(e,t,n,r),U(e,n,i,r),X(u)):a?(u=i,U(e,t,i,r),X(u)):o?(u=n,R(e,t,n,r)):u=t,{meaningfulScript:u,type:s?"p2sh-p2wsh":o?"p2sh":a?"p2wsh":"raw"}}function X(t){if(k(t)||C(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function Z(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 J(t){return k(t)?"witnesspubkeyhash":E(t)?"pubkeyhash":A(t)?"multisig":M(t)?"pubkey":"nonstandard"}function Y(t){return[...Array(t).keys()]}},3357:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5815),o=r(4362),s=r(1838),a=r(3027),u=r(5892),c=r(3565),h=r(2401);e.OPS=r(9991);const f=r(2920),l=e.OPS.OP_RESERVED;function d(t){return s.Buffer(t)||function(t){return s.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 s.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 m(t){return n.isBuffer(t)}function y(t){return n.isBuffer(t)}function w(t){if(m(t))return t;h(s.Array,t);const e=t.reduce(((t,e)=>y(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(y(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,s.Array(r))return t;var r;h(s.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 m(t)&&(t=b(t)),t.map((t=>{if(y(t)){const e=g(t);if(void 0===e)return t.toString("hex");t=e}return f[t]})).join(" ")},e.fromASM=function(t){return h(s.String,t),w(t.split(" ").map((t=>void 0!==e.OPS[t]?e.OPS[t]:(h(s.Hex,t),n.from(t,"hex")))))},e.toStack=function(t){return t=b(t),h(p,t),t.map((t=>y(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])&&a.check(t.slice(0,-1))},e.number=i,e.signature=o},5815:(t,e,r)=>{"use strict";var n=r(8764).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&&0==(127&t[n-1])&&(n<=1||0==(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),s=t<0;for(let t=0;t<r;++t)o.writeUInt8(255&e,t),e>>=8;return 128&o[r-1]?o.writeUInt8(s?128:0,r-1):s&&(o[r-1]|=128),o}},4362:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1838),o=r(3027),s=r(2401),a=n.alloc(1,0);function u(t){let e=0;for(;0===t[e];)++e;return e===t.length?a:128&(t=t.slice(e))[0]?n.concat([a,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)),s=c(i.r),a=c(i.s);return{signature:n.concat([s,a],64),hashType:e}},e.encode=function(t,e){s({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 a=n.allocUnsafe(1);a.writeUInt8(e,0);const c=u(t.slice(0,32)),h=u(t.slice(32,64));return n.concat([o.encode(c,h),a])}},8800:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8036);e.input=n;const i=r(5810);e.output=i},8036:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);function o(t){return t===i.OPS.OP_0||n.isCanonicalScriptSignature(t)}function s(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=s,s.toJSON=()=>"multisig input"},5810:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357),o=r(1838),s=i.OPS.OP_RESERVED;function a(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 a=r[0]-s,u=r[r.length-2]-s;return!(a<=0)&&(!(u>16)&&(!(a>u)&&(u===r.length-3&&(!!e||r.slice(1,-2).every(n.isCanonicalPubKey)))))}e.check=a,a.toJSON=()=>"multi-sig output"},2334:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),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 s={check:o};e.output=s},7114:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2002);e.input=n;const i=r(3202);e.output=i},2002:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357);function i(t){const e=n.decompile(t);return 1===e.length&&n.isCanonicalScriptSignature(e[0])}e.check=i,i.toJSON=()=>"pubKey input"},3202:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);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"},3645:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3797);e.input=n;const i=r(1382);e.output=i},3797:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357);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"},1382:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);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"},6484:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(904);e.input=n;const i=r(897);e.output=i},904:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3357),o=r(8800),s=r(7114),a=r(3645),u=r(5876),c=r(5112);function h(t,e){const r=i.decompile(t);if(r.length<1)return!1;const h=r[r.length-1];if(!n.isBuffer(h))return!1;const f=i.decompile(i.compile(r.slice(0,-1))),l=i.decompile(h);return!!l&&!!i.isPushOnly(f)&&(1===r.length?c.check(l)||u.check(l):!(!a.input.check(f)||!a.output.check(l))||!(!o.input.check(f,e)||!o.output.check(l))||!(!s.input.check(f)||!s.output.check(l)))}e.check=h,h.toJSON=()=>"scriptHash input"},897:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);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"},9920:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5704);e.output=n},5704:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3357),o=r(3357),s=r(1838),a=r(2401),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){a(s.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 a(c,t),i.decompile(t)[1].slice(4,36)}},8529:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5764);e.input=n;const i=r(5876);e.output=i},5764:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357);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"},5876:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);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"},2476:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5114);e.input=n;const i=r(5112);e.output=i},5114:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3357),o=r(2401),s=r(8800),a=r(7114),u=r(3645);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 h=i.compile(t.slice(0,-1));return!(!u.input.check(h)||!u.output.check(c))||!(!s.input.check(h,e)||!s.output.check(c))||!(!a.input.check(h)||!a.output.check(c))}e.check=c,c.toJSON=()=>"witnessScriptHash input"},5112:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3357),i=r(3357);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"},2737:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9357),o=r(5525),s=r(3357),a=r(3357),u=r(1838),c=r(2401),h=r(7795);function f(t){const e=t.length;return h.encodingLength(e)+e}const l=n.allocUnsafe(0),d=[],p=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),g=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),m=n.from("ffffffffffffffff","hex"),y={script:l,valueBuffer:m};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(),s=r.readUInt8();let a=!1;o===w.ADVANCED_TRANSACTION_MARKER&&s===w.ADVANCED_TRANSACTION_FLAG?a=!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(a){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)+h.encodingLength(this.ins.length)+h.encodingLength(this.outs.length)+this.ins.reduce(((t,e)=>t+40+f(e.script)),0)+this.outs.reduce(((t,e)=>t+8+f(e.script)),0)+(e?this.ins.reduce(((t,e)=>t+function(t){const e=t.length;return h.encodingLength(e)+t.reduce(((t,e)=>t+f(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=s.compile(s.decompile(e).filter((t=>t!==a.OPS.OP_CODESEPARATOR))),h=this.clone();if((31&r)===w.SIGHASH_NONE)h.outs=[],h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}));else if((31&r)===w.SIGHASH_SINGLE){if(t>=this.outs.length)return g;h.outs.length=t+1;for(let e=0;e<t;e++)h.outs[e]=y;h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}))}r&w.SIGHASH_ANYONECANPAY?(h.ins=[h.ins[t]],h.ins[0].script=i):(h.ins.forEach((t=>{t.script=l})),h.ins[t].script=i);const f=n.allocUnsafe(h.byteLength(!1)+4);return f.writeInt32LE(r,f.length-4),h.__toBuffer(f,0,!1),o.hash256(f)}hashForWitnessV0(t,e,r,s){c(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let a,h=n.from([]),l=p,d=p,g=p;if(s&w.SIGHASH_ANYONECANPAY||(h=n.allocUnsafe(36*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeSlice(t.hash),a.writeUInt32(t.index)})),d=o.hash256(h)),s&w.SIGHASH_ANYONECANPAY||(31&s)===w.SIGHASH_SINGLE||(31&s)===w.SIGHASH_NONE||(h=n.allocUnsafe(4*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeUInt32(t.sequence)})),g=o.hash256(h)),(31&s)!==w.SIGHASH_SINGLE&&(31&s)!==w.SIGHASH_NONE){const t=this.outs.reduce(((t,e)=>t+8+f(e.script)),0);h=n.allocUnsafe(t),a=new i.BufferWriter(h,0),this.outs.forEach((t=>{a.writeUInt64(t.value),a.writeVarSlice(t.script)})),l=o.hash256(h)}else if((31&s)===w.SIGHASH_SINGLE&&t<this.outs.length){const e=this.outs[t];h=n.allocUnsafe(8+f(e.script)),a=new i.BufferWriter(h,0),a.writeUInt64(e.value),a.writeVarSlice(e.script),l=o.hash256(h)}h=n.allocUnsafe(156+f(e)),a=new i.BufferWriter(h,0);const m=this.ins[t];return a.writeUInt32(this.version),a.writeSlice(d),a.writeSlice(g),a.writeSlice(m.hash),a.writeUInt32(m.index),a.writeVarSlice(e),a.writeUInt64(r),a.writeUInt32(m.sequence),a.writeSlice(l),a.writeUInt32(this.locktime),a.writeUInt32(s),o.hash256(h)}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 s=r&&this.hasWitnesses();return s&&(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)})),s&&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},1473:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5488),o=r(9357),s=r(7129),a=r(5525),u=r(4018),c=r(4378),h=r(3348),f=r(3357),l=r(3357),d=r(2737),p=r(1838),g=r(2401),m=s.types,y=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!==m.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 s;return n.some(((i,a)=>{if(!i)return!1;const u=f.signature.decode(i),c=e.hashForSignature(r,t.redeemScript,u.hashType);return!!o.verify(c,u.signature)&&(n[a]=void 0,s=i,!0)})),s}))}(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 s;if("string"==typeof(a=t)||a 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,s=r.value,t=t.getHash(!1)}var a;return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:s})}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 s=!1;for(const[a,u]of t.pubkeys.entries()){if(!e.equals(u))continue;if(t.signatures[a])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[a]=f.signature.encode(c,i),s=!0}if(!s)throw new Error("Key pair cannot sign for this input")}(function(t,e,r,n,i,o,s,a,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(!y.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:s,hashType:a,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(a=a||d.Transaction.SIGHASH_ALL))throw new Error("Transaction needs outputs");const v=e[b];if(void 0!==v.redeemScript&&s&&!v.redeemScript.equals(s))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=h.p2wsh({redeem:{output:n}}),o=h.p2wsh({output:r}),s=h.p2sh({redeem:{output:r}}),a=h.p2sh({redeem:i});if(!i.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!s.hash.equals(a.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 ("+f.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(u.signatures=t.signatures);const c=n;if(u.type===m.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:m.P2WSH,witnessScript:n,witnessScriptType:u.type,prevOutType:m.P2SH,prevOutScript:s.output,hasWitness:!0,signScript:c,signType:u.type,pubkeys:u.pubkeys,signatures:u.signatures,maxSignatures:u.maxSignatures}}if(r){const n=h.p2sh({redeem:{output:r}});if(t.prevOutScript){let e;try{e=h.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 ("+f.toASM(r)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);let o=r;return i.type===m.P2WPKH&&(o=h.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:m.P2SH,prevOutScript:n.output,hasWitness:i.type===m.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(n){const r=h.p2wsh({redeem:{output:n}});if(t.prevOutScript){const e=h.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 ("+f.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);const o=n;if(i.type===m.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:n,witnessScriptType:i.type,prevOutType:m.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===m.P2SH)throw new Error("PrevOutScript is "+t.prevOutType+", requires redeemScript");if(t.prevOutType===m.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 ("+f.toASM(t.prevOutScript)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(r.signatures=t.signatures);let n=t.prevOutScript;return r.type===m.P2WPKH&&(n=h.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:t.prevOutScript,hasWitness:r.type===m.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures,maxSignatures:r.maxSignatures}}const i=h.p2pkh({pubkey:e}).output;return{prevOutType:m.P2PKH,prevOutScript:i,hasWitness:!1,signScript:i,signType:m.P2PKH,pubkeys:[e],signatures:[void 0]}}(v,S,s,c);Object.assign(v,t)}if(!A(v))throw Error(v.prevOutType+" not supported")}let M;return M=v.hasWitness?n.hashForWitnessV0(b,v.signScript,v.value,a):n.hashForSignature(b,v.signScript,a),{input:v,ourPubKey:S,keyPair:o,signatureHash:M,hashType:a,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||s.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===m.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||0!=(M(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&&!(M(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&M(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=s.input(t,!0),i=s.witness(e,!0);n===m.NONSTANDARD&&(n=void 0),i===m.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case m.P2WPKH:{const{output:t,pubkey:r,signature:n}=h.p2wpkh({witness:e});return{prevOutScript:t,prevOutType:m.P2WPKH,pubkeys:[r],signatures:[n]}}case m.P2PKH:{const{output:e,pubkey:r,signature:n}=h.p2pkh({input:t});return{prevOutScript:e,prevOutType:m.P2PKH,pubkeys:[r],signatures:[n]}}case m.P2PK:{const{signature:e}=h.p2pk({input:t});return{prevOutType:m.P2PK,pubkeys:[void 0],signatures:[e]}}case m.P2MS:{const{m:e,pubkeys:r,signatures:i}=h.p2ms({input:t,output:n},{allowIncomplete:!0});return{prevOutType:m.P2MS,pubkeys:r,signatures:i,maxSignatures:e}}}if(r===m.P2SH){const{output:r,redeem:n}=h.p2sh({input:t,witness:e}),i=s.output(n.output),o=v(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:m.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===m.P2WSH){const{output:r,redeem:n}=h.p2wsh({input:t,witness:e}),i=s.output(n.output);let o;return o=i===m.P2WPKH?v(n.input,n.witness,i):v(f.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:m.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:m.NONSTANDARD,prevOutScript:t}}function _(t,e){g(p.Buffer,t);const r=s.output(t);switch(r){case m.P2PKH:{if(!e)return{type:r};const n=h.p2pkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2WPKH:{if(!e)return{type:r};const n=h.p2wpkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2PK:return{type:r,pubkeys:[h.p2pk({output:t}).pubkey],signatures:[void 0]};case m.P2MS:{const e=h.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 m.P2PKH:if(0===n.length)break;if(0===i.length)break;return h.p2pkh({pubkey:n[0],signature:i[0]});case m.P2WPKH:if(0===n.length)break;if(0===i.length)break;return h.p2wpkh({pubkey:n[0],signature:i[0]});case m.P2PK:if(0===n.length)break;if(0===i.length)break;return h.p2pk({signature:i[0]});case m.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 h.p2ms({m:t,pubkeys:n,signatures:i},{allowIncomplete:r,validate:o})}case m.P2SH:{const t=S(e.redeemScriptType,e,r);if(!t)return;return h.p2sh({redeem:{output:t.output||e.redeemScript,input:t.input,witness:t.witness}})}case m.P2WSH:{const t=S(e.witnessScriptType,e,r);if(!t)return;return h.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 M(t){return t.readUInt8(t.length-1)}e.TransactionBuilder=b},1838:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2401),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},9931:(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(9214);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},7191:(t,e,r)=>{var n=r(8162);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},3310:(t,e,r)=>{"use strict";var n=r(7191),i=r(9509).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)}}}},8334:(t,e,r)=>{"use strict";var n=r(3482),i=r(3310);t.exports=i((function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()}))},8764:(t,e,r)=>{"use strict";const n=r(9742),i=r(645),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 s=2147483647;function a(t){if(t>s)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 f(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=a(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=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?a(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 h(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 f(t){return h(t),a(t<0?0:0|p(t))}function l(t){const e=t.length<0?0:0|p(t.length),r=a(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>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.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 q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 P(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(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),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=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,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-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 s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function _(t,e,r,n){return G(q(e,t.length-r),t,r,n)}function S(t,e,r,n){return G(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(z(e),t,r,n)}function M(t,e,r,n){return G(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),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,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){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],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}e.kMaxLength=s,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 h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return f(t)},u.allocUnsafeSlow=function(t){return f(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)y(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)y(this,e,e+3),y(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)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(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):m.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),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r);for(let t=0;t<a;++t)if(c[t]!==h[t]){o=c[t],s=h[t];break}return o<s?-1:s<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 M(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 T=4096;function C(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 O(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 P(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+=J[t[n]];return i}function I(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 x(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 N(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 B(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 s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function R(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 s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function U(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||U(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||U(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||x(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||x(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||x(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(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||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Y((function(t){$(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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=Y((function(t){$(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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||x(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||x(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||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||x(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||x(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||x(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||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Y((function(t){$(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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=Y((function(t){$(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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||x(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(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||N(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||N(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||N(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||N(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||N(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||N(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||N(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=Y((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Y((function(t,e=0){return R(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);N(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&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);N(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(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||N(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||N(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||N(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||N(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=Y((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Y((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),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);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),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const D={};function j(t,e,r){D[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 V(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 D.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){$(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1))}(n,i,o)}function $(t,e){if("number"!=typeof t)throw new D.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw $(t,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("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=V(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(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 Z(t){return t!=t}const J=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 Y(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},3105:(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(6207),i=r(1189);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 s={};function a(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))}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=a,e.c32addressDecode=u,e.b58ToC32=function(t,e){void 0===e&&(e=-1);var r,n=i.decode(t),s=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,a(r,s)},e.c32ToB58=function(t,e){void 0===e&&(e=-1);var r,n=u(t),o=n[0],a=n[1];e<0?(r=o,void 0!==s[o]&&(r=s[o])):r=e;var c=r.toString(16);return 1===c.length&&(c="0"+c),i.encode(a,c)}},1189:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;var n=r(14),i=r(5592),o=r(8162),s="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 a=n.Buffer.concat([e,t]);return a=i.hashSha256(a),a=i.hashSha256(a),a=n.Buffer.concat([e,t,a.slice(0,4)]),o(s).encode(a)},e.decode=function(t,e){var r=new n.Buffer(o(s).decode(t)),a=r.slice(0,1),u=r.slice(1,-4),c=n.Buffer.concat([a,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&&(a=a.toString(e),u=u.toString(e)),{prefix:a,data:u}}},6207:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;var n=r(14),i=r(7495),o=r(5592);function s(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=s(""+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),a=n.toString(16);if(1===a.length&&(a="0"+a),s(""+a+e.substring(0,e.length-8))!==o)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},7495:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;var n=r(14);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=[],s=0,a=(t=t.toLowerCase()).length-1;a>=0;a--)if(s<4){var u=i.indexOf(t[a])>>s,c=0;0!==a&&(c=i.indexOf(t[a-1]));var h=1+s,f=c%(1<<h)<<5-h,l=e.c32[u+f];s=h,o.unshift(l)}else s=0;var d=0;for(a=0;a<o.length&&"0"===o[a];a++)d++;o=o.slice(d);var p=n.Buffer.from(t,"hex").toString().match(/^\u0000*/),g=p?p[0].length:0;for(a=0;a<g;a++)o.unshift(e.c32[0]);if(r){var m=r-o.length;for(a=0;a<m;a++)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]+"*"),s=n?n[0].length:0,a=[],u=0,c=0,h=t.length-1;h>=0;h--){4===c&&(a.unshift(i[u]),c=0,u=0);var f=(e.c32.indexOf(t[h])<<c)+u,l=i[f%16];if((u=f>>4)>1<<(c+=1))throw new Error("Panic error in decoding.");a.unshift(l)}a.unshift(i[u]),a.length%2==1&&a.unshift("0");var d=0;for(h=0;h<a.length&&"0"===a[h];h++)d++;var p=(a=a.slice(d-d%2)).join("");for(h=0;h<s;h++)p="00"+p;if(r){var g=2*r-p.length;for(h=0;h<g;h+=2)p="00"+p}return p}},7701:(t,e,r)=>{"use strict";e.xs=e.yI=e.H4=void 0;r(7495),r(6207);var n=r(3105);Object.defineProperty(e,"H4",{enumerable:!0,get:function(){return n.c32address}}),Object.defineProperty(e,"yI",{enumerable:!0,get:function(){return n.c32addressDecode}}),Object.defineProperty(e,"xs",{enumerable:!0,get:function(){return n.c32ToB58}})},14:(t,e,r)=>{"use strict";var n=r(9742),i=r(645),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 s=2147483647;function a(t){if(t>s)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 f(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=a(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(V(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(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(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=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||W(t.length)?a(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 h(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 f(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(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>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(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 L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 P(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(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,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){f=!1;break}if(f)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 s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(W(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return j(L(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 j(D(e),t,r,n)}function M(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>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,s,a,u,c=t[i],h=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}e.kMaxLength=s,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 h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return f(t)},u.allocUnsafeSlow=function(t){return f(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),V(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(V(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)y(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)y(this,e,e+3),y(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)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(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):m.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(V(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),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r),f=0;f<a;++f)if(c[f]!==h[f]){o=c[f],s=h[f];break}return o<s?-1:s<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 M(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 T=4096;function C(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 O(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 P(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+=$[t[o]];return i}function I(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 x(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 N(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 B(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 R(t,e,r,n,o){return e=+e,r>>>=0,o||B(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return e=+e,r>>>=0,o||B(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||x(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||x(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||x(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(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||x(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||x(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||x(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||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||x(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||x(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||x(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||x(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||x(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(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||N(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||N(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||N(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||N(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||N(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||N(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||N(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);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(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||N(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||N(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||N(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||N(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 R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!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 s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var F=/[^+/0-9A-Za-z-_]/g;function L(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 D(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(F,"")).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 V(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 $=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}()},1027:(t,e,r)=>{var n=r(9509).Buffer,i=r(2263).Transform,o=r(2553).s;function s(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(5717)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.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)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.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=s},3482:(t,e,r)=>{"use strict";var n=r(5717),i=r(2318),o=r(9785),s=r(9072),a=r(1027);function u(t){a.call(this,"digest"),this._hash=t}n(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},8028:(t,e,r)=>{var n=r(2318);t.exports=function(t){return(new n).update(t).digest()}},8355:(t,e,r)=>{"use strict";var n=r(5717),i=r(1031),o=r(1027),s=r(9509).Buffer,a=r(8028),u=r(9785),c=r(9072),h=s.alloc(128);function f(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.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=s.concat([e,h],r));for(var n=this._ipad=s.allocUnsafe(r),i=this._opad=s.allocUnsafe(r),a=0;a<r;a++)n[a]=54^e[a],i[a]=92^e[a];this._hash="rmd160"===t?new u:c(t),this._hash.update(n)}n(f,o),f.prototype._update=function(t){this._hash.update(t)},f.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 f("rmd160",e):"md5"===t?new i(a,e):new f(t,e)}},1031:(t,e,r)=>{"use strict";var n=r(5717),i=r(9509).Buffer,o=r(1027),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length<a&&(e=i.concat([e,s],a));for(var r=this._ipad=i.allocUnsafe(a),n=this._opad=i.allocUnsafe(a),u=0;u<a;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},1905: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,s="ArrayBuffer"in t;if(s)var a=["[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&&a.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 h(t){return"string"!=typeof t&&(t=String(t)),t}function f(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 m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){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():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(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=h(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)]=h(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)})),f(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(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})},y.call(b.prototype),y.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 s=new b(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.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 a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._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)},4098: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,s="ArrayBuffer"in t;if(s)var a=["[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&&a.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 h(t){return"string"!=typeof t&&(t=String(t)),t}function f(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 m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){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():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(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=h(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)]=h(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)})),f(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(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})},y.call(b.prototype),y.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 s=new b(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.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 a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._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},5592:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256=e.sha256=e.sha256nodeCrypto=e.sha256js=void 0;var n=r(2645),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,s=this._len,a=0;a<o;){for(var u=s%i,c=Math.min(o-a,i-u),h=0;h<c;h++)r[u+h]=t[a+h];a+=c,(s+=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 s=n.Buffer.alloc(32);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s.writeInt32BE(this._h,28),t?s.toString(t):s},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,s=0|this._d,a=0|this._e,u=0|this._f,c=0|this._g,h=0|this._h,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<64;++f)r[f]=this.gamma1(r[f-2])+r[f-7]+this.gamma0(r[f-15])+r[f-16]|0;for(var l=0;l<64;++l){var d=h+this.sigma1(a)+this.ch(a,u,c)+t.K[l]+r[l]|0,p=this.sigma0(n)+this.maj(n,i,o)|0;h=c,c=u,u=a,a=s+d|0,s=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=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=h+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(4729).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 s=void 0,a=function(){function t(){!function(){if(o.useCryptoModuleCache&&void 0!==s)return s;var t=!1;try{var e=r(4729);t=e&&"function"==typeof e.createHash}catch(t){}return s=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 a).update(t).digest()}e.sha256=a,e.hashSha256=u,e.default=u},2645:(t,e,r)=>{"use strict";var n=r(9742),i=r(645),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 s=2147483647;function a(t){if(t>s)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 f(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=a(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(V(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(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(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=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||W(t.length)?a(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 h(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 f(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(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>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(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 L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 P(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(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,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){f=!1;break}if(f)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 s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(W(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return j(L(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 j(D(e),t,r,n)}function M(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>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,s,a,u,c=t[i],h=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}e.kMaxLength=s,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 h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return f(t)},u.allocUnsafeSlow=function(t){return f(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),V(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(V(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)y(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)y(this,e,e+3),y(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)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(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):m.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(V(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),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r),f=0;f<a;++f)if(c[f]!==h[f]){o=c[f],s=h[f];break}return o<s?-1:s<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 M(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 T=4096;function C(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 O(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 P(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+=$[t[o]];return i}function I(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 x(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 N(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 B(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 R(t,e,r,n,o){return e=+e,r>>>=0,o||B(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return e=+e,r>>>=0,o||B(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||x(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||x(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||x(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(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||x(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||x(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||x(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||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||x(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||x(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||x(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||x(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||x(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(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||N(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||N(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||N(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||N(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||N(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||N(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||N(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);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(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||N(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||N(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||N(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||N(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 R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!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 s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var F=/[^+/0-9A-Za-z-_]/g;function L(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 D(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(F,"")).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 V(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 $=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}()},4020: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 s=Object.keys(e),a=0;a<s.length;a++){var u=s[a];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},5015:(t,e,r)=>{"use strict";var n=r(9509).Buffer,i=r(6972);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 s(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),s=r+1,a=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++]),a-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(a-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var h=t[u++];if(a-u-2<h)throw new Error('"r" specified length of "'+h+'", only "'+(a-u-2)+'" available');if(s<h)throw new Error('"r" specified length of "'+h+'", max of "'+s+'" is acceptable');var f=u;if(u+=h,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(a-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(a-u)+'"');if(s<l)throw new Error('"s" specified length of "'+l+'", max of "'+s+'" is acceptable');var d=u;if((u+=l)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-u)+'" bytes remain');var p=r-h,g=r-l,m=n.allocUnsafe(p+h+g+l);for(u=0;u<p;++u)m[u]=0;t.copy(m,u,f+Math.max(-p,0),f+h);for(var y=u=r;u<y+g;++u)m[u]=0;return t.copy(m,u,d+Math.max(-g,0),d+l),(m=m.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var r=i(e),a=t.length;if(a!==2*r)throw new TypeError('"'+e+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var u=s(t,0,r),c=s(t,r,t.length),h=r-u,f=r-c,l=2+h+1+1+f,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++]=h,u<0?(p[g++]=0,g+=t.copy(p,g,0,r)):g+=t.copy(p,g,u,r),p[g++]=2,p[g++]=f,c<0?(p[g++]=0,t.copy(p,g,r)):t.copy(p,g,r+c),p}}},6972: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+'"')}},6266:(t,e,r)=>{"use strict";var n=e;n.version=r(8597).i8,n.utils=r(953),n.rand=r(9931),n.curve=r(8254),n.curves=r(5427),n.ec=r(7954),n.eddsa=r(5980)},4918:(t,e,r)=>{"use strict";var n=r(3785),i=r(953),o=i.getNAF,s=i.getJSF,a=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){a(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 s,u,c=[];for(s=0;s<n.length;s+=r.step){u=0;for(var h=s+r.step-1;h>=s;h--)u=(u<<1)+n[h];c.push(u)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<c.length;s++)(u=c[s])===d?l=l.mixedAdd(r.points[s]):u===-d&&(l=l.mixedAdd(r.points[s].neg()));f=f.add(l)}return f.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(e,r,this._bitLength),u=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(var h=0;c>=0&&0===s[c];c--)h++;if(c>=0&&h++,u=u.dblp(h),c<0)break;var f=s[c];a(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,c,h=this._wnafT1,f=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a<n;a++){var p=(c=e[a])._getNAFPoints(t);h[a]=p.wnd,f[a]=p.points}for(a=n-1;a>=1;a-=2){var g=a-1,m=a;if(1===h[g]&&1===h[m]){var y=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(y[1]=e[g].add(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].add(e[m].neg())):(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg()));var w=[-3,-1,-5,-7,0,7,5,1,3],b=s(r[g],r[m]);for(d=Math.max(b[0].length,d),l[g]=new Array(d),l[m]=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[m][u]=0,f[g]=y}}else l[g]=o(r[g],h[g],this._bitLength),l[m]=o(r[m],h[m],this._bitLength),d=Math.max(l[g].length,d),d=Math.max(l[m].length,d)}var S=this.jpoint(null,null,null),A=this._wnafT4;for(a=d;a>=0;a--){for(var M=0;a>=0;){var E=!0;for(u=0;u<n;u++)A[u]=0|l[u][a],0!==A[u]&&(E=!1);if(!E)break;M++,a--}if(a>=0&&M++,S=S.dblp(M),a<0)break;for(u=0;u<n;u++){var k=A[u];0!==k&&(k>0?c=f[u][k-1>>1]:k<0&&(c=f[u][-k-1>>1].neg()),S="affine"===c.type?S.mixedAdd(c):S.add(c))}}for(a=0;a<n;a++)f[a]=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]?a(t[t.length-1]%2==0):7===t[0]&&a(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}},1138:(t,e,r)=>{"use strict";var n=r(953),i=r(3785),o=r(5717),s=r(4918),a=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.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),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,r,n,o){s.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,s),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)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new 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),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(c,s.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),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),c=o.redMul(a),h=i.redMul(a),f=s.redMul(o);return this.curve.point(u,c,f,h)},c.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).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=s.redSub(a).redISub(u).redMul(o),e=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.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),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),c=o.redMul(s),h=a.redMul(u),f=o.redMul(u),l=s.redMul(a);return this.curve.point(c,h,l,f)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),f=n.redMul(u).redMul(h);return this.curve.twisted?(e=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(f,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},8254:(t,e,r)=>{"use strict";var n=e;n.base=r(4918),n.short=r(6673),n.mont=r(2881),n.edwards=r(1138)},2881:(t,e,r)=>{"use strict";var n=r(3785),i=r(5717),o=r(4918),s=r(953);function a(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(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<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),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var 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()}},6673:(t,e,r)=>{"use strict";var n=r(953),i=r(3785),o=r(5717),s=r(4918),a=n.assert;function u(t){s.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){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){s.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,s),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],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),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,s,a,u,c,h,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),y=new i(1),w=0;0!==l.cmpn(0);){var b=d.div(l);c=d.sub(b.mul(l)),h=m.sub(b.mul(p));var v=y.sub(b.mul(g));if(!n&&c.cmp(f)<0)e=u.neg(),r=p,n=c.neg(),o=h;else if(n&&2==++w)break;u=c,d=l,l=c,m=p,p=h,y=g,g=v}s=c.neg(),a=h;var _=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:t.sub(s).sub(a),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 s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),h=0;h<2*o;h++)n[h]=null,i[h]=null;return c},o(c,s.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)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},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(h,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),h=c.redMul(a),f=n.redMul(c),l=u.redSqr().redIAdd(h).redISub(f).redISub(f),d=u.redMul(f.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),h=r.redMul(u),f=a.redSqr().redIAdd(c).redISub(h).redISub(h),l=a.redMul(h.redISub(f)).redISub(i.redMul(c)),d=this.z.redMul(s);return this.curve.jpoint(f,l,d)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),c=s.redAdd(s);for(e=0;e<t;e++){var h=o.redSqr(),f=c.redSqr(),l=f.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(n.redMul(u)),p=o.redMul(f),g=d.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=d.redMul(m);y=y.redIAdd(y).redISub(l);var w=c.redMul(a);e+1<t&&(u=u.redMul(l)),o=g,a=w,c=y}return this.curve.jpoint(o,c.redMul(i),a)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),f=this.y.redSqr(),l=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),g=p.redSqr(),m=l.redIAdd(l);m=(m=m.redIAdd(m)).redIAdd(m),t=g.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},h.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),f=this.y.redSqr(),l=this.x.redMul(f),d=this.x.redSub(h).redMul(this.x.redAdd(h));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(f).redISub(h);var m=f.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=d.redMul(p.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},h.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(s),h=a.redSqr().redISub(c.redAdd(c)),f=c.redISub(h),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(f).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(h,d,p)},h.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(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),h=e.redMul(c);h=(h=h.redIAdd(h)).redIAdd(h);var f=this.x.redMul(a).redISub(h);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,l,d)},h.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},h.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)},h.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}},h.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)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},5427:(t,e,r)=>{"use strict";var n,i=e,o=r(3715),s=r(8254),a=r(953).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function 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(1037)}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]})},7954:(t,e,r)=>{"use strict";var n=r(3785),i=r(2156),o=r(953),s=r(5427),a=r(9931),u=o.assert,c=r(1251),h=r(611);function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.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=f,f.prototype.keyPair=function(t){return new c(this,t)},f.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),c=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(f)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var y=d.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var w=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),w^=1),new h({r:m,s:y,recoveryParam:w})}}}}}},f.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new h(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),c=u.mul(t).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),f)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,s=new n(t),a=e.r,c=e.s,f=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),g=c.mul(d).umod(o);return this.g.mulAdd(p,a,g)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var 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")}},1251:(t,e,r)=>{"use strict";var n=r(3785),i=r(953).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){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},611:(t,e,r)=>{"use strict";var n=r(3785),i=r(953),o=i.assert;function s(t,e){if(t instanceof s)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 a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,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 h(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=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;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 s=u(t,r);if(!1===s)return!1;var c=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var h=u(t,r);if(!1===h)return!1;if(t.length!==h+r.place)return!1;var f=t.slice(r.place,h+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(c),this.s=new n(f),this.recoveryParam=null,!0},s.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];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),s=[48];return h(s,o.length),s=s.concat(o),i.encode(s,t)}},5980:(t,e,r)=>{"use strict";var n=r(3715),i=r(5427),o=r(953),s=o.assert,a=o.parseBytes,u=r(9087),c=r(3622);function h(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(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=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.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)},h.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},h.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},h.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},h.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},h.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},h.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(t){return o.intFromLE(t)},h.prototype.isPoint=function(t){return t instanceof this.pointClass}},9087:(t,e,r)=>{"use strict";var n=r(953),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"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})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},a.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=a},3622:(t,e,r)=>{"use strict";var n=r(3785),i=r(953),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(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}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(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},1037: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"]]}}},953:(t,e,r)=>{"use strict";var n=e,i=r(3785),o=r(9746),s=r(4504);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},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 s,a,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(s),a=0==(1&c)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+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")}},3785: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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(5568).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)f*=e;this.imuln(f),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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,f=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;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[c]=0|f,u=0|h}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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}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=f[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:h[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!==s),this.toArrayLike(s,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 s,a,u="le"===e,c=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[o-a-1]=s}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 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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(0==(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(0==(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(0==(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,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),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,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],f=8191&h,l=h>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,_=b>>>13,S=0|s[4],A=8191&S,M=S>>>13,E=0|s[5],k=8191&E,T=E>>>13,C=0|s[6],O=8191&C,P=C>>>13,I=0|s[7],x=8191&I,N=I>>>13,B=0|s[8],R=8191&B,U=B>>>13,F=0|s[9],L=8191&F,D=F>>>13,j=0|a[0],V=8191&j,W=j>>>13,$=0|a[1],K=8191&$,H=$>>>13,q=0|a[2],z=8191&q,G=q>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,W))+Math.imul(g,V)|0,o=Math.imul(g,W);var yt=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,W))+Math.imul(w,V)|0,o=Math.imul(w,W),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,H)|0;var wt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,z)|0))<<13)|0;c=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,W))+Math.imul(_,V)|0,o=Math.imul(_,W),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,z)|0,o=o+Math.imul(g,G)|0;var bt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,V),i=(i=Math.imul(A,W))+Math.imul(M,V)|0,o=Math.imul(M,W),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,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,V),i=(i=Math.imul(k,W))+Math.imul(T,V)|0,o=Math.imul(T,W),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(O,V),i=(i=Math.imul(O,W))+Math.imul(P,V)|0,o=Math.imul(P,W),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,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(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,W))+Math.imul(N,V)|0,o=Math.imul(N,W),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|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(y,rt)|0,i=(i=i+Math.imul(y,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,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var At=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(R,V),i=(i=Math.imul(R,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,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(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|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 Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,W))+Math.imul(D,V)|0,o=Math.imul(D,W),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(L,K),i=(i=Math.imul(L,H))+Math.imul(D,K)|0,o=Math.imul(D,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(U,z)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|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(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(w,ft)|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(L,z),i=(i=Math.imul(L,G))+Math.imul(D,z)|0,o=Math.imul(D,G),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var Tt=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,J))+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Ct=(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)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,lt)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,lt)|0;var Pt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,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(L,ot),i=(i=Math.imul(L,st))+Math.imul(D,ot)|0,o=Math.imul(D,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var It=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,lt)|0;var xt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul(D,ft)|0,o=Math.imul(D,lt);var Nt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(c+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,gt))+Math.imul(D,pt)|0))<<13)|0;return c=((o=Math.imul(D,gt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Mt,u[9]=Et,u[10]=kt,u[11]=Tt,u[12]=Ct,u[13]=Ot,u[14]=Pt,u[15]=It,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(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 s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,f=(0|t.words[h])*(0|e.words[c]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.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},m.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},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var f=u,l=c,d=0;d<s;d++){var p=r[h+d],g=n[h+d],m=r[h+d+s],y=n[h+d+s],w=f*m-l*y;y=f*y+l*m,m=w,r[h+d]=p+m,n[h+d]=g+y,r[h+d+s]=p-m,n[h+d+s]=g-y,d!==a&&(w=u*f-c*l,l=u*l+c*f,f=w)}},m.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},m.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}},m.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},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,h,f,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,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 s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,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,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&a}return u&&0!==h&&(u.words[u.length++]=h),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,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):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,s,a},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),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,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,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).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 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(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,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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 y={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 M(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 s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}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(y[t])return y[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 y[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(0==(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),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new o(1).iushln(p-m-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}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],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var f=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=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 M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7187: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,r){"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 s=10;function a(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,s,c;if(a(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),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=s.length,c=h,console&&console.warn&&console.warn(c)}return t}function h(){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 f(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.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 s},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+".");s=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 s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)n(u,this,e);else{var c=u.length,h=p(u,c);for(r=0;r<c;++r)n(h[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 a(e),this.on(t,f(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,f(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,o,s;if(a(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){s=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,s||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):[]}},2806: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 s=n[o],a=t[s];(i?-1!==e.indexOf(s):e(s,a,t))&&(r[s]=a)}return r}},3349:(t,e,r)=>{"use strict";var n=r(9509).Buffer,i=r(8473).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(5717)(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,e){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 s=0,a=8*t.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);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},3715:(t,e,r)=>{var n=e;n.utils=r(6436),n.common=r(5772),n.sha=r(9041),n.ripemd=r(2949),n.hmac=r(2344),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},5772:(t,e,r)=>{"use strict";var n=r(6436),i=r(9746);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}},2344:(t,e,r)=>{"use strict";var n=r(6436),i=r(9746);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)}},2949:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(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(h,c),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],h=this.h[4],w=r,b=n,v=i,_=c,S=h,A=0;A<80;A++){var M=s(o(u(r,f(A,n,i,c),t[p[A]+e],l(A)),m[A]),h);r=h,h=c,c=o(i,10),i=n,n=M,M=s(o(u(w,f(79-A,b,v,_),t[g[A]+e],d(A)),y[A]),S),w=S,S=_,_=o(v,10),v=b,b=M}M=a(this.h[1],i,_),this.h[1]=a(this.h[2],c,S),this.h[2]=a(this.h[3],h,w),this.h[3]=a(this.h[4],r,b),this.h[4]=a(this.h[0],n,v),this.h[0]=M},h.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],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[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]},9041:(t,e,r)=>{"use strict";e.sha1=r(4761),e.sha224=r(799),e.sha256=r(9344),e.sha384=r(772),e.sha512=r(5900)},4761:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=n.rotl32,a=n.sum32,u=n.sum32_5,c=o.ft_1,h=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,h),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]=s(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),g=u(s(i,5),c(p,o,h,l),d,r[n],f[p]);d=l,l=h,h=s(o,30),o=i,i=g}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],l),this.h[4]=a(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},799:(t,e,r)=>{"use strict";var n=r(6436),i=r(9344);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")}},9344:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=r(9746),a=n.sum32,u=n.sum32_4,c=n.sum32_5,h=o.ch32,f=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,g=o.g1_256,m=i.BlockHash,y=[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;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(w,m),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],m=this.h[2],y=this.h[3],w=this.h[4],b=this.h[5],v=this.h[6],_=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var S=c(_,d(w),h(w,b,v),this.k[n],r[n]),A=a(l(i),f(i,o,m));_=v,v=b,b=w,w=a(y,S),y=m,m=o,o=i,i=a(S,A)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],y),this.h[4]=a(this.h[4],w),this.h[5]=a(this.h[5],b),this.h[6]=a(this.h[6],v),this.h[7]=a(this.h[7],_)},w.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},772:(t,e,r)=>{"use strict";var n=r(6436),i=r(5900);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")}},5900:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(9746),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,h=n.sum64,f=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,g=n.sum64_5_hi,m=n.sum64_5_lo,y=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;y.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 s=e&n^~e&o;return s<0&&(s+=4294967296),s}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 s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function M(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function E(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function C(t,e){var r=a(t,e,1)^a(t,e,8)^c(t,e,7);return r<0&&(r+=4294967296),r}function O(t,e){var r=a(t,e,19)^a(e,t,29)^c(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(b,y),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=(m=r[n-4],y=r[n-3],w=void 0,(w=s(m,y,19)^s(y,m,29)^u(m,y,6))<0&&(w+=4294967296),w),o=O(r[n-4],r[n-3]),a=r[n-14],c=r[n-13],h=T(r[n-30],r[n-29]),f=C(r[n-30],r[n-29]),l=r[n-32],g=r[n-31];r[n]=d(i,o,a,c,h,f,l,g),r[n+1]=p(i,o,a,c,h,f,l,g)}var m,y,w},b.prototype._update=function(t,e){this._prepareBlock(t,e);var r,n,i,a=this.W,u=this.h[0],c=this.h[1],d=this.h[2],p=this.h[3],y=this.h[4],w=this.h[5],b=this.h[6],T=this.h[7],C=this.h[8],O=this.h[9],P=this.h[10],I=this.h[11],x=this.h[12],N=this.h[13],B=this.h[14],R=this.h[15];o(this.k.length===a.length);for(var U=0;U<a.length;U+=2){var F=B,L=R,D=(i=void 0,(i=s(r=C,n=O,14)^s(r,n,18)^s(n,r,9))<0&&(i+=4294967296),i),j=k(C,O),V=v(C,0,P,0,x),W=_(0,O,0,I,0,N),$=this.k[U],K=this.k[U+1],H=a[U],q=a[U+1],z=g(F,L,D,j,V,W,$,K,H,q),G=m(F,L,D,j,V,W,$,K,H,q);F=M(u,c),L=E(u,c),D=S(u,0,d,0,y),j=A(0,c,0,p,0,w);var X=f(F,L,D,j),Z=l(F,L,D,j);B=x,R=N,x=P,N=I,P=C,I=O,C=f(b,T,z,G),O=l(T,T,z,G),b=y,T=w,y=d,w=p,d=u,p=c,u=f(z,G,X,Z),c=l(z,G,X,Z)}h(this.h,0,u,c),h(this.h,2,d,p),h(this.h,4,y,w),h(this.h,6,b,T),h(this.h,8,C,O),h(this.h,10,P,I),h(this.h,12,x,N),h(this.h,14,B,R)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},7038:(t,e,r)=>{"use strict";var n=r(6436).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(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?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,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}},6436:(t,e,r)=>{"use strict";var n=r(9746),i=r(5717);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<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 s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=s,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=s(i)),r+=u(i.toString(16))}return r},e.zero2=a,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var s=new Array(o/4),a=0,u=e;a<s.length;a++,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],s[a]=c>>>0}return s},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,s=(o<n?1:0)+r+i;t[e]=s>>>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,s,a){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+s+(u+=(c=c+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,c){var h=0,f=e;return h+=(f=f+n>>>0)<e?1:0,h+=(f=f+o>>>0)<o?1:0,h+=(f=f+a>>>0)<a?1:0,t+r+i+s+u+(h+=(f=f+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,c){return e+n+o+a+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}},2156:(t,e,r)=>{"use strict";var n=r(3715),i=r(4504),o=r(9746);function s(t){if(!(this instanceof s))return new s(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=s,s.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},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.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())},s.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},s.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 s=o.slice(0,t);return this._update(r),this._reseed++,i.encode(s,e)}},645:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,f=r?i-1:0,l=r?-1:1,d=t[e+f];for(f+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,f=h>>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?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+d]=255&s,d+=p,s/=256,c-=8);t[r+d-p]|=128*g}},5717: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}}},7803:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5118);e.SECP256K1Client=n.SECP256K1Client;const i={ES256K:n.SECP256K1Client};e.cryptoClients=i},5118:(t,e,r)=>{"use strict";var n=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6266),o=r(5015),s=r(9581);class a{constructor(){}static loadPrivateKey(t){return 66===t.length&&(t=t.slice(0,64)),a.ec.keyFromPrivate(t)}static loadPublicKey(t){return a.ec.keyFromPublic(t,"hex")}static derivePublicKey(t,e=!0){if("string"!=typeof t)throw Error("private key must be a string");if(!/^[0-9A-F]+$/i.test(t))throw Error("private key must be a hex string");if(66==t.length)t=t.slice(0,64);else if(!(t.length<=64))throw Error("private key must be 66 characters or less");return a.ec.keyFromPrivate(t).getPublic(e,"hex")}static signHash(t,e,r="jose"){if(!t||!e)throw new s.MissingParametersError("a signing input hash and private key are all required");const i=a.loadPrivateKey(e).sign(t),u=n.from(i.toDER());if("der"===r)return u.toString("hex");if("jose"===r)return o.derToJose(u,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return o.joseToDer(t,"ES256")}static verifyHash(t,e,r){if(!(t&&e&&r))throw new s.MissingParametersError("a signing input hash, der signature, and public key are all required");return a.loadPublicKey(r).verify(t,e)}}e.SECP256K1Client=a,a.ec=new i.ec("secp256k1"),a.algorithmName="ES256K"},2674:function(t,e,r){"use strict";var n=r(8764).Buffer,i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(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(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=r(9072);function s(t){return(new o.sha256).update(t).digest()}e.hashSha256=s,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(8971);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(s(t))}}))}},3891:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3363);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}}}},9581:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!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},6080:(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(2298)),n(r(3523)),n(r(3891)),n(r(9581)),n(r(7803))},2298: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 s(t){try{u(n.next(t))}catch(t){o(t)}}function a(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(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=r(3363),o=r(7803),s=r(9581),a=r(2674);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 s.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=a.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 a.hashSha256Async(i);return this.createWithSignedHash(t,e,n,i,o)}))}createWithSignedHash(t,e,r,n,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.default.encode(JSON.stringify(r))],payload:JSON.stringify(t),signature:[s]}:[n,s].join(".")}}},3523:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3363),i=r(7803),o=r(9581),s=r(2674);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):void 0}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 s.hashSha256Async(n).then((t=>i(t)));{const t=s.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 s.hashSha256Async(r).then((t=>o(t)));{const t=s.hashSha256(r);return o(t)}}}},5889:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",h="[object Map]",f="[object Number]",l="[object Object]",d="[object Promise]",p="[object RegExp]",g="[object Set]",m="[object String]",y="[object Symbol]",w="[object WeakMap]",b="[object ArrayBuffer]",v="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",A="[object Int8Array]",M="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",T="[object Uint8ClampedArray]",C="[object Uint16Array]",O="[object Uint32Array]",P=/\w*$/,I=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,N={};N[o]=N["[object Array]"]=N[b]=N[v]=N[s]=N[a]=N[_]=N[S]=N[A]=N[M]=N[E]=N[h]=N[f]=N[l]=N[p]=N[g]=N[m]=N[y]=N[k]=N[T]=N[C]=N[O]=!0,N["[object Error]"]=N[u]=N[w]=!1;var B="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,R="object"==typeof self&&self&&self.Object===Object&&self,U=B||R||Function("return this")(),F=e&&!e.nodeType&&e,L=F&&t&&!t.nodeType&&t,D=L&&L.exports===F;function j(t,e){return t.set(e[0],e[1]),t}function V(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 $(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function K(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function H(t,e){return function(r){return t(e(r))}}function q(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var z,G=Array.prototype,X=Function.prototype,Z=Object.prototype,J=U["__core-js_shared__"],Y=(z=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"",Q=X.toString,tt=Z.hasOwnProperty,et=Z.toString,rt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=D?U.Buffer:void 0,it=U.Symbol,ot=U.Uint8Array,st=H(Object.getPrototypeOf,Object),at=Object.create,ut=Z.propertyIsEnumerable,ct=G.splice,ht=Object.getOwnPropertySymbols,ft=nt?nt.isBuffer:void 0,lt=H(Object.keys,Object),dt=Ut(U,"DataView"),pt=Ut(U,"Map"),gt=Ut(U,"Promise"),mt=Ut(U,"Set"),yt=Ut(U,"WeakMap"),wt=Ut(Object,"create"),bt=Vt(dt),vt=Vt(pt),_t=Vt(gt),St=Vt(mt),At=Vt(yt),Mt=it?it.prototype:void 0,Et=Mt?Mt.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 Tt(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){this.__data__=new Tt(t)}function Pt(t,e,r){var n=t[e];tt.call(t,e)&&Wt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function It(t,e){for(var r=t.length;r--;)if(Wt(t[r][0],e))return r;return-1}function xt(t,e,r,n,i,d,w){var I;if(n&&(I=d?n(t,i,d,w):n(t)),void 0!==I)return I;if(!zt(t))return t;var x=$t(t);if(x){if(I=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,I)}else{var B=Lt(t),R=B==u||B==c;if(Ht(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(B==l||B==o||R&&!d){if($(t))return d?t:{};if(I=function(t){return"function"!=typeof t.constructor||jt(t)?{}:zt(e=st(t))?at(e):{};var e}(R?{}:t),!e)return function(t,e){return Bt(t,Ft(t),e)}(t,function(t,e){return t&&Bt(e,Gt(e),t)}(I,t))}else{if(!N[B])return d?t:{};I=function(t,e,r,n){var i,o=t.constructor;switch(e){case b:return Nt(t);case s:case a:return new o(+t);case v:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case _:case S:case A:case M:case E:case k:case T:case C:case O:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case h:return function(t,e,r){return W(e?r(K(t),!0):K(t),j,new t.constructor)}(t,n,r);case f:case m:return new o(t);case p:return function(t){var e=new t.constructor(t.source,P.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,r){return W(e?r(q(t),!0):q(t),V,new t.constructor)}(t,n,r);case y:return i=t,Et?Object(Et.call(i)):{}}}(t,B,xt,e)}}w||(w=new Ot);var U=w.get(t);if(U)return U;if(w.set(t,I),!x)var F=r?function(t){return function(t,e,r){var n=e(t);return $t(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,Gt,Ft)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(F||t,(function(i,o){F&&(i=t[o=i]),Pt(I,o,xt(i,e,r,n,o,t,w))})),I}function Nt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Bt(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=n?n(r[s],t[s],s,r,t):void 0;Pt(r,s,void 0===a?t[s]:a)}return r}function Rt(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 Ut(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!zt(t)||(e=t,Y&&Y in e))&&(qt(t)||$(t)?rt:I).test(Vt(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},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=It(e,t);return!(r<0||(r==e.length-1?e.pop():ct.call(e,r,1),0))},Tt.prototype.get=function(t){var e=this.__data__,r=It(e,t);return r<0?void 0:e[r][1]},Tt.prototype.has=function(t){return It(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=It(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Ct.prototype.clear=function(){this.__data__={hash:new kt,map:new(pt||Tt),string:new kt}},Ct.prototype.delete=function(t){return Rt(this,t).delete(t)},Ct.prototype.get=function(t){return Rt(this,t).get(t)},Ct.prototype.has=function(t){return Rt(this,t).has(t)},Ct.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},Ot.prototype.clear=function(){this.__data__=new Tt},Ot.prototype.delete=function(t){return this.__data__.delete(t)},Ot.prototype.get=function(t){return this.__data__.get(t)},Ot.prototype.has=function(t){return this.__data__.has(t)},Ot.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Ct(n)}return r.set(t,e),this};var Ft=ht?H(ht,Object):function(){return[]},Lt=function(t){return et.call(t)};function Dt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||x.test(t))&&t>-1&&t%1==0&&t<e}function jt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function Vt(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&&Lt(new dt(new ArrayBuffer(1)))!=v||pt&&Lt(new pt)!=h||gt&&Lt(gt.resolve())!=d||mt&&Lt(new mt)!=g||yt&&Lt(new yt)!=w)&&(Lt=function(t){var e=et.call(t),r=e==l?t.constructor:void 0,n=r?Vt(r):void 0;if(n)switch(n){case bt:return v;case vt:return h;case _t:return d;case St:return g;case At:return w}return e});var $t=Array.isArray;function Kt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!qt(t)}var Ht=ft||function(){return!1};function qt(t){var e=zt(t)?et.call(t):"";return e==u||e==c}function zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Kt(t)?function(t,e){var r=$t(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Kt(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 s in t)!e&&!tt.call(t,s)||i&&("length"==s||Dt(s,n))||r.push(s);return r}(t):function(t){if(!jt(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 xt(t,!0,!0)}},8552:(t,e,r)=>{var n=r(852)(r(5639),"DataView");t.exports=n},1989:(t,e,r)=>{var n=r(1789),i=r(401),o=r(7667),s=r(1327),a=r(1866);function u(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])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,t.exports=u},8407:(t,e,r)=>{var n=r(7040),i=r(4125),o=r(2117),s=r(7518),a=r(4705);function u(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])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,t.exports=u},7071:(t,e,r)=>{var n=r(852)(r(5639),"Map");t.exports=n},3369:(t,e,r)=>{var n=r(4785),i=r(1285),o=r(6e3),s=r(9916),a=r(5265);function u(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])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,t.exports=u},3818:(t,e,r)=>{var n=r(852)(r(5639),"Promise");t.exports=n},8525:(t,e,r)=>{var n=r(852)(r(5639),"Set");t.exports=n},6384:(t,e,r)=>{var n=r(8407),i=r(7465),o=r(3779),s=r(7599),a=r(4758),u=r(4309);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=s,c.prototype.has=a,c.prototype.set=u,t.exports=c},2705:(t,e,r)=>{var n=r(5639).Symbol;t.exports=n},1149:(t,e,r)=>{var n=r(5639).Uint8Array;t.exports=n},577:(t,e,r)=>{var n=r(852)(r(5639),"WeakMap");t.exports=n},7412:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},4963:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}},4636:(t,e,r)=>{var n=r(2545),i=r(5694),o=r(1469),s=r(4144),a=r(5776),u=r(6719),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=o(t),h=!r&&i(t),f=!r&&!h&&s(t),l=!r&&!h&&!f&&u(t),d=r||h||f||l,p=d?n(t.length,String):[],g=p.length;for(var m in t)!e&&!c.call(t,m)||d&&("length"==m||f&&("offset"==m||"parent"==m)||l&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,g))||p.push(m);return p}},2488:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}},4865:(t,e,r)=>{var n=r(9465),i=r(7813),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];o.call(t,e)&&i(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},8470:(t,e,r)=>{var n=r(7813);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4037:(t,e,r)=>{var n=r(8363),i=r(3674);t.exports=function(t,e){return t&&n(e,i(e),t)}},3886:(t,e,r)=>{var n=r(8363),i=r(1704);t.exports=function(t,e){return t&&n(e,i(e),t)}},9465:(t,e,r)=>{var n=r(8777);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},5990:(t,e,r)=>{var n=r(6384),i=r(7412),o=r(4865),s=r(4037),a=r(3886),u=r(4626),c=r(278),h=r(8805),f=r(1911),l=r(8234),d=r(6904),p=r(4160),g=r(3824),m=r(9148),y=r(8517),w=r(1469),b=r(4144),v=r(6688),_=r(3218),S=r(2928),A=r(3674),M=r(1704),E="[object Arguments]",k="[object Function]",T="[object Object]",C={};C[E]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[T]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[k]=C["[object WeakMap]"]=!1,t.exports=function t(e,r,O,P,I,x){var N,B=1&r,R=2&r,U=4&r;if(O&&(N=I?O(e,P,I,x):O(e)),void 0!==N)return N;if(!_(e))return e;var F=w(e);if(F){if(N=g(e),!B)return c(e,N)}else{var L=p(e),D=L==k||"[object GeneratorFunction]"==L;if(b(e))return u(e,B);if(L==T||L==E||D&&!I){if(N=R||D?{}:y(e),!B)return R?f(e,a(N,e)):h(e,s(N,e))}else{if(!C[L])return I?e:{};N=m(e,L,B)}}x||(x=new n);var j=x.get(e);if(j)return j;x.set(e,N),S(e)?e.forEach((function(n){N.add(t(n,r,O,n,e,x))})):v(e)&&e.forEach((function(n,i){N.set(i,t(n,r,O,i,e,x))}));var V=F?void 0:(U?R?d:l:R?M:A)(e);return i(V||e,(function(n,i){V&&(n=e[i=n]),o(N,i,t(n,r,O,i,e,x))})),N}},3118:(t,e,r)=>{var n=r(3218),i=Object.create,o=function(){function t(){}return function(e){if(!n(e))return{};if(i)return i(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=o},8866:(t,e,r)=>{var n=r(2488),i=r(1469);t.exports=function(t,e,r){var o=e(t);return i(t)?o:n(o,r(t))}},4239:(t,e,r)=>{var n=r(2705),i=r(9607),o=r(2333),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?i(t):o(t)}},9454:(t,e,r)=>{var n=r(4239),i=r(7005);t.exports=function(t){return i(t)&&"[object Arguments]"==n(t)}},5588:(t,e,r)=>{var n=r(4160),i=r(7005);t.exports=function(t){return i(t)&&"[object Map]"==n(t)}},8458:(t,e,r)=>{var n=r(3560),i=r(5346),o=r(3218),s=r(346),a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,f=c.hasOwnProperty,l=RegExp("^"+h.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(n(t)?l:a).test(s(t))}},9221:(t,e,r)=>{var n=r(4160),i=r(7005);t.exports=function(t){return i(t)&&"[object Set]"==n(t)}},8749:(t,e,r)=>{var n=r(4239),i=r(1780),o=r(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!s[n(t)]}},280:(t,e,r)=>{var n=r(5726),i=r(6916),o=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=[];for(var r in Object(t))o.call(t,r)&&"constructor"!=r&&e.push(r);return e}},313:(t,e,r)=>{var n=r(3218),i=r(5726),o=r(3498),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=i(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2545:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},1717:t=>{t.exports=function(t){return function(e){return t(e)}}},4318:(t,e,r)=>{var n=r(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},4626:(t,e,r)=>{t=r.nmd(t);var n=r(5639),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7157:(t,e,r)=>{var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3147:t=>{var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},419:(t,e,r)=>{var n=r(2705),i=n?n.prototype:void 0,o=i?i.valueOf:void 0;t.exports=function(t){return o?Object(o.call(t)):{}}},7133:(t,e,r)=>{var n=r(4318);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},278:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8363:(t,e,r)=>{var n=r(4865),i=r(9465);t.exports=function(t,e,r,o){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var c=e[a],h=o?o(r[c],t[c],c,r,t):void 0;void 0===h&&(h=t[c]),s?i(r,c,h):n(r,c,h)}return r}},8805:(t,e,r)=>{var n=r(8363),i=r(9551);t.exports=function(t,e){return n(t,i(t),e)}},1911:(t,e,r)=>{var n=r(8363),i=r(1442);t.exports=function(t,e){return n(t,i(t),e)}},4429:(t,e,r)=>{var n=r(5639)["__core-js_shared__"];t.exports=n},8777:(t,e,r)=>{var n=r(852),i=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},1957:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},8234:(t,e,r)=>{var n=r(8866),i=r(9551),o=r(3674);t.exports=function(t){return n(t,o,i)}},6904:(t,e,r)=>{var n=r(8866),i=r(1442),o=r(1704);t.exports=function(t){return n(t,o,i)}},5050:(t,e,r)=>{var n=r(7019);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},852:(t,e,r)=>{var n=r(8458),i=r(7801);t.exports=function(t,e){var r=i(t,e);return n(r)?r:void 0}},5924:(t,e,r)=>{var n=r(5569)(Object.getPrototypeOf,Object);t.exports=n},9607:(t,e,r)=>{var n=r(2705),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var i=s.call(t);return n&&(e?t[a]=r:delete t[a]),i}},9551:(t,e,r)=>{var n=r(4963),i=r(479),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return o.call(t,e)})))}:i;t.exports=a},1442:(t,e,r)=>{var n=r(2488),i=r(5924),o=r(9551),s=r(479),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,o(t)),t=i(t);return e}:s;t.exports=a},4160:(t,e,r)=>{var n=r(8552),i=r(7071),o=r(3818),s=r(8525),a=r(577),u=r(4239),c=r(346),h="[object Map]",f="[object Promise]",l="[object Set]",d="[object WeakMap]",p="[object DataView]",g=c(n),m=c(i),y=c(o),w=c(s),b=c(a),v=u;(n&&v(new n(new ArrayBuffer(1)))!=p||i&&v(new i)!=h||o&&v(o.resolve())!=f||s&&v(new s)!=l||a&&v(new a)!=d)&&(v=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?c(r):"";if(n)switch(n){case g:return p;case m:return h;case y:return f;case w:return l;case b:return d}return e}),t.exports=v},7801:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},1789:(t,e,r)=>{var n=r(4536);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},401:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:(t,e,r)=>{var n=r(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return i.call(e,t)?e[t]:void 0}},1327:(t,e,r)=>{var n=r(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:i.call(e,t)}},1866:(t,e,r)=>{var n=r(4536);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},3824:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},9148:(t,e,r)=>{var n=r(4318),i=r(7157),o=r(3147),s=r(419),a=r(7133);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return i(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 a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return o(t);case"[object Symbol]":return s(t)}}},8517:(t,e,r)=>{var n=r(3118),i=r(5924),o=r(5726);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:n(i(t))}},5776:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},7019:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:(t,e,r)=>{var n,i=r(4429),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!o&&o in t}},5726:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7040:t=>{t.exports=function(){this.__data__=[],this.size=0}},4125:(t,e,r)=>{var n=r(8470),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():i.call(e,r,1),--this.size,0))}},2117:(t,e,r)=>{var n=r(8470);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},7518:(t,e,r)=>{var n=r(8470);t.exports=function(t){return n(this.__data__,t)>-1}},4705:(t,e,r)=>{var n=r(8470);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},4785:(t,e,r)=>{var n=r(1989),i=r(8407),o=r(7071);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}},1285:(t,e,r)=>{var n=r(5050);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},6e3:(t,e,r)=>{var n=r(5050);t.exports=function(t){return n(this,t).get(t)}},9916:(t,e,r)=>{var n=r(5050);t.exports=function(t){return n(this,t).has(t)}},5265:(t,e,r)=>{var n=r(5050);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},4536:(t,e,r)=>{var n=r(852)(Object,"create");t.exports=n},6916:(t,e,r)=>{var n=r(5569)(Object.keys,Object);t.exports=n},3498:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},1167:(t,e,r)=>{t=r.nmd(t);var n=r(1957),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i&&n.process,a=function(){try{return o&&o.require&&o.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},2333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5639:(t,e,r)=>{var n=r(1957),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();t.exports=o},7465:(t,e,r)=>{var n=r(8407);t.exports=function(){this.__data__=new n,this.size=0}},3779:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},7599:t=>{t.exports=function(t){return this.__data__.get(t)}},4758:t=>{t.exports=function(t){return this.__data__.has(t)}},4309:(t,e,r)=>{var n=r(8407),i=r(7071),o=r(3369);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!i||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new o(s)}return r.set(t,e),this.size=r.size,this}},346:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},361:(t,e,r)=>{var n=r(5990);t.exports=function(t){return n(t,5)}},7813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},5694:(t,e,r)=>{var n=r(9454),i=r(7005),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return i(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},1469:t=>{var e=Array.isArray;t.exports=e},8612:(t,e,r)=>{var n=r(3560),i=r(1780);t.exports=function(t){return null!=t&&i(t.length)&&!n(t)}},4144:(t,e,r)=>{t=r.nmd(t);var n=r(5639),i=r(5062),o=e&&!e.nodeType&&e,s=o&&t&&!t.nodeType&&t,a=s&&s.exports===o?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||i;t.exports=u},3560:(t,e,r)=>{var n=r(4239),i=r(3218);t.exports=function(t){if(!i(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},1780:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},6688:(t,e,r)=>{var n=r(5588),i=r(1717),o=r(1167),s=o&&o.isMap,a=s?i(s):n;t.exports=a},3218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},2928:(t,e,r)=>{var n=r(9221),i=r(1717),o=r(1167),s=o&&o.isSet,a=s?i(s):n;t.exports=a},6719:(t,e,r)=>{var n=r(8749),i=r(1717),o=r(1167),s=o&&o.isTypedArray,a=s?i(s):n;t.exports=a},3674:(t,e,r)=>{var n=r(4636),i=r(280),o=r(8612);t.exports=function(t){return o(t)?n(t):i(t)}},1704:(t,e,r)=>{var n=r(4636),i=r(313),o=r(8612);t.exports=function(t){return o(t)?n(t,!0):i(t)}},479:t=>{t.exports=function(){return[]}},5062:t=>{t.exports=function(){return!1}},2318:(t,e,r)=>{"use strict";var n=r(5717),i=r(3349),o=r(9509).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,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=h(r,n=c(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=f(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=f(o,r,n,i,t[8],2272392833,11),i=f(i,o,r,n,t[11],1839030562,16),n=f(n,i,o,r,t[14],4259657740,23),r=f(r,n,i,o,t[1],2763975236,4),o=f(o,r,n,i,t[4],1272893353,11),i=f(i,o,r,n,t[7],4139469664,16),n=f(n,i,o,r,t[10],3200236656,23),r=f(r,n,i,o,t[13],681279174,4),o=f(o,r,n,i,t[0],3936430074,11),i=f(i,o,r,n,t[3],3572445317,16),n=f(n,i,o,r,t[6],76029189,23),r=f(r,n,i,o,t[9],3654602809,4),o=f(o,r,n,i,t[12],3873151461,11),i=f(i,o,r,n,t[15],530742520,16),r=l(r,n=f(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},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=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=a},3673:(t,e,r)=>{var n=r(8764).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,s=0;s<r;s+=2,++o){var a=i[s],u=s+1===r?a:i[s+1],c=n.concat([a,u]);i[o]=e(c)}r=o}return i[0]}},9746: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)}},4504:(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,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},3565:(t,e,r)=>{var n=r(9991);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}}}},7563:(t,e,r)=>{"use strict";const n=r(610),i=r(4020),o=r(500),s=r(2806);function a(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 h(t){return Array.isArray(t)?t.sort():"object"==typeof t?h(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function f(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function l(t){const e=(t=f(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){a((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 s=i||o?r.split(t.arrayFormatSeparator).map((e=>c(e,t))):null===r?r:c(r,t);n[e]=s};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,s]=o(e.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(e.arrayFormat)?s:c(s,e),r(c(t,e),s,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]=h(r):t[e]=r,t}),Object.create(null))}e.extract=l,e.parse=p,e.stringify=(t,e)=>{if(!t)return"";a((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=f(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),s=Object.assign(o,t.query);let a=e.stringify(s,r);a&&(a=`?${a}`);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}${a}${c}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0},n);const{url:i,query:o,fragmentIdentifier:a}=e.parseUrl(t,n);return e.stringifyUrl({url:i,query:s(o,r),fragmentIdentifier:a},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)}},1798:(t,e,r)=>{"use strict";var n=65536,i=r(9509).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 s=0;s<t;s+=n)o.getRandomValues(r.slice(s,s+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")}},4281: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,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===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-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(n(e,"type"));else{var c=("number"!=typeof u&&(u=0),u+".".length>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(n(e,"type"))}return s+". 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.q=e},6753:(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(9481),o=r(4229);r(5717)(c,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var u=s[a];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",h)))}function h(){this._writableState.ended||process.nextTick(f,this)}function f(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)}})},2725:(t,e,r)=>{"use strict";t.exports=i;var n=r(4605);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(5717)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},9481:(t,e,r)=>{"use strict";var n;t.exports=M,M.ReadableState=A,r(7187).EventEmitter;var i,o=function(t,e){return t.listeners(e).length},s=r(2503),a=r(8764).Buffer,u=r.g.Uint8Array||function(){},c=r(4616);i=c&&c.debuglog?c.debuglog("stream"):function(){};var h,f,l,d=r(7327),p=r(1195),g=r(2457).getHighWaterMark,m=r(4281).q,y=m.ERR_INVALID_ARG_TYPE,w=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,v=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(5717)(M,s);var _=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function A(t,e,i){n=n||r(6753),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&&(h||(h=r(2553).s),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function M(t){if(n=n||r(6753),!(this instanceof M))return new M(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)),s.call(this)}function E(t,e,r,n,o){i("readableAddChunk",e);var s,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?O(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}}(t,c);else if(o||(s=function(t,e){var r,n;return n=e,a.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e)),r}(c,e)),s)_(t,s);else if(c.objectMode||e&&e.length>0)if("string"==typeof e||c.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.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):I(t,c)):k(t,c,e,!1)}else n||(c.reading=!1,I(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&&O(t)),I(t,e)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),M.prototype.destroy=p.destroy,M.prototype._undestroy=p.undestroy,M.prototype._destroy=function(t,e){e(t)},M.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=a.from(t,e),e=""),r=!0),E(this,t,e,!1,r)},M.prototype.unshift=function(t){return E(this,t,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(t){h||(h=r(2553).s);var e=new h(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 T=1073741824;function C(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>=T?t=T:(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 O(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(P,t))}function P(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,U(t)}function I(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(x,t,e))}function x(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 N(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 B(t){i("readable nexttick read 0"),t.read(0)}function R(t,e){i("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),U(t),e.flowing&&!e.reading&&t.read(0)}function U(t){var e=t._readableState;for(i("flow",e.flowing);e.flowing&&null!==t.read(););}function F(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 L(t){var e=t._readableState;i("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(D,e,t))}function D(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 j(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}M.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?L(this):O(this),null;if(0===(t=C(t,e))&&e.ended)return 0===e.length&&L(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=C(r,e))),null===(n=t>0?F(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&&L(this)),null!==n&&this.emit("data",n),n},M.prototype._read=function(t){_(this,new b("_read()"))},M.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 s=e&&!1===e.end||t===process.stdout||t===process.stderr?p:a;function a(){i("onend"),t.end()}n.endEmitted?process.nextTick(s):r.once("end",s),t.on("unpipe",(function e(o,s){i("onunpipe"),o===r&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,i("cleanup"),t.removeListener("close",l),t.removeListener("finish",d),t.removeListener("drain",u),t.removeListener("error",f),t.removeListener("unpipe",e),r.removeListener("end",a),r.removeListener("end",p),r.removeListener("data",h),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,U(t))}}(r);t.on("drain",u);var c=!1;function h(e){i("ondata");var o=t.write(e);i("dest.write",o),!1===o&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==j(n.pipes,t))&&!c&&(i("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function f(e){i("onerror",e),p(),t.removeListener("error",f),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",h),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on(e,r)}(t,"error",f),t.once("close",l),t.once("finish",d),t.emit("pipe",r),n.flowing||(i("pipe resume"),r.resume()),t},M.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 s=j(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},M.prototype.on=function(t,e){var r=s.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?O(this):n.reading||process.nextTick(B,this))),r},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(N,this),r},M.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(N,this),e},M.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(R,t,e))}(this,t)),t.paused=!1,this},M.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},M.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 s=0;s<S.length;s++)t.on(S[s],this.emit.bind(this,S[s]));return this._read=function(e){i("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(5850)),f(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),M._fromList=F,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(t,e){return void 0===l&&(l=r(5167)),l(M,t,e)})},4605:(t,e,r)=>{"use strict";t.exports=h;var n=r(4281).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(6753);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 h(t){if(!(this instanceof h))return new h(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",f)}function f(){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 a;if(t._transformState.transforming)throw new s;return t.push(null)}r(5717)(h,u),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,r){r(new i("_transform()"))},h.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)}},h.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))},h.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},4229:(t,e,r)=>{"use strict";function n(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(undefined),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var i;t.exports=M,M.WritableState=A;var o,s={deprecate:r(4927)},a=r(2503),u=r(8764).Buffer,c=r.g.Uint8Array||function(){},h=r(1195),f=r(2457).getHighWaterMark,l=r(4281).q,d=l.ERR_INVALID_ARG_TYPE,p=l.ERR_METHOD_NOT_IMPLEMENTED,g=l.ERR_MULTIPLE_CALLBACK,m=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,w=l.ERR_STREAM_NULL_VALUES,b=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,_=h.errorOrDestroy;function S(){}function A(t,e,o){i=i||r(6753),t=t||{},"boolean"!=typeof o&&(o=e instanceof i),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,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(P,t,e),t._writableState.errorEmitted=!0,_(t,n)):(i(n),t._writableState.errorEmitted=!0,_(t,n),P(t,e))}(t,r,n,e,i);else{var o=C(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||T(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 M(t){var e=this instanceof(i=i||r(6753));if(!e&&!o.call(M,this))return new M(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)),a.call(this)}function E(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("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(),P(t,e)}function T(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)o[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;o.allBuffers=u,E(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,h=r.encoding,f=r.callback;if(E(t,e,!1,e.objectMode?1:c.length,c,h,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function O(t,e){t._final((function(r){e.pendingcb--,r&&_(t,r),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var r=C(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(O,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(5717)(M,a),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:s.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(M,Symbol.hasInstance,{value:function(t){return!!o.call(this,t)||this===M&&t&&t._writableState instanceof A}})):o=function(t){return t instanceof this},M.prototype.pipe=function(){_(this,new m)},M.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,s=!i.objectMode&&(n=t,u.isBuffer(n)||n instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?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):(s||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 s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r)),e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,a,n,i,o);return c}(this,i,s,t,e,r)),o},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||T(this,t))},M.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(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new p("_write()"))},M.prototype._writev=null,M.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,P(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=h.destroy,M.prototype._undestroy=h.undestroy,M.prototype._destroy=function(t,e){e(t)}},5850:(t,e,r)=>{"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(8610),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var r=t[l].read();null!==r&&(t[h]=null,t[s]=null,t[a]=null,e(d(r,!1)))}}function g(t){process.nextTick(p,t)}var m=Object.getPrototypeOf((function(){})),y=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[h];if(n)r=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(d(void 0,!0)):e[f](r,n)}),n)}}(n,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(d(i,!1));r=new Promise(this[f])}return this[h]=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),m);t.exports=function(t){var e,r=Object.create(y,(i(e={},l,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,f,{value:function(t,e){var n=r[l].read();n?(r[h]=null,r[s]=null,r[a]=null,t(d(n,!1))):(r[s]=t,r[a]=e)},writable:!0}),e));return r[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[a];return null!==e&&(r[h]=null,r[s]=null,r[a]=null,e(t)),void(r[u]=t)}var n=r[s];null!==n&&(r[h]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[c]=!0})),t.on("readable",g.bind(null,r)),r}},7327:(t,e,r)=>{"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(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)}}var s=r(8764).Buffer,a=r(2361).inspect,u=a&&a.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 s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.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=s.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:u,value:function(t,e){return a(this,function(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){i(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}({},e,{depth:0,customInspect:!1}))}}],r&&o(e.prototype,r),t}()},1195: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,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(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)}}},8610:(t,e,r)=>{"use strict";var n=r(4281).q.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 s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||h()},c=e._writableState&&e._writableState.finished,h=function(){a=!1,c=!0,s||o.call(e)},f=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,f=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!f?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},g=function(){e.req.on("finish",h)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",h),e.on("abort",p),e.req?g():e.on("request",g)):a&&!e._writableState&&(e.on("end",u),e.on("close",u)),e.on("end",l),e.on("finish",h),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",g),e.req&&e.req.removeListener("finish",h),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},5167:t=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(t,e,r)=>{"use strict";var n,i=r(4281).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=r(8610)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var u=!1;return function(e){if(!a&&!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 s("pipe"))}}function c(t){t()}function h(t,e){return t.pipe(e)}function f(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(c),o||(s.forEach(c),i(n))}))}));return e.reduce(h)}},2457:(t,e,r)=>{"use strict";var n=r(4281).q.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}}},2503:(t,e,r)=>{t.exports=r(7187).EventEmitter},8473:(t,e,r)=>{(e=t.exports=r(9481)).Stream=e,e.Readable=e,e.Writable=r(4229),e.Duplex=r(6753),e.Transform=r(4605),e.PassThrough=r(2725),e.finished=r(8610),e.pipeline=r(9946)},5666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=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 m?e:m,o=Object.create(i.prototype),s=new C(n||[]);return o._invoke=function(t,e,r){var n=f;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=E(s,r);if(a){if(a===g)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=h(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,s),o}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f="suspendedStart",l="suspendedYield",d="executing",p="completed",g={};function m(){}function y(){}function w(){}var b={};u(b,o,(function(){return this}));var v=Object.getPrototypeOf,_=v&&v(v(O([])));_&&_!==r&&n.call(_,o)&&(b=_);var S=w.prototype=m.prototype=Object.create(b);function A(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function M(t,e){function r(i,o,s,a){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,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return r("throw",t,s,a)}))}a(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=h(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function O(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,s=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 s.next=s}}return{next:P}}function P(){return{value:e,done:!0}}return y.prototype=w,u(S,"constructor",w),u(w,"constructor",y),y.displayName=u(w,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,a,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},A(M.prototype),u(M.prototype,s,(function(){return this})),t.AsyncIterator=M,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new M(c(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},A(S),u(S,a,"Generator"),u(S,o,(function(){return this})),u(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=O,C.prototype={constructor:C,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(T),!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 a.type="throw",a.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.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 s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},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),T(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;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},4574:(t,e,r)=>{"use strict";r.d(e,{Z:()=>_});const n=new Array(16),i=b([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]),o=b([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]),s=b([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]),a=b([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]),u=w([0,1518500249,1859775393,2400959708,2840853838]),c=w([1352829926,1548603684,1836072691,2053994217,0]);function h(t,e){return t<<e|t>>>32-e}function f(t,e,r,n,i,o,s,a){return h(t+(e^r^n)+o+s|0,a)+i|0}function l(t,e,r,n,i,o,s,a){return h(t+(e&r|~e&n)+o+s|0,a)+i|0}function d(t,e,r,n,i,o,s,a){return h(t+((e|~r)^n)+o+s|0,a)+i|0}function p(t,e,r,n,i,o,s,a){return h(t+(e&n|r&~n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return h(t+(e^(r|~n))+o+s|0,a)+i|0}function m(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 y(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 w(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function b(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function v(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}const _=class{constructor(){this._block=v(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=n;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 m=0|this._a,y=0|this._b,w=0|this._c,b=0|this._d,v=0|this._e,_=0|this._a,S=0|this._b,A=0|this._c,M=0|this._d,E=0|this._e;for(let e=0;e<80;e+=1){let r,n;e<16?(r=f(m,y,w,b,v,t[i[e]],u[0],s[e]),n=g(_,S,A,M,E,t[o[e]],c[0],a[e])):e<32?(r=l(m,y,w,b,v,t[i[e]],u[1],s[e]),n=p(_,S,A,M,E,t[o[e]],c[1],a[e])):e<48?(r=d(m,y,w,b,v,t[i[e]],u[2],s[e]),n=d(_,S,A,M,E,t[o[e]],c[2],a[e])):e<64?(r=p(m,y,w,b,v,t[i[e]],u[3],s[e]),n=l(_,S,A,M,E,t[o[e]],c[3],a[e])):(r=g(m,y,w,b,v,t[i[e]],u[4],s[e]),n=f(_,S,A,M,E,t[o[e]],c[4],a[e])),m=v,v=b,b=h(w,10),w=y,y=r,_=E,E=M,M=h(A,10),A=S,S=n}const k=this._b+w+M|0;this._b=this._c+b+E|0,this._c=this._d+v+_|0,this._d=this._e+m+S|0,this._e=this._a+y+A|0,this._a=k}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),m(this._block,this._length[0],56),m(this._block,this._length[1],60),this._update();const t=v(20);y(t,this._a,0),y(t,this._b,4),y(t,this._c,8),y(t,this._d,12),y(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}}},9785:(t,e,r)=>{"use strict";var n=r(8764).Buffer,i=r(5717),o=r(3349),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],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],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[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,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function m(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function w(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,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,M=0|this._e,E=0;E<80;E+=1){var k,T;E<16?(k=g(r,n,i,o,d,t[a[E]],f[0],c[E]),T=b(v,_,S,A,M,t[u[E]],l[0],h[E])):E<32?(k=m(r,n,i,o,d,t[a[E]],f[1],c[E]),T=w(v,_,S,A,M,t[u[E]],l[1],h[E])):E<48?(k=y(r,n,i,o,d,t[a[E]],f[2],c[E]),T=y(v,_,S,A,M,t[u[E]],l[2],h[E])):E<64?(k=w(r,n,i,o,d,t[a[E]],f[3],c[E]),T=m(v,_,S,A,M,t[u[E]],l[3],h[E])):(k=b(r,n,i,o,d,t[a[E]],f[4],c[E]),T=g(v,_,S,A,M,t[u[E]],l[4],h[E])),r=d,d=o,o=p(i,10),i=n,n=k,v=M,M=A,A=p(S,10),S=_,_=T}var C=this._b+i+A|0;this._b=this._c+o+M|0,this._c=this._d+d+v|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=C},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},9509:(t,e,r)=>{var n=r(8764),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.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},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},2324:(t,e,r)=>{t.exports=r(9839)},9839:(t,e,r)=>{!function(){var e={};if(e.async=r(2044),"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 s(){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 a(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"object"==typeof t&&t.constructor!==Array&&null!=t},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function c(t,e){return"function"==typeof t?e instanceof t:u[t=t in u?t:"any"](e)}function h(t,e){for(var r=[],n=t.indexOf(e);-1!==n;)r.push(n),n=t.indexOf(e,n+1);return r}var f={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:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),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?"an 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||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(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=h(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 f&&(t=f[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 s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),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){a.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 s),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]}},m={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()}},y={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 m[t]&&(e=m[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 s=o.length<e.length?o.length:e.length;n.timesSeries(s,(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){a.prototype.constructor.call(this,t,o(b.custom,e));var r=[];this._basicFields=Object.keys(y),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,y),i(b.prototype,w),i(b,new s),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 M={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,s=_.int(1,9),a=1;a<=s;a++)o in r||(e[o]=this.generate(r[n])),o=i+a}return e},array:function(t){var e,r,n,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(u.array(o))for(n=o.length,null!=t.exactLength?n=t.exactLength:n<s?n=s:n>a&&(n=a),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(s,a),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(M);return this[e[_.int(0,e.length-2)]](t)}};function E(){}i(E.prototype,M);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 T={};t.exports?t.exports=T:window.SchemaInspector=T,T.newSanitization=function(t,e){return new b(t,e)},T.newValidation=function(t,e){return new p(t,e)},T.Validation=p,T.Sanitization=b,T.sanitize=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new b(t,r).sanitize(e,n)},T.validate=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new p(t,r).validate(e,n)},T.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)}}()},4189:(t,e,r)=>{var n=r(9509).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,s=this._len,a=0;a<o;){for(var u=s%i,c=Math.min(o-a,i-u),h=0;h<c;h++)r[u+h]=t[a+h];a+=c,(s+=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},9072:(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(4448),n.sha1=r(8336),n.sha224=r(8432),n.sha256=r(7499),n.sha384=r(1686),n.sha512=r(7816)},4448:(t,e,r)=>{var n=r(5717),i=r(4189),o=r(9509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(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,a=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+h(d,i,o,a)+u+r[l]+s[d];u=a,a=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=a+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},8336:(t,e,r)=>{var n=r(5717),i=r(4189),o=r(9509).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function h(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,a=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)+f(p,i,o,a)+u+r[d]+s[p]|0;u=a,a=o,o=h(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=a+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},8432:(t,e,r)=>{var n=r(5717),i=r(7499),o=r(4189),s=r(9509).Buffer,a=new Array(64);function u(){this.init(),this._w=a,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=s.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},7499:(t,e,r)=>{var n=r(5717),i=r(4189),o=r(9509).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function f(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,a=0|this._d,u=0|this._e,p=0|this._f,g=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+d(r[y-15])+r[y-16];for(var w=0;w<64;++w){var b=m+l(u)+c(u,p,g)+s[w]+r[w]|0,v=f(n)+h(n,i,o)|0;m=g,g=p,p=u,u=a+b|0,a=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=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=g+this._g|0,this._h=m+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},1686:(t,e,r)=>{var n=r(5717),i=r(7816),o=r(4189),s=r(9509).Buffer,a=new Array(160);function u(){this.init(),this._w=a,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=s.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},7816:(t,e,r)=>{var n=r(5717),i=r(4189),o=r(9509).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function f(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 m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(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,a=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,M=0|this._el,E=0|this._fl,k=0|this._gl,T=0|this._hl,C=0;C<32;C+=2)e[C]=t.readInt32BE(4*C),e[C+1]=t.readInt32BE(4*C+4);for(;C<160;C+=2){var O=e[C-30],P=e[C-30+1],I=d(O,P),x=p(P,O),N=g(O=e[C-4],P=e[C-4+1]),B=m(P,O),R=e[C-14],U=e[C-14+1],F=e[C-32],L=e[C-32+1],D=x+U|0,j=I+R+y(D,x)|0;j=(j=j+N+y(D=D+B|0,B)|0)+F+y(D=D+L|0,L)|0,e[C]=j,e[C+1]=D}for(var V=0;V<160;V+=2){j=e[V],D=e[V+1];var W=h(r,n,i),$=h(v,_,S),K=f(r,v),H=f(v,r),q=l(a,M),z=l(M,a),G=s[V],X=s[V+1],Z=c(a,u,w),J=c(M,E,k),Y=T+z|0,Q=b+q+y(Y,T)|0;Q=(Q=(Q=Q+Z+y(Y=Y+J|0,J)|0)+G+y(Y=Y+X|0,X)|0)+j+y(Y=Y+D|0,D)|0;var tt=H+$|0,et=K+W+y(tt,H)|0;b=w,T=k,w=u,k=E,u=a,E=M,a=o+Q+y(M=A+Y|0,A)|0,o=i,A=S,i=n,S=_,n=r,_=v,r=Q+et+y(v=Y+tt|0,Y)|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+M|0,this._fl=this._fl+E|0,this._gl=this._gl+k|0,this._hl=this._hl+T|0,this._ah=this._ah+r+y(this._al,v)|0,this._bh=this._bh+n+y(this._bl,_)|0,this._ch=this._ch+i+y(this._cl,S)|0,this._dh=this._dh+o+y(this._dl,A)|0,this._eh=this._eh+a+y(this._el,M)|0,this._fh=this._fh+u+y(this._fl,E)|0,this._gh=this._gh+w+y(this._gl,k)|0,this._hh=this._hh+b+y(this._hl,T)|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},3717:(t,e,r)=>{"use strict";var n=r(8764).Buffer;const i=r(4624);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 s=this._writeOffset,a=this._encoding;"number"==typeof r?s=r:"string"==typeof r&&(i.checkEncoding(r),a=r),"string"==typeof o&&(i.checkEncoding(o),a=o);const u=n.byteLength(t,a);return e?this.ensureInsertable(u,s):this._ensureWriteable(u,s),this._buff.write(t,s,u,a),e?this._writeOffset+=u:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,s+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.$=o},4624:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8764),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 s(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){s(t,!1)},e.checkOffsetValue=function(t){s(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}.`)}},500: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)]}},610:t=>{"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},2553:(t,e,r)=>{"use strict";var n=r(9509).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=a,e=4;break;case"base64":this.text=h,this.end=f,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function 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 h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(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.s=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=s(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(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}},5892:(t,e,r)=>{var n=r(8764).Buffer;const i=r(4220),o=new(0,r(6266).ec)("secp256k1"),s=r(4142),a=n.alloc(32,0),u=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),c=n.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),h=o.curve.n,f=h.shrn(1),l=o.curve.g,d="Expected Private",p="Expected Point",g="Expected Tweak",m="Expected Hash";function y(t){return n.isBuffer(t)&&32===t.length}function w(t){return!!y(t)&&t.compare(u)<0}function b(t){if(!n.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],r=t.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(c)>=0)return!1;if((2===e||3===e)&&33===t.length){try{E(t)}catch(t){return!1}return!0}const i=t.slice(33);return 0!==i.compare(a)&&!(i.compare(c)>=0)&&4===e&&65===t.length}function v(t){return 4!==t[0]}function _(t){return!!y(t)&&t.compare(a)>0&&t.compare(u)<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 M(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 T(t,e,r){if(!y(t))throw new TypeError(m);if(!_(e))throw new TypeError(d);if(void 0!==r&&!y(r))throw new TypeError("Expected Extra Data (32 bytes)");const i=A(e),o=A(t);let a,u;s(t,e,(function(t){const e=A(t),r=l.mul(e);return!r.isInfinity()&&(a=r.x.umod(h),0!==a.isZero()&&(u=e.invm(h).mul(o.add(i.mul(a))).umod(h),0!==u.isZero()))}),_,r),u.cmp(f)>0&&(u=h.sub(u));const c=n.allocUnsafe(64);return M(a).copy(c,0),M(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===e.compare(a))return k(i,n);const o=A(e),s=l.mul(o),u=i.add(s);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),s=i.mul(o);return s.isInfinity()?null:k(s,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=M(r.add(n).umod(h));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=M(r.sub(n).umod(h));return _(i)?i:null},sign:function(t,e){return T(t,e)},signWithEntropy:function(t,e,r){return T(t,e,r)},verify:function(t,e,r,i){if(!y(t))throw new TypeError(m);if(!b(e))throw new TypeError(p);if(!function(t){const e=t.slice(0,32),r=t.slice(32,64);return n.isBuffer(t)&&64===t.length&&e.compare(u)<0&&r.compare(u)<0}(r))throw new TypeError("Expected Signature");const o=E(e),s=A(r.slice(0,32)),a=A(r.slice(32,64));if(i&&a.cmp(f)>0)return!1;if(s.gtn(0)<=0)return!1;if(a.gtn(0)<=0)return!1;const c=A(t),d=a.invm(h),g=c.mul(d).umod(h),w=s.mul(d).umod(h),v=l.mulAdd(g,o,w);return!v.isInfinity()&&v.x.umod(h).eq(s)}}},4220: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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3370).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)f*=e;this.imuln(f),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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,f=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;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[c]=0|f,u=0|h}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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}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=f[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:h[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!==s),this.toArrayLike(s,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 s,a,u="le"===e,c=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),c[o-a-1]=s}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 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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(0==(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(0==(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(0==(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,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),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,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],f=8191&h,l=h>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,_=b>>>13,S=0|s[4],A=8191&S,M=S>>>13,E=0|s[5],k=8191&E,T=E>>>13,C=0|s[6],O=8191&C,P=C>>>13,I=0|s[7],x=8191&I,N=I>>>13,B=0|s[8],R=8191&B,U=B>>>13,F=0|s[9],L=8191&F,D=F>>>13,j=0|a[0],V=8191&j,W=j>>>13,$=0|a[1],K=8191&$,H=$>>>13,q=0|a[2],z=8191&q,G=q>>>13,X=0|a[3],Z=8191&X,J=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,W))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,W))+Math.imul(g,V)|0,o=Math.imul(g,W);var yt=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,W))+Math.imul(w,V)|0,o=Math.imul(w,W),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,H)|0;var wt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,z)|0))<<13)|0;c=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,W))+Math.imul(_,V)|0,o=Math.imul(_,W),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,z)|0,o=o+Math.imul(g,G)|0;var bt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,V),i=(i=Math.imul(A,W))+Math.imul(M,V)|0,o=Math.imul(M,W),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var vt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,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,V),i=(i=Math.imul(k,W))+Math.imul(T,V)|0,o=Math.imul(T,W),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,J)|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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(O,V),i=(i=Math.imul(O,W))+Math.imul(P,V)|0,o=Math.imul(P,W),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,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(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,W))+Math.imul(N,V)|0,o=Math.imul(N,W),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|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(y,rt)|0,i=(i=i+Math.imul(y,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,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var At=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(R,V),i=(i=Math.imul(R,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,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(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|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 Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,W))+Math.imul(D,V)|0,o=Math.imul(D,W),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,lt)|0;var Et=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,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(L,K),i=(i=Math.imul(L,H))+Math.imul(D,K)|0,o=Math.imul(D,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(U,z)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|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(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(w,ft)|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(L,z),i=(i=Math.imul(L,G))+Math.imul(D,z)|0,o=Math.imul(D,G),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var Tt=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,J))+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Ct=(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)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,lt)|0;var Ot=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,lt)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,lt)|0;var Pt=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,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(L,ot),i=(i=Math.imul(L,st))+Math.imul(D,ot)|0,o=Math.imul(D,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var It=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,lt)|0;var xt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul(D,ft)|0,o=Math.imul(D,lt);var Nt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(c+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,gt))+Math.imul(D,pt)|0))<<13)|0;return c=((o=Math.imul(D,gt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=_t,u[6]=St,u[7]=At,u[8]=Mt,u[9]=Et,u[10]=kt,u[11]=Tt,u[12]=Ct,u[13]=Ot,u[14]=Pt,u[15]=It,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(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 s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,f=(0|t.words[h])*(0|e.words[c]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.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},m.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},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var f=u,l=c,d=0;d<s;d++){var p=r[h+d],g=n[h+d],m=r[h+d+s],y=n[h+d+s],w=f*m-l*y;y=f*y+l*m,m=w,r[h+d]=p+m,n[h+d]=g+y,r[h+d+s]=p-m,n[h+d+s]=g-y,d!==a&&(w=u*f-c*l,l=u*l+c*f,f=w)}},m.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},m.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}},m.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},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,h,f,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,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 s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,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,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&a}return u&&0!==h&&(u.words[u.length++]=h),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,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):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,s,a},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),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,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,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).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 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(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,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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 y={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 M(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 s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}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(y[t])return y[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 y[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(0==(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),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new o(1).iushln(p-m-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}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],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var f=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=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 M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},4142:(t,e,r)=>{var n=r(8764).Buffer;const i=r(8355),o=n.alloc(1,1),s=n.alloc(1,0);t.exports=function(t,e,r,a,u){let c=n.alloc(32,0),h=n.alloc(32,1);c=i("sha256",c).update(h).update(s).update(e).update(t).update(u||"").digest(),h=i("sha256",c).update(h).digest(),c=i("sha256",c).update(h).update(o).update(e).update(t).update(u||"").digest(),h=i("sha256",c).update(h).digest(),h=i("sha256",c).update(h).digest();let f=h;for(;!a(f)||!r(f);)c=i("sha256",c).update(h).update(s).digest(),h=i("sha256",c).update(h).digest(),h=i("sha256",c).update(h).digest(),f=h;return f}},3465: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.StackswapMainnetAPI=void 0;const i=r(663),o=n(r(9669)),s=r(9299),a=r(8360),u=r(9185),c=r(5620),h=r(8019),f=r(2759),l=r(9776),d=r(8901),p=r(2916),g=r(8217),m=r(6555),y=r(1582),w=r(1361),b=r(8408),v=r(5735),_=r(7138);e.StackswapMainnetAPI=class{constructor(t=""){this.config=new s.StackswapMainetConfig,this.connected=!1,this.getCurrentBlock=async()=>(await o.default.get(this.config.STACKS_API_URL()+"/extended/v1/stx_supply")).data.block_height,this.network=new i.StacksMainnet({url:this.config.STACKS_API_URL()}),""!==t?(this.connected=!0,this.senderAdderss=t):(this.connected=!1,this.senderAdderss=this.config.STACKSWAP_ADDRESS(),this.getConnectedWallet(((t,e)=>{}))),this.nftManager=new u.NftManager(this),this.tokenManager=new a.TokenManager(this),this.farm2Manager=new h.Farm2Manager(this),this.farmManager=new c.FarmManager(this),this.governanceManager=new f.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 m.OtherManager(this),this.poolManager=new y.PoolManager(this),this.poxlManager=new w.PoxlManager(this),this.stakingManager=new b.StakingManager(this),this.swapManager=new v.SwapManager(this)}getSenderAddress(){return this.senderAdderss}async getCurrentBlocks(){const t=await o.default.get(this.config.STACKS_API_URL()+"/extended/v1/block?limit=1");return{block_height:t.data.results[0].height,burn_block_height:t.data.results[0].burn_block_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)({appDetails:{name:"Stackswap",icon:"https://app.stackswap.org/favicon.ico"},redirectTo:"/",onFinish:()=>{const e=r.loadUserData().profile.stxAddress;this.senderAdderss=e.mainnet,this.connected=!0,t(null,e.mainnet)}})}catch(e){t(e,null)}}getConnectedWallet(t){try{const e=new _.AppConfig(["store_write","publish_data"]),r=new _.UserSession({appConfig:e}).loadUserData().profile.stxAddress;this.senderAdderss=r.mainnet,this.connected=!0,t(null,r.mainnet)}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)}}}},9299:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StackswapMainetConfig=void 0,e.StackswapMainetConfig=class{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(){return"stackswap-farming-v2a"}CONTRACT_NAME_STACKSWAP_GOVERNANCE(){return"stackswap-governance-v5k"}CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(){return"stackswap-one-step-mint-v5k"}CONTRACT_NAME_STACKSWAP_ROUTER_SWAP(){return"stackswap-swap-router-v1b"}CONTRACT_NAME_STACKSWAP_STACKING(){return"stackswap-staking-v1l"}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"9999"}STACKSWAP_ADDRESS(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275"}STACKS_API_URL(){return"https://stacks-node-api.mainnet.stacks.co"}STACKS_BACKEND_PARAM(){return"49"}STACKS_BACKEND_PARAM_LEGACY(){return"43"}STACKS_BACKEND_URL(){return"https://app.stackswap.org"}isMainnet(){return!0}MODE(){return"mainnet"}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"}')}STX_STSW_LP(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-stx-stsw"}STSW_LBTC_LP(){return"SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-v5krqbd8nh6"}}},5620: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(5014),o=n(r(4431)),s=r(7138),a=r(9458);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,a.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,a.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,a.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),s=(0,i.cvToValue)(o);try{const t=s.value.amountUstx.value,r=[],n=[];for(const t of s.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,a.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,s=r.addr;let a=new o.default(-1);return i===this.stackswap.config.BASE_WSTX_DATA().addr?a=new o.default(t["balance-x"].value).multipliedBy(n).dividedBy(t["shares-total"].value).dividedBy(new o.default(10**e.decimal)).multipliedBy(2):s===this.stackswap.config.BASE_WSTX_DATA().addr&&(a=new o.default(t["balance-y"].value).multipliedBy(n).dividedBy(t["shares-total"].value).dividedBy(new o.default(10**r.decimal)).multipliedBy(2)),a}async getFarmingTotalStatusCycle(t){const e=(0,a.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,a.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,a.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,a.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,a.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,a.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(),h=(0,a.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,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,c,i.FungibleConditionCode.Equal)],n);await(0,s.openContractCall)(h)}async claimFarmingContract(t,e,r,n,o=null){const u=t.split("."),c=[];c.push(await(0,a.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,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,n,i.FungibleConditionCode.Equal));const h=(0,a.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,s.openContractCall)(h)}async unstakeFarmingContract(t,e,r,n=null){const o=t.split("."),u=[];u.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,r,i.FungibleConditionCode.Equal));const c=(0,a.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,s.openContractCall)(c)}async getCurrentFarmingRound(){const t=await this.stackswap.getCurrentBlock();return await this.getFarmingRound(t)}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,a.numFormat_)((0,a.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();{o.default.config({DECIMAL_PLACES:10});const r=new o.default(t);return new o.default(671731.2).multipliedBy(new o.default(e)).div(r).multipliedBy(5200).toFixed(3).toString()}}}},8019: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=void 0;const i=r(5014),o=n(r(4431)),s=r(7138),a=r(9458);e.Farm2Manager=class{constructor(t){this.stackswap=t}async getFarmingRound(t){try{const e=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getRewardRound",[(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,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getFirstBlockOfRound",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e);return(0,i.cvToValue)(r)}async isUserMigratable(t){const e=t.split("."),r=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"isUserMigratable",[(0,i.contractPrincipalCV)(e[0],e[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t)}catch(t){return!0}}getPoolUSDPriceFarm(t,e,r,n,i){let s=0;switch(t.BASE){case"STX":s=t.token_x.symbol===t.BASE?new o.default(t.pair["balance-x"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r)).toNumber():new o.default(t.pair["balance-y"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(r)).toNumber();break;case"STSW":s=t.token_x.symbol===t.BASE?new o.default(t.pair["balance-x"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(n)).toNumber():new o.default(t.pair["balance-y"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**12)).multipliedBy(2).multipliedBy(new o.default(n)).toNumber();break;case"lBTC":s=t.token_x.symbol===t.BASE?new o.default(t.pair["balance-x"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(i)).toNumber():new o.default(t.pair["balance-y"].value).multipliedBy(e).dividedBy(t.pair["shares-total"].value).dividedBy(new o.default(10**14)).multipliedBy(2).multipliedBy(new o.default(i)).toNumber();break;default:s=0}return s}async getFarming(t,e,r,n){const i=e.addr,s=r.addr;let a=new o.default(-1);return i===this.stackswap.config.BASE_WSTX_DATA().addr?a=new o.default(t["balance-x"].value).multipliedBy(n).dividedBy(t["shares-total"].value).dividedBy(new o.default(10**e.decimal)).multipliedBy(2):s===this.stackswap.config.BASE_WSTX_DATA().addr&&(a=new o.default(t["balance-y"].value).multipliedBy(n).dividedBy(t["shares-total"].value).dividedBy(new o.default(10**r.decimal)).multipliedBy(2)),a}async getFarmingStakerStatus(t,e){const r=t.split("."),n=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getLPUserData",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),o=await(0,i.callReadOnlyFunction)(n),s=(0,i.cvToValue)(o);try{const t=s.value.amountLP.value,r=[],n=[];for(const t of s.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 getFarmingTotalStatusCycle(t){const e=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getTotalRoundDataOrDefault",[(0,i.uintCV)(t)]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r);try{return{reward:n.reward.value,value:n.value.value}}catch(t){return{reward:0,value:0}}}async getFarmingTotalPoolStatus(t){const e=t.split("."),r=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getLPTotalData",[(0,i.contractPrincipalCV)(e[0],e[1])]),n=await(0,i.callReadOnlyFunction)(r),o=(0,i.cvToValue)(n);try{return{amountLP:o.value.amountLP.value,weight:o.value.weight.value}}catch(t){return{amountLP:"0",weight:"1"}}}async getFarmingTotalPoolStatusCycle(t,e){const r=t.split("."),n=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getLPRoundData",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.uintCV)(e)]),s=await(0,i.callReadOnlyFunction)(n),u=(0,i.cvToValue)(s);try{return new o.default(u.value.amountUstx.value).multipliedBy(2).toFixed(0).toString()}catch(t){return"0"}}async getFarmingTotalValue(t){try{const e=t.split("."),r=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getLPTotalData",[(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,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getFarmingReward",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o)}async getFarmingUserRewardList(t,e){const r=t.split("."),n=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getFarmingRewardFromList",[(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,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"getLPUserRoundData",[(0,i.contractPrincipalCV)(r[0],r[1]),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.uintCV)(e)]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o).value.returnLP.value}async migrateToVersion2(t,e=null){const r=t.split("."),n=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"migrateFromVersion1",[(0,i.contractPrincipalCV)(r[0],r[1])],[],e);await(0,s.openContractCall)(n)}async stakeFarmingContract(t,e,r,n=null){const u=t.split("."),c=new o.default(e).multipliedBy(10**6).toFixed(0).toString(),h=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"stakeTokens",[(0,i.uintCV)(c),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.uintCV)(r),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t,c,i.FungibleConditionCode.Equal)],n);await(0,s.openContractCall)(h)}async getFarmBalance(t){const e=(0,a.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 claimFarmingContract(t,e,r,n,o=null){const u=t.split("."),c=[];c.push(await(0,a.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,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,n,i.FungibleConditionCode.Equal));const h=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),"claimStakingReward",[(0,i.uintCV)(e),(0,i.contractPrincipalCV)(u[0],u[1]),(0,i.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],c,o);await(0,s.openContractCall)(h)}async unstakeFarmingContract(t,e,r,n=null){const o=t.split("."),u=[];u.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_FARMING(),t,r,i.FungibleConditionCode.Equal));const c=(0,a.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,s.openContractCall)(c)}async getCurrentFarmingRound(){const t=Number(await this.stackswap.getCurrentBlock());return await this.getFarmingRound(t)}async getRewardBalanceFromFarming(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.getFarmingUserRewardList(t,r.slice(e,e+4<r.length?e+4:r.length));n=n.plus(new o.default(i.rewardSum.value))}return(0,a.numFormat_)((0,a.num2decimal)(n.toString(),6))}catch(t){return(0,a.numFormat_)((0,a.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**6).multipliedBy(52).multipliedBy(e).toFixed(3).toString();{o.default.config({DECIMAL_PLACES:10});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()}}}},2759: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(5014),o=r(7138),s=n(r(4431)),a=r(9458);e.GovernanceManager=class{constructor(t){this.stackswap=t}async getProposalsList(){const t=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"get-proposals",[]),e=await(0,i.callReadOnlyFunction)(t),r=(0,i.cvToValue)(e);let n=[];return r.value.forEach((t=>{n.push(t.value)})),n}async getNumVoting(t){const e=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"get-votes-by-member-by-id",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,i.callReadOnlyFunction)(e),n=(0,i.cvToValue)(r);return[n["vote-count"].value,n.returned.value]}async txWithdrawVoting(t,e=null){const r=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"return-votes-to-member",[(0,i.uintCV)(t),(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())],e);await(0,o.openContractCall)(r)}async txVote(t,e,r,n=null){const u=new s.default(10**6).multipliedBy(parseFloat(r)).toFixed(0).toString(),c=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_vSTSW_DATA().addr,u,i.FungibleConditionCode.Equal)];let h=null;"For"===e?h=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"vote-for",[(0,i.uintCV)(t),(0,i.uintCV)(u)],c,n):"Against"===e&&(h=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"vote-against",[(0,i.uintCV)(t),(0,i.uintCV)(u)],c,n)),null!=h&&await(0,o.openContractCall)(h)}}},9776:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LaunchpadManager=void 0;const n=r(9458),i=r(5014),o=r(7138);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 mintSIPContractCall(t,e,r,s=null){const a=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 h=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-sip10-token-with-stx",[(0,i.contractPrincipalCV)(a[0],a[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)(a[0],a[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,s);(0,o.openContractCall)(h)}async mintPOXLContractCall(t,e,r,s=null){const a=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 h=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-poxl-token-with-stx",[(0,i.contractPrincipalCV)(a[0],a[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)(a[0],a[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,s);(0,o.openContractCall)(h)}async mintSIPSTSWContractCall(t,e,r,s=null){const a=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 h=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-sip10-token-with-stsw",[(0,i.contractPrincipalCV)(a[0],a[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)(a[0],a[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,s);(0,o.openContractCall)(h)}async mintPOXLSTSWContractCall(t,e,r,s=null){const a=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 h=(0,n.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-poxl-token-with-stsw",[(0,i.contractPrincipalCV)(a[0],a[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)(a[0],a[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,s);(0,o.openContractCall)(h)}}},8901: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(9458),o=n(r(4431)),s=r(5014),a=r(7138);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,s.callReadOnlyFunction)(t);return(0,s.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,s.stringAsciiCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r)}async getVaultIDFromUser(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vaults",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,s.callReadOnlyFunction)(t);return(0,s.cvToValue)(e)}async getVaultInfoFromID(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vault-by-id",[(0,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r)}async getVaultIDFromUser2(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_VAULT_DATA(),"get-vault-entries",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,s.callReadOnlyFunction)(t);return(0,s.cvToValue)(e)}async txCreateVaultWithSTX(t,e,r,n,o=null){let u=s.trueCV;u=n?s.trueCV:s.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(),s.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(),s.FungibleConditionCode.LessEqual));const h=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"collateralize-and-mint",[(0,s.uintCV)(t.multipliedBy(10**6).toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),u(),(0,s.stringAsciiCV)(r),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_STX_RESERVE()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],c,o);(0,a.openContractCall)(h)}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(),s.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(),s.FungibleConditionCode.LessEqual));const u=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"collateralize-and-mint",[(0,s.uintCV)(t.multipliedBy(10**6).toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),(0,s.falseCV)(),(0,s.stringAsciiCV)(r),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE()),(0,s.contractPrincipalCV)(this.stackswap.config.BASE_STSW_DATA().addr.split(".")[0],this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],o,n);(0,a.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(),s.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(),s.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"deposit",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**6).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,a.openContractCall)(c)}async txToggleStacking(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"toggle-stacking",[(0,s.uintCV)(t.toString())],[],e);(0,a.openContractCall)(r)}async txStackCollateral(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"stack-collateral",[(0,s.uintCV)(t.toString())],[],e);(0,a.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,s.uintCV)(t.toString())],[],r);(0,a.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(),s.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(),s.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"withdraw",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**6).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,a.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(),s.FungibleConditionCode.LessEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"mint",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,a.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(),s.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,a.openContractCall)(c)}async txCloseVault(t,e,r,n,u=null){let c=this.stackswap.config.CONTRACT_NAME_SIP10_RESERVE();const h=[];"STX"===e?(c=this.stackswap.config.CONTRACT_NAME_STX_RESERVE(),h.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,s.FungibleConditionCode.Equal))):h.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,s.FungibleConditionCode.Equal)),h.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),s.FungibleConditionCode.LessEqual));const f=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"close-vault",[(0,s.uintCV)(t.toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),c),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],h,u);(0,a.openContractCall)(f)}async txFinalLiquidation(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"finalize-liquidation",[(0,s.uintCV)(t.toString())],[],e);(0,a.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(),s.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(),s.FungibleConditionCode.Equal));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"deposit-to-unliquidate",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**6).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,a.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(),s.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn-to-unliquidate",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())],u,n);(0,a.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,s.FungibleConditionCode.GreaterEqual)):"STSW"===r&&u.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,0,s.FungibleConditionCode.GreaterEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"withdraw-liquidated",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**6).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,a.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(),s.FungibleConditionCode.LessEqual));const c=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"burn-liquidated",[(0,s.uintCV)(t.toString()),(0,s.uintCV)(e.multipliedBy(10**8).toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),o),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],u,n);(0,a.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,s.uintCV)(t.toString()),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),n),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.BASE_STSW_DATA().addr.split(".")[1]),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())],[],r);(0,a.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,s.stringAsciiCV)(r),(0,s.uintCV)(e.multipliedBy(10**8).toFixed(0)),(0,s.uintCV)(t.multipliedBy(10**6).toFixed(0)),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_ORACLE())]),a=await(0,s.callReadOnlyFunction)(o);return(0,s.cvToValue)(a)}async getPrice(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_ORACLE(),"get-price",[(0,s.stringAsciiCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r)}async getStabilityFee(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_MORTGAGER(),"get-stability-fee-for-vault",[(0,s.uintCV)(t),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),this.stackswap.config.CONTRACT_NAME_COLLATERAL_TYPES())]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r)}}},2916:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MultisigManager=void 0;const n=r(7138),i=r(5014),o=r(9458);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)],s=(0,o.getWriteOptions)(this.stackswap,"SPVRC3RHFD58B2PY1HZD2V71THPW7G445WBRCQYW.octopus_v01","withdraw",[(0,o.parseAddressToCV)(t),(0,i.uintCV)(e)],r);await(0,n.openContractCall)(s)}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 console.log("get-balance",(0,i.cvToValue)(e)),(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 console.log(t,(0,i.cvToValue)(r)),(0,i.cvToValue)(r)}}},9185: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(9458),o=r(7138),s=r(5014),a=n(r(4431)),u=n(r(9669));e.NftManager=class{constructor(t){this.stackswap=t}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,s.makeStandardNonFungiblePostCondition)(t,r,i,(0,s.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,s.FungibleConditionCode.Equal));const a=(0,i.getWriteOptions)(this.stackswap,e,"mint",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress()),r],n,r);await(0,o.openContractCall)(a)}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,s.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,s.FungibleConditionCode.GreaterEqual)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,s.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,s.FungibleConditionCode.GreaterEqual)),r.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,s.FungibleConditionCode.GreaterEqual));const n=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"mint",[(0,s.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,s.listCV)(t)],[],r);await(0,o.openContractCall)(n)}async listInUstx(t,e,r=this.stackswap.config.CONTRACT_NAME_COMMISSION(),n=null){const a=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"list-in-ustx",[(0,s.uintCV)(t),(0,s.uintCV)(e),this.stackswap.getQualifiedAddress(r)],[],n);await(0,o.openContractCall)(a)}async unlistInUstx(t,e=null){const r=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"unlist-in-ustx",[(0,s.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 a.default(e).multipliedBy(1.075).toFixed(),s.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,s.FungibleConditionCode.GreaterEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,s.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,s.FungibleConditionCode.GreaterEqual)),c.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,s.FungibleConditionCode.GreaterEqual)),c.push(await this.getPostConditionFromAssetNFT(r,this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),s.NonFungibleConditionCode.DoesNotOwn,""+t));const h=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"buy-in-ustx",[(0,s.uintCV)(t),(0,s.contractPrincipalCV)(this.stackswap.config.STACKSWAP_ADDRESS(),n)],c,u);await(0,o.openContractCall)(h)}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,s.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,s.FungibleConditionCode.GreaterEqual)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STX_STSW_LP(),this.stackswap.config.BASE_STSW_DATA().addr,0,s.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,s.FungibleConditionCode.GreaterEqual)),n.push(await(0,i.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STSW_LBTC_LP(),this.stackswap.config.BASE_LBTC_DATA().addr,0,s.FungibleConditionCode.GreaterEqual)),n.push(await this.getPostConditionFromAssetNFT(this.stackswap.getSenderAddress(),this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),s.NonFungibleConditionCode.DoesNotOwn,""+t));const a=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"re-touch",[(0,s.uintCV)(t)],n,r);await(0,o.openContractCall)(a)}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,s.FungibleConditionCode.Equal)),n.push(await this.getPostConditionFromAssetNFT(this.stackswap.getSenderAddress(),this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_AINFT(),s.NonFungibleConditionCode.DoesNotOwn,""+t));const a=(0,i.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"regress-token",[(0,s.uintCV)(t)],n,r);await(0,o.openContractCall)(a)}async getNFTData(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-nft-data",[(0,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r).value}async getOwner(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-owner",[(0,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e),n=(0,s.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,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,s.callReadOnlyFunction)(e),n=(0,s.cvToValue)(r);try{return n}catch(t){return""}}async getPassBalance(t){const e=(0,i.getReadOptions)(this.stackswap,t,"get-balance",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,s.callReadOnlyFunction)(e);try{return(0,s.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,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r).value}async getTokenURI(t){const e=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-token-uri",[(0,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r).value}async getTotalList(){const t=(0,i.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_AINFT(),"get-total-list",[]),e=await(0,s.callReadOnlyFunction)(t);try{return(0,s.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,s.callReadOnlyFunction)(t);try{return(0,s.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,s.uintCV)(t)]),r=await(0,s.callReadOnlyFunction)(e),n=(0,s.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/ipfs/QmQtSMAPvKFEr11VfKio2NHqwayJk4CTUkfmkxgXTR7Q2w":"https://gateway.ipfs/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/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}}},8217: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(4431)),o=r(7138),s=r(9458),a=r(5014);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("."),h=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"collect-fees",[(0,a.contractPrincipalCV)(i[0],i[1]),(0,a.contractPrincipalCV)(u[0],u[1]),(0,a.contractPrincipalCV)(c[0],c[1])],[],n);(0,o.openContractCall)(h)}async add_liquidity_dist(t,e,r,n=null){const i=(0,s.getWriteOptions)(this.stackswap,t,"add-liquidity",[(0,a.uintCV)(e),(0,a.uintCV)(r)],[],n);(0,o.openContractCall)(i)}async invest_to_farm_dist(t,e=null){const r=(0,s.getWriteOptions)(this.stackswap,t,"invest-to-farm",[(0,a.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,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_WSTX_DATA().addr,r,a.FungibleConditionCode.Equal)],u=(0,s.getWriteOptions)(this.stackswap,"distributor0001","invest",[(0,a.uintCV)(r)],n,e);return await(0,o.openContractCall)(u)}async farmClaimDistributor(t,e=null){const r=(0,s.getWriteOptions)(this.stackswap,"distributor0001","claim-from-farm",[(0,a.uintCV)(t)],[],e);return await(0,o.openContractCall)(r)}async STSWAwdDistributor(t,e=null){const r=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.BASE_STSW_DATA().addr,t,a.FungibleConditionCode.Equal)],n=(0,s.getWriteOptions)(this.stackswap,"distributor0001","awd-stsw",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,a.uintCV)(t)],r,e);return await(0,o.openContractCall)(n)}async STSWStaking(t,e="1",r=null){const n=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,t,a.FungibleConditionCode.Equal)],i=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"stake-tokens",[(0,a.uintCV)(t),(0,a.uintCV)(e)],n,r);return await(0,o.openContractCall)(i)}async distributorGetInvestor(){const t=(0,s.getReadOptions)(this.stackswap,"distributor0001","get-invester",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,a.callReadOnlyFunction)(t);return(0,a.cvToValue)(e).value}async distributorGetReclaim(){const t=(0,s.getReadOptions)(this.stackswap,"distributor0001","get-claimable-amount",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress())]),e=await(0,a.callReadOnlyFunction)(t);return(0,a.cvToValue)(e)}async distributorReclaimLP(t,e=null){const r=new i.default(t).multipliedBy(10**6).toFixed(0).toString(),n=[await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.STX_STSW_LP(),r,a.FungibleConditionCode.Equal)],u=(0,s.getWriteOptions)(this.stackswap,"distributor0001","reclaim-lp-tokens",[(0,a.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,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.config.STACKSWAP_ADDRESS()+".distributor0001",this.stackswap.config.BASE_STSW_DATA().addr,r,a.FungibleConditionCode.Equal)],u=(0,s.getWriteOptions)(this.stackswap,"distributor0001","claim-stsw-tokens",[(0,a.uintCV)(r)],n,e);return await(0,o.openContractCall)(u)}async propose(t,e,r,n,i=null){const u=(0,s.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_GOVERNANCE(),"propose",[(0,a.uintCV)(t),(0,a.stringUtf8CV)(e),(0,a.stringUtf8CV)(r),(0,a.listCV)(n)],[],i);await(0,o.openContractCall)(u)}}},6555:function(t,e,r){"use strict";var n=r(8764).Buffer,i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.OtherManager=void 0;const o=r(7138),s=r(5014),a=r(9458),u=i(r(4431));e.OtherManager=class{constructor(t){this.stackswap=t}async getUserBeta01Data(t){try{const e=(0,a.getReadOptions)(this.stackswap,t,"get-user-rewards",[(0,s.standardPrincipalCV)(this.stackswap.getSenderAddress())]),r=await(0,s.callReadOnlyFunction)(e);return(0,s.cvToValue)(r).value}catch(t){return 0}}async claimUserBeta01Reward(t,e,r=null){try{const n=[await(0,a.getPostConditionFromAsset)(this.stackswap,t,this.stackswap.config.BASE_STSW_DATA().addr,e,s.FungibleConditionCode.Equal)],i=(0,a.getWriteOptions)(this.stackswap,t,"claim-reward",[],n,r);return await(0,o.openContractCall)(i)}catch(t){return 0}}async get_pox_info(){const t=(0,a.getReadOptions)(this.stackswap,"SP000000000000000000002Q6VF78.pox","get-pox-info",[]),e=await(0,s.callReadOnlyFunction)(t);return(0,s.cvToValue)(e).value}async stack_stx_to_pox(t,e,r,i,c=null){const h=(0,s.tupleCV)({hashbytes:(0,s.bufferCV)(e),version:(0,s.bufferCV)(new n(1))}),f=new u.default(t).multipliedBy(10**6).toFixed(0).toString(),l=(0,a.getWriteOptions)(this.stackswap,"SP000000000000000000002Q6VF78.pox","stack-stx",[(0,s.uintCV)(f),h,(0,s.uintCV)(r),(0,s.uintCV)(i)],[],c);return await(0,o.openContractCall)(l)}}},1582: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(5014),o=n(r(4431)),s=n(r(9669)),a=r(9458),u=r(8360);class c{constructor(t,e,r,n,i="0",o="0",s="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=s}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,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.liquidity_token_addr,t.pair_name),(0,a.decimal2integer)(t.balance_token_x,t.token_x.decimal),(0,a.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,a.getPriceAndDY)(this,e,!1):(0,a.getPriceAndDY)(this,e,!0)}getPoolTVL(t,e,r,n,i){const s=e.token_x.addr,a=e.token_y.addr;let u=new o.default(-1),c=-1;return s===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()):a===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()):s===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()):a===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()):s===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()):a===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),s=r.dividedBy(i).multipliedBy(100).toNumber();return isNaN(s)?0:s}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 s.default.get(t,{timeout:3e4});return c.parsePoolsFromJsonList(e.data)}async getPairDataFromContract(t,e){const r=(0,a.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"get-pair-details",[(0,a.parseAddressToCV)(t.addr),(0,a.parseAddressToCV)(e.addr)]);try{const n=await(0,i.callReadOnlyFunction)(r),o=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(source,(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,a.getReadOptions)(this.stackswap,r,"get-pair-details",[(0,a.parseAddressToCV)(t.addr),(0,a.parseAddressToCV)(e.addr)]);try{const r=await(0,i.callReadOnlyFunction)(n),o=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(source,(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}}}},1361: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(9669)),o=r(7138),s=r(9458),a=r(5014),u=r(8360);e.PoxlManager=class{constructor(t){this.stackswap=t}async minePOXLToken(t,e,r=null){const n=[];n.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),u.Token.getBaseTokens(this.stackswap,u.BaseToken.STX).addr,(0,s.decimal2integer)(e,6),a.FungibleConditionCode.Equal));const i=(0,s.getWriteOptions)(this.stackswap,t.addr,"mine-tokens",[(0,a.uintCV)((0,s.decimal2integer)(e,6)),(0,a.noneCV)()],n,r);await(0,o.openContractCall)(i)}async stackPOXLToken(t,e,r,n=null){const i=[];i.push(await(0,s.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.addr,(0,s.decimal2integer)(e,t.decimal),a.FungibleConditionCode.Equal));const u=(0,s.getWriteOptions)(this.stackswap,t.addr,"stack-tokens",[(0,a.uintCV)(e),(0,a.uintCV)(r)],i,n);await(0,o.openContractCall)(u)}async claimMiningReward(t,e,r=null){const n=(0,s.getWriteOptions)(this.stackswap,t.addr,"claim-token-reward",[(0,a.uintCV)(e)],[],r);await(0,o.openContractCall)(n)}async claimStackingReward(t,e,r=null){const n=(0,s.getWriteOptions)(this.stackswap,t.addr,"claim-stacking-reward",[(0,a.uintCV)(e)],[],r,!0);await(0,o.openContractCall)(n)}async getRandomInt(t,e){await(0,a.callReadOnlyFunction)((0,s.getReadOptions)(this.stackswap,t,"get-random-uint-at-block",[(0,a.uintCV)(e)]))}async getMinedBlock(t,e){const r=await i.default.get(this.stackswap.config.STACKS_API_URL()+"/extended/v1/address/"+this.stackswap.getSenderAddress()+"/transactions",{params:{limit:40,offset:e}}),n=r.data.total,o=r.data.results,s=[];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)&&s.push(e.block_height)}catch(t){}return{total:n,mined_block:s}}async canClaimCall(t,e){const r=(0,s.getReadOptions)(this.stackswap,t,"can-claim-mining-reward",[(0,a.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,a.uintCV)(e)]),n=await(0,a.callReadOnlyFunction)(r);return(0,a.cvToValue)(n)}}},8408: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(5014),o=n(r(9669)),s=r(7138),a=n(r(4431)),u=r(9458);e.StakingManager=class{constructor(t){this.stackswap=t}async getStackingRoundFirstBlock(t){const e=(0,u.getReadOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING(),"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_STACKING(),r=Number(await this.getCurrentStakingRound(e)),n=(0,u.getReadOptions)(t,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING(),"get-staker",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress())]),o=await(0,i.callReadOnlyFunction)(n),s=[];for(const t of(0,i.cvToValue)(o).value)t.value<r&&s.push(t.value);return s}catch(t){return[]}}async getStakingRound(t,e){try{const r=(0,u.getReadOptions)(this.stackswap,t,"get-reward-cycle",[(0,i.uintCV)(e)]),n=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(n).value}catch(t){return 0}}async getCurrentStakingRound(t){const e=await this.stackswap.getCurrentBlock();return await this.getStakingRound(t,e)}async getRewardRoundID(t){const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING(),r=(await o.default.get(this.stackswap.config.STACKS_API_URL()+"/extended/v1/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,s=this.range_number(i,o);n.push(...s)}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_STACKING();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_STACKING(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal),o=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING(),"claim-staking-reward",[(0,i.uintCV)(t)],n,r);await(0,s.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 a.default(r.value.stakedSTX.value).dividedBy(new a.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),s=(0,i.cvToValue)(o);s.value.returned.value||(t[n]=s,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 a.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_STACKING(),"stake-tokens",[(0,i.uintCV)(n),(0,i.uintCV)(e)],o,r);await(0,s.openContractCall)(c)}async txCooldownFromVSTSW(t,e=null){const r=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING(),"unstake-tokens",[(0,i.uintCV)(t)],[],e);await(0,s.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 a=(0,u.getWriteOptions)(this.stackswap,this.stackswap.config.BASE_vSTSW_DATA().addr,"reclaim-tokens",[(0,i.uintCV)(t)],o,n);await(0,s.openContractCall)(a)}async getRewardBalanceFromStaking(){const t=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING();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_STACKING();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 getRewardTotal(t){const e=this.stackswap.config.STACKSWAP_ADDRESS()+"."+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STACKING();if(0===t.length)return 0;const r=[];for(const e of t)r.push((0,i.uintCV)(e));const n=(0,u.getReadOptions)(this.stackswap,e,"get-staking-reward-from-list",[(0,i.standardPrincipalCV)(this.stackswap.getSenderAddress()),(0,i.listCV)(r)]),o=await(0,i.callReadOnlyFunction)(n);return(0,i.cvToValue)(o).rewardSum.value}}},5735: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(4431)),o=r(5014),s=r(7138),a=r(9458),u=r(1582),c=r(8360),h=n(r(9669));var f;!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"}(f=e.SwapType||(e.SwapType={})),e.SwapManager=class{constructor(t){this.stackswap=t}async findRouter(t,e,r){const n=this.stackswap.config.STACKS_BACKEND_URL()+"/api/v1/swap/"+t.addr+"/"+e.addr+"/"+r,i=(await h.default.get(n,{timeout:5e4})).data;return 0===Object.keys(i).length?{valid:f.NO_ROUTE}:"SWAP"===i.type?{valid:f.SINGLE,x_to_y:i.direction,pair:u.LiquidityPool.parsePoolsFromServerData(i.pair,t,e,i.direction)}:"RouterSWAP"===i.type?"STX"===i.bridge_token?{valid:f.ROUTER_STX,router_from_pair:u.LiquidityPool.parsePoolsFromServerData(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData(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:f.ROUTER_STSW,router_from_pair:u.LiquidityPool.parsePoolsFromServerData(i.from_pair,t,c.Token.getBaseTokens(this.stackswap,c.BaseToken.STSW),i.from_direction),router_to_pair:u.LiquidityPool.parsePoolsFromServerData(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:f.NO_ROUTE}:{valid:f.NO_ROUTE}}async routerSwapContractCall(t,e,r,n,u,c,h,f,l=null){const d=c?n.token_x:n.token_y,p=c?n.token_y:n.token_x,g=h?u.token_y:u.token_x,m=new i.default(10**d.decimal).multipliedBy(t).integerValue(),y=new i.default(10**p.decimal).multipliedBy(r).integerValue(),w=new i.default(10**g.decimal).multipliedBy(e).integerValue(),b=y.multipliedBy(100-f).dividedBy(100).integerValue(),v=w.multipliedBy(100-f).dividedBy(100).multipliedBy(100-f).dividedBy(100).integerValue(),_=d.addr,S=p.addr,A=g.addr,M=n.token_lp.addr,E=u.token_lp.addr,k=c?(0,o.trueCV)():(0,o.falseCV)(),T=h?(0,o.trueCV)():(0,o.falseCV)(),C=[];C.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),d.addr,m.toString(),o.FungibleConditionCode.Equal)),C.push(await(0,a.getPostConditionFromAsset)(this.stackswap,M,p.addr,b.toString(),o.FungibleConditionCode.GreaterEqual)),C.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),p.addr,b.toString(),o.FungibleConditionCode.GreaterEqual)),C.push(await(0,a.getPostConditionFromAsset)(this.stackswap,E,g.addr,v.toString(),o.FungibleConditionCode.GreaterEqual));const O=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ROUTER_SWAP(),"router-swap",[(0,a.parseAddressToCV)(_),(0,a.parseAddressToCV)(S),(0,a.parseAddressToCV)(A),(0,a.parseAddressToCV)(M),(0,a.parseAddressToCV)(E),k,T,(0,o.uintCV)(m.toString()),(0,o.uintCV)(b.toString()),(0,o.uintCV)(v.toString())],C,l);(0,s.openContractCall)(O)}async swapContractCall(t,e,r,n,u,c=null){const h=n?r.token_x:r.token_y,f=n?r.token_y:r.token_x,l=new i.default(10**h.decimal).multipliedBy(t),d=new i.default(10**f.decimal).multipliedBy(e).multipliedBy(100-u).dividedBy(100),p=l.toFixed(0).toString(),g=d.toFixed(0).toString(),m=n?"swap-x-for-y":"swap-y-for-x",y=n?h.addr:f.addr,w=n?f.addr:h.addr,b=[];b.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),h.addr,p,o.FungibleConditionCode.Equal)),b.push(await(0,a.getPostConditionFromAsset)(this.stackswap,r.token_lp.addr,f.addr,g,o.FungibleConditionCode.GreaterEqual));const v=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),m,[(0,a.parseAddressToCV)(y),(0,a.parseAddressToCV)(w),(0,a.parseAddressToCV)(r.token_lp.addr),(0,o.uintCV)(p),(0,o.uintCV)(g)],b,c);(0,s.openContractCall)(v)}async importContractCall(t,e,r,n,u=null){const c=e?t.token_x:t.token_y,h=e?t.token_y:t.token_x,f=new i.default(10**c.decimal).multipliedBy(r),l=new i.default(10**h.decimal).multipliedBy(n),d=e?f:l,p=e?l:f,g=f.multipliedBy(1.2).toFixed(0).toString(),m=l.multipliedBy(1.2).toFixed(0).toString(),y=e?c.addr:h.addr,w=e?h.addr:c.addr,b=[];b.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),c.addr,g,o.FungibleConditionCode.LessEqual)),b.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),h.addr,m,o.FungibleConditionCode.LessEqual));const v=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),"add-to-position",[(0,a.parseAddressToCV)(y),(0,a.parseAddressToCV)(w),(0,a.parseAddressToCV)(t.token_lp.addr),(0,o.uintCV)(d.toFixed(0).toString()),(0,o.uintCV)(p.toFixed(0).toString())],b,u);(0,s.openContractCall)(v)}async removeContractCall(t,e,r,n,u,c=this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP(),h=null){const f=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,a.getPostConditionFromAsset)(this.stackswap,t.token_lp.addr,t.token_x.addr,n,o.FungibleConditionCode.GreaterEqual)),p.push(await(0,a.getPostConditionFromAsset)(this.stackswap,t.token_lp.addr,t.token_y.addr,u,o.FungibleConditionCode.GreaterEqual)),p.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.token_lp.addr,g,o.FungibleConditionCode.LessEqual));const m=(0,a.getWriteOptions)(this.stackswap,c,"reduce-position",[(0,a.parseAddressToCV)(f),(0,a.parseAddressToCV)(l),(0,a.parseAddressToCV)(d),(0,o.uintCV)(e)],p,h);(0,s.openContractCall)(m)}async createContractCall(t,e,r,n,i,u=null){const c=t.addr,h=e.addr,f=i,l=[],d=(0,a.decimal2integer)(r,t.decimal),p=(0,a.decimal2integer)(n,e.decimal);l.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),t.addr,d,o.FungibleConditionCode.Equal)),l.push(await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),e.addr,p,o.FungibleConditionCode.Equal));const g=(0,a.getWriteOptions)(this.stackswap,this.stackswap.config.CONTRACT_NAME_STACKSWAP_ONE_STEP_MINT(),"create-pair-new-liquidity-token",[(0,a.parseAddressToCV)(c),(0,a.parseAddressToCV)(h),(0,a.parseAddressToCV)(f),(0,o.stringAsciiCV)(t.symbol+"-"+e.symbol),(0,o.uintCV)(d),(0,o.uintCV)(p),(0,a.parseAddressToCV)(f),(0,a.parseAddressToCV)(this.stackswap.getQualifiedAddress(this.stackswap.config.CONTRACT_NAME_STACKSWAP_SWAP()))],l,u);(0,s.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,s=e.balance_y,a=new i.default(r).multipliedBy(10**o);if(a.toNumber()>new i.default(n).toNumber())return 100;const u=new i.default(s).multipliedBy(a),c=new i.default(n).plus(a),h=u.toNumber()/c.toNumber(),f=new i.default(10**10).multipliedBy(new i.default(n)).dividedBy(new i.default(s));let l=new i.default(10**10).multipliedBy(new i.default(n)).plus(a).dividedBy(new i.default(s).minus(h)).minus(f).multipliedBy(1e4).dividedBy(f).toNumber();return l>=1e4&&(l=9999),(l/100).toFixed(5)}catch(t){return 0}}price_impact_router(t,e,r,n,o){try{const s=t?r.balance_x:r.balance_y,a=t?r.token_x.decimal:r.token_y.decimal,u=e?n.balance_y:n.balance_x,c=new i.default(o).multipliedBy(10**a);if(c.toNumber()>new i.default(s).toNumber())return 100;const h=new i.default(u).multipliedBy(c),f=new i.default(s).plus(c),l=h.toNumber()/f.toNumber(),d=new i.default(10**10).multipliedBy(new i.default(s)).dividedBy(new i.default(u));let p=new i.default(10**10).multipliedBy(new i.default(s)).plus(c).dividedBy(new i.default(u).minus(l)).minus(d).multipliedBy(1e4).dividedBy(d).toNumber();return p>=1e4&&(p=9999),(p/100).toFixed(5)}catch(t){return 0}}getPriceString(t,e,r,n,i){try{return null!=t&&n<0?"dx exceed pool balance":null!=e&&null!=r?i?` 1 ${r.symbol} = ${(0,a.numFormat_)(1/n,e.decimal)} ${e.symbol}`:` 1 ${e.symbol} = ${(0,a.numFormat_)(n,r.decimal)} ${r.symbol}`:""}catch(t){return""}}getPricesWithSwapData(t,e,r){let n=-1;switch(t.valid){case f.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 s=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:s}}catch(t){return{price:n,dy:"0",price_strings:""}}case f.ROUTER_STX:const o=c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),s=t.router_from_pair.getPoolPrice(!t.router_from_mode,Number(e)<=0||""==e?"1":e);let a=-1;"0"!==s.output_price&&(a=1/parseFloat(s.output_price));const u=new i.default(new i.default(s.dy).toFixed(Number(o.decimal))).toString(),h=t.router_to_pair.getPoolPrice(!t.router_to_mode,Number(u)<=0?"-1":u);let l=-1;return"0"!==h.output_price&&(l=1/parseFloat(h.output_price)),n=a*l,{price:n,dy:new i.default(h.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),n,r),bridge_amount:u};case f.ROUTER_STSW:const d=c.Token.getBaseTokens(this.stackswap,c.BaseToken.STX),p=t.router_from_pair.getPoolPrice(!t.router_from_mode,Number(e)<=0||""==e?"1":e);let g=-1;"0"!==p.output_price&&(g=1/parseFloat(p.output_price));const m=new i.default(new i.default(p.dy).toFixed(Number(d.decimal))).toString(),y=t.router_to_pair.getPoolPrice(!t.router_to_mode,Number(m)<=0?"-1":m);let w=-1;return"0"!==y.output_price&&(w=1/parseFloat(y.output_price)),n=g*w,{price:n,dy:new i.default(y.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),n,r),bridge_amount:m};default:return{price:n,dy:"0",price_strings:""}}}}},8360: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(5014),o=n(r(9669)),s=r(7138),a=r(9458);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"}(c=e.BaseToken||(e.BaseToken={}));class h{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 h(t.name,t.decimal,t.icon,t.addr,t.symbol)}static parseTokenFromJsonList(t){const e=[];for(const r of t)e.push(h.parseTokenFromJson(r));return e}static getBaseTokens(t,e){switch(e){case c.STX:return h.parseTokenFromJson(t.config.BASE_WSTX_DATA());case c.STSW:return h.parseTokenFromJson(t.config.BASE_STSW_DATA());case c.vSTSW:return h.parseTokenFromJson(t.config.BASE_vSTSW_DATA());case c.lBTC:return h.parseTokenFromJson(t.config.BASE_LBTC_DATA())}}}e.Token=h,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 h.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 h.parseTokenFromJsonList(n.data)}}async transferSTSW(t,e,r=null){const n=[await(0,a.getPostConditionFromAsset)(this.stackswap,this.stackswap.getSenderAddress(),this.stackswap.config.BASE_STSW_DATA().addr,e,i.FungibleConditionCode.Equal)],o=(0,a.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,s.openContractCall)(o)}async getTokenData(t){try{const e=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(this.stackswap,t,"get-name",[]));let r=(0,i.cvToValue)(e).value;const n=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(this.stackswap,t,"get-symbol",[])),s=(0,i.cvToValue)(n).value,u=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(this.stackswap,t,"get-decimals",[])),c=(0,i.cvToValue)(u).value,f=await(0,i.callReadOnlyFunction)((0,a.getReadOptions)(this.stackswap,t,"get-token-uri",[])),l=(0,i.cvToValue)(f).value.value;let d="https://app.stackswap.org/icon/blank.svg";try{const t=await o.default.get(l);try{await o.default.get(t.data.image),d=t.data.image}catch(t){}try{await o.default.get(t.data.vector),d=t.data.vector}catch(t){}}catch(t){}return"wSTX"===r&&(r="STX"),new h(r,c,d,t,s)}catch(t){return null}}async getBalanceOf(t,e){const r=(0,a.getReadOptions)(this.stackswap,t.addr,"get-balance",[(0,a.parseAddressToCV)(e)]);try{const t=await(0,i.callReadOnlyFunction)(r);return(0,i.cvToValue)(t).value}catch(t){return"0"}}}},9458: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.getDecimalStringfromString=e.getDecimalStringfromString2=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(4431)),o=r(5014),s=n(r(9669));function a(t){return"string"==typeof t?t.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g,","):"number"==typeof t||i.default.isBigNumber(t)?t.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g,","):"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=[],s=null,a=!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:a?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{s(null,t)}catch(t){s(t,null)}},onCancel:()=>{try{s("canceled",null)}catch(t){s(t,null)}}}}return{contractAddress:t.config.STACKSWAP_ADDRESS(),contractName:e,functionName:r,functionArgs:n,network:t.network,senderAddress:t.getSenderAddress(),postConditionMode:a?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{s(null,t)}catch(t){s(t,null)}},onCancel:()=>{try{s("canceled",null)}catch(t){s(t,null)}}}},e.getPostConditionFromAsset=async function(t,e,r,n,i){const a=await async function(t,e){const r=e.split("."),n=t.config.STACKS_API_URL()+"/v2/contracts/interface/"+r[0]+"/"+r[1],i=await s.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"===a?(0,o.createSTXPostCondition)(e,i,n):(0,o.createFungiblePostCondition)(e,i,n,a)},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=a,e.numFormat_=function(t,e=6){const r=new i.default(t);return r.isInteger()?a(r):a(r.toFixed(e,1))},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,s=r?t.token_x.decimal:t.token_y.decimal,a=r?t.token_y.decimal:t.token_x.decimal;let u=new i.default(10).exponentiatedBy(s).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)),h=(new i.default(10).exponentiatedBy(a).dividedBy(new i.default(10).exponentiatedBy(s)).toNumber()*(u.toNumber()/c.toNumber())).toString(),f=c.dividedBy(new i.default(10).exponentiatedBy(a)).toString();return"-1"==e?{dy:"0",output_price:h}:{dy:f,output_price:h}}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()}},e.getDecimalStringfromString2=function(t,e){const r=new i.default(t),n=new i.default(10**e);return i.default.config({DECIMAL_PLACES:3}),r.dividedBy(n).toFixed(0).toString()},e.getDecimalStringfromString=function(t,e){const r=t.length;if(r>e){const n=t.substr(0,r-e)+"."+t.substr(r-e,r).replace(/.0+$/,"");return"0."===n?"0":"."===n.charAt(n.length-1)?n.substr(0,n.length-1):n}{const n="0".repeat(e-r+1)+t,i=n.substr(0,n.length-e)+"."+n.substr(n.length-e,n.length).replace(/0+$/,"");return"0."===i?"0":"."===i.charAt(i.length-1)?i.substr(0,i.length-1):i}}},6647:(t,e,r)=>{var n=r(247);function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function o(t){return n.Nil(t)?"":i(t.constructor)}function s(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function a(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 "+a(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function c(t,e,r){r=r||o(e),this.message=u(t,e,r),s(this,c),this.__type=t,this.__value=e,this.__valueTypeName=r}function h(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 "'+a(r)+o+a(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',s(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,h.prototype=Object.create(Error.prototype),h.prototype.constructor=c,t.exports={TfTypeError:c,TfPropertyTypeError:h,tfCustomError:function(t,e){return new c(t,{},e)},tfSubError:function(t,e,r){return t instanceof h?(e=e+"."+t.__property,t=new h(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof c&&(t=new h(t.__type,e,r,t.__value,t.__valueTypeName)),s(t),t},tfJSON:a,getValueTypeName:o}},4307:(t,e,r)=>{var n=r(8764).Buffer,i=r(247),o=r(6647);function s(t){return n.isBuffer(t)}function a(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),h=u.bind(null,s),f=u.bind(null,a),l=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:c,Buffer:s,BufferN:h,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:a,HexN:f,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},2401:(t,e,r)=>{var n=r(6647),i=r(247),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,c=n.getValueTypeName,h={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=f(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=f(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 s=r[o];l(t,s,n)}catch(t){throw u(t,o)}}return!0}return t=f(t),e&&(e=f(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]=f(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 a(void 0,n);return!0}return n.toJSON=function(){return o(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(f);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(f);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(f);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 f(t){if(i.String(t))return"?"===t[0]?h.maybe(t.slice(1)):i[t]||h.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 h.arrayOf(t[0])}return h.object(t)}return i.Function(t)?t:h.value(t)}function l(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new s(n||t,e)}return l(f(t),e,r)}for(var d in h.oneOf=h.anyOf,i)l[d]=i[d];for(d in h)l[d]=h[d];var p=r(4307);for(d in p)l[d]=p[d];l.compile=f,l.TfTypeError=s,l.TfPropertyTypeError=a,t.exports=l},247: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},4927:(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)}}},7795:(t,e,r)=>{"use strict";var n=r(9509).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,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),t.bytes=1):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),t.bytes=5):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+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 s=e.readUInt32LE(r+1),a=4294967296*e.readUInt32LE(r+5)+s;return i(a),a},encodingLength:o}},7174:(t,e,r)=>{var n=r(8764).Buffer,i=r(8334);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 s(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(s(t,e,r)):i.encode(s(t.version,t.privateKey,t.compressed))},encodeRaw:s}},3624:(t,e,r)=>{"use strict";Object.defineProperty(e,"ar",{enumerable:!0,get:function(){return n.makeZoneFile}}),Object.defineProperty(e,"FW",{enumerable:!0,get:function(){return i.parseZoneFile}});var n=r(2439),i=r(353);r(7018)},2439:(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)),e.replace(/\n{2,}/gim,"\n\n")};var n=r(2960)},353:(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 s(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 a(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 s={name:e[0],txt:o};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}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 h(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 f(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(s(t))):/\s+MX\s+/.test(d)?(e.mx=e.mx||[],e.mx.push(a(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(h(t))):/\s+SPF\s+/.test(d)?(e.spf=e.spf||[],e.spf.push(f(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)))}},7018:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZoneFile=void 0;var n=r(2439),i=r(353);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())}}},2960:(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"}},9100:()=>{},874:()=>{},8859:()=>{},4243:()=>{},9214:()=>{},2263:()=>{},4729:()=>{},5568:()=>{},8971:()=>{},2361:()=>{},4616:()=>{},3370:()=>{},8593:t=>{"use strict";t.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},9991: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}')},8597:t=>{"use strict";t.exports={i8:"6.5.4"}}},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.m=r,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},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.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,r)=>(i.f[r](t,e),e)),[])),i.u=t=>t+".index.umd.js",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),t={},e="StackswapFrontAPI:",i.l=(r,n,o,s)=>{if(t[r])t[r].push(n);else{var a,u;if(void 0!==o)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var f=c[h];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==e+o){a=f;break}}a||(u=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",e+o),a.src=r),t[r]=[n];var l=(e,n)=>{a.onerror=a.onload=null,clearTimeout(d);var i=t[r];if(delete t[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(n))),e)return e(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=l.bind(null,a.onerror),a.onload=l.bind(null,a.onload),u&&document.head.appendChild(a)}},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),(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");r.length&&(t=r[r.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{var t={179:0};i.f.j=(e,r)=>{var n=i.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,i)=>n=t[e]=[r,i]));r.push(n[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,(r=>{if(i.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,n[1](a)}}),"chunk-"+e,e)}};var e=(e,r)=>{var n,o,[s,a,u]=r,c=0;if(s.some((e=>0!==t[e]))){for(n in a)i.o(a,n)&&(i.m[n]=a[n]);u&&u(i)}for(e&&e(r);c<s.length;c++)o=s[c],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},r=self.webpackChunkStackswapFrontAPI=self.webpackChunkStackswapFrontAPI||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})(),i(3465)})()}));
|