diff --git a/app/static/js/main.js b/app/static/js/main.js index b34244e..7ec8ec1 100644 --- a/app/static/js/main.js +++ b/app/static/js/main.js @@ -1,2 +1,2 @@ /*! For license information please see main.js.LICENSE.txt */ -(()=>{var e={3877:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(8677).Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function l(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),l=t;l=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=l(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,l=0,c=n;c1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],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],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?d[6-l.length]+l+n:l+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=p[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);n=(h=h.idivn(c)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return v(e,t,n)}function b(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):n<63?m(this,e,t):n<1024?v(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},b.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,l=r.length-i.length;if("mod"!==t){(a=new o(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),l=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var c=n.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(l)):(n.isub(t),a.isub(i),l.isub(s))}return{a,b:l,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),l=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>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(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function A(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.call(this,e),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)}A.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},A.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},A.prototype.split=function(e,t){e.iushrn(this.n,0,t)},A.prototype.imulK=function(e){return e.imul(this.k)},i(_,A),_.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},_.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new E;else if("p192"===e)t=new M;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new k}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}l=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new x(e)},i(x,S),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},3286:(e,t,n)=>{"use strict";n.d(t,{lE:()=>u,zo:()=>c,xs:()=>y,E1:()=>g,p3:()=>v,Ou:()=>w,$P:()=>b,$m:()=>A,Dv:()=>m,_t:()=>l,Zq:()=>s,A7:()=>f,gV:()=>E,N:()=>_,G1:()=>h,Bu:()=>d});const r=new(n(711).Yd)("bytes/5.7.0");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){return f(e)&&!(e.length%2)||l(e)}function a(e){return"number"==typeof e&&e==e&&e%1==0}function l(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!a(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function u(e,t){if(t||(t={}),"number"==typeof e){r.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),o(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),f(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":r.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;eu(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),o(r)}function h(e){let t=u(e);if(0===t.length)return t;let n=0;for(;nt&&r.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),o(n)}function f(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const p="0123456789abcdef";function m(e,t){if(t||(t={}),"number"==typeof e){r.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=p[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(f(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":r.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(l(e)){let t="0x";for(let n=0;n>4]+p[15&r]}return t}return r.throwArgumentError("invalid hexlify value","value",e)}function g(e){if("string"!=typeof e)e=m(e);else if(!f(e)||e.length%2)return null;return(e.length-2)/2}function v(e,t,n){return"string"!=typeof e?e=m(e):(!f(e)||e.length%2)&&r.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function y(e){let t="0x";return e.forEach((e=>{t+=m(e).substring(2)})),t}function b(e){const t=w(m(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!=typeof e&&(e=m(e)),f(e)||r.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&r.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function _(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(s(e)){let n=u(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=m(n.slice(0,32)),t.s=m(n.slice(32,64))):65===n.length?(t.r=m(n.slice(0,32)),t.s=m(n.slice(32,64)),t.v=n[64]):r.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:r.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=m(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=d(u(t._vs),32);t._vs=m(n);const i=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&r.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const o=m(n);null==t.s?t.s=o:t.s!==o&&r.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?r.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&r.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&f(t.r)?t.r=A(t.r,32):r.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&f(t.s)?t.s=A(t.s,32):r.throwArgumentError("signature missing or invalid s","signature",e);const n=u(t.s);n[0]>=128&&r.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const i=m(n);t._vs&&(f(t._vs)||r.throwArgumentError("signature invalid _vs","signature",e),t._vs=A(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&r.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function E(e){return m(c([(e=_(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},711:(e,t,n)=>{"use strict";n.d(t,{jK:()=>c,Yd:()=>d});let r=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const l=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var u,c;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(u||(u={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(c||(c={}));const h="0123456789abcdef";class d{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==o[n]&&this.throwArgumentError("invalid log level name","logLevel",e),s>o[n]||console.log.apply(console,t)}debug(...e){this._log(d.levels.DEBUG,e)}info(...e){this._log(d.levels.INFO,e)}warn(...e){this._log(d.levels.WARNING,e)}makeError(e,t,n){if(i)return this.makeError("censored error",t,{});t||(t=d.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e>4],n+=h[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const o=e;let s="";switch(t){case c.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case c.CALL_EXCEPTION:case c.INSUFFICIENT_FUNDS:case c.MISSING_NEW:case c.NONCE_EXPIRED:case c.REPLACEMENT_UNDERPRICED:case c.TRANSACTION_REPLACED:case c.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,d.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),l&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:l})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",et&&this.throwError("too many arguments"+n,d.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new d("logger/5.7.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),r){if(!e)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,r=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?s=t:d.globalLogger().warn("invalid log level - "+e)}static from(e){return new d(e)}}d.errors=c,d.levels=u},2500:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(2808).Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function l(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),l=t;l=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=l(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,l=0,c=n;c1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],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],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?d[6-l.length]+l+n:l+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=p[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);n=(h=h.idivn(c)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(e,t,n){return v(e,t,n)}function b(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):n<63?m(this,e,t):n<1024?v(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},b.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,l=r.length-i.length;if("mod"!==t){(a=new o(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),l=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var c=n.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(l)):(n.isub(t),a.isub(i),l.isub(s))}return{a,b:l,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),l=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>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(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function A(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.call(this,e),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)}A.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},A.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},A.prototype.split=function(e,t){e.iushrn(this.n,0,t)},A.prototype.imulK=function(e){return e.imul(this.k)},i(_,A),_.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},_.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new E;else if("p192"===e)t=new M;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new k}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}l=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new x(e)},i(x,S),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},4242:(e,t,n)=>{"use strict";n.d(t,{Uj:()=>o,te:()=>l,Uw:()=>s,U$:()=>d,uu:()=>f,Y0:()=>c,XL:()=>m,ZN:()=>p});var r=n(3286);const i=new(n(711).Yd)("strings/5.7.0");var o,s;function a(e,t,n,r,i){if(e===s.BAD_PREFIX||e===s.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r>6==2;r++)e++;return e}return e===s.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(o||(o={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(s||(s={}));const l=Object.freeze({error:function(e,t,n,r,o){return i.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:a,replace:function(e,t,n,r,i){return e===s.OVERLONG?(r.push(i),0):(r.push(65533),a(e,t,n))}});function u(e,t){null==t&&(t=l.error),e=(0,r.lE)(e);const n=[];let i=0;for(;i>7==0){n.push(r);continue}let o=null,a=null;if(192==(224&r))o=1,a=127;else if(224==(240&r))o=2,a=2047;else{if(240!=(248&r)){i+=t(128==(192&r)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,e,n);continue}o=3,a=65535}if(i-1+o>=e.length){i+=t(s.OVERRUN,i-1,e,n);continue}let l=r&(1<<8-o-1)-1;for(let r=0;r1114111?i+=t(s.OUT_OF_RANGE,i-1-o,e,n,l):l>=55296&&l<=57343?i+=t(s.UTF16_SURROGATE,i-1-o,e,n,l):l<=a?i+=t(s.OVERLONG,i-1-o,e,n,l):n.push(l))}return n}function c(e,t=o.current){t!=o.current&&(i.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return(0,r.lE)(n)}function h(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function d(e,t){return'"'+u(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?h(e):h(55296+((e-=65536)>>10&1023))+h(56320+(1023&e))})).join("")+'"'}function f(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function p(e,t){return f(u(e,t))}function m(e,t=o.current){return u(c(e,t))}},4145:function(e,t,n){!function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}var r=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},i=void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o=[],s=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,l=!1;function u(){l=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)o[t]=e[t],s[e.charCodeAt(t)]=t;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63}function c(e,t,n){for(var r,i,s=[],a=t;a>18&63]+o[i>>12&63]+o[i>>6&63]+o[63&i]);return s.join("")}function h(e){var t;l||u();for(var n=e.length,r=n%3,i="",s=[],a=16383,h=0,d=n-r;hd?d:h+a));return 1===r?(t=e[n-1],i+=o[t>>2],i+=o[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=o[t>>10],i+=o[t>>4&63],i+=o[t<<2&63],i+="="),s.push(i),s.join("")}function d(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+h],h+=d,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)}function f(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*m}var p={}.toString,m=Array.isArray||function(e){return"[object Array]"==p.call(e)};b.TYPED_ARRAY_SUPPORT=void 0===i.TYPED_ARRAY_SUPPORT||i.TYPED_ARRAY_SUPPORT;var g=v();function v(){return b.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function y(e,t){if(v()=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return 0|e}function k(e){return!(null==e||!e._isBuffer)}function S(e,t){if(k(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return X(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ee(e).length;default:if(r)return X(e).length;t=(""+t).toLowerCase(),r=!0}}function x(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return z(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return U(this,t,n);case"latin1":case"binary":return q(this,t,n);case"base64":return D(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function C(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function T(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=b.from(t,r)),k(t))return 0===t.length?-1:O(e,t,n,r,i);if("number"==typeof t)return t&=255,b.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):O(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function O(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=n;oa&&(n=a-l),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function D(e,t,n){return 0===t&&n===e.length?h(e):h(e.slice(t,n))}function j(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},b.prototype.compare=function(e,t,n,r,i){if(!k(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return R(this,e,t,n);case"utf8":case"utf-8":return P(this,e,t,n);case"ascii":return N(this,e,t,n);case"latin1":case"binary":return L(this,e,t,n);case"base64":return I(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function U(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function V(e,t,n,r,i,o){if(!k(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function W(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function $(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function Y(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function G(e,t,n,r,i){return i||Y(e,0,n,4),f(e,t,n,r,23,4),n+4}function Z(e,t,n,r,i){return i||Y(e,0,n,8),f(e,t,n,r,52,8),n+8}b.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},b.prototype.readUInt8=function(e,t){return t||K(e,1,this.length),this[e]},b.prototype.readUInt16LE=function(e,t){return t||K(e,2,this.length),this[e]|this[e+1]<<8},b.prototype.readUInt16BE=function(e,t){return t||K(e,2,this.length),this[e]<<8|this[e+1]},b.prototype.readUInt32LE=function(e,t){return t||K(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},b.prototype.readUInt32BE=function(e,t){return t||K(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},b.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||K(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},b.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||K(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},b.prototype.readInt8=function(e,t){return t||K(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},b.prototype.readInt16LE=function(e,t){t||K(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},b.prototype.readInt16BE=function(e,t){t||K(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},b.prototype.readInt32LE=function(e,t){return t||K(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},b.prototype.readInt32BE=function(e,t){return t||K(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},b.prototype.readFloatLE=function(e,t){return t||K(e,4,this.length),d(this,e,!0,23,4)},b.prototype.readFloatBE=function(e,t){return t||K(e,4,this.length),d(this,e,!1,23,4)},b.prototype.readDoubleLE=function(e,t){return t||K(e,8,this.length),d(this,e,!0,52,8)},b.prototype.readDoubleBE=function(e,t){return t||K(e,8,this.length),d(this,e,!1,52,8)},b.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||V(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},b.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,1,255,0),b.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},b.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,2,65535,0),b.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):W(this,e,t,!0),t+2},b.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,2,65535,0),b.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):W(this,e,t,!1),t+2},b.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,4,4294967295,0),b.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):$(this,e,t,!0),t+4},b.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,4,4294967295,0),b.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):$(this,e,t,!1),t+4},b.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);V(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},b.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);V(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},b.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,1,127,-128),b.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},b.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,2,32767,-32768),b.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):W(this,e,t,!0),t+2},b.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,2,32767,-32768),b.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):W(this,e,t,!1),t+2},b.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,4,2147483647,-2147483648),b.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):$(this,e,t,!0),t+4},b.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),b.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):$(this,e,t,!1),t+4},b.prototype.writeFloatLE=function(e,t,n){return G(this,e,t,!0,n)},b.prototype.writeFloatBE=function(e,t,n){return G(this,e,t,!1,n)},b.prototype.writeDoubleLE=function(e,t,n){return Z(this,e,t,!0,n)},b.prototype.writeDoubleBE=function(e,t,n){return Z(this,e,t,!1,n)},b.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!b.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ee(e){return function(e){var t,n,r,i,o,c;l||u();var h=e.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[h-2]?2:"="===e[h-1]?1:0,c=new a(3*h/4-o),r=o>0?h-4:h;var d=0;for(t=0,n=0;t>16&255,c[d++]=i>>8&255,c[d++]=255&i;return 2===o?(i=s[e.charCodeAt(t)]<<2|s[e.charCodeAt(t+1)]>>4,c[d++]=255&i):1===o&&(i=s[e.charCodeAt(t)]<<10|s[e.charCodeAt(t+1)]<<4|s[e.charCodeAt(t+2)]>>2,c[d++]=i>>8&255,c[d++]=255&i),c}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function te(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ne(e){return null!=e&&(!!e._isBuffer||re(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&re(e.slice(0,0))}(e))}function re(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ie=Object.freeze({__proto__:null,Buffer:b,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),b.alloc(+e)},isBuffer:ne,kMaxLength:g}),oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{};function se(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var ae={},le={},ue={},ce=se(ie),he={};function de(){throw new Error("setTimeout has not been defined")}function fe(){throw new Error("clearTimeout has not been defined")}var pe=de,me=fe;function ge(e){if(pe===setTimeout)return setTimeout(e,0);if((pe===de||!pe)&&setTimeout)return pe=setTimeout,setTimeout(e,0);try{return pe(e,0)}catch(t){try{return pe.call(null,e,0)}catch(t){return pe.call(this,e,0)}}}"function"==typeof i.setTimeout&&(pe=setTimeout),"function"==typeof i.clearTimeout&&(me=clearTimeout);var ve,ye=[],be=!1,we=-1;function Ae(){be&&ve&&(be=!1,ve.length?ye=ve.concat(ye):we=-1,ye.length&&_e())}function _e(){if(!be){var e=ge(Ae);be=!0;for(var t=ye.length;t;){for(ve=ye,ye=[];++we1)for(var n=1;n4294967295)throw new RangeError("requested too many random bytes");var n=qe.allocUnsafe(e);if(e>0)if(e>Ue)for(var r=0;r0&&s.length>i){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=n,++e._eventsCount;return e}function Qe(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function Je(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Xe(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}$e.prototype=Object.create(null),Ye.EventEmitter=Ye,Ye.usingDomains=!1,Ye.prototype.domain=void 0,Ye.prototype._events=void 0,Ye.prototype._maxListeners=void 0,Ye.defaultMaxListeners=10,Ye.init=function(){this.domain=null,Ye.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new $e,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ye.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Ye.prototype.getMaxListeners=function(){return Ge(this)},Ye.prototype.emit=function(e){var t,n,r,i,o,s,a,l="error"===e;if(s=this._events)l=l&&null==s.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=Xe(e,r),o=0;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new $e,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var et=se(Object.freeze({__proto__:null,EventEmitter:Ye,default:Ye})),tt=et.EventEmitter,nt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},rt=/%[sdj%]/g;function it(e){if(!wt(e)){for(var t=[],n=0;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),s=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),gt(t)?n.showHidden=t:t&&Lt(n,t),_t(n.showHidden)&&(n.showHidden=!1),_t(n.depth)&&(n.depth=2),_t(n.colors)&&(n.colors=!1),_t(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=ct),dt(n,e,n.depth)}function ct(e,t){var n=ut.styles[t];return n?"["+ut.colors[n][0]+"m"+e+"["+ut.colors[n][1]+"m":e}function ht(e,t){return e}function dt(e,t,n){if(e.customInspect&&t&&xt(t.inspect)&&t.inspect!==ut&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return wt(r)||(r=dt(e,r,n)),r}var i=function(e,t){if(_t(t))return e.stylize("undefined","undefined");if(wt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return bt(t)?e.stylize(""+t,"number"):gt(t)?e.stylize(""+t,"boolean"):vt(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),St(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ft(t);if(0===o.length){if(xt(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(Et(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(kt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(St(t))return ft(t)}var l,u="",c=!1,h=["{","}"];return mt(t)&&(c=!0,h=["[","]"]),xt(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),Et(t)&&(u=" "+RegExp.prototype.toString.call(t)),kt(t)&&(u=" "+Date.prototype.toUTCString.call(t)),St(t)&&(u=" "+ft(t)),0!==o.length||c&&0!=t.length?n<0?Et(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=c?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,h)):h[0]+u+h[1]}function ft(e){return"["+Error.prototype.toString.call(e)+"]"}function pt(e,t,n,r,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),It(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=vt(n)?dt(e,l.value,null):dt(e,l.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),_t(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function mt(e){return Array.isArray(e)}function gt(e){return"boolean"==typeof e}function vt(e){return null===e}function yt(e){return null==e}function bt(e){return"number"==typeof e}function wt(e){return"string"==typeof e}function At(e){return"symbol"==typeof e}function _t(e){return void 0===e}function Et(e){return Mt(e)&&"[object RegExp]"===Ot(e)}function Mt(e){return"object"==typeof e&&null!==e}function kt(e){return Mt(e)&&"[object Date]"===Ot(e)}function St(e){return Mt(e)&&("[object Error]"===Ot(e)||e instanceof Error)}function xt(e){return"function"==typeof e}function Ct(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Tt(e){return ne(e)}function Ot(e){return Object.prototype.toString.call(e)}function Rt(e){return e<10?"0"+e.toString(10):e.toString(10)}ut.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ut.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Pt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Nt(){var e,t;console.log("%s - %s",(t=[Rt((e=new Date).getHours()),Rt(e.getMinutes()),Rt(e.getSeconds())].join(":"),[e.getDate(),Pt[e.getMonth()],t].join(" ")),it.apply(null,arguments))}function Lt(e,t){if(!t||!Mt(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function It(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Bt,Dt,jt={inherits:nt,_extend:Lt,log:Nt,isBuffer:Tt,isPrimitive:Ct,isFunction:xt,isError:St,isDate:kt,isObject:Mt,isRegExp:Et,isUndefined:_t,isSymbol:At,isString:wt,isNumber:bt,isNullOrUndefined:yt,isNull:vt,isBoolean:gt,isArray:mt,inspect:ut,deprecate:ot,format:it,debuglog:lt},Ft=se(Object.freeze({__proto__:null,_extend:Lt,debuglog:lt,default:jt,deprecate:ot,format:it,inherits:nt,inspect:ut,isArray:mt,isBoolean:gt,isBuffer:Tt,isDate:kt,isError:St,isFunction:xt,isNull:vt,isNullOrUndefined:yt,isNumber:bt,isObject:Mt,isPrimitive:Ct,isRegExp:Et,isString:wt,isSymbol:At,isUndefined:_t,log:Nt}));function Ut(e,t){zt(e,t),qt(e)}function qt(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function zt(e,t){e.emit("error",t)}var Ht={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ee(zt,this,e)):Ee(zt,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Ee(qt,n):(n._writableState.errorEmitted=!0,Ee(Ut,n,e)):Ee(Ut,n,e):t?(Ee(qt,n),t(e)):Ee(qt,n)})),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(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Kt={},Vt={};function Wt(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Vt[e]=r}function $t(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Wt("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Wt("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i;if("string"==typeof t&&("not ","not "===t.substr(0,4))?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length)," argument"===e.substring(n-9,n)}(e))i="The ".concat(e," ").concat(r," ").concat($t(t,"type"));else{var o=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat($t(t,"type"))}return i+". Received type ".concat(typeof n)}),TypeError),Wt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Wt("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Wt("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Wt("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Wt("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Wt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Wt("ERR_STREAM_WRITE_AFTER_END","write after end"),Wt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Wt("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Wt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Kt.codes=Vt;var Yt,Gt,Zt,Qt,Jt,Xt,en=Kt.codes.ERR_INVALID_OPT_VALUE,tn={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new en(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function nn(){if(Gt)return Yt;function e(e){try{if(!oe.localStorage)return!1}catch(e){return!1}var t=oe.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return Gt=1,Yt=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},Yt}function rn(){if(Qt)return Zt;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;Qt=1,Zt=A,A.WritableState=w;var n,r={deprecate:nn()},i=tt,o=ce.Buffer,s=(void 0!==oe?oe:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Ht,l=tn.getHighWaterMark,u=Kt.codes,c=u.ERR_INVALID_ARG_TYPE,h=u.ERR_METHOD_NOT_IMPLEMENTED,d=u.ERR_MULTIPLE_CALLBACK,f=u.ERR_STREAM_CANNOT_PIPE,p=u.ERR_STREAM_DESTROYED,m=u.ERR_STREAM_NULL_VALUES,g=u.ERR_STREAM_WRITE_AFTER_END,v=u.ERR_UNKNOWN_ENCODING,y=a.errorOrDestroy;function b(){}function w(n,r,i){t=t||on(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=l(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new d;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Ee(i,r),Ee(x,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),x(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||M(e,n),r?Ee(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||on());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function _(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function M(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),s=n.corkedRequestsFree;s.entry=r;for(var a=0,l=!0;r;)o[a]=r,r.isBuf||(l=!1),r=r.next,a+=1;o.allBuffers=l,_(t,n,!0,n.length,o,"",s.finish),n.pendingcb++,n.lastBufferedRequest=null,s.next?(n.corkedRequestsFree=s.next,s.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(_(t,n,!1,n.objectMode?1:u.length,u,c,h),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Ee(S,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Ve(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new f)},A.prototype.write=function(e,t,n){var r,i=this._writableState,a=!1,l=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof s);return l&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),l?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Ee(t,n)}(this,n):(l||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Ee(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,a=function(e,t,n,r,i,s){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var l=t.objectMode?1:r.length;t.length+=l;var u=t.length-1))throw new v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new h("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?Ee(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=a.destroy,A.prototype._undestroy=a.undestroy,A.prototype._destroy=function(e,t){t(e)},Zt}function on(){if(Xt)return Jt;Xt=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Jt=s;var t=yn(),n=rn();Ve(s,t);for(var r=e(n.prototype),i=0;i>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function a(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return an.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(o>0&&(e.lastNeed=o-1),o):--i=0?(o>0&&(e.lastNeed=o-2),o):--i=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},an}var un=Kt.codes.ERR_STREAM_PREMATURE_CLOSE;function cn(){}var hn,dn,fn,pn,mn,gn,vn=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:a,value:function(e,n){return s(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),Bt}(),h=Ht,d=tn.getHighWaterMark,f=Kt.codes,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,g=f.ERR_METHOD_NOT_IMPLEMENTED,v=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Ve(A,r);var y=h.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||on(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=d(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(a||(a=ln().StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||on(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function _(e,n,r,s,a){t("readableAddChunk",n);var l,u=e._readableState;if(null===n)u.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?S(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,x(e)))}}(e,u);else if(a||(l=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(u,n)),l)y(e,l);else if(u.objectMode||n&&n.length>0)if("string"==typeof n||u.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),s)u.endEmitted?y(e,new v):E(e,u,n,!0);else if(u.ended)y(e,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(n=u.decoder.write(n),u.objectMode||0!==n.length?E(e,u,n,!1):C(e,u)):E(e,u,n,!1)}else s||(u.reading=!1,C(e,u));return!u.ended&&(u.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Ee(x,e))}function x(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,N(e)}function C(e,t){t.readingMore||(t.readingMore=!0,Ee(T,e,t))}function T(e,n){for(;!n.reading&&!n.ended&&(n.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function R(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),N(e),n.flowing&&!n.reading&&e.read(0)}function N(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function I(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Ee(B,n,e))}function B(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function D(e,t){for(var n=0,r=e.length;n=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?I(this):S(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&I(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e0?L(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&I(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var s=r&&!1===r.end||e===Be.stdout||e===Be.stderr?p:a;function a(){t("onend"),e.end()}o.endEmitted?Ee(s):i.once("end",s),e.on("unpipe",(function n(r,s){t("onunpipe"),r===i&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,t("cleanup"),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",n),i.removeListener("end",a),i.removeListener("end",p),i.removeListener("data",c),u=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}));var l=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,N(e))}}(i);e.on("drain",l);var u=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==D(o.pipes,e))&&!u&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function h(r){t("onerror",r),p(),e.removeListener("error",h),0===n(e,"error")&&y(e,r)}function d(){e.removeListener("finish",f),p()}function f(){t("onfinish"),e.removeListener("close",d),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",d),e.once("finish",f),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?S(this):o.reading||Ee(R,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Ee(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Ee(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Ee(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s0,(function(e){r||(r=e),e&&o.forEach(jn),s||(o.forEach(jn),i(r))}))}));return t.reduce(Fn)};!function(e,t){(t=We.exports=yn()).Stream=t,t.Readable=t,t.Writable=rn(),t.Duplex=on(),t.Transform=bn,t.PassThrough=Rn,t.finished=vn,t.pipeline=Un}(0,We.exports);var qn=We.exports,zn=Fe.Buffer,Hn=qn.Transform;function Kn(e){Hn.call(this),this._block=zn.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Ve(Kn,Hn),Kn.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},Kn.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},Kn.prototype.update=function(e,t){if(function(e,t){if(!zn.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");zn.isBuffer(e)||(e=zn.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},Kn.prototype._update=function(){throw new Error("_update is not implemented")},Kn.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},Kn.prototype._digest=function(){throw new Error("_digest is not implemented")};var Vn=Kn,Wn=Ve,$n=Vn,Yn=Fe.Buffer,Gn=new Array(16);function Zn(){$n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Qn(e,t){return e<>>32-t}function Jn(e,t,n,r,i,o,s){return Qn(e+(t&n|~t&r)+i+o|0,s)+t|0}function Xn(e,t,n,r,i,o,s){return Qn(e+(t&r|n&~r)+i+o|0,s)+t|0}function er(e,t,n,r,i,o,s){return Qn(e+(t^n^r)+i+o|0,s)+t|0}function tr(e,t,n,r,i,o,s){return Qn(e+(n^(t|~r))+i+o|0,s)+t|0}Wn(Zn,$n),Zn.prototype._update=function(){for(var e=Gn,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=Jn(n,r,i,o,e[0],3614090360,7),o=Jn(o,n,r,i,e[1],3905402710,12),i=Jn(i,o,n,r,e[2],606105819,17),r=Jn(r,i,o,n,e[3],3250441966,22),n=Jn(n,r,i,o,e[4],4118548399,7),o=Jn(o,n,r,i,e[5],1200080426,12),i=Jn(i,o,n,r,e[6],2821735955,17),r=Jn(r,i,o,n,e[7],4249261313,22),n=Jn(n,r,i,o,e[8],1770035416,7),o=Jn(o,n,r,i,e[9],2336552879,12),i=Jn(i,o,n,r,e[10],4294925233,17),r=Jn(r,i,o,n,e[11],2304563134,22),n=Jn(n,r,i,o,e[12],1804603682,7),o=Jn(o,n,r,i,e[13],4254626195,12),i=Jn(i,o,n,r,e[14],2792965006,17),n=Xn(n,r=Jn(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=Xn(o,n,r,i,e[6],3225465664,9),i=Xn(i,o,n,r,e[11],643717713,14),r=Xn(r,i,o,n,e[0],3921069994,20),n=Xn(n,r,i,o,e[5],3593408605,5),o=Xn(o,n,r,i,e[10],38016083,9),i=Xn(i,o,n,r,e[15],3634488961,14),r=Xn(r,i,o,n,e[4],3889429448,20),n=Xn(n,r,i,o,e[9],568446438,5),o=Xn(o,n,r,i,e[14],3275163606,9),i=Xn(i,o,n,r,e[3],4107603335,14),r=Xn(r,i,o,n,e[8],1163531501,20),n=Xn(n,r,i,o,e[13],2850285829,5),o=Xn(o,n,r,i,e[2],4243563512,9),i=Xn(i,o,n,r,e[7],1735328473,14),n=er(n,r=Xn(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=er(o,n,r,i,e[8],2272392833,11),i=er(i,o,n,r,e[11],1839030562,16),r=er(r,i,o,n,e[14],4259657740,23),n=er(n,r,i,o,e[1],2763975236,4),o=er(o,n,r,i,e[4],1272893353,11),i=er(i,o,n,r,e[7],4139469664,16),r=er(r,i,o,n,e[10],3200236656,23),n=er(n,r,i,o,e[13],681279174,4),o=er(o,n,r,i,e[0],3936430074,11),i=er(i,o,n,r,e[3],3572445317,16),r=er(r,i,o,n,e[6],76029189,23),n=er(n,r,i,o,e[9],3654602809,4),o=er(o,n,r,i,e[12],3873151461,11),i=er(i,o,n,r,e[15],530742520,16),n=tr(n,r=er(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=tr(o,n,r,i,e[7],1126891415,10),i=tr(i,o,n,r,e[14],2878612391,15),r=tr(r,i,o,n,e[5],4237533241,21),n=tr(n,r,i,o,e[12],1700485571,6),o=tr(o,n,r,i,e[3],2399980690,10),i=tr(i,o,n,r,e[10],4293915773,15),r=tr(r,i,o,n,e[1],2240044497,21),n=tr(n,r,i,o,e[8],1873313359,6),o=tr(o,n,r,i,e[15],4264355552,10),i=tr(i,o,n,r,e[6],2734768916,15),r=tr(r,i,o,n,e[13],1309151649,21),n=tr(n,r,i,o,e[4],4149444226,6),o=tr(o,n,r,i,e[11],3174756917,10),i=tr(i,o,n,r,e[2],718787259,15),r=tr(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},Zn.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 e=Yn.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var nr=Zn,rr=ce.Buffer,ir=Ve,or=Vn,sr=new Array(16),ar=[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],lr=[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],ur=[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],cr=[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],hr=[0,1518500249,1859775393,2400959708,2840853838],dr=[1352829926,1548603684,1836072691,2053994217,0];function fr(){or.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function pr(e,t){return e<>>32-t}function mr(e,t,n,r,i,o,s,a){return pr(e+(t^n^r)+o+s|0,a)+i|0}function gr(e,t,n,r,i,o,s,a){return pr(e+(t&n|~t&r)+o+s|0,a)+i|0}function vr(e,t,n,r,i,o,s,a){return pr(e+((t|~n)^r)+o+s|0,a)+i|0}function yr(e,t,n,r,i,o,s,a){return pr(e+(t&r|n&~r)+o+s|0,a)+i|0}function br(e,t,n,r,i,o,s,a){return pr(e+(t^(n|~r))+o+s|0,a)+i|0}ir(fr,or),fr.prototype._update=function(){for(var e=sr,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,l=0|this._b,u=0|this._c,c=0|this._d,h=0|this._e,d=0;d<80;d+=1){var f,p;d<16?(f=mr(n,r,i,o,s,e[ar[d]],hr[0],ur[d]),p=br(a,l,u,c,h,e[lr[d]],dr[0],cr[d])):d<32?(f=gr(n,r,i,o,s,e[ar[d]],hr[1],ur[d]),p=yr(a,l,u,c,h,e[lr[d]],dr[1],cr[d])):d<48?(f=vr(n,r,i,o,s,e[ar[d]],hr[2],ur[d]),p=vr(a,l,u,c,h,e[lr[d]],dr[2],cr[d])):d<64?(f=yr(n,r,i,o,s,e[ar[d]],hr[3],ur[d]),p=gr(a,l,u,c,h,e[lr[d]],dr[3],cr[d])):(f=br(n,r,i,o,s,e[ar[d]],hr[4],ur[d]),p=mr(a,l,u,c,h,e[lr[d]],dr[4],cr[d])),n=s,s=o,o=pr(i,10),i=r,r=f,a=h,h=c,c=pr(u,10),u=l,l=p}var m=this._b+i+c|0;this._b=this._c+o+h|0,this._c=this._d+s+a|0,this._d=this._e+n+l|0,this._e=this._a+r+u|0,this._a=m},fr.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 e=rr.alloc?rr.alloc(20):new rr(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var wr=fr,Ar={exports:{}},_r=Fe.Buffer;function Er(e,t){this._block=_r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Er.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=_r.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Er.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Mr=Er,kr=Ve,Sr=Mr,xr=Fe.Buffer,Cr=[1518500249,1859775393,-1894007588,-899497514],Tr=new Array(80);function Or(){this.init(),this._w=Tr,Sr.call(this,64,56)}function Rr(e){return e<<30|e>>>2}function Pr(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}kr(Or,Sr),Or.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Or.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var u=0;u<80;++u){var c=~~(u/20),h=0|((t=r)<<5|t>>>27)+Pr(c,i,o,s)+a+n[u]+Cr[c];a=s,s=o,o=Rr(i),i=r,r=h}this._a=r+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},Or.prototype._hash=function(){var e=xr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Nr=Or,Lr=Ve,Ir=Mr,Br=Fe.Buffer,Dr=[1518500249,1859775393,-1894007588,-899497514],jr=new Array(80);function Fr(){this.init(),this._w=jr,Ir.call(this,64,56)}function Ur(e){return e<<5|e>>>27}function qr(e){return e<<30|e>>>2}function zr(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Lr(Fr,Ir),Fr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Fr.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=(t=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|t>>>31;for(var u=0;u<80;++u){var c=~~(u/20),h=Ur(r)+zr(c,i,o,s)+a+n[u]+Dr[c]|0;a=s,s=o,o=qr(i),i=r,r=h}this._a=r+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},Fr.prototype._hash=function(){var e=Br.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Hr=Fr,Kr=Ve,Vr=Mr,Wr=Fe.Buffer,$r=[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],Yr=new Array(64);function Gr(){this.init(),this._w=Yr,Vr.call(this,64,56)}function Zr(e,t,n){return n^e&(t^n)}function Qr(e,t,n){return e&t|n&(e|t)}function Jr(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Xr(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function ei(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}Kr(Gr,Vr),Gr.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},Gr.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,l=0|this._f,u=0|this._g,c=0|this._h,h=0;h<16;++h)n[h]=e.readInt32BE(4*h);for(;h<64;++h)n[h]=0|(((t=n[h-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[h-7]+ei(n[h-15])+n[h-16];for(var d=0;d<64;++d){var f=c+Xr(a)+Zr(a,l,u)+$r[d]+n[d]|0,p=Jr(r)+Qr(r,i,o)|0;c=u,u=l,l=a,a=s+f|0,s=o,o=i,i=r,r=f+p|0}this._a=r+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=l+this._f|0,this._g=u+this._g|0,this._h=c+this._h|0},Gr.prototype._hash=function(){var e=Wr.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var ti=Gr,ni=Ve,ri=ti,ii=Mr,oi=Fe.Buffer,si=new Array(64);function ai(){this.init(),this._w=si,ii.call(this,64,56)}ni(ai,ri),ai.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},ai.prototype._hash=function(){var e=oi.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var li=ai,ui=Ve,ci=Mr,hi=Fe.Buffer,di=[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],fi=new Array(160);function pi(){this.init(),this._w=fi,ci.call(this,128,112)}function mi(e,t,n){return n^e&(t^n)}function gi(e,t,n){return e&t|n&(e|t)}function yi(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function bi(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function wi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Ai(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function _i(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ei(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Mi(e,t){return e>>>0>>0?1:0}ui(pi,ci),pi.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},pi.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,l=0|this._gh,u=0|this._hh,c=0|this._al,h=0|this._bl,d=0|this._cl,f=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,v=0|this._hl,y=0;y<32;y+=2)t[y]=e.readInt32BE(4*y),t[y+1]=e.readInt32BE(4*y+4);for(;y<160;y+=2){var b=t[y-30],w=t[y-30+1],A=wi(b,w),_=Ai(w,b),E=_i(b=t[y-4],w=t[y-4+1]),M=Ei(w,b),k=t[y-14],S=t[y-14+1],x=t[y-32],C=t[y-32+1],T=_+S|0,O=A+k+Mi(T,_)|0;O=(O=O+E+Mi(T=T+M|0,M)|0)+x+Mi(T=T+C|0,C)|0,t[y]=O,t[y+1]=T}for(var R=0;R<160;R+=2){O=t[R],T=t[R+1];var P=gi(n,r,i),N=gi(c,h,d),L=yi(n,c),I=yi(c,n),B=bi(s,p),D=bi(p,s),j=di[R],F=di[R+1],U=mi(s,a,l),q=mi(p,m,g),z=v+D|0,H=u+B+Mi(z,v)|0;H=(H=(H=H+U+Mi(z=z+q|0,q)|0)+j+Mi(z=z+F|0,F)|0)+O+Mi(z=z+T|0,T)|0;var K=I+N|0,V=L+P+Mi(K,I)|0;u=l,v=g,l=a,g=m,a=s,m=p,s=o+H+Mi(p=f+z|0,f)|0,o=i,f=d,i=r,d=h,r=n,h=c,n=H+V+Mi(c=z+K|0,z)|0}this._al=this._al+c|0,this._bl=this._bl+h|0,this._cl=this._cl+d|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+v|0,this._ah=this._ah+n+Mi(this._al,c)|0,this._bh=this._bh+r+Mi(this._bl,h)|0,this._ch=this._ch+i+Mi(this._cl,d)|0,this._dh=this._dh+o+Mi(this._dl,f)|0,this._eh=this._eh+s+Mi(this._el,p)|0,this._fh=this._fh+a+Mi(this._fl,m)|0,this._gh=this._gh+l+Mi(this._gl,g)|0,this._hh=this._hh+u+Mi(this._hl,v)|0},pi.prototype._hash=function(){var e=hi.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var ki=pi,Si=Ve,xi=ki,Ci=Mr,Ti=Fe.Buffer,Oi=new Array(160);function Ri(){this.init(),this._w=Oi,Ci.call(this,128,112)}Si(Ri,xi),Ri.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},Ri.prototype._hash=function(){var e=Ti.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Pi=Ri,Ni=Ar.exports=function(e){e=e.toLowerCase();var t=Ni[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Ni.sha=Nr,Ni.sha1=Hr,Ni.sha224=li,Ni.sha256=ti,Ni.sha384=Pi,Ni.sha512=ki;var Li=Ar.exports;function Ii(){this.head=null,this.tail=null,this.length=0}Ii.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Ii.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Ii.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Ii.prototype.clear=function(){this.head=this.tail=null,this.length=0},Ii.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},Ii.prototype.concat=function(e){if(0===this.length)return b.alloc(0);if(1===this.length)return this.head.data;for(var t=b.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Bi=b.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Di(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Bi(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Fi;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Ui;break;default:return void(this.write=ji)}this.charBuffer=new b(6),this.charReceived=0,this.charLength=0}function ji(e){return e.toString(this.encoding)}function Fi(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Ui(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Di.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Di.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Di.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var qi=Object.freeze({__proto__:null,StringDecoder:Di});Ki.ReadableState=Hi;var zi=lt("stream");function Hi(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof bo&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Ii,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.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Di(e.encoding),this.encoding=e.encoding)}function Ki(e){if(!(this instanceof Ki))return new Ki(e);this._readableState=new Hi(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ye.call(this)}function Vi(e,t,n,r,i){var o=function(e,t){var n=null;return ne(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Yi(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var l;!t.decoder||i||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Yi(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ee(Zi,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Wi?e=Wi:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Yi(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(zi("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ee(Gi,e):Gi(e))}function Gi(e){zi("emit readable"),e.emit("readable"),Xi(e)}function Zi(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=b.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function to(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ee(no,t,e))}function no(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function ro(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return zi("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?to(this):Yi(this),null;if(0===(e=$i(e,t))&&t.ended)return 0===t.length&&to(this),null;var r,i=t.needReadable;return zi("need readable",i),(0===t.length||t.length-e0?eo(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&to(this)),null!==r&&this.emit("data",r),r},Ki.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Ki.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,zi("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:s;function o(e){zi("onunpipe"),e===n&&u()}function s(){zi("onend"),e.end()}r.endEmitted?Ee(i):n.once("end",i),e.on("unpipe",o);var a=function(e){return function(){var t=e._readableState;zi("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Xi(e))}}(n);e.on("drain",a);var l=!1;function u(){zi("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",a),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",u),n.removeListener("data",h),l=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a()}var c=!1;function h(t){zi("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==ro(r.pipes,e))&&!l&&(zi("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){zi("onerror",t),m(),e.removeListener("error",d),0===e.listeners("error").length&&e.emit("error",t)}function f(){e.removeListener("finish",p),m()}function p(){zi("onfinish"),e.removeListener("close",f),m()}function m(){zi("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(zi("pipe resume"),n.resume()),e},Ki.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},ao.prototype._write=function(e,t,n){n(new Error("not implemented"))},ao.prototype._writev=null,ao.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,po(e,t),n&&(t.finished?Ee(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},nt(bo,Ki);for(var go=Object.keys(ao.prototype),vo=0;voKo?t=e(t):t.lengthn?t=("rmd160"===e?new Xo:es(e)).update(t).digest():t.lengthas||t!=t)throw new TypeError("Bad key length")},us=oe.process&&oe.process.browser?"utf-8":oe.process&&oe.process.version?parseInt(Be.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",cs=Fe.Buffer,hs=function(e,t,n){if(cs.isBuffer(e))return e;if("string"==typeof e)return cs.from(e,t);if(ArrayBuffer.isView(e))return cs.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},ds=$o,fs=wr,ps=Li,ms=Fe.Buffer,gs=ls,vs=us,ys=hs,bs=ms.alloc(128),ws={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function As(e,t,n){var r=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new fs).update(e).digest()}:"md5"===e?ds:function(t){return ps(e).update(t).digest()}}(e),i="sha512"===e||"sha384"===e?128:64;t.length>i?t=r(t):t.length>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1}n[r+0]=i>>>0,n[r+1]=o>>>0},rip:function(e,t,n,r){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=t>>>a+s&1,i<<=1,i|=e>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=t>>>a+s&1,o<<=1,o|=e>>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},pc1:function(e,t,n,r){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;n[r+0]=i>>>0,n[r+1]=o>>>0},r28shl:function(e,t){return e<>>28-t}},js=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Ds.pc2=function(e,t,n,r){for(var i=0,o=0,s=js.length>>>1,a=0;a>>js[a]&1;for(a=s;a>>js[a]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},Ds.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var Fs=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Ds.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=Fs[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=Fs[256+64*r+(t>>>18-6*r&63)];return n>>>0};var Us=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Ds.permute=function(e){for(var t=0,n=0;n>>Us[n]&1;return t>>>0},Ds.padSplit=function(e,t,n){for(var r=e.toString(2);r.length0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},Ks.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},Ks.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];n=$s.r28shl(n,o),r=$s.r28shl(r,o),$s.pc2(n,r,e.keys,i)}},Zs.prototype._update=function(e,t,n,r){var i=this._desState,o=$s.readUInt32BE(e,t),s=$s.readUInt32BE(e,t+4);$s.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],$s.writeUInt32BE(n,o,r),$s.writeUInt32BE(n,s,r+4)},Zs.prototype._pad=function(e,t){for(var n=e.length-t,r=t;r>>0,o=h}$s.rip(s,o,r,i)},Zs.prototype._decrypt=function(e,t,n,r,i){for(var o=n,s=t,a=e.keys.length-2;a>=0;a-=2){var l=e.keys[a],u=e.keys[a+1];$s.expand(o,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var c=$s.substitute(l,u),h=o;o=(s^$s.permute(c))>>>0,s=h}$s.rip(o,s,r,i)};var Xs={},ea=qs,ta=Ve,na={};function ra(e){ea.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t>o%8,e._prev=Pa(e._prev,n?r:i);return s}function Pa(e,t){var n=e.length,r=-1,i=Oa.allocUnsafe(e.length);for(e=Oa.concat([e,Oa.from([t])]);++r>7;return i}Ta.encrypt=function(e,t,n){for(var r=t.length,i=Oa.allocUnsafe(r),o=-1;++o>>24]^c[p>>>16&255]^h[m>>>8&255]^d[255&g]^t[v++],s=u[p>>>24]^c[m>>>16&255]^h[g>>>8&255]^d[255&f]^t[v++],a=u[m>>>24]^c[g>>>16&255]^h[f>>>8&255]^d[255&p]^t[v++],l=u[g>>>24]^c[f>>>16&255]^h[p>>>8&255]^d[255&m]^t[v++],f=o,p=s,m=a,g=l;return o=(r[f>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[v++],s=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&f])^t[v++],a=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[f>>>8&255]<<8|r[255&p])^t[v++],l=(r[g>>>24]<<24|r[f>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[v++],[o>>>=0,s>>>=0,a>>>=0,l>>>=0]}var Ja=[0,1,2,4,8,16,32,64,128,27,54],Xa=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,l=0;l<256;++l){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,n[s]=u,r[u]=s;var c=e[s],h=e[c],d=e[h],f=257*e[u]^16843008*u;i[0][s]=f<<24|f>>>8,i[1][s]=f<<16|f>>>16,i[2][s]=f<<8|f>>>24,i[3][s]=f,f=16843009*d^65537*h^257*c^16843008*s,o[0][u]=f<<24|f>>>8,o[1][u]=f<<16|f>>>16,o[2][u]=f<<8|f>>>24,o[3][u]=f,0===s?s=a=1:(s=c^e[e[e[d^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function el(e){this._key=Ga(e),this._reset()}el.blockSize=16,el.keySize=32,el.prototype.blockSize=el.blockSize,el.prototype.keySize=el.keySize,el.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=Xa.SBOX[s>>>24]<<24|Xa.SBOX[s>>>16&255]<<16|Xa.SBOX[s>>>8&255]<<8|Xa.SBOX[255&s],s^=Ja[o/t|0]<<24):t>6&&o%t==4&&(s=Xa.SBOX[s>>>24]<<24|Xa.SBOX[s>>>16&255]<<16|Xa.SBOX[s>>>8&255]<<8|Xa.SBOX[255&s]),i[o]=i[o-t]^s}for(var a=[],l=0;l>>24]]^Xa.INV_SUB_MIX[1][Xa.SBOX[c>>>16&255]]^Xa.INV_SUB_MIX[2][Xa.SBOX[c>>>8&255]]^Xa.INV_SUB_MIX[3][Xa.SBOX[255&c]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=a},el.prototype.encryptBlockRaw=function(e){return Qa(e=Ga(e),this._keySchedule,Xa.SUB_MIX,Xa.SBOX,this._nRounds)},el.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=Ya.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},el.prototype.decryptBlock=function(e){var t=(e=Ga(e))[1];e[1]=e[3],e[3]=t;var n=Qa(e,this._invKeySchedule,Xa.INV_SUB_MIX,Xa.INV_SBOX,this._nRounds),r=Ya.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},el.prototype.scrub=function(){Za(this._keySchedule),Za(this._invKeySchedule),Za(this._key)},$a.AES=el;var tl=Fe.Buffer,nl=tl.alloc(16,0);function rl(e){var t=tl.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function il(e){this.h=e,this.state=tl.alloc(16,0),this.cache=tl.allocUnsafe(0)}il.prototype.ghash=function(e){for(var t=-1;++t0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=rl(i)},il.prototype.update=function(e){var t;for(this.cache=tl.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},il.prototype.final=function(e,t){return this.cache.length&&this.ghash(tl.concat([this.cache,nl],16)),this.ghash(rl([0,e,0,t])),this.state};var ol=il,sl=$a,al=Fe.Buffer,ll=No,ul=ol,cl=wa,hl=Da;function dl(e,t,n,r){ll.call(this);var i=al.alloc(4,0);this._cipher=new sl.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new ul(o),n=function(e,t,n){if(12===t.length)return e._finID=al.concat([t,al.from([0,0,0,1])]),al.concat([t,al.from([0,0,0,2])]);var r=new ul(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(al.alloc(o,0))),r.update(al.alloc(8,0));var s=8*i,a=al.alloc(8);a.writeUIntBE(s,0,8),r.update(a),e._finID=r.state;var l=al.from(e._finID);return hl(l),l}(this,n,o),this._prev=al.from(n),this._cache=al.allocUnsafe(0),this._secCache=al.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}Ve(dl,ll),dl.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=al.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},dl.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=cl(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i0||r>0;){var l=new wl;l.update(a),l.update(e),t&&l.update(t),a=l.digest();var u=0;if(i>0){var c=o.length-i;u=Math.min(i,a.length),a.copy(o,c,0,u),i-=u}if(u0){var h=s.length-r,d=Math.min(r,a.length-u);a.copy(s,h,u,u+d),r-=d}}return a.fill(0),{key:o,iv:s}},_l=Wa,El=fl,Ml=Fe.Buffer,kl=yl,Sl=No,xl=$a,Cl=Al;function Tl(e,t,n){Sl.call(this),this._cache=new Rl,this._cipher=new xl.AES(t),this._prev=Ml.from(n),this._mode=e,this._autopadding=!0}Ve(Tl,Sl),Tl.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return Ml.concat(r)};var Ol=Ml.alloc(16,16);function Rl(){this.cache=Ml.allocUnsafe(0)}function Pl(e,t,n){var r=_l[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=Ml.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=Ml.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===r.type?new kl(r.module,t,n):"auth"===r.type?new El(r.module,t,n):new Tl(r.module,t,n)}Tl.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(Ol))throw this._cipher.scrub(),new Error("data not multiple of block length")},Tl.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Rl.prototype.add=function(e){this.cache=Ml.concat([this.cache,e])},Rl.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Rl.prototype.flush=function(){for(var e=16-this.cache.length,t=Ml.allocUnsafe(e),n=-1;++n16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},zl.prototype.flush=function(){if(this.cache.length)return this.cache},Nl.createDecipher=function(e,t){var n=Bl[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=Ul(t,!1,n.key,n.iv);return Hl(e,r.key,r.iv)},Nl.createDecipheriv=Hl;var Kl=ya,Vl=Nl,Wl=za;va.createCipher=va.Cipher=Kl.createCipher,va.createCipheriv=va.Cipheriv=Kl.createCipheriv,va.createDecipher=va.Decipher=Vl.createDecipher,va.createDecipheriv=va.Decipheriv=Vl.createDecipheriv,va.listCiphers=va.getCiphers=function(){return Object.keys(Wl)};var $l={};!function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}}($l);var Yl=ma,Gl=va,Zl=Wa,Ql=$l,Jl=Al;function Xl(e,t,n){if(e=e.toLowerCase(),Zl[e])return Gl.createCipheriv(e,t,n);if(Ql[e])return new Yl({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function eu(e,t,n){if(e=e.toLowerCase(),Zl[e])return Gl.createDecipheriv(e,t,n);if(Ql[e])return new Yl({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}Is.createCipher=Is.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),Zl[e])n=Zl[e].key,r=Zl[e].iv;else{if(!Ql[e])throw new TypeError("invalid suite type");n=8*Ql[e].key,r=Ql[e].iv}var i=Jl(t,!1,n,r);return Xl(e,i.key,i.iv)},Is.createCipheriv=Is.Cipheriv=Xl,Is.createDecipher=Is.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),Zl[e])n=Zl[e].key,r=Zl[e].iv;else{if(!Ql[e])throw new TypeError("invalid suite type");n=8*Ql[e].key,r=Ql[e].iv}var i=Jl(t,!1,n,r);return eu(e,i.key,i.iv)},Is.createDecipheriv=Is.Decipheriv=eu,Is.listCiphers=Is.getCiphers=function(){return Object.keys(Ql).concat(Gl.getCiphers())};var tu={},nu={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ce.Buffer}catch(e){}function s(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(nu,oe);var ru=nu.exports,iu={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ce.Buffer}catch(e){}function s(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(iu,oe);var ou,su,au,lu,uu,cu=iu.exports,hu={exports:{}};function du(){if(ou)return hu.exports;var e;function t(e){this.rand=e}if(ou=1,hu.exports=function(n){return e||(e=new t(null)),e.generate(n)},hu.exports.Rand=t,t.prototype.generate=function(e){return this._rand(e)},t.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n=0);return i},n.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},n.prototype.test=function(t,n,r){var i=t.bitLength(),o=e.mont(t),s=new e(1).toRed(o);n||(n=Math.max(1,i/48|0));for(var a=t.subn(1),l=0;!a.testn(l);l++);for(var u=t.shrn(l),c=a.toRed(o);n>0;n--){var h=this._randrange(new e(2),a);r&&r(h);var d=h.toRed(o).redPow(u);if(0!==d.cmp(s)&&0!==d.cmp(c)){for(var f=1;f0;n--){var c=this._randrange(new e(2),s),h=t.gcd(c);if(0!==h.cmpn(1))return h;var d=c.toRed(i).redPow(l);if(0!==d.cmp(o)&&0!==d.cmp(u)){for(var f=1;fh;)m.ishrn(1);if(m.isEven()&&m.iadd(i),m.testn(1)||m.iadd(o),p.cmp(o)){if(!p.cmp(s))for(;m.mod(a).cmp(l);)m.iadd(c)}else for(;m.mod(n).cmp(u);)m.iadd(c);if(d(g=m.shrn(1))&&d(m)&&f(g)&&f(m)&&r.test(g)&&r.test(m))return m}}return lu}var mu,gu,vu,yu,bu,wu={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},Au={exports:{}},_u=et.EventEmitter;function Eu(e,t){ku(e,t),Mu(e)}function Mu(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function ku(e,t){e.emit("error",t)}var Su={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ee(ku,this,e)):Ee(ku,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Ee(Mu,n):(n._writableState.errorEmitted=!0,Ee(Eu,n,e)):Ee(Eu,n,e):t?(Ee(Mu,n),t(e)):Ee(Mu,n)})),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(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},xu={},Cu={};function Tu(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Cu[e]=r}function Ou(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Tu("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Tu("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i;if("string"==typeof t&&("not ","not "===t.substr(0,4))?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length)," argument"===e.substring(n-9,n)}(e))i="The ".concat(e," ").concat(r," ").concat(Ou(t,"type"));else{var o=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(Ou(t,"type"))}return i+". Received type ".concat(typeof n)}),TypeError),Tu("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Tu("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Tu("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Tu("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Tu("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Tu("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Tu("ERR_STREAM_WRITE_AFTER_END","write after end"),Tu("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Tu("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Tu("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),xu.codes=Cu;var Ru,Pu,Nu,Lu,Iu=xu.codes.ERR_INVALID_OPT_VALUE,Bu={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new Iu(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function Du(){if(Pu)return Ru;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;Pu=1,Ru=A,A.WritableState=w;var n,r={deprecate:nn()},i=_u,o=ce.Buffer,s=(void 0!==oe?oe:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Su,l=Bu.getHighWaterMark,u=xu.codes,c=u.ERR_INVALID_ARG_TYPE,h=u.ERR_METHOD_NOT_IMPLEMENTED,d=u.ERR_MULTIPLE_CALLBACK,f=u.ERR_STREAM_CANNOT_PIPE,p=u.ERR_STREAM_DESTROYED,m=u.ERR_STREAM_NULL_VALUES,g=u.ERR_STREAM_WRITE_AFTER_END,v=u.ERR_UNKNOWN_ENCODING,y=a.errorOrDestroy;function b(){}function w(n,r,i){t=t||ju(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=l(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new d;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Ee(i,r),Ee(x,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),x(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||M(e,n),r?Ee(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||ju());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function _(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function M(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),s=n.corkedRequestsFree;s.entry=r;for(var a=0,l=!0;r;)o[a]=r,r.isBuf||(l=!1),r=r.next,a+=1;o.allBuffers=l,_(t,n,!0,n.length,o,"",s.finish),n.pendingcb++,n.lastBufferedRequest=null,s.next?(n.corkedRequestsFree=s.next,s.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(_(t,n,!1,n.objectMode?1:u.length,u,c,h),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Ee(S,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Ve(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new f)},A.prototype.write=function(e,t,n){var r,i=this._writableState,a=!1,l=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof s);return l&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),l?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Ee(t,n)}(this,n):(l||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Ee(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,a=function(e,t,n,r,i,s){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var l=t.objectMode?1:r.length;t.length+=l;var u=t.length-1))throw new v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new h("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?Ee(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=a.destroy,A.prototype._undestroy=a.undestroy,A.prototype._destroy=function(e,t){t(e)},Ru}function ju(){if(Lu)return Nu;Lu=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Nu=s;var t=Qu(),n=Du();Ve(s,t);for(var r=e(n.prototype),i=0;i>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function a(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return Uu.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(o>0&&(e.lastNeed=o-1),o):--i=0?(o>0&&(e.lastNeed=o-2),o):--i=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},Uu}var zu=xu.codes.ERR_STREAM_PREMATURE_CLOSE;function Hu(){}var Ku,Vu,Wu,$u,Yu,Gu,Zu=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:a,value:function(e,n){return s(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),yu}(),h=Su,d=Bu.getHighWaterMark,f=xu.codes,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,g=f.ERR_METHOD_NOT_IMPLEMENTED,v=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Ve(A,r);var y=h.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||ju(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=d(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(a||(a=qu().StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||ju(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function _(e,n,r,s,a){t("readableAddChunk",n);var l,u=e._readableState;if(null===n)u.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?S(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,x(e)))}}(e,u);else if(a||(l=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(u,n)),l)y(e,l);else if(u.objectMode||n&&n.length>0)if("string"==typeof n||u.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),s)u.endEmitted?y(e,new v):E(e,u,n,!0);else if(u.ended)y(e,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(n=u.decoder.write(n),u.objectMode||0!==n.length?E(e,u,n,!1):C(e,u)):E(e,u,n,!1)}else s||(u.reading=!1,C(e,u));return!u.ended&&(u.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Ee(x,e))}function x(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,N(e)}function C(e,t){t.readingMore||(t.readingMore=!0,Ee(T,e,t))}function T(e,n){for(;!n.reading&&!n.ended&&(n.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function R(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),N(e),n.flowing&&!n.reading&&e.read(0)}function N(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function I(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Ee(B,n,e))}function B(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function D(e,t){for(var n=0,r=e.length;n=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?I(this):S(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&I(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e0?L(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&I(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var s=r&&!1===r.end||e===Be.stdout||e===Be.stderr?p:a;function a(){t("onend"),e.end()}o.endEmitted?Ee(s):i.once("end",s),e.on("unpipe",(function n(r,s){t("onunpipe"),r===i&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,t("cleanup"),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",n),i.removeListener("end",a),i.removeListener("end",p),i.removeListener("data",c),u=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}));var l=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,N(e))}}(i);e.on("drain",l);var u=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==D(o.pipes,e))&&!u&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function h(r){t("onerror",r),p(),e.removeListener("error",h),0===n(e,"error")&&y(e,r)}function d(){e.removeListener("finish",f),p()}function f(){t("onfinish"),e.removeListener("close",d),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",d),e.once("finish",f),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?S(this):o.reading||Ee(R,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Ee(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Ee(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Ee(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s0,(function(e){r||(r=e),e&&o.forEach(vc),s||(o.forEach(vc),i(r))}))}));return t.reduce(yc)};!function(e,t){(t=Au.exports=Qu()).Stream=t,t.Readable=t,t.Writable=Du(),t.Duplex=ju(),t.Transform=Ju,t.PassThrough=cc,t.finished=Zu,t.pipeline=bc}(0,Au.exports);var wc=Au.exports,Ac={exports:{}},_c={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ce.Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,r,i){for(var o=0,s=0,a=Math.min(e.length,r),l=t;l=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&s0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[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],f=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?h[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],c=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:h[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();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");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(e,t,n){return g(e,t,n)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):n<1024?g(this,e,t):v(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),v(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new M(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(w,b),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new A;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return y[e]=t,t},M.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},r(k,M),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(_c,oe);var Ec=_c.exports,Mc=Ec,kc=He;function Sc(e){var t,n=e.modulus.byteLength();do{t=new Mc(kc(n))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function xc(e,t){var n=function(e){var t=Sc(e);return{blinder:t.toRed(Mc.mont(e.modulus)).redPow(new Mc(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),r=t.modulus.byteLength(),i=new Mc(e).mul(n.blinder).umod(t.modulus),o=i.toRed(Mc.mont(t.prime1)),s=i.toRed(Mc.mont(t.prime2)),a=t.coefficient,l=t.prime1,u=t.prime2,c=o.redPow(t.exponent1).fromRed(),h=s.redPow(t.exponent2).fromRed(),d=c.isub(h).imul(a).umod(l).imul(u);return h.iadd(d).imul(n.unblinder).umod(t.modulus).toArrayLike(b,"be",r)}xc.getr=Sc;var Cc=xc,Tc={},Oc={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},Rc={},Pc={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ce.Buffer}catch(e){}function s(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Pc,oe);var Nc=Pc.exports,Lc={};!function(e){var t=Lc;function n(e){return 1===e.length?"0"+e:e}function r(e){for(var t="",r=0;r>8,s=255&i;o?n.push(o,s):n.push(s)}return n},t.zero2=n,t.toHex=r,t.encode=function(e,t){return"hex"===t?r(e):e}}(),function(e){var t=Rc,n=Nc,r=qs,i=Lc;t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},t.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,l=e.andln(3)+i&3,u=t.andln(3)+o&3;3===l&&(l=-1),3===u&&(u=-1),s=0==(1&l)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==u?l:-l,n[0].push(s),a=0==(1&u)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==l?u:-u,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},t.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new n(e,"hex","le")}}();var Ic={},Bc=Nc,Dc=Rc,jc=Dc.getNAF,Fc=Dc.getJSF,Uc=Dc.assert;function qc(e,t){this.type=e,this.p=new Bc(t.p,16),this.red=t.prime?Bc.red(t.prime):Bc.mont(this.p),this.zero=new Bc(0).toRed(this.red),this.one=new Bc(1).toRed(this.red),this.two=new Bc(2).toRed(this.red),this.n=t.n&&new Bc(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zc=qc;function Hc(e,t){this.curve=e,this.type=t,this.precomputed=null}qc.prototype.point=function(){throw new Error("Not implemented")},qc.prototype.validate=function(){throw new Error("Not implemented")},qc.prototype._fixedNafMul=function(e,t){Uc(e.precomputed);var n=e._getDoubles(),r=jc(t,1,this._bitLength),i=(1<=o;l--)s=(s<<1)+r[l];a.push(s)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;a--){for(var l=0;a>=0&&0===o[a];a--)l++;if(a>=0&&l++,s=s.dblp(l),a<0)break;var u=o[a];Uc(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},qc.prototype._wnafMulAdd=function(e,t,n,r,i){var o,s,a,l=this._wnafT1,u=this._wnafT2,c=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===l[f]&&1===l[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Fc(n[f],n[p]);for(h=Math.max(v[0].length,h),c[f]=new Array(h),c[p]=new Array(h),s=0;s=0;o--){for(var _=0;o>=0;){var E=!0;for(s=0;s=0&&_++,w=w.dblp(_),o<0)break;for(s=0;s0?a=u[s][M-1>>1]:M<0&&(a=u[s][-M-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Hc.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=t,s=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:r,b:i},{a:o,b:s}]},Yc.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),l=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(s).sub(a),k2:l.add(u).neg()}},Yc.prototype.pointFromX=function(e,t){(e=new Kc(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Yc.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Yc.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Zc.prototype.isInfinity=function(){return this.inf},Zc.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Zc.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),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)},Zc.prototype.getX=function(){return this.x.fromRed()},Zc.prototype.getY=function(){return this.y.fromRed()},Zc.prototype.mul=function(e){return e=new Kc(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Zc.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Zc.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Zc.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Zc.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},Zc.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Vc(Qc,Wc.BasePoint),Yc.prototype.jpoint=function(e,t,n){return new Qc(this,e,t,n)},Qc.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},Qc.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Qc.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),l=o.redSub(s);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=r.redMul(u),d=l.redSqr().redIAdd(c).redISub(h).redISub(h),f=l.redMul(h.redISub(d)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,f,p)},Qc.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),u=l.redMul(s),c=n.redMul(l),h=a.redSqr().redIAdd(u).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(u)),f=this.z.redMul(s);return this.curve.jpoint(h,d,f)},Qc.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},Qc.prototype.inspect=function(){return this.isInfinity()?"":""},Qc.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Jc=Nc,Xc=Ve,eh=zc,th=Rc;function nh(e){eh.call(this,"mont",e),this.a=new Jc(e.a,16).toRed(this.red),this.b=new Jc(e.b,16).toRed(this.red),this.i4=new Jc(4).toRed(this.red).redInvm(),this.two=new Jc(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Xc(nh,eh);var rh=nh;function ih(e,t,n){eh.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Jc(t,16),this.z=new Jc(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}nh.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},Xc(ih,eh.BasePoint),nh.prototype.decodePoint=function(e,t){return this.point(th.toArray(e,t),1)},nh.prototype.point=function(e,t){return new ih(this,e,t)},nh.prototype.pointFromJSON=function(e){return ih.fromJSON(this,e)},ih.prototype.precompute=function(){},ih.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},ih.fromJSON=function(e,t){return new ih(e,t[0],t[1]||e.one)},ih.prototype.inspect=function(){return this.isInfinity()?"":""},ih.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},ih.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},ih.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},ih.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),s=i.redMul(r),a=t.z.redMul(o.redAdd(s).redSqr()),l=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,l)},ih.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},ih.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},ih.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},ih.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},ih.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},ih.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var oh=Nc,sh=Ve,ah=zc,lh=Rc.assert;function uh(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,ah.call(this,"edwards",e),this.a=new oh(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new oh(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new oh(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),lh(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}sh(uh,ah);var ch=uh;function hh(e,t,n,r,i){ah.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(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 oh(t,16),this.y=new oh(n,16),this.z=r?new oh(r,16):this.curve.one,this.t=i&&new oh(i,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()))))}uh.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},uh.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},uh.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},uh.prototype.pointFromX=function(e,t){(e=new oh(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var a=s.fromRed().isOdd();return(t&&!a||!t&&a)&&(s=s.redNeg()),this.point(e,s)},uh.prototype.pointFromY=function(e,t){(e=new oh(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},uh.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},sh(hh,ah.BasePoint),uh.prototype.pointFromJSON=function(e){return hh.fromJSON(this,e)},uh.prototype.point=function(e,t,n,r){return new hh(this,e,t,n,r)},hh.fromJSON=function(e,t){return new hh(e,t[0],t[1],t[2])},hh.prototype.inspect=function(){return this.isInfinity()?"":""},hh.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},hh.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),s=o.redSub(n),a=r.redSub(t),l=i.redMul(s),u=o.redMul(a),c=i.redMul(a),h=s.redMul(o);return this.curve.point(l,u,h,c)},hh.prototype._projDbl=function(){var e,t,n,r,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(a)).redAdd(l);this.zOne?(e=s.redSub(a).redSub(l).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(l)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(l).redMul(o),t=u.redMul(r.redSub(l)),n=u.redMul(o))}else r=a.redAdd(l),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(a.redISub(l)),n=r.redMul(o);return this.curve.point(e,t,n)},hh.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},hh.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),s=i.redSub(r),a=i.redAdd(r),l=n.redAdd(t),u=o.redMul(s),c=a.redMul(l),h=o.redMul(l),d=s.redMul(a);return this.curve.point(u,c,d,h)},hh.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),l=i.redSub(a),u=i.redAdd(a),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),h=r.redMul(l).redMul(c);return this.curve.twisted?(t=r.redMul(u).redMul(s.redSub(this.curve._mulA(o))),n=l.redMul(u)):(t=r.redMul(u).redMul(s.redSub(o)),n=this.curve._mulC(l).redMul(u)),this.curve.point(h,t,n)},hh.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},hh.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},hh.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},hh.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},hh.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},hh.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},hh.prototype.getX=function(){return this.normalize(),this.x.fromRed()},hh.prototype.getY=function(){return this.normalize(),this.y.fromRed()},hh.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},hh.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},hh.prototype.toP=hh.prototype.normalize,hh.prototype.mixedAdd=hh.prototype.add,function(e){var t=e;t.base=zc,t.short=Gc,t.mont=rh,t.edwards=ch}(Ic);var dh={},fh={},ph={},mh=qs,gh=Ve;function vh(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function yh(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function bh(e){return 1===e.length?"0"+e:e}function wh(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}ph.inherits=gh,ph.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,n[r++]=63&o|128):vh(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},ph.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},ph.rotr32=function(e,t){return e>>>t|e<<32-t},ph.rotl32=function(e,t){return e<>>32-t},ph.sum32=function(e,t){return e+t>>>0},ph.sum32_3=function(e,t,n){return e+t+n>>>0},ph.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},ph.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},ph.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,s=(o>>0,e[t+1]=o},ph.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},ph.sum64_lo=function(e,t,n,r){return t+r>>>0},ph.sum64_4_hi=function(e,t,n,r,i,o,s,a){var l=0,u=t;return l+=(u=u+r>>>0)>>0)>>0)>>0},ph.sum64_4_lo=function(e,t,n,r,i,o,s,a){return t+r+o+a>>>0},ph.sum64_5_hi=function(e,t,n,r,i,o,s,a,l,u){var c=0,h=t;return c+=(h=h+r>>>0)>>0)>>0)>>0)>>0},ph.sum64_5_lo=function(e,t,n,r,i,o,s,a,l,u){return t+r+o+a+u>>>0},ph.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},ph.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},ph.shr64_hi=function(e,t,n){return e>>>n},ph.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var Ah={},_h=ph,Eh=qs;function Mh(){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}Ah.BlockHash=Mh,Mh.prototype.update=function(e,t){if(e=_h.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=_h.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},Sh.g1_256=function(e){return xh(e,17)^xh(e,19)^e>>>10};var Rh=ph,Ph=Ah,Nh=Sh,Lh=Rh.rotl32,Ih=Rh.sum32,Bh=Rh.sum32_5,Dh=Nh.ft_1,jh=Ph.BlockHash,Fh=[1518500249,1859775393,2400959708,3395469782];function Uh(){if(!(this instanceof Uh))return new Uh;jh.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Rh.inherits(Uh,jh);var qh=Uh;Uh.blockSize=512,Uh.outSize=160,Uh.hmacStrength=80,Uh.padLength=64,Uh.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;rthis.blockSize&&(e=(new this.Hash).update(e).digest()),af(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var gf=mf;mf.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},mf.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=ff.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var Af=Nc,_f=Rc,Ef=_f.assert;function Mf(e,t){if(e instanceof Mf)return e;this._importDER(e,t)||(Ef(e.r&&e.s,"Signature without r or s"),this.r=new Af(e.r,16),this.s=new Af(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var kf,Sf,xf=Mf;function Cf(){this.place=0}function Tf(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function Of(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}Mf.prototype._importDER=function(e,t){e=_f.toArray(e,t);var n=new Cf;if(48!==e[n.place++])return!1;var r=Tf(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=Tf(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var s=Tf(e,n);if(!1===s)return!1;if(e.length!==s+n.place)return!1;var a=e.slice(n.place,s+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Af(o),this.s=new Af(a),this.recoveryParam=null,!0},Mf.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=Of(t),n=Of(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Rf(r,t.length),(r=r.concat(t)).push(2),Rf(r,n.length);var i=r.concat(n),o=[48];return Rf(o,i.length),o=o.concat(i),_f.encode(o,e)};var Pf=Rc,Nf=Pf.assert,Lf=Pf.parseBytes,If=Pf.cachedProperty;function Bf(e,t){this.eddsa=e,this._secret=Lf(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Lf(t.pub)}Bf.fromPublic=function(e,t){return t instanceof Bf?t:new Bf(e,{pub:t})},Bf.fromSecret=function(e,t){return t instanceof Bf?t:new Bf(e,{secret:t})},Bf.prototype.secret=function(){return this._secret},If(Bf,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),If(Bf,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),If(Bf,"privBytes",(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),If(Bf,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),If(Bf,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),If(Bf,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Bf.prototype.sign=function(e){return Nf(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Bf.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Bf.prototype.getSecret=function(e){return Nf(this._secret,"KeyPair is public only"),Pf.encode(this.secret(),e)},Bf.prototype.getPublic=function(e){return Pf.encode(this.pubBytes(),e)};var Df=Bf,jf=Nc,Ff=Rc,Uf=Ff.assert,qf=Ff.cachedProperty,zf=Ff.parseBytes;function Hf(e,t){this.eddsa=e,"object"!=typeof t&&(t=zf(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Uf(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof jf&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}qf(Hf,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),qf(Hf,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),qf(Hf,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),qf(Hf,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Hf.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Hf.prototype.toHex=function(){return Ff.encode(this.toBytes(),"hex").toUpperCase()};var Kf=Hf,Vf=fh,Wf=dh,$f=Rc,Yf=$f.assert,Gf=$f.parseBytes,Zf=Df,Qf=Kf;function Jf(e){if(Yf("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Jf))return new Jf(e);e=Wf[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Vf.sha512}var Xf,ep=Jf;function tp(){return Xf||(Xf=1,function(e){var t=Tc;t.version=Oc.version,t.utils=Rc,t.rand=du(),t.curve=Ic,t.curves=dh,t.ec=function(){if(Sf)return kf;Sf=1;var e=Nc,t=gf,n=Rc,r=dh,i=du(),o=n.assert,s=wf,a=xf;function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(o(Object.prototype.hasOwnProperty.call(r,e),"Unknown curve "+e),e=r[e]),e instanceof r.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}return kf=l,l.prototype.keyPair=function(e){return new s(this,e)},l.prototype.keyFromPrivate=function(e,t){return s.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return s.fromPublic(this,e,t)},l.prototype.genKeyPair=function(n){n||(n={});for(var r=new t({hash:this.hash,pers:n.pers,persEnc:n.persEnc||"utf8",entropy:n.entropy||i(this.hash.hmacStrength),entropyEnc:n.entropy&&n.entropyEnc||"utf8",nonce:this.n.toArray()}),o=this.n.byteLength(),s=this.n.sub(new e(2));;){var a=new e(r.generate(o));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},l.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(n,r,i,o){"object"==typeof i&&(o=i,i=null),o||(o={}),r=this.keyFromPrivate(r,i),n=this._truncateToN(new e(n,16));for(var s=this.n.byteLength(),l=r.getPrivate().toArray("be",s),u=n.toArray("be",s),c=new t({hash:this.hash,entropy:l,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new e(1)),d=0;;d++){var f=o.k?o.k(d):new e(c.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(h)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=f.invm(this.n).mul(g.mul(r.getPrivate()).iadd(n));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new a({r:g,s:v,recoveryParam:y})}}}}}},l.prototype.verify=function(t,n,r,i){t=this._truncateToN(new e(t,16)),r=this.keyFromPublic(r,i);var o=(n=new a(n,"hex")).r,s=n.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 l,u=s.invm(this.n),c=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(l=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&l.eqXToP(o):!(l=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===l.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,n,r,i){o((3&r)===r,"The recovery param is more than two bits"),n=new a(n,i);var s=this.n,l=new e(t),u=n.r,c=n.s,h=1&r,d=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");u=d?this.curve.pointFromX(u.add(this.curve.n),h):this.curve.pointFromX(u,h);var f=n.r.invm(s),p=s.sub(l).mul(f).umod(s),m=c.mul(f).umod(s);return this.g.mulAdd(p,u,m)},l.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new a(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")},kf}(),t.eddsa=ep}()),Tc}Jf.prototype.sign=function(e,t){e=Gf(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),a=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},Jf.prototype.verify=function(e,t,n){e=Gf(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},Jf.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(ip,oe);var op,sp=ip.exports,ap={},lp={},up=ce,cp=up.Buffer,hp={};for(op in up)up.hasOwnProperty(op)&&"SlowBuffer"!==op&&"Buffer"!==op&&(hp[op]=up[op]);var dp=hp.Buffer={};for(op in cp)cp.hasOwnProperty(op)&&"allocUnsafe"!==op&&"allocUnsafeSlow"!==op&&(dp[op]=cp[op]);if(hp.Buffer.prototype=cp.prototype,dp.from&&dp.from!==Uint8Array.from||(dp.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return cp(e,t,n)}),dp.alloc||(dp.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=cp(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!hp.kStringMaxLength)try{hp.kStringMaxLength=Be.binding("buffer").kStringMaxLength}catch(i){}hp.constants||(hp.constants={MAX_LENGTH:hp.kMaxLength},hp.kStringMaxLength&&(hp.constants.MAX_STRING_LENGTH=hp.kStringMaxLength));var fp=hp,pp={};const mp=Ve;function gp(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function vp(e,t){this.path=e,this.rethrow(t)}pp.Reporter=gp,gp.prototype.isError=function(e){return e instanceof vp},gp.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},gp.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},gp.prototype.enterKey=function(e){return this._reporterState.path.push(e)},gp.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},gp.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},gp.prototype.path=function(){return this._reporterState.path.join("/")},gp.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},gp.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},gp.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof vp;if(t=r?e:new vp(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},gp.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},mp(vp,Error),vp.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,vp),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var yp={};const bp=Ve,wp=pp.Reporter,Ap=fp.Buffer;function _p(e,t){wp.call(this,t),Ap.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function Ep(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return Ep.isEncoderBuffer(e)||(e=new Ep(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=Ap.byteLength(e);else{if(!Ap.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}bp(_p,wp),yp.DecoderBuffer=_p,_p.isDecoderBuffer=function(e){return e instanceof _p||"object"==typeof e&&Ap.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},_p.prototype.save=function(){return{offset:this.offset,reporter:wp.prototype.save.call(this)}},_p.prototype.restore=function(e){const t=new _p(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,wp.prototype.restore.call(this,e.reporter),t},_p.prototype.isEmpty=function(){return this.offset===this.length},_p.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},_p.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new _p(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},_p.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},yp.EncoderBuffer=Ep,Ep.isEncoderBuffer=function(e){return e instanceof Ep||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},Ep.prototype.join=function(e,t){return e||(e=Ap.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):Ap.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const Mp=pp.Reporter,kp=yp.EncoderBuffer,Sp=yp.DecoderBuffer,xp=qs,Cp=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],Tp=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(Cp);function Op(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var Rp=Op;const Pp=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Op.prototype.clone=function(){const e=this._baseState,t={};Pp.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},Op.prototype._wrap=function(){const e=this._baseState;Tp.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},Op.prototype._init=function(e){const t=this._baseState;xp(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),xp.equal(t.children.length,1,"Root node can have only one child")},Op.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(xp(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(xp(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){Op.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),Cp.forEach((function(e){Op.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return xp(null===t.tag),t.tag=e,this._useArgs(n),this}})),Op.prototype.use=function(e){xp(e);const t=this._baseState;return xp(null===t.use),t.use=e,this},Op.prototype.optional=function(){return this._baseState.optional=!0,this},Op.prototype.def=function(e){const t=this._baseState;return xp(null===t.default),t.default=e,t.optional=!0,this},Op.prototype.explicit=function(e){const t=this._baseState;return xp(null===t.explicit&&null===t.implicit),t.explicit=e,this},Op.prototype.implicit=function(e){const t=this._baseState;return xp(null===t.explicit&&null===t.implicit),t.implicit=e,this},Op.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Op.prototype.key=function(e){const t=this._baseState;return xp(null===t.key),t.key=e,this},Op.prototype.any=function(){return this._baseState.any=!0,this},Op.prototype.choice=function(e){const t=this._baseState;return xp(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},Op.prototype.contains=function(e){const t=this._baseState;return xp(null===t.use),t.contains=e,this},Op.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,s=null;if(null!==n.key&&(s=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{const r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new Sp(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==s&&e.exitKey(s):e.leaveKey(s,n.key,i),i},Op.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},Op.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),xp(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},Op.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const s=e.save(),a=n.choice[o];try{const n=a._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(s),!1}return!0}),this),i?r:e.error("Choice not matched")},Op.prototype._createEncoderBuffer=function(e){return new kp(e,this.reporter)},Op.prototype._encode=function(e,t,n){const r=this._baseState;if(null!==r.default&&r.default===e)return;const i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},Op.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new Mp);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,s=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),s=!0;else if(r.children)o=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(n){const r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)}),n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),s=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,s,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},Op.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||xp(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},Op.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Op.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},Op.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Np={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(Np);const Lp=Ve,Ip=fp.Buffer,Bp=Rp,Dp=Np;function jp(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new Up,this.tree._init(e.body)}var Fp=jp;function Up(e){Bp.call(this,"der",e)}function qp(e){return e<10?"0"+e:e}jp.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},Lp(Up,Bp),Up.prototype._encodeComposite=function(e,t,n,r){const i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),Dp.tagByName.hasOwnProperty(e))i=Dp.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=Dp.tagClassByName[n||"universal"]<<6,i)}(e,t,n,this.reporter);if(r.length<128){const e=Ip.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const s=Ip.alloc(2+o);s[0]=i,s[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)s[e]=255&t;return this._createEncoderBuffer([s,r])},Up.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=Ip.alloc(2*e.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t=128;n>>=7)r++}const i=Ip.alloc(r);let o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},Up.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return"gentime"===t?n=[qp(r.getUTCFullYear()),qp(r.getUTCMonth()+1),qp(r.getUTCDate()),qp(r.getUTCHours()),qp(r.getUTCMinutes()),qp(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[qp(r.getUTCFullYear()%100),qp(r.getUTCMonth()+1),qp(r.getUTCDate()),qp(r.getUTCHours()),qp(r.getUTCMinutes()),qp(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},Up.prototype._encodeNull=function(){return this._createEncoderBuffer("")},Up.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!Ip.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=Ip.from(t)}if(Ip.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=Ip.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const r=new Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(Ip.from(r))},Up.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},Up.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},Up.prototype._skipDefault=function(e,t,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:Zp.tag[n]}}function tm(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Zm,oe);var Qm,Jm,Xm=Zm.exports,eg={},tg=Fo,ng=Fe.Buffer,rg=function(e,t){for(var n,r=ng.alloc(0),i=0;r.length=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[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(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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,l="le"===t,u=new e(o),c=this.clone();if(l){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),u[a]=s;for(;a=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,A=b>>>13,_=0|s[4],E=8191&_,M=_>>>13,k=0|s[5],S=8191&k,x=k>>>13,C=0|s[6],T=8191&C,O=C>>>13,R=0|s[7],P=8191&R,N=R>>>13,L=0|s[8],I=8191&L,B=L>>>13,D=0|s[9],j=8191&D,F=D>>>13,U=0|a[0],q=8191&U,z=U>>>13,H=0|a[1],K=8191&H,V=H>>>13,W=0|a[2],$=8191&W,Y=W>>>13,G=0|a[3],Z=8191&G,Q=G>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ue=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,o=Math.imul(m,z);var ve=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(y,q)|0,o=Math.imul(y,z),r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,o=Math.imul(A,z),r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,z))+Math.imul(M,q)|0,o=Math.imul(M,z),r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Q)|0;var we=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,o=Math.imul(x,z),r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Q)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(O,q)|0,o=Math.imul(O,z),r=r+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,Q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(u+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,o=Math.imul(N,z),r=r+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Q)|0,r=r+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(u+(r=r+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(B,q)|0,o=Math.imul(B,z),r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,Q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,ue)|0;var Me=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(F,q)|0,o=Math.imul(F,z),r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,Y)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Q)|0,r=r+Math.imul(S,X)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var ke=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(F,K)|0,o=Math.imul(F,V),r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,r=r+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,Q)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ue)|0,r=r+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Se=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(F,$)|0,o=Math.imul(F,Y),r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Q)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,ue)|0,r=r+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var xe=(u+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,Z),i=(i=Math.imul(j,Q))+Math.imul(F,Z)|0,o=Math.imul(F,Q),r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,ue)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ce=(u+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(T,le)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Te=(u+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,ue)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(B,le)|0,o=o+Math.imul(B,ue)|0,r=r+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Re=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,le),i=(i=Math.imul(j,ue))+Math.imul(F,le)|0,o=Math.imul(F,ue),r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Pe=(u+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(N,pe)|0))<<13)|0;u=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Ne=(u+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Le=(u+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,l[0]=ge,l[1]=ve,l[2]=ye,l[3]=be,l[4]=we,l[5]=Ae,l[6]=_e,l[7]=Ee,l[8]=Me,l[9]=ke,l[10]=Se,l[11]=xe,l[12]=Ce,l[13]=Te,l[14]=Oe,l[15]=Re,l[16]=Pe,l[17]=Ne,l[18]=Le,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?f(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&a}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,l=r.length-o.length;if("mod"!==t){(a=new i(null)).length=l+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(c),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(l)):(r.isub(t),a.isub(o),l.isub(s))}return{a,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),l=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var h=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===c)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(sg,oe);var ag=sg.exports,lg=ag,ug=Fe.Buffer,cg=function(e,t){return ug.from(e.toRed(lg.mont(t.modulus)).redPow(new lg(t.publicExponent)).fromRed().toArray())},hg=zm,dg=He,fg=Fo,pg=rg,mg=og,gg=ag,vg=cg,yg=Cc,bg=Fe.Buffer,wg=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=hg(e);if(4===r)i=function(e,t){var n=e.modulus.byteLength(),r=t.length,i=fg("sha1").update(bg.alloc(0)).digest(),o=i.length,s=2*o;if(r>n-s-2)throw new Error("message too long");var a=bg.alloc(n-r-s-2),l=n-o-1,u=dg(o),c=mg(bg.concat([i,a,bg.alloc(1,1),t],l),pg(u,l)),h=mg(u,pg(c,o));return new gg(bg.concat([bg.alloc(1),h,c],n))}(o,t);else if(1===r)i=function(e,t,n){var r,i=t.length,o=e.modulus.byteLength();if(i>o-11)throw new Error("message too long");return r=n?bg.alloc(o-i-3,255):function(e){for(var t,n=bg.allocUnsafe(e),r=0,i=dg(2*e),o=0;r=0)throw new Error("data too long for modulus")}return n?yg(i,o):vg(i,o)},Ag=zm,_g=rg,Eg=og,Mg=ag,kg=Cc,Sg=Fo,xg=cg,Cg=Fe.Buffer,Tg=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=Ag(e),s=o.modulus.byteLength();if(t.length>s||new Mg(t).cmp(o.modulus)>=0)throw new Error("decryption error");i=n?xg(new Mg(t),o):kg(t,o);var a=Cg.alloc(s-i.length);if(i=Cg.concat([a,i],s),4===r)return function(e,t){var n=e.modulus.byteLength(),r=Sg("sha1").update(Cg.alloc(0)).digest(),i=r.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),s=t.slice(i+1),a=Eg(o,_g(s,i)),l=Eg(s,_g(a,n-i-1));if(function(e,t){e=Cg.from(e),t=Cg.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i=t.length){o++;break}var s=t.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return t.slice(i)}(0,i,n);if(3===r)return i;throw new Error("unknown padding")};!function(e){e.publicEncrypt=wg,e.privateDecrypt=Tg,e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}}(eg);var Og={};function Rg(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var Pg,Ng=Fe,Lg=Ng.Buffer,Ig=Ng.kMaxLength,Bg=oe.crypto||oe.msCrypto,Dg=Math.pow(2,32)-1;function jg(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>Dg||e<0)throw new TypeError("offset must be a uint32");if(e>Ig||e>t)throw new RangeError("offset out of range")}function Fg(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>Dg||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>Ig)throw new RangeError("buffer too small")}function Ug(e,t,n,r){var i=e.buffer,o=new Uint8Array(i,t,n);return Bg.getRandomValues(o),r?void Ee((function(){r(null,e)})):e}function qg(){if(Pg)return he;Pg=1,he.randomBytes=he.rng=he.pseudoRandomBytes=he.prng=He,he.createHash=he.Hash=Fo,he.createHmac=he.Hmac=rs;var e=os,t=Object.keys(e),n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);he.getHashes=function(){return n};var r=ss;he.pbkdf2=r.pbkdf2,he.pbkdf2Sync=r.pbkdf2Sync;var i=Is;he.Cipher=i.Cipher,he.createCipher=i.createCipher,he.Cipheriv=i.Cipheriv,he.createCipheriv=i.createCipheriv,he.Decipher=i.Decipher,he.createDecipher=i.createDecipher,he.Decipheriv=i.Decipheriv,he.createDecipheriv=i.createDecipheriv,he.getCiphers=i.getCiphers,he.listCiphers=i.listCiphers;var o=function(){if(vu)return tu;vu=1;var e=pu(),t=wu,n=function(){if(gu)return mu;gu=1;var e=ru,t=new(fu()),n=new e(24),r=new e(11),i=new e(10),o=new e(3),s=new e(7),a=pu(),l=He;function u(t,n){return n=n||"utf8",ne(t)||(t=new b(t,n)),this._pub=new e(t),this}function c(t,n){return n=n||"utf8",ne(t)||(t=new b(t,n)),this._priv=new e(t),this}mu=d;var h={};function d(t,n,r){this.setGenerator(n),this.__prime=new e(t),this._prime=e.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=u,this.setPrivateKey=c):this._primeCode=8}function f(e,t){var n=new b(e.toArray());return t?n.toString(t):n}return Object.defineProperty(d.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,l){var u=l.toString("hex"),c=[u,e.toString(16)].join("_");if(c in h)return h[c];var d,f=0;if(e.isEven()||!a.simpleSieve||!a.fermatTest(e)||!t.test(e))return f+=1,f+="02"===u||"05"===u?8:4,h[c]=f,f;switch(t.test(e.shrn(1))||(f+=2),u){case"02":e.mod(n).cmp(r)&&(f+=8);break;case"05":(d=e.mod(i)).cmp(o)&&d.cmp(s)&&(f+=8);break;default:f+=4}return h[c]=f,f}(this.__prime,this.__gen)),this._primeCode}}),d.prototype.generateKeys=function(){return this._priv||(this._priv=new e(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},d.prototype.computeSecret=function(t){var n=new b((t=(t=new e(t)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),r=this.getPrime();if(n.length0&&n.ishrn(r),n}function u(n,r,i){var o,s;do{for(o=e.alloc(0);8*o.length=t)throw new Error("invalid sig")}return Vm=function(s,a,l,u,c){var h=r(l);if("ec"===h.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(e,t,r){var o=i[r.data.algorithm.curve.join(".")];if(!o)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var s=new n(o),a=r.data.subjectPrivateKey.data;return s.verify(t,e,a)}(s,a,h)}if("dsa"===h.type){if("dsa"!==u)throw new Error("wrong public key type");return function(e,n,i){var s=i.data.p,a=i.data.q,l=i.data.g,u=i.data.pub_key,c=r.signature.decode(e,"der"),h=c.s,d=c.r;o(h,a),o(d,a);var f=t.mont(s),p=h.invm(a);return 0===l.toRed(f).redPow(new t(n).mul(p).mod(a)).fromRed().mul(u.toRed(f).redPow(d.mul(p).mod(a)).fromRed()).mod(s).mod(a).cmp(d)}(s,a,h)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");a=e.concat([c,a]);for(var d=h.modulus.byteLength(),f=[1],p=0;a.length+f.length+2{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=Vg[e];return void 0===t&&(t=Hg(e).digest().length,Vg[e]=t),t}}},$g=(e,t,n,r)=>{const i=zg.isBuffer(n)?n:zg.from(n),o=r&&r.length?zg.from(r):zg.alloc(t,0);return Kg(e,o).update(i).digest()},Yg=(e,t,n,r,i)=>{const o=zg.isBuffer(i)?i:zg.from(i||""),s=o.length,a=Math.ceil(r/t);if(a>255)throw new Error(`OKM length ${r} is too long for ${e} hash`);const l=zg.alloc(t*a+s+1);for(let r=1,i=0,u=0;r<=a;++r)o.copy(l,u),l[u+s]=r,Kg(e,n).update(l.slice(i,u+s+1)).digest().copy(l,u),i=u,u+=t;return l.slice(0,r)};function Gg(e,t,{salt:n="",info:r="",hash:i="SHA-256"}={}){i=i.toLowerCase().replace("-","");const o=Wg(i),s=$g(i,o,e,n);return Yg(i,o,s,t,r)}Object.defineProperties(Gg,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:Wg},extract:{configurable:!1,enumerable:!1,writable:!1,value:$g},expand:{configurable:!1,enumerable:!1,writable:!1,value:Yg}});var Zg=Gg;const Qg="Impossible case. Please create issue.",Jg="The tweak was out of range or the resulted private key is invalid",Xg="The tweak was out of range or equal to zero",ev="Public Key could not be parsed",tv="Public Key serialization error",nv="Signature could not be parsed";function rv(e,t){if(!e)throw new Error(t)}function iv(e,t,n){if(rv(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;rv(n.includes(t.length),r)}else{const r=`Expected ${e} to be an Uint8Array with length ${n}`;rv(t.length===n,r)}}function ov(e){rv("Boolean"===av(e),"Expected compressed to be a Boolean")}function sv(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),iv("output",e,t),e}function av(e){return Object.prototype.toString.call(e).slice(8,-1)}const lv=new(tp().ec)("secp256k1"),uv=lv.curve,cv=uv.n.constructor;function hv(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let n=new cv(t);if(n.cmp(uv.p)>=0)return null;n=n.toRed(uv.red);let r=n.redSqr().redIMul(n).redIAdd(uv.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),lv.keyPair({pub:{x:n,y:r}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){let r=new cv(t),i=new cv(n);if(r.cmp(uv.p)>=0||i.cmp(uv.p)>=0)return null;if(r=r.toRed(uv.red),i=i.toRed(uv.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(uv.b)).isZero()?lv.keyPair({pub:{x:r,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function dv(e,t){const n=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){const t=new cv(e);return t.cmp(uv.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new cv(e),n=uv.n.sub(t).umod(uv.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){const n=new cv(t);if(n.cmp(uv.n)>=0)return 1;if(n.iadd(new cv(e)),n.cmp(uv.n)>=0&&n.isub(uv.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new cv(t);if(n.cmp(uv.n)>=0||n.isZero())return 1;n.imul(new cv(e)),n.cmp(uv.n)>=0&&(n=n.umod(uv.n));const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>null===hv(e)?1:0,publicKeyCreate(e,t){const n=new cv(t);return n.cmp(uv.n)>=0||n.isZero()?1:(dv(e,lv.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const n=hv(t);return null===n?1:(dv(e,n.getPublic()),0)},publicKeyNegate(e,t){const n=hv(t);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),dv(e,r),0},publicKeyCombine(e,t){const n=new Array(t.length);for(let e=0;e=0)return 2;const i=r.getPublic().add(uv.g.mul(n));return i.isInfinity()?2:(dv(e,i),0)},publicKeyTweakMul(e,t,n){const r=hv(t);return null===r?1:(n=new cv(n)).cmp(uv.n)>=0||n.isZero()?2:(dv(e,r.getPublic().mul(n)),0)},signatureNormalize(e){const t=new cv(e.subarray(0,32)),n=new cv(e.subarray(32,64));return t.cmp(uv.n)>=0||n.cmp(uv.n)>=0?1:(1===n.cmp(lv.nh)&&e.set(uv.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const n=t.subarray(0,32),r=t.subarray(32,64);if(new cv(n).cmp(uv.n)>=0)return 1;if(new cv(r).cmp(uv.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let l=i.subarray(39,72);l[0]=0,l.set(r,1);let u=33,c=0;for(;u>1&&0===l[c]&&!(128&l[c+1]);--u,++c);return l=l.subarray(c),128&l[0]||u>1&&0===l[0]&&!(128&l[1])?1:(e.outputlen=6+s+u,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=l.length,i.set(l,6+s),0)},signatureImport(e,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;const n=t[3];if(0===n)return 1;if(5+n>=t.length)return 1;if(2!==t[4+n])return 1;const r=t[5+n];if(0===r)return 1;if(6+n+r!==t.length)return 1;if(128&t[4])return 1;if(n>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[n+6])return 1;if(r>1&&0===t[n+6]&&!(128&t[n+7]))return 1;let i=t.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new cv(i);s.cmp(uv.n)>=0&&(s=new cv(0));let a=new cv(t.subarray(6+n));return a.cmp(uv.n)>=0&&(a=new cv(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,i){if(i){const e=i;i=i=>{const o=e(t,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new cv(o)}}const o=new cv(n);if(o.cmp(uv.n)>=0||o.isZero())return 1;let s;try{s=lv.sign(t,n,{canonical:!0,k:i,pers:r})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,n){const r={r:e.subarray(0,32),s:e.subarray(32,64)},i=new cv(r.r),o=new cv(r.s);if(i.cmp(uv.n)>=0||o.cmp(uv.n)>=0)return 1;if(1===o.cmp(lv.nh)||i.isZero()||o.isZero())return 3;const s=hv(n);if(null===s)return 2;const a=s.getPublic();return lv.verify(t,r,a)?0:3},ecdsaRecover(e,t,n,r){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new cv(i.r),s=new cv(i.s);if(o.cmp(uv.n)>=0||s.cmp(uv.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=lv.recoverPubKey(r,i,n)}catch(e){return 2}return dv(e,a),0},ecdh(e,t,n,r,i,o,s){const a=hv(t);if(null===a)return 1;const l=new cv(n);if(l.cmp(uv.n)>=0||l.isZero())return 2;const u=a.getPublic().mul(l);if(void 0===i){const t=u.encode(null,!0),n=lv.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=n[t]}else{o||(o=new Uint8Array(32));const t=u.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const n=u.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=n[e];const a=i(o,s,r);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},pv=(e=>({contextRandomize(t){if(rv(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&iv("seed",t,32),1===e.contextRandomize(t))throw new Error("Unknow error on context randomization")},privateKeyVerify:t=>(iv("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(iv("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Qg)}},privateKeyTweakAdd(t,n){switch(iv("private key",t,32),iv("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error(Jg)}},privateKeyTweakMul(t,n){switch(iv("private key",t,32),iv("tweak",n,32),e.privateKeyTweakMul(t,n)){case 0:return t;case 1:throw new Error(Xg)}},publicKeyVerify:t=>(iv("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,n=!0,r){switch(iv("private key",t,32),ov(n),r=sv(r,n?33:65),e.publicKeyCreate(r,t)){case 0:return r;case 1:throw new Error("Private Key is invalid");case 2:throw new Error(tv)}},publicKeyConvert(t,n=!0,r){switch(iv("public key",t,[33,65]),ov(n),r=sv(r,n?33:65),e.publicKeyConvert(r,t)){case 0:return r;case 1:throw new Error(ev);case 2:throw new Error(tv)}},publicKeyNegate(t,n=!0,r){switch(iv("public key",t,[33,65]),ov(n),r=sv(r,n?33:65),e.publicKeyNegate(r,t)){case 0:return r;case 1:throw new Error(ev);case 2:throw new Error(Qg);case 3:throw new Error(tv)}},publicKeyCombine(t,n=!0,r){rv(Array.isArray(t),"Expected public keys to be an Array"),rv(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)iv("public key",e,[33,65]);switch(ov(n),r=sv(r,n?33:65),e.publicKeyCombine(r,t)){case 0:return r;case 1:throw new Error(ev);case 2:throw new Error("The sum of the public keys is not valid");case 3:throw new Error(tv)}},publicKeyTweakAdd(t,n,r=!0,i){switch(iv("public key",t,[33,65]),iv("tweak",n,32),ov(r),i=sv(i,r?33:65),e.publicKeyTweakAdd(i,t,n)){case 0:return i;case 1:throw new Error(ev);case 2:throw new Error(Jg)}},publicKeyTweakMul(t,n,r=!0,i){switch(iv("public key",t,[33,65]),iv("tweak",n,32),ov(r),i=sv(i,r?33:65),e.publicKeyTweakMul(i,t,n)){case 0:return i;case 1:throw new Error(ev);case 2:throw new Error(Xg)}},signatureNormalize(t){switch(iv("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(nv)}},signatureExport(t,n){iv("signature",t,64);const r={output:n=sv(n,72),outputlen:72};switch(e.signatureExport(r,t)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(nv);case 2:throw new Error(Qg)}},signatureImport(t,n){switch(iv("signature",t),n=sv(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(nv);case 2:throw new Error(Qg)}},ecdsaSign(t,n,r={},i){iv("message",t,32),iv("private key",n,32),rv("Object"===av(r),"Expected options to be an Object"),void 0!==r.data&&iv("options.data",r.data),void 0!==r.noncefn&&rv("Function"===av(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=sv(i,64),recid:null};switch(e.ecdsaSign(o,t,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error("The nonce generation function failed, or the private key was invalid");case 2:throw new Error(Qg)}},ecdsaVerify(t,n,r){switch(iv("signature",t,64),iv("message",n,32),iv("public key",r,[33,65]),e.ecdsaVerify(t,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(nv);case 2:throw new Error(ev)}},ecdsaRecover(t,n,r,i=!0,o){switch(iv("signature",t,64),rv("Number"===av(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),iv("message",r,32),ov(i),o=sv(o,i?33:65),e.ecdsaRecover(o,t,n,r)){case 0:return o;case 1:throw new Error(nv);case 2:throw new Error("Public key could not be recover");case 3:throw new Error(Qg)}},ecdh(t,n,r={},i){switch(iv("public key",t,[33,65]),iv("private key",n,32),rv("Object"===av(r),"Expected options to be an Object"),void 0!==r.data&&iv("options.data",r.data),void 0!==r.hashfn?(rv("Function"===av(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&iv("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&iv("options.ybuf",r.ybuf,32),iv("output",i)):i=sv(i,32),e.ecdh(i,t,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(ev);case 2:throw new Error("Scalar was invalid (zero or overflow)")}}}))(fv),mv={},gv={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SECRET_KEY_LENGTH=e.AES_IV_PLUS_TAG_LENGTH=e.AES_TAG_LENGTH=e.AES_IV_LENGTH=e.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,e.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,e.AES_IV_LENGTH=16,e.AES_TAG_LENGTH=16,e.AES_IV_PLUS_TAG_LENGTH=e.AES_IV_LENGTH+e.AES_TAG_LENGTH,e.SECRET_KEY_LENGTH=32}(gv);var vv=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mv,"__esModule",{value:!0}),mv.aesDecrypt=mv.aesEncrypt=mv.getValidSecret=mv.decodeHex=mv.remove0x=void 0;var yv=qg(),bv=vv(pv),wv=gv;function Av(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}mv.remove0x=Av,mv.decodeHex=function(e){return b.from(Av(e),"hex")},mv.getValidSecret=function(){var e;do{e=(0,yv.randomBytes)(wv.SECRET_KEY_LENGTH)}while(!bv.default.privateKeyVerify(e));return e},mv.aesEncrypt=function(e,t){var n=(0,yv.randomBytes)(wv.AES_IV_LENGTH),r=(0,yv.createCipheriv)("aes-256-gcm",e,n),i=b.concat([r.update(t),r.final()]),o=r.getAuthTag();return b.concat([n,o,i])},mv.aesDecrypt=function(e,t){var n=t.slice(0,wv.AES_IV_LENGTH),r=t.slice(wv.AES_IV_LENGTH,wv.AES_IV_PLUS_TAG_LENGTH),i=t.slice(wv.AES_IV_PLUS_TAG_LENGTH),o=(0,yv.createDecipheriv)("aes-256-gcm",e,n);return o.setAuthTag(r),b.concat([o.update(i),o.final()])};var _v={},Ev=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_v,"__esModule",{value:!0});var Mv=Ev(Zg),kv=Ev(pv),Sv=mv,xv=gv,Cv=function(){function e(e){this.uncompressed=b.from(kv.default.publicKeyConvert(e,!1)),this.compressed=b.from(kv.default.publicKeyConvert(e,!0))}return e.fromHex=function(t){var n=(0,Sv.decodeHex)(t);if(n.length===xv.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=b.from([4]);return new e(b.concat([r,n]))}return new e(n)},e.prototype.toHex=function(e){return void 0===e&&(e=!0),e?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(e){var t=b.concat([this.uncompressed,e.multiply(this)]);return(0,Mv.default)(t,32,{hash:"SHA-256"})},e.prototype.equals=function(e){return this.uncompressed.equals(e.uncompressed)},e}();_v.default=Cv;var Tv=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ue,"__esModule",{value:!0});var Ov=Tv(Zg),Rv=Tv(pv),Pv=mv,Nv=Tv(_v),Lv=function(){function e(e){if(this.secret=e||(0,Pv.getValidSecret)(),!Rv.default.privateKeyVerify(this.secret))throw new Error("Invalid private key");this.publicKey=new Nv.default(b.from(Rv.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,Pv.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(e){var t=b.concat([this.publicKey.uncompressed,this.multiply(e)]);return(0,Ov.default)(t,32,{hash:"SHA-256"})},e.prototype.multiply=function(e){return b.from(Rv.default.publicKeyTweakMul(e.compressed,this.secret,!1))},e.prototype.equals=function(e){return this.secret.equals(e.secret)},e}();ue.default=Lv,function(e){var t=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=ue;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t(n).default}});var r=_v;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return t(r).default}})}(le),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.decrypt=e.encrypt=void 0;var t=le,n=mv,r=gv;e.encrypt=function(e,r){var i=new t.PrivateKey,o=e instanceof b?new t.PublicKey(e):t.PublicKey.fromHex(e),s=i.encapsulate(o),a=(0,n.aesEncrypt)(s,r);return b.concat([i.publicKey.uncompressed,a])},e.decrypt=function(e,i){var o=e instanceof b?new t.PrivateKey(e):t.PrivateKey.fromHex(e),s=new t.PublicKey(i.slice(0,r.UNCOMPRESSED_PUBLIC_KEY_SIZE)),a=i.slice(r.UNCOMPRESSED_PUBLIC_KEY_SIZE),l=s.decapsulate(o);return(0,n.aesDecrypt)(l,a)};var i=le;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return i.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return i.PublicKey}}),e.utils={aesDecrypt:n.aesDecrypt,aesEncrypt:n.aesEncrypt,decodeHex:n.decodeHex,getValidSecret:n.getValidSecret,remove0x:n.remove0x}}(ae);class Iv{constructor(e){this.enabled=!0,this.debug=!1,(null==e?void 0:e.debug)&&(this.debug=e.debug),(null==e?void 0:e.pkey)?this.ecies=ae.PrivateKey.fromHex(e.pkey):this.ecies=new ae.PrivateKey,this.debug&&(console.info("[ECIES] initialized secret: ",this.ecies.toHex()),console.info("[ECIES] initialized public: ",this.ecies.publicKey.toHex()),console.info("[ECIES] init with",this))}generateECIES(){this.ecies=new ae.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{const r=b.from(e),i=ae.encrypt(t,r);n=b.from(i).toString("base64")}catch(n){throw this.debug&&(console.error("error encrypt:",n),console.error("private: ",this.ecies.toHex()),console.error("data: ",e),console.error("otherkey: ",t)),n}return n}decrypt(e){let t=e;if(this.enabled)try{const n=b.from(e.toString(),"base64");t=ae.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw this.debug&&(console.error("error decrypt",t),console.error("private: ",this.ecies.toHex()),console.error("encryptedData: ",e)),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){console.debug("ECIES::toString()",this.getKeyInfo())}}function Bv(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))}var Dv={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof Be&&!0,o="function"==typeof Symbol,s="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,l=o?s&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function u(){this._events={},this._conf&&c.call(this,this._conf)}function c(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function h(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==Be&&Be.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,Be.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function f(e,n){for(var r={},i=e.length,o=n?n.length:0,s=0;s0;)if(o===e[s])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=d.apply(null,arguments),s={data:r,name:t,original:e};n?!1!==n.call(i,s)&&o.emit.apply(o,[s.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=l(o)).length;r-- >0;)e=n[r],a.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),b=v(["object","function"]);function w(e,t,n){var r,i,o,s=0,a=new e((function(l,u,c){function h(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var d=function(e){h(),l(e)},f=function(e){h(),u(e)};r?t(d,f,c):(i=[function(e){f(e||Error("canceled"))}],t(d,f,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),u(e)}),n.timeout))}));return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(f=y[a])&&(b=_(e,t,n[f],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(w=_(e,t,n,i,i)),a=(y=l(n)).length;a-- >0;)"_listeners"!==(f=y[a])&&("*"===f||"**"===f?(n[f]._listeners&&!v&&(b=_(e,t,n[f],i,i))&&(w?w.push.apply(w,b):w=b),b=_(e,t,n[f],r,i)):b=_(e,t,n[f],f===E?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=_(e,t,n[A],r+1,i))}if((p=n["*"])&&_(e,t,p,r+1,i),m=n["**"])if(r0;)"_listeners"!==(f=y[a])&&(f===E?_(e,t,m[f],r+2,i):f===A?_(e,t,m[f],r+1,i):((g={})[f]=m[f],_(e,t,{"**":g},r+1,i)));else m._listeners?_(e,t,m,i,i):m["*"]&&m["*"]._listeners&&_(e,t,m["*"],i,i);return w}function E(e,t,n){var r,i,o=0,s=0,a=this.delimiter,l=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+l}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+10&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,u))):c._listeners=t,!0;return!0}function M(e,t,n,r){for(var i,o,s,a,u=l(e),c=u.length,h=e._listeners;c-- >0;)i=e[o=u[c]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,h&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&M.call(this,i,t,s,a);return t}function k(e){for(var t,n,r,i=l(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||k(t)||delete e[n]);return r}function S(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)s=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,s=r.promisify,l=r.nextTick,u=r.objectify}if(o||l||s){var c=n,h=n._origin||n;if(l&&!i)throw Error("process.nextTick is not supported");s===t&&(s="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise((function(e){a(e)})).then((function(){return t.event=n,c.apply(t,e)})):(l?Ee:a)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=h}return[n,u?new S(this,e,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}S.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,s=A.call(o,e);n=-1===s?new p(o,e,i):o._observers[s];for(var a,u=l(t),c=u.length,h="function"==typeof r,d=0;d0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,n,r,i,s,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,o)for(r=0;r3)for(t=new Array(h-1),i=1;i3)for(n=new Array(d-1),s=1;s0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=n,s)},C.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=a[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var u=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,u,c,s,0),u}return a&&(r=a[e])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?M.call(this,this.listenerTree,[],null,e):t?l(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?l(i).length:i[e]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),w((n=m(n,{timeout:0,filter:t,handleError:!1,Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function s(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,s),n.handleError){var a=arguments[0];a?i(a):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}o((function(){r.off(e,s)})),r._on(e,s,!1)}),{timeout:n.timeout,overload:n.overload})};var T=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return T._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");T._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return w((n=m(n,{Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(d.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return C})):e.exports=C}()}(Dv);var jv,Fv=Dv.exports,Uv=new Uint8Array(16);function qv(){if(!jv&&!(jv="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jv(Uv)}var zv=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Hv(e){return"string"==typeof e&&zv.test(e)}for(var Kv=[],Vv=0;Vv<256;++Vv)Kv.push((Vv+256).toString(16).substr(1));function Wv(e,t,n){var r=(e=e||{}).random||(e.rng||qv)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Kv[e[t+0]]+Kv[e[t+1]]+Kv[e[t+2]]+Kv[e[t+3]]+"-"+Kv[e[t+4]]+Kv[e[t+5]]+"-"+Kv[e[t+6]]+Kv[e[t+7]]+"-"+Kv[e[t+8]]+Kv[e[t+9]]+"-"+Kv[e[t+10]]+Kv[e[t+11]]+Kv[e[t+12]]+Kv[e[t+13]]+Kv[e[t+14]]+Kv[e[t+15]]).toLowerCase();if(!Hv(n))throw TypeError("Stringified UUID is invalid");return n}(r)}var $v="0.3.2",Yv={exports:{}};!function(e,t){var n="undefined"!=typeof self?self:oe,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=f(this);if(e)return e;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?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,r=f(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];A.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new b(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new A(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.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(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",l)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=d,e.Request=b,e.Response=A),t.Headers=d,t.Request=b,t.Response=A,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Yv,Yv.exports);var Gv=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Yv.exports);const Zv=(e,t)=>Bv(void 0,void 0,void 0,(function*(){const n=t.endsWith("/")?`${t}debug`:`${t}/debug`,r=JSON.stringify(e),i=yield Gv(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r});return yield i.text()})),Qv="https://metamask-sdk-socket.metafi.codefi.network/",Jv=["polling","websocket"],Xv=6048e5,ey=Object.create(null);ey.open="0",ey.close="1",ey.ping="2",ey.pong="3",ey.message="4",ey.upgrade="5",ey.noop="6";const ty=Object.create(null);Object.keys(ey).forEach((e=>{ty[ey[e]]=e}));const ny={type:"error",data:"parser error"},ry="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),iy="function"==typeof ArrayBuffer,oy=({type:e,data:t},n,r)=>{return ry&&t instanceof Blob?n?r(t):sy(t,r):iy&&(t instanceof ArrayBuffer||(i=t,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer))?n?r(t):sy(new Blob([t]),r):r(ey[e]+(t||""));var i},sy=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)},ay="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)ay["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;const ly="function"==typeof ArrayBuffer,uy=(e,t)=>{if("string"!=typeof e)return{type:"message",data:hy(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:cy(e.substring(1),t)}:ty[n]?e.length>1?{type:ty[n],data:e.substring(1)}:{type:ty[n]}:ny},cy=(e,t)=>{if(ly){const n=(e=>{let t,n,r,i,o,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const u=new ArrayBuffer(s),c=new Uint8Array(u);for(t=0;t>4,c[l++]=(15&r)<<4|i>>2,c[l++]=(3&i)<<6|63&o;return u})(e);return hy(n,t)}return{base64:!0,data:e}},hy=(e,t)=>"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e,dy=String.fromCharCode(30);function fy(e){if(e)return function(e){for(var t in fy.prototype)e[t]=fy.prototype[t];return e}(e)}fy.prototype.on=fy.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},fy.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},fy.prototype.off=fy.prototype.removeListener=fy.prototype.removeAllListeners=fy.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const gy=py.setTimeout,vy=py.clearTimeout;function yy(e,t){t.useNativeTimers?(e.setTimeoutFn=gy.bind(py),e.clearTimeoutFn=vy.bind(py)):(e.setTimeoutFn=py.setTimeout.bind(py),e.clearTimeoutFn=py.clearTimeout.bind(py))}class by extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class wy extends fy{constructor(e){super(),this.writable=!1,yy(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new by(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=uy(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Ay="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),_y=64,Ey={};let My,ky=0,Sy=0;function xy(e){let t="";do{t=Ay[e%_y]+t,e=Math.floor(e/_y)}while(e>0);return t}function Cy(){const e=xy(+new Date);return e!==My?(ky=0,My=e):e+"."+xy(ky++)}for(;Sy<_y;Sy++)Ey[Ay[Sy]]=Sy;function Ty(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}let Oy=!1;try{Oy="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(i){}const Ry=Oy;function Py(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Ry))return new XMLHttpRequest}catch(e){}if(!t)try{return new(py[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function Ny(){}const Ly=null!=new Py({xdomain:!1}).responseType;class Iy extends fy{constructor(e,t){super(),yy(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=my(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new Py(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Iy.requestsCount++,Iy.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Ny,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Iy.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function By(){for(let e in Iy.requests)Iy.requests.hasOwnProperty(e)&&Iy.requests[e].abort()}Iy.requestsCount=0,Iy.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",By):"function"==typeof addEventListener&&addEventListener("onpagehide"in py?"pagehide":"unload",By,!1));const Dy="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),jy=py.WebSocket||py.MozWebSocket,Fy="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),Uy={websocket:class extends wy{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=Fy?{}:my(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=Fy?new jy(e,t,n):t?new jy(e,t):new jy(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}r&&Dy((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let n="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Cy()),this.supportsBinary||(e.b64=1);const r=Ty(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}check(){return!!jy}},polling:class extends wy{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=Ly&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(dy),r=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach(((e,o)=>{oy(e,!1,(e=>{r[o]=e,++i===n&&t(r.join(dy))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let n="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=Cy()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port);const r=Ty(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Iy(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},qy=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,zy=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hy(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=qy.exec(e||""),o={},s=14;for(;s--;)o[zy[s]]=i[s]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,o.query),o}let Ky=class e extends fy{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=Hy(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Hy(t.host).host),yy(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Uy[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}})))};function o(){r||(r=!0,c(),n.close(),n=null)}const s=e=>{const t=new Error("probe error: "+e);t.transport=n.name,o(),this.emitReserved("upgradeError",t)};function a(){s("transport closed")}function l(){s("socket closed")}function u(e){n&&e.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",u),n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,$y=Object.prototype.toString,Yy="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===$y.call(Blob),Gy="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===$y.call(File);function Zy(e){return Vy&&(e instanceof ArrayBuffer||Wy(e))||Yy&&e instanceof Blob||Gy&&e instanceof File}function Qy(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num0;case nb.ACK:case nb.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ib{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=eb(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var ob=Object.freeze({__proto__:null,Decoder:rb,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==nb.EVENT&&e.type!==nb.ACK||!Qy(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===nb.EVENT?nb.BINARY_EVENT:nb.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==nb.BINARY_EVENT&&e.type!==nb.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Jy(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return nb},protocol:5});function sb(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ab=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class lb extends fy{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[sb(e,"open",this.onopen.bind(this)),sb(e,"packet",this.onpacket.bind(this)),sb(e,"error",this.onerror.bind(this)),sb(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ab.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:nb.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((r,i)=>{t.push(((e,t)=>n?e?i(e):r(t):r(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:nb.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case nb.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case nb.EVENT:case nb.BINARY_EVENT:this.onevent(e);break;case nb.ACK:case nb.BINARY_ACK:this.onack(e);break;case nb.DISCONNECT:this.ondisconnect();break;case nb.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:nb.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:nb.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}ub.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},ub.prototype.reset=function(){this.attempts=0},ub.prototype.setMin=function(e){this.ms=e},ub.prototype.setMax=function(e){this.max=e},ub.prototype.setJitter=function(e){this.jitter=e};class cb extends fy{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,yy(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new ub({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ob;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ky(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=sb(t,"open",(function(){n.onopen(),e&&e()})),i=sb(t,"error",(t=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",t),e?e(t):n.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&r();const n=this.setTimeoutFn((()=>{r(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(sb(e,"ping",this.onping.bind(this)),sb(e,"data",this.ondata.bind(this)),sb(e,"error",this.onerror.bind(this)),sb(e,"close",this.onclose.bind(this)),sb(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Dy((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new lb(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const hb={};function db(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=Hy(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=hb[i]&&o in hb[i].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new cb(r,t):(hb[i]||(hb[i]=new cb(r,t)),a=hb[i]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}var fb,pb;e.EventType=void 0,e.CommunicationLayerPreference=void 0,e.MessageType=void 0,Object.assign(db,{Manager:cb,Socket:lb,io:db,connect:db}),function(e){e.KEY_INFO="key_info",e.SERVICE_STATUS="service_status",e.KEYS_EXCHANGED="keys_exchanged",e.JOIN_CHANNEL="join_channel",e.CHANNEL_CREATED="channel_created",e.CLIENTS_CONNECTED="clients_connected",e.CLIENTS_DISCONNECTED="clients_disconnected",e.CLIENTS_WAITING="clients_waiting",e.CLIENTS_READY="clients_ready",e.SOCKET_DISCONNECTED="socket_disconnected",e.SOCKET_RECONNECT="socket_reconnect",e.OTP="otp",e.SDK_RPC_CALL="sdk_rpc_call",e.AUTHORIZED="authorized",e.CONNECTION_STATUS="connection_status",e.MESSAGE="message",e.TERMINATE="terminate"}(e.EventType||(e.EventType={})),function(e){e.KEY_EXCHANGE="key_exchange"}(fb||(fb={})),function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_NONE="none"}(pb||(pb={}));class mb extends Fv.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=pb.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.myECIES=new Iv(r),this.communicationLayer=e,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(fb.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(t){this.debug&&console.debug(`KeyExchange::${this.context}::onKeyExchangeMessage() keysExchanged=${this.keysExchanged}`,t);const{message:n}=t;this.keysExchanged&&this.debug&&console.log(`KeyExchange::${this.context}::onKeyExchangeMessage received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),n.type===pb.KEY_HANDSHAKE_SYN?(this.checkStep([pb.KEY_HANDSHAKE_NONE,pb.KEY_HANDSHAKE_ACK]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:pb.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}),this.step=pb.KEY_HANDSHAKE_ACK,this.emit(e.EventType.KEY_INFO,this.step)):n.type===pb.KEY_HANDSHAKE_SYNACK?(this.checkStep([pb.KEY_HANDSHAKE_SYNACK,pb.KEY_HANDSHAKE_NONE]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:pb.KEY_HANDSHAKE_ACK}),this.keysExchanged=!0,this.step=pb.KEY_HANDSHAKE_NONE,this.emit(e.EventType.KEYS_EXCHANGED)):n.type===pb.KEY_HANDSHAKE_ACK&&(this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([pb.KEY_HANDSHAKE_ACK,pb.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.step=pb.KEY_HANDSHAKE_NONE,this.emit(e.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new Iv(e)}clean(){this.debug&&console.debug(`KeyExchange::${this.context}::clean reset handshake state`),this.step=pb.KEY_HANDSHAKE_NONE,this.emit(e.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:t,force:n}){this.debug&&console.debug(`KeyExchange::${this.context}::start isOriginator=${t} step=${this.step} keysExchanged=${this.keysExchanged}`),t?!this.keysExchanged&&this.step===pb.KEY_HANDSHAKE_NONE||n?(this.debug&&console.debug(`KeyExchange::${this.context}::start -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.step=pb.KEY_HANDSHAKE_SYNACK,this.emit(e.EventType.KEY_INFO,this.step),this.communicationLayer.sendMessage({type:pb.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey})):this.debug&&console.debug(`KeyExchange::${this.context}::start -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==n?this.debug&&console.debug("KeyExchange::start don't send KEY_HANDSHAKE_START -- exchange already done."):(this.communicationLayer.sendMessage({type:pb.KEY_HANDSHAKE_START}),this.clean())}checkStep(e){if(e.length>0&&-1===e.indexOf(this.step.toString()))throw new Error(`Wrong Step "${this.step}" not within ${e}`)}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}setOtherPublicKey(e){this.debug&&console.debug("KeyExchange::setOtherPubKey()",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}!function(e){e.WEBRTC="webrtc",e.SOCKET="socket",e.WALLETCONNECT="wc"}(e.CommunicationLayerPreference||(e.CommunicationLayerPreference={})),function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(e.MessageType||(e.MessageType={}));const gb=e=>new Promise((t=>{setTimeout(t,e)}));class vb extends Fv.EventEmitter2{constructor({otherPublicKey:e,reconnect:t,communicationLayerPreference:n,transports:r,communicationServerUrl:i,context:o,ecies:s,logging:a}){super(),this.clientsConnected=!1,this.clientsPaused=!1,this.manualDisconnect=!1,this.rpcMethodTracker={},this.hasPlaintext=!1,this.resumed=t,this.context=o,this.communicationLayerPreference=n,this.debug=!0===(null==a?void 0:a.serviceLayer),this.communicationServerUrl=i,this.hasPlaintext=this.communicationServerUrl!==Qv&&!0===(null==a?void 0:a.plaintext);const l={autoConnect:!1,transports:Jv};r&&(l.transports=r),this.debug&&console.debug(`SocketService::constructor() Socket IO url: ${this.communicationServerUrl}`),this.socket=db(i,l);const u={communicationLayer:this,otherPublicKey:e,sendPublicKey:!1,context:this.context,ecies:s,logging:a};this.keyExchange=new mb(u)}resetKeys(){this.debug&&console.debug("SocketService::resetKeys()"),this.keyExchange.resetKeys()}checkSameId(e){if(e!==this.channelId)throw this.debug&&console.error(`Wrong id ${e} - should be ${this.channelId}`),new Error("Wrong id")}setupChannelListeners(t){this.debug&&console.debug(`SocketService::${this.context}::setupChannelListener setting socket listeners for channel ${t}...`);const n=()=>Bv(this,void 0,void 0,(function*(){this.debug&&console.debug(`SocketService::connectAgain this.socket.connected=${this.socket.connected} trying to reconnect after socketio disconnection`,this),yield gb(200),this.socket.connected||(this.resumed=!0,this.socket.connect(),this.emit(e.EventType.SOCKET_RECONNECT),this.socket.emit(e.EventType.JOIN_CHANNEL,this.channelId,`${this.context}connect_again`))})),r=()=>{"undefined"!=typeof window&&"undefined"!=typeof document&&(this.debug&&console.debug(`SocketService::checkFocus hasFocus=${document.hasFocus()}`,this),document.hasFocus()?n.call(this):window.addEventListener("focus",n.bind(this),{once:!0}))};this.socket.on("error",(e=>{this.debug&&console.debug("SocketService::on 'error' ",e),r()})),this.socket.on("ping",(()=>{this.debug&&console.debug("SocketService::on 'ping'")})),this.socket.on("reconnect",(e=>{this.debug&&console.debug(`SocketService::on 'reconnect' attempt=${e}`)})),this.socket.on("reconnect_error",(e=>{this.debug&&console.debug("SocketService::on 'reconnect_error'",e)})),this.socket.on("reconnect_failed",(()=>{this.debug&&console.debug("SocketService::on 'reconnect_failed'")})),this.socket.on("disconnect",(t=>{this.debug&&console.debug(`SocketService::on 'disconnect' manualDisconnect=${this.manualDisconnect}`,t),this.manualDisconnect||(this.emit(e.EventType.SOCKET_DISCONNECTED),r.call(this))})),this.socket.on(`clients_connected-${t}`,(n=>Bv(this,void 0,void 0,(function*(){var n,r;this.debug&&console.debug(`SocketService::${this.context}::setupChannelListener::on 'clients_connected-${t}' resumed=${this.resumed} clientsPaused=${this.clientsPaused} keysExchanged=${this.keyExchange.areKeysExchanged()} isOriginator=${this.isOriginator}`),this.emit(e.EventType.CLIENTS_CONNECTED,{isOriginator:this.isOriginator,keysExchanged:this.keyExchange.areKeysExchanged(),context:this.context}),this.resumed?(this.keyExchange.areKeysExchanged()?(this.debug&&console.debug(`SocketService::${this.context}::on 'clients_connected' reconnect=true keysExchanged=false`),this.communicationLayerPreference===e.CommunicationLayerPreference.WEBRTC&&this.emit(e.EventType.CLIENTS_READY,{isOriginator:this.isOriginator,keysExchanged:this.keyExchange.areKeysExchanged(),context:this.context})):this.isOriginator||(this.debug&&console.debug(`SocketService::${this.context}::on 'clients_connected' / keysExchanged=${this.keyExchange.areKeysExchanged()} -- backward compatibility`),this.keyExchange.start({isOriginator:null!==(n=this.isOriginator)&&void 0!==n&&n})),this.resumed=!1):this.clientsPaused?console.debug("SocketService::on 'clients_connected' skip sending originatorInfo on pause"):this.isOriginator?this.isOriginator&&(yield gb(3e3),this.keyExchange.start({isOriginator:this.isOriginator,force:!1})):(this.debug&&console.debug(`SocketService::${this.context}::on 'clients_connected' / keysExchanged=${this.keyExchange.areKeysExchanged()} -- backward compatibility`),this.keyExchange.start({isOriginator:null!==(r=this.isOriginator)&&void 0!==r&&r,force:!0})),this.clientsConnected=!0,this.clientsPaused=!1})))),this.socket.on(`channel_created-${t}`,(n=>{this.debug&&console.debug(`SocketService::${this.context}::setupChannelListener::on 'channel_created-${t}'`,n),this.emit(e.EventType.CHANNEL_CREATED,n)})),this.socket.on(`clients_disconnected-${t}`,(()=>{this.clientsConnected=!1,this.debug&&console.debug(`SocketService::${this.context}::setupChannelListener::on 'clients_disconnected-${t}'`),this.isOriginator&&this.keyExchange.clean(),this.emit(e.EventType.CLIENTS_DISCONNECTED,t)})),this.socket.on(`message-${t}`,(({id:n,message:r,error:i})=>{var o,s,a,l;if(this.debug&&console.debug(`SocketService::${this.context}::on 'message' ${t} keysExchanged=${this.keyExchange.areKeysExchanged()}`,r),i)throw this.debug&&console.debug(`\n SocketService::${this.context}::on 'message' error=${i}`),new Error(i);try{this.checkSameId(n)}catch(e){return void console.error("ignore message --- wrong id ",r)}if(this.isOriginator&&(null==r?void 0:r.type)===pb.KEY_HANDSHAKE_START)return this.debug&&console.debug(`SocketService::${this.context}::on 'message' received HANDSHAKE_START isOriginator=${this.isOriginator}`,r),void this.keyExchange.start({isOriginator:null!==(o=this.isOriginator)&&void 0!==o&&o,force:!0});if((null==r?void 0:r.type)===pb.KEY_HANDSHAKE_CHECK){const t=r.pubkey,n=this.getKeyInfo().ecies.otherPubKey,i=this.keyExchange.getMyPublicKey(),o=t===i;return console.log(`exchanged=${this.getKeyInfo().keysExchanged} keysVerifiedk=${o}\n${JSON.stringify({remote:t,local:i,mmpublic:n},null,4)}`),o||this.keyExchange.start({isOriginator:null!==(s=this.isOriginator)&&void 0!==s&&s}),void this.emit(e.EventType.MESSAGE,{message:{type:pb.KEY_HANDSHAKE_CHECK}})}if((null==r?void 0:r.type)===e.MessageType.PING)return this.debug&&console.debug(`SocketService::${this.context}::on 'message' ping `),void this.emit(e.EventType.MESSAGE,{message:{type:"ping"}});if(this.debug&&console.debug(`SocketService::${this.context}::on 'message' originator=${this.isOriginator}, type=${null==r?void 0:r.type}, keysExchanged=${this.keyExchange.areKeysExchanged()}`),null===(a=null==r?void 0:r.type)||void 0===a?void 0:a.startsWith("key_handshake"))return this.debug&&console.debug(`SocketService::${this.context}::on 'message' emit KEY_EXCHANGE`,r),void this.emit(fb.KEY_EXCHANGE,{message:r,context:this.context});if(!this.keyExchange.areKeysExchanged())return this.isOriginator?this.keyExchange.start({isOriginator:null!==(l=this.isOriginator)&&void 0!==l&&l}):this.sendMessage({type:pb.KEY_HANDSHAKE_START}),void console.warn("Message ignored because invalid key exchange status",r);if(-1!==r.toString().indexOf("type"))return console.warn("SocketService::on 'message' received non encrypted unkwown message"),void this.emit(e.EventType.MESSAGE,r);const u=this.keyExchange.decryptMessage(r),c=JSON.parse(u);if((null==c?void 0:c.type)===e.MessageType.PAUSE?this.clientsPaused=!0:this.clientsPaused=!1,this.isOriginator&&c.data){const e=c.data,t=this.rpcMethodTracker[e.id];if(t){const n=Date.now()-t.timestamp;this.debug&&console.debug(`received answer for id=${e.id} method=${t.method} responseTime=${n}`,c)}}this.emit(e.EventType.MESSAGE,{message:c})})),this.socket.on(`clients_waiting_to_join-${t}`,(n=>{this.debug&&console.debug(`SocketService::${this.context}::setupChannelListener::on 'clients_waiting_to_join-${t}'`,n),this.emit(e.EventType.CLIENTS_WAITING,n)})),this.keyExchange.on(e.EventType.KEY_INFO,(t=>{this.debug&&console.debug("SocketService::on 'KEY_INFO'",t),this.emit(e.EventType.KEY_INFO,t)})),this.keyExchange.on(e.EventType.KEYS_EXCHANGED,(()=>{this.debug&&console.debug(`SocketService::on 'keys_exchanged' keyschanged=${this.keyExchange.areKeysExchanged()}`),this.emit(e.EventType.KEYS_EXCHANGED,{keysExchanged:this.keyExchange.areKeysExchanged(),isOriginator:this.isOriginator});const t={keyInfo:this.getKeyInfo()};this.emit(e.EventType.SERVICE_STATUS,t)}))}createChannel(){this.debug&&console.debug(`SocketService::${this.context}::createChannel()`),this.socket.connected||this.socket.connect(),this.manualDisconnect=!1,this.isOriginator=!0;const t=Wv();return this.channelId=t,this.setupChannelListeners(t),this.socket.emit(e.EventType.JOIN_CHANNEL,t,`${this.context}createChannel`),{channelId:t,pubKey:this.keyExchange.getMyPublicKey()}}connectToChannel({channelId:t,isOriginator:n=!1,withKeyExchange:r=!1}){if(this.debug&&console.debug(`SocketService::${this.context}::connectToChannel() channelId=${t} isOriginator=${n}`,this.keyExchange.toString()),this.socket.connected)throw new Error("socket already connected");this.manualDisconnect=!1,this.socket.connect(),this.withKeyExchange=r,this.isOriginator=n,this.channelId=t,this.setupChannelListeners(t),this.socket.emit(e.EventType.JOIN_CHANNEL,t,`${this.context}_connectToChannel`)}getKeyInfo(){return this.keyExchange.getKeyInfo()}keyCheck(){this.socket.emit(e.EventType.MESSAGE,{id:this.channelId,context:this.context,message:{type:pb.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}sendMessage(t){var n,r;if(!this.channelId)throw new Error("Create a channel first");if(this.debug&&console.debug(`SocketService::${this.context}::sendMessage() areKeysExchanged=${this.keyExchange.areKeysExchanged()}`,t),null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.startsWith("key_handshake"))return this.debug&&console.debug(`SocketService::${this.context}::sendMessage()`,t),void this.socket.emit(e.EventType.MESSAGE,{id:this.channelId,context:this.context,message:t});if(!this.keyExchange.areKeysExchanged())throw this.debug&&console.debug(`SocketService::${this.context}::sendMessage() ERROR keys not exchanged`,t),new Error("Keys not exchanged BBB");const i=null!==(r=null==t?void 0:t.method)&&void 0!==r?r:"",o=null==t?void 0:t.id;this.isOriginator&&o&&(this.rpcMethodTracker[o]={timestamp:Date.now(),method:i});const s=this.keyExchange.encryptMessage(JSON.stringify(t)),a={id:this.channelId,context:this.context,message:s,plaintext:this.hasPlaintext?JSON.stringify(t):void 0};this.debug&&console.debug(`SocketService::${this.context}::sendMessage()`,a),t.type===e.MessageType.TERMINATE&&(this.manualDisconnect=!0),this.socket.emit(e.EventType.MESSAGE,a)}ping(){var t;this.debug&&console.debug(`SocketService::${this.context}::ping() keysExchanged=${this.keyExchange.areKeysExchanged()}`),this.isOriginator||(this.keyExchange.areKeysExchanged()?this.sendMessage({type:e.MessageType.READY}):this.keyExchange.start({isOriginator:null!==(t=this.isOriginator)&&void 0!==t&&t})),this.socket.emit(e.EventType.MESSAGE,{id:this.channelId,context:this.context,message:{type:e.MessageType.PING}})}pause(){this.debug&&console.debug(`SocketService::${this.context}::pause()`),this.manualDisconnect=!0,this.keyExchange.areKeysExchanged()&&this.sendMessage({type:e.MessageType.PAUSE}),this.socket.disconnect()}isConnected(){return this.socket.connected}resume(){var t;this.debug&&console.debug(`SocketService::${this.context}::resume() connected=${this.socket.connected} manualDisconnect=${this.manualDisconnect} resumed=${this.resumed} keysExchanged=${this.keyExchange.areKeysExchanged()}`),this.socket.connected?this.debug&&console.debug("SocketService::resume() already connected."):(this.socket.connect(),this.debug&&console.debug(`SocketService::resume() after connecting socket --\x3e connected=${this.socket.connected}`),this.socket.emit(e.EventType.JOIN_CHANNEL,this.channelId,`${this.context}_resume`)),this.keyExchange.areKeysExchanged()?this.isOriginator||this.sendMessage({type:e.MessageType.READY}):this.isOriginator||this.keyExchange.start({isOriginator:null!==(t=this.isOriginator)&&void 0!==t&&t}),this.manualDisconnect=!1,this.resumed=!0}disconnect(e){this.debug&&console.debug(`SocketService::${this.context}::disconnect()`,e),(null==e?void 0:e.terminate)&&(this.channelId=e.channelId,this.keyExchange.clean()),this.manualDisconnect=!0,this.socket.disconnect()}}var yb;e.ConnectionStatus=void 0,e.AutoConnectType=void 0,function(e){e.DISCONNECTED="disconnected",e.WAITING="waiting",e.TIMEOUT="timeout",e.LINKED="linked",e.PAUSED="paused",e.TERMINATED="terminated"}(e.ConnectionStatus||(e.ConnectionStatus={})),function(e){e.REQUEST="sdk_connect_request_started",e.CONNECTED="sdk_connection_established",e.DISCONNECTED="sdk_disconnected"}(yb||(yb={}));class bb extends Fv.EventEmitter2{constructor({otherPublicKey:t,webRTCLib:n,communicationLayerPreference:r,reconnect:i,transports:o,context:s,ecies:a,communicationServerUrl:l,logging:u}){super(),this.handshakeDone=!1,this.isOriginator=!1,this.clientsConnected=!1,this.clientsReady=!1,this.reconnect=i,this.context=s,this.debug=!0===(null==u?void 0:u.serviceLayer),n?(this.RTCPeerConnection=n.RTCPeerConnection,this.RTCSessionDescription=n.RTCSessionDescription,this.RTCIceCandidate=n.RTCIceCandidate):(this.RTCPeerConnection=RTCPeerConnection,this.RTCSessionDescription=RTCSessionDescription,this.RTCIceCandidate=RTCIceCandidate),this.socketService=new vb({otherPublicKey:t,communicationLayerPreference:r,reconnect:i,transports:o,communicationServerUrl:l,ecies:a,context:s,logging:u});const c={communicationLayer:this,otherPublicKey:void 0,sendPublicKey:!0,context:this.context,logging:u};this.keyExchange=new mb(c),this.keyExchange.on(e.EventType.KEYS_EXCHANGED,(()=>{this.clientsReady=!0,this.emit(e.EventType.CLIENTS_READY,{isOriginator:this.isOriginator})})),this.socketService.on(e.EventType.CLIENTS_DISCONNECTED,(()=>this.clientsConnected?this.clientsConnected:(this.socketService.removeAllListeners(),this.emit(e.EventType.CLIENTS_DISCONNECTED)))),this.socketService.on(e.EventType.MESSAGE,(({message:t})=>Bv(this,void 0,void 0,(function*(){var n,r,i,o,s;const{offer:a,answer:l,candidate:u,type:c}=t;if(c===e.MessageType.OFFER){yield null===(n=this.webrtc)||void 0===n?void 0:n.setRemoteDescription(new this.RTCSessionDescription(a));const t=yield null===(r=this.webrtc)||void 0===r?void 0:r.createAnswer();yield null===(i=this.webrtc)||void 0===i?void 0:i.setLocalDescription(t),this.socketService.sendMessage({type:e.MessageType.ANSWER,answer:t})}else c===e.MessageType.ANSWER?(yield null===(o=this.webrtc)||void 0===o?void 0:o.setRemoteDescription(new this.RTCSessionDescription(l)),this.handshakeDone=!0):c===e.MessageType.CANDIDATE&&(null===(s=this.webrtc)||void 0===s||s.addIceCandidate(new this.RTCIceCandidate(u)))})))),this.socketService.on(e.EventType.CLIENTS_READY,(({isOriginator:t})=>Bv(this,void 0,void 0,(function*(){if(this.setupWebrtc(),!t)return;if(!this.webrtc)throw new Error("invalid webrtc configuration");const n=yield this.webrtc.createOffer();yield this.webrtc.setLocalDescription(n),this.isOriginator=t,this.socketService.sendMessage({type:e.MessageType.OFFER,offer:n})})))),this.socketService.on(e.EventType.CHANNEL_CREATED,(t=>{this.emit(e.EventType.CHANNEL_CREATED,t)})),this.socketService.on(e.EventType.CLIENTS_WAITING,(t=>{this.emit(e.EventType.CLIENTS_WAITING,t)}))}isConnected(){return this.socketService.isConnected()}setupWebrtc(){if(this.webrtc=new this.RTCPeerConnection({iceServers:[{urls:"stun:15.237.115.65"}]}),!this.webrtc)throw new Error("invalid webrtc configuration");this.webrtc.ondatachannel=t=>{console.log("Data channel is created!");const n=t.channel;n.onopen=()=>{var t,n;console.log("Data channel is open and ready to be used."),this.clientsConnected=!0,this.isOriginator&&(this.keyExchange.areKeysExchanged()||this.keyExchange.start({isOriginator:null!==(t=this.isOriginator)&&void 0!==t&&t})),this.reconnect&&(this.keyExchange.areKeysExchanged()?(this.sendMessage({type:e.MessageType.READY}),this.emit(e.EventType.CLIENTS_READY,{isOriginator:this.isOriginator})):this.isOriginator||this.keyExchange.start({isOriginator:null!==(n=this.isOriginator)&&void 0!==n&&n}),this.reconnect=!1)},this.onMessage=this.onMessage.bind(this),n.onmessage=this.onMessage},this.webrtc.onconnectionstatechange=()=>{var t,n;const r=null!==(n=null===(t=this.webrtc)||void 0===t?void 0:t.connectionState)&&void 0!==n?n:"closed";return console.log("connectionStatus",r),["disconnected","failed","closed"].includes(r)?this.emit(e.EventType.CLIENTS_DISCONNECTED):r},this.webrtc.onicecandidate=({candidate:t})=>{t&&this.socketService.sendMessage({type:e.MessageType.CANDIDATE,candidate:t})},this.webrtc.onicecandidateerror=e=>console.log("ICE ERROR",e),this.dataChannel=this.webrtc.createDataChannel("messenger"),this.dataChannel.onerror=t=>0===t.error.code?this.emit(e.EventType.CLIENTS_DISCONNECTED):(console.log("ERROR: datachannel",t),t)}connectToChannel({channelId:e}){this.socketService.connectToChannel({channelId:e})}resetKeys(){this.socketService.resetKeys()}keyCheck(){this.socketService.keyCheck()}onMessage(t){if(!this.keyExchange.areKeysExchanged()){const e=JSON.parse(t.data);if(null==e?void 0:e.type.startsWith("key_handshake"))return this.emit(fb.KEY_EXCHANGE,{message:e});throw new Error("Keys not exchanged")}const n=this.keyExchange.decryptMessage(t.data),r=JSON.parse(n);return this.emit(e.EventType.MESSAGE,{message:r})}sendMessage(e){var t;if(!this.clientsConnected)throw new Error("Clients not connected");if(!this.dataChannel)throw new Error("Invalid webrtc status - data channel is not defined");if(!this.keyExchange.areKeysExchanged()){if(null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.startsWith("key_handshake"))return this.dataChannel.send(JSON.stringify(e));throw new Error("Keys not exchanged")}const n=this.keyExchange.encryptMessage(JSON.stringify(e));return this.dataChannel.send(n)}createChannel(){return this.socketService.createChannel()}getKeyInfo(){return this.socketService.getKeyInfo()}ping(){this.socketService.ping()}pause(){var t;this.keyExchange.areKeysExchanged()&&this.sendMessage({type:e.MessageType.PAUSE}),null===(t=this.webrtc)||void 0===t||t.close(),this.socketService.pause()}resume(){this.reconnect=!0,this.socketService.resume()}disconnect(e){var t;this.socketService.disconnect(e),null===(t=this.webrtc)||void 0===t||t.close()}}class wb extends Fv.EventEmitter2{constructor({platform:t,communicationLayerPreference:n,otherPublicKey:r,webRTCLib:i,reconnect:o,walletInfo:s,dappMetadata:a,transports:l,context:u,ecies:c,analytics:h=!1,storage:d,sdkVersion:f,communicationServerUrl:p=Qv,logging:m,autoConnect:g={timeout:3e3}}){super(),this.ready=!1,this.isOriginator=!1,this.paused=!1,this.analytics=!1,this.originatorInfoSent=!1,this.clientsConnected=!1,this.sessionDuration=Xv,this.autoStarted=!1,this.debug=!1,this._connectionStatus=e.ConnectionStatus.DISCONNECTED,this.otherPublicKey=r,this.webRTCLib=i,this.dappMetadata=a,this.walletInfo=s,this.transports=l,this.platform=t,this.analytics=h,this.communicationServerUrl=p,this.context=u,this.sdkVersion=f,this.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),(null==d?void 0:d.duration)&&(this.sessionDuration=Xv),this.storageOptions=d,this.autoConnectOptions=g,this.debug=!0===(null==m?void 0:m.remoteLayer),this.logging=m,(null==d?void 0:d.storageManager)&&(this.storageManager=d.storageManager),this.initCommunicationLayer({communicationLayerPreference:n,otherPublicKey:r,webRTCLib:i,reconnect:o,ecies:c,communicationServerUrl:p}),this.emitServiceStatusEvent()}initCommunicationLayer({communicationLayerPreference:t,otherPublicKey:n,webRTCLib:r,reconnect:i,ecies:o,communicationServerUrl:s=Qv}){var a,l,u,c,h,d,f,p,m,g,v;switch(t){case e.CommunicationLayerPreference.WEBRTC:this.communicationLayer=new bb({communicationLayerPreference:t,otherPublicKey:n,reconnect:i,transports:this.transports,webRTCLib:r,communicationServerUrl:s,ecies:o,context:this.context,logging:this.logging});break;case e.CommunicationLayerPreference.SOCKET:this.communicationLayer=new vb({communicationLayerPreference:t,otherPublicKey:n,reconnect:i,transports:this.transports,communicationServerUrl:s,context:this.context,ecies:o,logging:this.logging});break;default:throw new Error("Invalid communication protocol")}let y="undefined"!=typeof document&&document.URL||"",b="undefined"!=typeof document&&document.title||"";(null===(a=this.dappMetadata)||void 0===a?void 0:a.url)&&(y=this.dappMetadata.url),(null===(l=this.dappMetadata)||void 0===l?void 0:l.name)&&(b=this.dappMetadata.name);const w={url:y,title:b,icon:null===(u=this.dappMetadata)||void 0===u?void 0:u.base64Icon,platform:this.platform,apiVersion:$v};this.originatorInfo=w,null===(c=this.communicationLayer)||void 0===c||c.on(e.EventType.MESSAGE,(e=>{let t=e;e.message&&(t=t.message),this.onCommunicationLayerMessage(t)})),null===(h=this.communicationLayer)||void 0===h||h.on(e.EventType.CLIENTS_CONNECTED,(()=>{var n,r,i;this.debug&&console.debug(`RemoteCommunication::on 'clients_connected' channel=${this.channelId} keysExchanged=${null===(n=this.getKeyInfo())||void 0===n?void 0:n.keysExchanged}`),this.analytics&&Zv(Object.assign(Object.assign({id:null!==(r=this.channelId)&&void 0!==r?r:"",event:yb.REQUEST},w),{commLayer:t,sdkVersion:this.sdkVersion,walletVersion:null===(i=this.walletInfo)||void 0===i?void 0:i.version,commLayerVersion:$v}),this.communicationServerUrl),this.clientsConnected=!0,this.originatorInfoSent=!1,this.emit(e.EventType.CLIENTS_CONNECTED)})),null===(d=this.communicationLayer)||void 0===d||d.on(e.EventType.KEYS_EXCHANGED,(n=>{var r,i,o,s;this.debug&&console.debug(`RemoteCommunication::${this.context}::on commLayer.'keys_exchanged' channel=${this.channelId}`,n),(null===(r=this.getKeyInfo())||void 0===r?void 0:r.keysExchanged)&&this.setConnectionStatus(e.ConnectionStatus.LINKED),this.setLastActiveDate(new Date),this.analytics&&this.channelId&&Zv({id:this.channelId,event:yb.CONNECTED,sdkVersion:this.sdkVersion,commLayer:t,commLayerVersion:$v,walletVersion:null===(i=this.walletInfo)||void 0===i?void 0:i.version},this.communicationServerUrl),this.isOriginator=n.isOriginator,n.isOriginator||(null===(o=this.communicationLayer)||void 0===o||o.sendMessage({type:e.MessageType.READY}),this.ready=!0,this.paused=!1),n.isOriginator&&!this.originatorInfoSent&&(null===(s=this.communicationLayer)||void 0===s||s.sendMessage({type:e.MessageType.ORIGINATOR_INFO,originatorInfo:this.originatorInfo,originator:this.originatorInfo}),this.originatorInfoSent=!0)})),null===(f=this.communicationLayer)||void 0===f||f.on(e.EventType.SOCKET_DISCONNECTED,(()=>{this.debug&&console.debug("RemoteCommunication::on 'socket_Disconnected' set ready to false"),this.ready=!1})),null===(p=this.communicationLayer)||void 0===p||p.on(e.EventType.SOCKET_RECONNECT,(()=>{this.debug&&console.debug("RemoteCommunication::on 'socket_reconnect' -- reset key exchange status / set ready to false"),this.ready=!1,this.clean()})),null===(m=this.communicationLayer)||void 0===m||m.on(e.EventType.CLIENTS_DISCONNECTED,(n=>{var r;this.debug&&console.debug(`RemoteCommunication::${this.context}]::on 'clients_disconnected' channelId=${n}`),this.clientsConnected=!1,this.emit(e.EventType.CLIENTS_DISCONNECTED,this.channelId),this.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),this.ready=!1,this.analytics&&this.channelId&&Zv({id:this.channelId,event:yb.DISCONNECTED,sdkVersion:this.sdkVersion,commLayer:t,commLayerVersion:$v,walletVersion:null===(r=this.walletInfo)||void 0===r?void 0:r.version},this.communicationServerUrl)})),null===(g=this.communicationLayer)||void 0===g||g.on(e.EventType.CHANNEL_CREATED,(t=>{this.debug&&console.debug(`RemoteCommunication::${this.context}::on 'channel_created' channelId=${t}`),this.emit(e.EventType.CHANNEL_CREATED,t)})),null===(v=this.communicationLayer)||void 0===v||v.on(e.EventType.CLIENTS_WAITING,(t=>{if(this.debug&&console.debug(`RemoteCommunication::${this.context}::on 'clients_waiting' numberUsers=${t} ready=${this.ready} autoStarted=${this.autoStarted}`),this.setConnectionStatus(e.ConnectionStatus.WAITING),this.emit(e.EventType.CLIENTS_WAITING,t),this.autoStarted){this.debug&&console.debug(`RemoteCommunication::on 'clients_waiting' watch autoStarted=${this.autoStarted} timeout`,this.autoConnectOptions);const t=this.autoConnectOptions.timeout||3e3,n=setTimeout((()=>{this.debug&&console.debug(`RemoteCommunication::on setTimeout(${t}) terminate channelConfig`,this.autoConnectOptions),this.autoStarted=!1,this.ready||this.setConnectionStatus(e.ConnectionStatus.TIMEOUT),clearTimeout(n)}),t)}}))}onCommunicationLayerMessage(t){var n,r;if(this.debug&&console.debug(`RemoteCommunication::${this.context}::on 'message' typeof=${typeof t}`,t),this.ready=!0,!this.isOriginator&&t.type===e.MessageType.ORIGINATOR_INFO)return null===(n=this.communicationLayer)||void 0===n||n.sendMessage({type:e.MessageType.WALLET_INFO,walletInfo:this.walletInfo}),this.originatorInfo=t.originatorInfo||t.originator,this.emit(e.EventType.CLIENTS_READY,{isOriginator:this.isOriginator,originatorInfo:this.originatorInfo}),void(this.paused=!1);if(this.isOriginator&&t.type===e.MessageType.WALLET_INFO)return this.walletInfo=t.walletInfo,void(this.paused=!1);if(t.type===e.MessageType.TERMINATE)this.isOriginator&&(this.disconnect({terminate:!0,sendMessage:!1}),console.debug(),this.emit(e.EventType.TERMINATE));else if(t.type===e.MessageType.PAUSE)this.paused=!0,this.setConnectionStatus(e.ConnectionStatus.PAUSED);else if(t.type===e.MessageType.READY&&this.isOriginator)this.setConnectionStatus(e.ConnectionStatus.LINKED),this.paused=!1,this.emit(e.EventType.CLIENTS_READY,{isOriginator:this.isOriginator,walletInfo:this.walletInfo});else{if(t.type===e.MessageType.OTP&&this.isOriginator)return this.emit(e.EventType.OTP,t.otpAnswer),void(1==="6.6".localeCompare((null===(r=this.walletInfo)||void 0===r?void 0:r.version)||"")&&this.emit(e.EventType.SDK_RPC_CALL,{method:"eth_requestAccounts",params:[]}));t.type===e.MessageType.AUTHORIZED&&this.isOriginator&&this.emit(e.EventType.AUTHORIZED)}this.emit(e.EventType.MESSAGE,t)}startAutoConnect(){var e,t,n;return Bv(this,void 0,void 0,(function*(){if(!this.storageManager)return void(this.debug&&console.debug("RemoteCommunication::startAutoConnect() no storage manager defined - skip"));const r=yield this.storageManager.getPersistedChannelConfig(null!==(e=this.channelId)&&void 0!==e?e:"");if(this.debug&&console.debug(`RemoteCommunication::startAutoConnect() autoStarted=${this.autoStarted} channelConfig`,r),null===(t=this.communicationLayer)||void 0===t?void 0:t.isConnected())return this.debug&&console.debug("RemoteCommunication::startAutoConnect() socket already connected - exit autoConnect()"),r;if(r){if(r.validUntil>Date.now())return this.channelConfig=r,this.autoStarted=!0,this.channelId=null==r?void 0:r.channelId,null===(n=this.communicationLayer)||void 0===n||n.connectToChannel({channelId:r.channelId,isOriginator:!0}),Promise.resolve(r);this.debug&&console.log("RemoteCommunication::autoConnect Session has expired")}else this.debug&&console.debug("RemoteCommunication::autoConnect not available");this.autoStarted=!1}))}generateChannelId(){var e,t,n;return Bv(this,void 0,void 0,(function*(){if(!this.communicationLayer)throw new Error("communication layer not initialized");if(this.ready)throw new Error("Channel already connected");if(this.channelId&&this.isConnected())return console.warn("Channel already exists -- interrupt generateChannelId",this.channelConfig),this.channelConfig={channelId:this.channelId,validUntil:Date.now()+this.sessionDuration},null===(e=this.storageManager)||void 0===e||e.persistChannelConfig(this.channelConfig),{channelId:this.channelId,pubKey:null===(t=this.getKeyInfo())||void 0===t?void 0:t.ecies.public};this.debug&&console.debug("RemoteCommunication::generateChannelId()"),this.clean();const r=this.communicationLayer.createChannel();this.debug&&console.debug("RemoteCommunication::generateChannelId() channel created",r);const i={channelId:r.channelId,validUntil:Date.now()+this.sessionDuration};return this.channelId=r.channelId,this.channelConfig=i,null===(n=this.storageManager)||void 0===n||n.persistChannelConfig(i),{channelId:this.channelId,pubKey:r.pubKey}}))}clean(){this.debug&&console.debug(`RemoteCommunication::${this.context}::clean()`),this.channelConfig=void 0,this.ready=!1,this.autoStarted=!1}connectToChannel(e,t){var n,r,i;if(!Hv(e))throw console.debug(`RemoteCommunication::${this.context}::connectToChannel() invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(this.debug&&console.debug(`RemoteCommunication::${this.context}::connectToChannel() channelId=${e}`),null===(n=this.communicationLayer)||void 0===n?void 0:n.isConnected())return void console.debug(`RemoteCommunication::${this.context}::connectToChannel() already connected - interrup connection.`);this.channelId=e,null===(r=this.communicationLayer)||void 0===r||r.connectToChannel({channelId:e,withKeyExchange:t});const o={channelId:e,validUntil:Date.now()+this.sessionDuration};this.channelConfig=o,null===(i=this.storageManager)||void 0===i||i.persistChannelConfig(o)}sendMessage(t){return new Promise((n=>{var r,i,o;this.debug&&console.log(`RemoteCommunication::${this.context}::sendMessage paused=${this.paused} ready=${this.ready} socker=${null===(r=this.communicationLayer)||void 0===r?void 0:r.isConnected()} clientsConnected=${this.clientsConnected} status=${this._connectionStatus}`,t),!this.paused&&this.ready&&(null===(i=this.communicationLayer)||void 0===i?void 0:i.isConnected())&&this.clientsConnected?(null===(o=this.communicationLayer)||void 0===o||o.sendMessage(t),n()):(this.debug&&console.log(`RemoteCommunication::${this.context}::sendMessage SKIP message waiting for MM mobile readiness.`),this.once(e.EventType.CLIENTS_READY,(()=>{var e;this.debug&&console.log(`RemoteCommunication::${this.context}::sendMessage AFTER SKIP / READY -- sending pending message`),null===(e=this.communicationLayer)||void 0===e||e.sendMessage(t),n()})))}))}testStorage(){var e,t;return Bv(this,void 0,void 0,(function*(){const n=yield null===(e=this.storageManager)||void 0===e?void 0:e.getPersistedChannelConfig(null!==(t=this.channelId)&&void 0!==t?t:"");console.debug("RemoteCommunication.testStorage() res",n)}))}setLastActiveDate(e){var t,n,r,i;this.debug&&console.debug(`RemoteCommunication::setLastActiveDate() channel=${this.channelId}`,e);const o={channelId:null!==(t=this.channelId)&&void 0!==t?t:"",validUntil:null!==(r=null===(n=this.channelConfig)||void 0===n?void 0:n.validUntil)&&void 0!==r?r:0,lastActive:e.getTime()};null===(i=this.storageManager)||void 0===i||i.persistChannelConfig(o)}getChannelConfig(){return this.channelConfig}isReady(){return this.ready}isConnected(){var e;return null===(e=this.communicationLayer)||void 0===e?void 0:e.isConnected()}isPaused(){return this.paused}getCommunicationLayer(){return this.communicationLayer}ping(){var e;this.debug&&console.debug(`RemoteCommunication::ping() channel=${this.channelId}`),null===(e=this.communicationLayer)||void 0===e||e.ping()}keyCheck(){var e;this.debug&&console.debug(`RemoteCommunication::keyCheck() channel=${this.channelId}`),null===(e=this.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(t){this._connectionStatus!==t&&(this._connectionStatus=t,this.emit(e.EventType.CONNECTION_STATUS,t),this.emitServiceStatusEvent())}emitServiceStatusEvent(){this.emit(e.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this._connectionStatus}getServiceStatus(){return{originatorInfo:this.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this._connectionStatus,channelConfig:this.channelConfig,channelId:this.channelId}}getKeyInfo(){var e;return null===(e=this.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.communicationLayer)||void 0===e||e.resetKeys()}pause(){var t;this.debug&&console.debug(`RemoteCommunication::pause() channel=${this.channelId}`),null===(t=this.communicationLayer)||void 0===t||t.pause(),this.setConnectionStatus(e.ConnectionStatus.PAUSED)}resume(){var t;this.debug&&console.debug(`RemoteCommunication::resume() channel=${this.channelId}`),null===(t=this.communicationLayer)||void 0===t||t.resume(),this.setConnectionStatus(e.ConnectionStatus.LINKED)}getChannelId(){return this.channelId}disconnect(t){var n,r,i,o,s,a;this.debug&&console.debug(`RemoteCommunication::disconnect() channel=${this.channelId}`,t),this.ready=!1,this.paused=!1,(null==t?void 0:t.terminate)?(null===(n=this.storageManager)||void 0===n||n.terminate(null!==(r=this.channelId)&&void 0!==r?r:""),(null===(i=this.communicationLayer)||void 0===i?void 0:i.getKeyInfo().keysExchanged)&&(null==t?void 0:t.sendMessage)&&(null===(o=this.communicationLayer)||void 0===o||o.sendMessage({type:e.MessageType.TERMINATE})),this.channelId=Wv(),t.channelId=this.channelId,this.channelConfig=void 0,this.autoStarted=!1,null===(s=this.communicationLayer)||void 0===s||s.disconnect(t),this.setConnectionStatus(e.ConnectionStatus.TERMINATED)):(null===(a=this.communicationLayer)||void 0===a||a.disconnect(t),this.setConnectionStatus(e.ConnectionStatus.DISCONNECTED))}}function Ab(){throw new Error("setTimeout has not been defined")}function _b(){throw new Error("clearTimeout has not been defined")}!function(e){e.RENEW="renew",e.LINK="link"}(e.AutoConnectType||(e.AutoConnectType={}));var Eb=Ab,Mb=_b;function kb(e){if(Eb===setTimeout)return setTimeout(e,0);if((Eb===Ab||!Eb)&&setTimeout)return Eb=setTimeout,setTimeout(e,0);try{return Eb(e,0)}catch(t){try{return Eb.call(null,e,0)}catch(t){return Eb.call(this,e,0)}}}"function"==typeof r.setTimeout&&(Eb=setTimeout),"function"==typeof r.clearTimeout&&(Mb=clearTimeout);var Sb,xb=[],Cb=!1,Tb=-1;function Ob(){Cb&&Sb&&(Cb=!1,Sb.length?xb=Sb.concat(xb):Tb=-1,xb.length&&Rb())}function Rb(){if(!Cb){var e=kb(Ob);Cb=!0;for(var t=xb.length;t;){for(Sb=xb,xb=[];++Tb1)for(var n=1;n0;)if(o===e[s])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=d.apply(null,arguments),s={data:r,name:t,original:e};n?!1!==n.call(i,s)&&o.emit.apply(o,[s.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=l(o)).length;r-- >0;)e=n[r],a.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),b=v(["object","function"]);function w(e,t,n){var r,i,o,s=0,a=new e((function(l,u,c){function h(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var d=function(e){h(),l(e)},f=function(e){h(),u(e)};r?t(d,f,c):(i=[function(e){f(e||Error("canceled"))}],t(d,f,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),u(e)}),n.timeout))}));return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(f=y[a])&&(b=_(e,t,n[f],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(w=_(e,t,n,i,i)),a=(y=l(n)).length;a-- >0;)"_listeners"!==(f=y[a])&&("*"===f||"**"===f?(n[f]._listeners&&!v&&(b=_(e,t,n[f],i,i))&&(w?w.push.apply(w,b):w=b),b=_(e,t,n[f],r,i)):b=_(e,t,n[f],f===E?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=_(e,t,n[A],r+1,i))}if((p=n["*"])&&_(e,t,p,r+1,i),m=n["**"])if(r0;)"_listeners"!==(f=y[a])&&(f===E?_(e,t,m[f],r+2,i):f===A?_(e,t,m[f],r+1,i):((g={})[f]=m[f],_(e,t,{"**":g},r+1,i)));else m._listeners?_(e,t,m,i,i):m["*"]&&m["*"]._listeners&&_(e,t,m["*"],i,i);return w}function E(e,t,n){var r,i,o=0,s=0,a=this.delimiter,l=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+l}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+10&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,u))):c._listeners=t,!0;return!0}function M(e,t,n,r){for(var i,o,s,a,u=l(e),c=u.length,h=e._listeners;c-- >0;)i=e[o=u[c]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,h&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&M.call(this,i,t,s,a);return t}function k(e){for(var t,n,r,i=l(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||k(t)||delete e[n]);return r}function S(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)s=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,s=r.promisify,l=r.nextTick,u=r.objectify}if(o||l||s){var c=n,h=n._origin||n;if(l&&!i)throw Error("process.nextTick is not supported");s===t&&(s="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise((function(e){a(e)})).then((function(){return t.event=n,c.apply(t,e)})):(l?Pb:a)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=h}return[n,u?new S(this,e,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}S.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,s=A.call(o,e);n=-1===s?new p(o,e,i):o._observers[s];for(var a,u=l(t),c=u.length,h="function"==typeof r,d=0;d0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,n,r,i,s,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,o)for(r=0;r3)for(t=new Array(h-1),i=1;i3)for(n=new Array(d-1),s=1;s0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=n,s)},C.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=a[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var u=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,u,c,s,0),u}return a&&(r=a[e])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?M.call(this,this.listenerTree,[],null,e):t?l(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?l(i).length:i[e]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),w((n=m(n,{timeout:0,filter:t,handleError:!1,Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function s(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,s),n.handleError){var a=arguments[0];a?i(a):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}o((function(){r.off(e,s)})),r._on(e,s,!1)}),{timeout:n.timeout,overload:n.overload})};var T=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return T._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");T._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return w((n=m(n,{Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(d.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return C})):e.exports=C}()}(Gb);var Zb=$b(Gb.exports),Qb={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,l=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]1?i-1:0),s=1;s0){var s=Object.keys(n),l=a.default.find(s,(function(e){return t.isOS(e)}));if(l){var u=this.satisfies(n[l]);if(void 0!==u)return u}var c=a.default.find(s,(function(e){return t.isPlatform(e)}));if(c){var h=this.satisfies(n[c]);if(void 0!==h)return h}}if(o>0){var d=Object.keys(i),f=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})}(Qb);var Jb=$b(Qb.exports);var Xb="INSTALLED",ew="NOT_INSTALLED",tw="REGISTERED",nw="REGISTERING",rw="RELOADING",iw={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},ow="REGISTRATION_IN_PROGRESS",sw="FORWARDER_ID",aw=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=void 0===r?"https://fwd.metamask.io":r,o=n.forwarderMode,s=void 0===o?e.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=s,this.state=e.isMetaMaskInstalled()?Xb:ew;var a=e._detectBrowser();this.downloadUrl=a?iw[a]:iw.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),s===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(ow)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},e.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){return function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(a)}}else s=o[t]=n,++e._eventsCount;return e}function mw(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function gw(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function vw(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}hw.prototype=Object.create(null),dw.EventEmitter=dw,dw.usingDomains=!1,dw.prototype.domain=void 0,dw.prototype._events=void 0,dw.prototype._maxListeners=void 0,dw.defaultMaxListeners=10,dw.init=function(){this.domain=null,dw.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new hw,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},dw.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},dw.prototype.getMaxListeners=function(){return fw(this)},dw.prototype.emit=function(e){var t,n,r,i,o,s,a,l="error"===e;if(s=this._events)l=l&&null==s.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=vw(e,r),o=0;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new hw,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var yw=Yb(Object.freeze({__proto__:null,EventEmitter:dw,default:dw}));Object.defineProperty(cw,"__esModule",{value:!0});const bw=yw;function ww(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout((()=>{throw e}))}}class Aw extends bw.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)ww(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;rs.depthLimit)return void Rw(kw,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void Rw(kw,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;at?1:0}function Lw(e,t,n,r){void 0===r&&(r=Tw());var i,o=Iw(e,"",0,[],void 0,0,r)||e;try{i=0===Cw.length?JSON.stringify(o,t,n):JSON.stringify(o,Bw(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==xw.length;){var s=xw.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Iw(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;as.depthLimit)return void Rw(kw,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void Rw(kw,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a0)for(var r=0;r=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var Uw={},qw={};Object.defineProperty(qw,"__esModule",{value:!0}),qw.errorValues=qw.errorCodes=void 0,qw.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},qw.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=qw,n=Ew,r=t.errorCodes.rpc.internal,i={code:r,message:o(r)};function o(n,r="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(n)){const r=n.toString();if(u(t.errorValues,r))return t.errorValues[r].message;if(a(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function s(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!a(e)}function a(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=s,e.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:r=!1}={}){var a,c;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof n.EthereumRpcError)return e.serialize();const h={};if(e&&"object"==typeof e&&!Array.isArray(e)&&u(e,"code")&&s(e.code)){const t=e;h.code=t.code,t.message&&"string"==typeof t.message?(h.message=t.message,u(t,"data")&&(h.data=t.data)):(h.message=o(h.code),h.data={originalError:l(e)})}else{h.code=t.code;const n=null===(a=e)||void 0===a?void 0:a.message;h.message=n&&"string"==typeof n?n:t.message,h.data={originalError:l(e)}}const d=null===(c=e)||void 0===c?void 0:c.stack;return r&&e&&d&&"string"==typeof d&&(h.stack=d),h}}(Uw);var zw={};Object.defineProperty(zw,"__esModule",{value:!0}),zw.ethErrors=void 0;const Hw=Ew,Kw=Uw,Vw=qw;function Ww(e,t){const[n,r]=Yw(t);return new Hw.EthereumRpcError(e,n||Kw.getMessageFromCode(e),r)}function $w(e,t){const[n,r]=Yw(t);return new Hw.EthereumProviderError(e,n||Kw.getMessageFromCode(e),r)}function Yw(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}zw.ethErrors={rpc:{parse:e=>Ww(Vw.errorCodes.rpc.parse,e),invalidRequest:e=>Ww(Vw.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Ww(Vw.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Ww(Vw.errorCodes.rpc.methodNotFound,e),internal:e=>Ww(Vw.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Ww(t,e)},invalidInput:e=>Ww(Vw.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Ww(Vw.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Ww(Vw.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Ww(Vw.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Ww(Vw.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Ww(Vw.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>$w(Vw.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>$w(Vw.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>$w(Vw.errorCodes.provider.unsupportedMethod,e),disconnected:e=>$w(Vw.errorCodes.provider.disconnected,e),chainDisconnected:e=>$w(Vw.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new Hw.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Ew;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=Uw;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=zw;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=qw;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(_w);var Gw=Array.isArray,Zw=Object.keys,Qw=Object.prototype.hasOwnProperty,Jw={},Xw={},eA={};Object.defineProperty(eA,"__esModule",{value:!0}),eA.getUniqueId=void 0;const tA=4294967295;let nA=Math.floor(Math.random()*tA);eA.getUniqueId=function(){return nA=(nA+1)%tA,nA},Object.defineProperty(Xw,"__esModule",{value:!0}),Xw.createIdRemapMiddleware=void 0;const rA=eA;Xw.createIdRemapMiddleware=function(){return(e,t,n,r)=>{const i=e.id,o=rA.getUniqueId();e.id=o,t.id=o,n((n=>{e.id=i,t.id=i,n()}))}};var iA={};Object.defineProperty(iA,"__esModule",{value:!0}),iA.createAsyncMiddleware=void 0,iA.createAsyncMiddleware=function(e){return async(t,n,r,i)=>{let o;const s=new Promise((e=>{o=e}));let a=null,l=!1;const u=async()=>{l=!0,r((e=>{a=e,o()})),await s};try{await e(t,n,u),l?(await s,a(null)):i(null)}catch(e){a?a(e):i(e)}}};var oA={};Object.defineProperty(oA,"__esModule",{value:!0}),oA.createScaffoldMiddleware=void 0,oA.createScaffoldMiddleware=function(e){return(t,n,r,i)=>{const o=e[t.method];return void 0===o?r():"function"==typeof o?o(t,n,r,i):(n.result=o,i())}};var sA={},aA=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sA,"__esModule",{value:!0}),sA.JsonRpcEngine=void 0;const lA=aA(cw),uA=_w;class cA extends lA.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,n,r)=>{try{const[i,o,s]=await cA._runAllMiddleware(e,t,this._middleware);return o?(await cA._runReturnHandlers(s),r(i)):n((async e=>{try{await cA._runReturnHandlers(s)}catch(t){return e(t)}return e()}))}catch(e){return r(e)}}}async _handleBatch(e,t){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,n):n}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,n)=>{t(n)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const n=new uA.EthereumRpcError(uA.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:void 0,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){const n=new uA.EthereumRpcError(uA.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(n,{id:e.id,jsonrpc:"2.0",error:n})}const n=Object.assign({},e),r={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,r)}catch(e){i=e}return i&&(delete r.result,r.error||(r.error=uA.serializeError(i))),t(i,r)}async _processRequest(e,t){const[n,r,i]=await cA._runAllMiddleware(e,t,this._middleware);if(cA._checkForCompletion(e,t,r),await cA._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,t,n){const r=[];let i=null,o=!1;for(const s of n)if([i,o]=await cA._runMiddleware(e,t,s,r),o)break;return[i,o,r.reverse()]}static _runMiddleware(e,t,n,r){return new Promise((i=>{const o=e=>{const n=e||t.error;n&&(t.error=uA.serializeError(n)),i([n,!0])},s=n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new uA.EthereumRpcError(uA.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:\n${hA(e)}`,{request:e})),r.push(n)),i([null,!1]))};try{n(e,t,s,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,n)=>{t((t=>t?n(t):e()))}))}static _checkForCompletion(e,t,n){if(!("result"in t)&&!("error"in t))throw new uA.EthereumRpcError(uA.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${hA(e)}`,{request:e});if(!n)throw new uA.EthereumRpcError(uA.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${hA(e)}`,{request:e})}}function hA(e){return JSON.stringify(e,null,2)}sA.JsonRpcEngine=cA;var dA={};Object.defineProperty(dA,"__esModule",{value:!0}),dA.mergeMiddleware=void 0;const fA=sA;dA.mergeMiddleware=function(e){const t=new fA.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(e){var t=Wb&&Wb.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=Wb&&Wb.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Xw,e),n(iA,e),n(oA,e),n(eA,e),n(sA,e),n(dA,e)}(Jw);var pA={};Object.defineProperty(pA,"__esModule",{value:!0});pA.default={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};var mA={},gA={},vA=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gA,"__esModule",{value:!0}),gA.createRpcWarningMiddleware=void 0;const yA=vA(pA);gA.createRpcWarningMiddleware=function(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1};return(n,r,i)=>{!1===t.ethDecryptDeprecation&&"eth_decrypt"===n.method?(e.warn(yA.default.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0):!1===t.ethGetEncryptionPublicKeyDeprecation&&"eth_getEncryptionPublicKey"===n.method&&(e.warn(yA.default.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0),i()}},Object.defineProperty(mA,"__esModule",{value:!0}),mA.NOOP=mA.isValidNetworkVersion=mA.isValidChainId=mA.getRpcPromiseCallback=mA.getDefaultExternalMiddleware=mA.EMITTED_NOTIFICATIONS=void 0;const bA=Jw,wA=_w,AA=gA;function _A(e){return(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=wA.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:t})),r((t=>{const{error:r}=n;return r?(e.error(`MetaMask - RPC Error: ${r.message}`,r),t()):t()}))}}mA.EMITTED_NOTIFICATIONS=Object.freeze(["eth_subscription"]),mA.getDefaultExternalMiddleware=(e=console)=>[bA.createIdRemapMiddleware(),_A(e),AA.createRpcWarningMiddleware(e)],mA.getRpcPromiseCallback=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},mA.isValidChainId=e=>Boolean(e)&&"string"==typeof e&&e.startsWith("0x"),mA.isValidNetworkVersion=e=>Boolean(e)&&"string"==typeof e,mA.NOOP=()=>{};var EA=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uw,"__esModule",{value:!0}),uw.BaseProvider=void 0;const MA=EA(cw),kA=_w,SA=EA((function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,i,o,s=Gw(t),a=Gw(n);if(s&&a){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(s!=a)return!1;var l=t instanceof Date,u=n instanceof Date;if(l!=u)return!1;if(l&&u)return t.getTime()==n.getTime();var c=t instanceof RegExp,h=n instanceof RegExp;if(c!=h)return!1;if(c&&h)return t.toString()==n.toString();var d=Zw(t);if((i=d.length)!==Zw(n).length)return!1;for(r=i;0!=r--;)if(!Qw.call(n,d[r]))return!1;for(r=i;0!=r--;)if(!e(t[o=d[r]],n[o]))return!1;return!0}return t!=t&&n!=n})),xA=Jw,CA=EA(pA),TA=mA;class OA extends MA.default{constructor({logger:e=console,maxEventListeners:t=100,rpcMiddleware:n=[]}={}){super(),this._log=e,this.setMaxListeners(t),this._state=Object.assign({},OA._defaultState),this.selectedAddress=null,this.chainId=null,this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const r=new xA.JsonRpcEngine;n.forEach((e=>r.push(e))),this._rpcEngine=r}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw kA.ethErrors.rpc.invalidRequest({message:CA.default.errors.invalidRequestArgs(),data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw kA.ethErrors.rpc.invalidRequest({message:CA.default.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw kA.ethErrors.rpc.invalidRequest({message:CA.default.errors.invalidRequestParams(),data:e});return new Promise(((e,r)=>{this._rpcRequest({method:t,params:n},TA.getRpcPromiseCallback(e,r))}))}_initializeState(e){if(!0===this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result||[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(CA.default.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new kA.EthereumRpcError(1013,t||CA.default.errors.disconnected()),this._log.debug(n)):(n=new kA.EthereumRpcError(1011,t||CA.default.errors.permanentlyDisconnected()),this._log.error(n),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){TA.isValidChainId(e)?(this._handleConnect(e),e!==this.chainId&&(this.chainId=e,this._state.initialized&&this.emit("chainChanged",this.chainId))):this._log.error(CA.default.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]);for(const t of e)if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}SA.default(this._state.accounts,n)||(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,this.selectedAddress!==n[0]&&(this.selectedAddress=n[0]||null),this._state.initialized&&this.emit("accountsChanged",n))}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e||[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}}uw.BaseProvider=OA,OA._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var RA={},PA=[],NA=[],LA="undefined"!=typeof Uint8Array?Uint8Array:Array,IA=!1;function BA(){IA=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)PA[t]=e[t],NA[e.charCodeAt(t)]=t;NA["-".charCodeAt(0)]=62,NA["_".charCodeAt(0)]=63}function DA(e,t,n){for(var r,i,o=[],s=t;s>18&63]+PA[i>>12&63]+PA[i>>6&63]+PA[63&i]);return o.join("")}function jA(e){var t;IA||BA();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,l=n-r;al?l:a+s));return 1===r?(t=e[n-1],i+=PA[t>>2],i+=PA[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=PA[t>>10],i+=PA[t>>4&63],i+=PA[t<<2&63],i+="="),o.push(i),o.join("")}function FA(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+h],h+=d,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)}function UA(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*m}var qA={}.toString,zA=Array.isArray||function(e){return"[object Array]"==qA.call(e)};WA.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;var HA=KA();function KA(){return WA.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function VA(e,t){if(KA()=KA())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+KA().toString(16)+" bytes");return 0|e}function JA(e){return!(null==e||!e._isBuffer)}function XA(e,t){if(JA(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return S_(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return x_(e).length;default:if(r)return S_(e).length;t=(""+t).toLowerCase(),r=!0}}function e_(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return m_(this,t,n);case"utf8":case"utf-8":return h_(this,t,n);case"ascii":return f_(this,t,n);case"latin1":case"binary":return p_(this,t,n);case"base64":return c_(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g_(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function t_(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function n_(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=WA.from(t,r)),JA(t))return 0===t.length?-1:r_(e,t,n,r,i);if("number"==typeof t)return t&=255,WA.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):r_(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function r_(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=n;oa&&(n=a-l),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function c_(e,t,n){return 0===t&&n===e.length?jA(e):jA(e.slice(t,n))}function h_(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=d_)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},WA.prototype.compare=function(e,t,n,r,i){if(!JA(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return i_(this,e,t,n);case"utf8":case"utf-8":return o_(this,e,t,n);case"ascii":return s_(this,e,t,n);case"latin1":case"binary":return a_(this,e,t,n);case"base64":return l_(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u_(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},WA.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var d_=4096;function f_(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function y_(e,t,n,r,i,o){if(!JA(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function b_(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function w_(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function A_(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function __(e,t,n,r,i){return i||A_(e,0,n,4),UA(e,t,n,r,23,4),n+4}function E_(e,t,n,r,i){return i||A_(e,0,n,8),UA(e,t,n,r,52,8),n+8}WA.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},WA.prototype.readUInt8=function(e,t){return t||v_(e,1,this.length),this[e]},WA.prototype.readUInt16LE=function(e,t){return t||v_(e,2,this.length),this[e]|this[e+1]<<8},WA.prototype.readUInt16BE=function(e,t){return t||v_(e,2,this.length),this[e]<<8|this[e+1]},WA.prototype.readUInt32LE=function(e,t){return t||v_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},WA.prototype.readUInt32BE=function(e,t){return t||v_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},WA.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||v_(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},WA.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||v_(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},WA.prototype.readInt8=function(e,t){return t||v_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},WA.prototype.readInt16LE=function(e,t){t||v_(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},WA.prototype.readInt16BE=function(e,t){t||v_(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},WA.prototype.readInt32LE=function(e,t){return t||v_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},WA.prototype.readInt32BE=function(e,t){return t||v_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},WA.prototype.readFloatLE=function(e,t){return t||v_(e,4,this.length),FA(this,e,!0,23,4)},WA.prototype.readFloatBE=function(e,t){return t||v_(e,4,this.length),FA(this,e,!1,23,4)},WA.prototype.readDoubleLE=function(e,t){return t||v_(e,8,this.length),FA(this,e,!0,52,8)},WA.prototype.readDoubleBE=function(e,t){return t||v_(e,8,this.length),FA(this,e,!1,52,8)},WA.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||y_(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},WA.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,1,255,0),WA.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},WA.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,2,65535,0),WA.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):b_(this,e,t,!0),t+2},WA.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,2,65535,0),WA.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):b_(this,e,t,!1),t+2},WA.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,4,4294967295,0),WA.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):w_(this,e,t,!0),t+4},WA.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,4,4294967295,0),WA.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w_(this,e,t,!1),t+4},WA.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);y_(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},WA.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);y_(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},WA.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,1,127,-128),WA.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},WA.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,2,32767,-32768),WA.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):b_(this,e,t,!0),t+2},WA.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,2,32767,-32768),WA.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):b_(this,e,t,!1),t+2},WA.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,4,2147483647,-2147483648),WA.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):w_(this,e,t,!0),t+4},WA.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||y_(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),WA.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w_(this,e,t,!1),t+4},WA.prototype.writeFloatLE=function(e,t,n){return __(this,e,t,!0,n)},WA.prototype.writeFloatBE=function(e,t,n){return __(this,e,t,!1,n)},WA.prototype.writeDoubleLE=function(e,t,n){return E_(this,e,t,!0,n)},WA.prototype.writeDoubleBE=function(e,t,n){return E_(this,e,t,!1,n)},WA.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!WA.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function x_(e){return function(e){var t,n,r,i,o,s;IA||BA();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new LA(3*a/4-o),r=o>0?a-4:a;var l=0;for(t=0,n=0;t>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===o?(i=NA[e.charCodeAt(t)]<<2|NA[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===o&&(i=NA[e.charCodeAt(t)]<<10|NA[e.charCodeAt(t+1)]<<4|NA[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C_(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function T_(e){return null!=e&&(!!e._isBuffer||O_(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&O_(e.slice(0,0))}(e))}function O_(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var R_=Object.freeze({__proto__:null,Buffer:WA,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),WA.alloc(+e)},isBuffer:T_,kMaxLength:HA}),P_="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},N_=/%[sdj%]/g;function L_(e){if(!Z_(e)){for(var t=[],n=0;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),s=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),W_(t)?n.showHidden=t:t&&cE(n,t),J_(n.showHidden)&&(n.showHidden=!1),J_(n.depth)&&(n.depth=2),J_(n.colors)&&(n.colors=!1),J_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=U_),z_(n,e,n.depth)}function U_(e,t){var n=F_.styles[t];return n?"["+F_.colors[n][0]+"m"+e+"["+F_.colors[n][1]+"m":e}function q_(e,t){return e}function z_(e,t,n){if(e.customInspect&&t&&rE(t.inspect)&&t.inspect!==F_&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Z_(r)||(r=z_(e,r,n)),r}var i=function(e,t){if(J_(t))return e.stylize("undefined","undefined");if(Z_(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return G_(t)?e.stylize(""+t,"number"):W_(t)?e.stylize(""+t,"boolean"):$_(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),nE(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return H_(t);if(0===o.length){if(rE(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(X_(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(tE(t))return e.stylize(Date.prototype.toString.call(t),"date");if(nE(t))return H_(t)}var l,u="",c=!1,h=["{","}"];return V_(t)&&(c=!0,h=["[","]"]),rE(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),X_(t)&&(u=" "+RegExp.prototype.toString.call(t)),tE(t)&&(u=" "+Date.prototype.toUTCString.call(t)),nE(t)&&(u=" "+H_(t)),0!==o.length||c&&0!=t.length?n<0?X_(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=c?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,h)):h[0]+u+h[1]}function H_(e){return"["+Error.prototype.toString.call(e)+"]"}function K_(e,t,n,r,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),hE(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=$_(n)?z_(e,l.value,null):z_(e,l.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),J_(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function V_(e){return Array.isArray(e)}function W_(e){return"boolean"==typeof e}function $_(e){return null===e}function Y_(e){return null==e}function G_(e){return"number"==typeof e}function Z_(e){return"string"==typeof e}function Q_(e){return"symbol"==typeof e}function J_(e){return void 0===e}function X_(e){return eE(e)&&"[object RegExp]"===sE(e)}function eE(e){return"object"==typeof e&&null!==e}function tE(e){return eE(e)&&"[object Date]"===sE(e)}function nE(e){return eE(e)&&("[object Error]"===sE(e)||e instanceof Error)}function rE(e){return"function"==typeof e}function iE(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function oE(e){return T_(e)}function sE(e){return Object.prototype.toString.call(e)}function aE(e){return e<10?"0"+e.toString(10):e.toString(10)}F_.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},F_.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var lE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function uE(){console.log("%s - %s",function(){var e=new Date,t=[aE(e.getHours()),aE(e.getMinutes()),aE(e.getSeconds())].join(":");return[e.getDate(),lE[e.getMonth()],t].join(" ")}(),L_.apply(null,arguments))}function cE(e,t){if(!t||!eE(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function hE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var dE={inherits:P_,_extend:cE,log:uE,isBuffer:oE,isPrimitive:iE,isFunction:rE,isError:nE,isDate:tE,isObject:eE,isRegExp:X_,isUndefined:J_,isSymbol:Q_,isString:Z_,isNumber:G_,isNullOrUndefined:Y_,isNull:$_,isBoolean:W_,isArray:V_,inspect:F_,deprecate:I_,format:L_,debuglog:j_},fE=Object.freeze({__proto__:null,_extend:cE,debuglog:j_,default:dE,deprecate:I_,format:L_,inherits:P_,inspect:F_,isArray:V_,isBoolean:W_,isBuffer:oE,isDate:tE,isError:nE,isFunction:rE,isNull:$_,isNullOrUndefined:Y_,isNumber:G_,isObject:eE,isPrimitive:iE,isRegExp:X_,isString:Z_,isSymbol:Q_,isUndefined:J_,log:uE});function pE(){this.head=null,this.tail=null,this.length=0}pE.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},pE.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},pE.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},pE.prototype.clear=function(){this.head=this.tail=null,this.length=0},pE.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},pE.prototype.concat=function(e){if(0===this.length)return WA.alloc(0);if(1===this.length)return this.head.data;for(var t=WA.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var mE=WA.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function gE(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!mE(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=yE;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=bE;break;default:return void(this.write=vE)}this.charBuffer=new WA(6),this.charReceived=0,this.charLength=0}function vE(e){return e.toString(this.encoding)}function yE(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function bE(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}gE.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},gE.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},gE.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},_E.ReadableState=AE;var wE=j_("stream");function AE(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof ZE&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new pE,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.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new gE(e.encoding),this.encoding=e.encoding)}function _E(e){if(!(this instanceof _E))return new _E(e);this._readableState=new AE(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),dw.call(this)}function EE(e,t,n,r,i){var o=function(e,t){var n=null;return T_(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,SE(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var l;!t.decoder||i||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&SE(e))),function(e,t){t.readingMore||(t.readingMore=!0,Pb(CE,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=ME?e=ME:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function SE(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(wE("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Pb(xE,e):xE(e))}function xE(e){wE("emit readable"),e.emit("readable"),RE(e)}function CE(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=WA.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function NE(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Pb(LE,t,e))}function LE(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function IE(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return wE("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?NE(this):SE(this),null;if(0===(e=kE(e,t))&&t.ended)return 0===t.length&&NE(this),null;var r,i=t.needReadable;return wE("need readable",i),(0===t.length||t.length-e0?PE(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&NE(this)),null!==r&&this.emit("data",r),r},_E.prototype._read=function(e){this.emit("error",new Error("not implemented"))},_E.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,wE("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:s;function o(e){wE("onunpipe"),e===n&&u()}function s(){wE("onend"),e.end()}r.endEmitted?Pb(i):n.once("end",i),e.on("unpipe",o);var a=function(e){return function(){var t=e._readableState;wE("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,RE(e))}}(n);e.on("drain",a);var l=!1;function u(){wE("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",a),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",u),n.removeListener("data",h),l=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a()}var c=!1;function h(t){wE("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==IE(r.pipes,e))&&!l&&(wE("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){wE("onerror",t),m(),e.removeListener("error",d),0===("error",e.listeners("error").length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),m()}function p(){wE("onfinish"),e.removeListener("close",f),m()}function m(){wE("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(wE("pipe resume"),n.resume()),e},_E.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},FE.prototype._write=function(e,t,n){n(new Error("not implemented"))},FE.prototype._writev=null,FE.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,VE(e,t),n&&(t.finished?Pb(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},P_(ZE,_E);for(var $E=Object.keys(FE.prototype),YE=0;YE<$E.length;YE++){var GE=$E[YE];ZE.prototype[GE]||(ZE.prototype[GE]=FE.prototype[GE])}function ZE(e){if(!(this instanceof ZE))return new ZE(e);_E.call(this,e),FE.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",QE)}function QE(){this.allowHalfOpen||this._writableState.ended||Pb(JE,this)}function JE(e){e.end()}function XE(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.lengththis._onMessage(e))),this._port.onDisconnect.addListener((()=>this._onDisconnect()))}_onMessage(e){if(T_(e)){const t=WA.from(e);this.push(t)}else this.push(e)}_onDisconnect(){this.destroy()}_read(){}_write(e,t,n){try{if(T_(e)){const t=e.toJSON();t._isBuffer=!0,this._port.postMessage(t)}else this._port.postMessage(e)}catch(e){return n(new Error("PortDuplexStream - disconnected"))}return n()}},sM=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function xM(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const e of n)if(e&&await CM(e.href))return e.href;return null}function CM(e){return new Promise(((t,n)=>{try{const n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}}))}_M.sendSiteMetadata=async function(e,t){try{const t=await async function(){return{name:SM(window),icon:await xM(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},kM.NOOP)}catch(e){t.error({message:MM.default.errors.sendSiteMetadata(),originalError:e})}};var TM={},OM={},RM={exports:{}},PM={exports:{}};void 0===Vb||!Vb.version||0===Vb.version.indexOf("v0.")||0===Vb.version.indexOf("v1.")&&0!==Vb.version.indexOf("v1.8.")?PM.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return Pb(e);case 2:return Pb((function(){e.call(null,t)}));case 3:return Pb((function(){e.call(null,t,n)}));case 4:return Pb((function(){e.call(null,t,n,r)}));default:for(i=new Array(s-1),o=0;o-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),f.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},f.prototype._writev=null,f.prototype.end=function(t,n,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,n=null):"function"==typeof n&&(r=n,n=null),null!=t&&this.write(t,n),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,n,r){n.ending=!0,b(t,n),r&&(n.finished?e.nextTick(r):t.once("finish",r)),n.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),f.prototype.destroy=c.destroy,f.prototype._undestroy=c.undestroy,f.prototype._destroy=function(e,t){this.end(),t(e)},GM}function rk(){if(JM)return QM;JM=1;var e=NM,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};QM=l;var n=Object.create(UM);n.inherits=KM;var r=uk(),i=nk();n.inherits(l,r);for(var o=t(i.prototype),s=0;s>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function a(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return ak.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(o>0&&(e.lastNeed=o-1),o):--i=0?(o>0&&(e.lastNeed=o-2),o):--i=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},ak}function uk(){if(sk)return ok;sk=1;var e=NM;ok=m;var t,n=IM;m.ReadableState=p,yw.EventEmitter;var r=function(e,t){return e.listeners(t).length},i=BM,o=FM.Buffer,s=(void 0!==Wb?Wb:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Object.create(UM);a.inherits=KM;var l=VM,u=void 0;u=l&&l.debuglog?l.debuglog("stream"):function(){};var c,h=(HM||(HM=1,function(e){var t=FM.Buffer,n=VM;e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return t.alloc(0);for(var n,r,i=t.allocUnsafe(e>>>0),o=this.head,s=0;o;)n=i,r=s,o.data.copy(n,r),s+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})}(WM)),WM.exports),d=XM;a.inherits(m,i);var f=["error","close","destroy","pause","resume"];function p(e,n){e=e||{};var r=n instanceof(t=t||rk());this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=lk().StringDecoder),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function m(e){if(t=t||rk(),!(this instanceof m))return new m(e);this._readableState=new p(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),i.call(this)}function g(e,t,n,r,i){var a,l=e._readableState;return null===t?(l.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,w(e)}}(e,l)):(i||(a=function(e,t){var n,r;return r=t,o.isBuffer(r)||r instanceof s||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(l,t)),a?e.emit("error",a):l.objectMode||t&&t.length>0?("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),r?l.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):v(e,l,t,!0):l.ended?e.emit("error",new Error("stream.push() after EOF")):(l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?v(e,l,t,!1):_(e,l)):v(e,l,t,!1))):r||(l.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=y?e=y:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function w(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(u("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(A,t):A(t))}function A(e){u("emit readable"),e.emit("readable"),S(e)}function _(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(E,t,n))}function E(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=o.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var s=r.data,a=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,a),0==(e-=a)){a===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function C(t){var n=t._readableState;if(n.length>0)throw new Error('"endReadable()" called on non-empty stream');n.endEmitted||(n.ended=!0,e.nextTick(T,n,t))}function T(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function O(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?C(this):w(this),null;if(0===(e=b(e,t))&&t.ended)return 0===t.length&&C(this),null;var r,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e0?x(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&C(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(t,i){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,u("pipe count=%d opts=%j",s.pipesCount,i);var a=i&&!1===i.end||t===Vb.stdout||t===Vb.stderr?v:l;function l(){u("onend"),t.end()}s.endEmitted?e.nextTick(a):o.once("end",a),t.on("unpipe",(function e(n,r){u("onunpipe"),n===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",m),t.removeListener("finish",g),t.removeListener("drain",c),t.removeListener("error",p),t.removeListener("unpipe",e),o.removeListener("end",l),o.removeListener("end",v),o.removeListener("data",f),h=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r(e,"data")&&(t.flowing=!0,S(e))}}(o);t.on("drain",c);var h=!1,d=!1;function f(e){u("ondata"),d=!1,!1!==t.write(e)||d||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==O(s.pipes,t))&&!h&&(u("false write response, pause",s.awaitDrain),s.awaitDrain++,d=!0),o.pause())}function p(e){u("onerror",e),v(),t.removeListener("error",p),0===r(t,"error")&&t.emit("error",e)}function m(){t.removeListener("finish",g),v()}function g(){u("onfinish"),t.removeListener("close",m),v()}function v(){u("unpipe"),o.unpipe(t)}return o.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(t,"error",p),t.once("close",m),t.once("finish",g),t.emit("pipe",o),s.flowing||(u("pipe resume"),o.resume()),t},m.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;ot.destroy(e||void 0))),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=Fk}_read(){}_write(e,t,n){const{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const o=this._substreams[r];return o?(o!==Fk&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}}OM.ObjectMultiplex=Uk;var qk=OM.ObjectMultiplex;const zk=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;zk.writable=e=>zk(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,zk.readable=e=>zk(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,zk.duplex=e=>zk.writable(e)&&zk.readable(e),zk.transform=e=>zk.duplex(e)&&"function"==typeof e._transform;var Hk=zk,Kk={},Vk={};Object.defineProperty(Vk,"__esModule",{value:!0});const Wk=Ak;Vk.default=function(e){if(!e||!e.engine)throw new Error("Missing engine parameter!");const{engine:t}=e,n=new Wk.Duplex({objectMode:!0,read:()=>{},write:function(e,r,i){t.handle(e,((e,t)=>{n.push(t)})),i()}});return t.on&&t.on("notification",(e=>{n.push(e)})),n};var $k={},Yk=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($k,"__esModule",{value:!0});const Gk=Yk(cw),Zk=Ak;$k.default=function(e={}){const t={},n=new Zk.Duplex({objectMode:!0,read:()=>{},write:function(n,o,s){let a=null;try{n.id?function(e){const n=t[e.id];n?(delete t[e.id],Object.assign(n.res,e),setTimeout(n.end)):console.warn(`StreamMiddleware - Unknown response id "${e.id}"`)}(n):function(n){(null==e?void 0:e.retryOnMessage)&&n.method===e.retryOnMessage&&Object.values(t).forEach((({req:e,retryCount:n=0})=>{if(e.id){if(n>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);t[e.id].retryCount=n+1,i(e)}})),r.emit("notification",n)}(n)}catch(e){a=e}s(a)}}),r=new Gk.default;return{events:r,middleware:(e,n,r,o)=>{i(e),t[e.id]={req:e,res:n,next:r,end:o}},stream:n};function i(e){n.push(e)}};var Qk=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Kk,"__esModule",{value:!0}),Kk.createStreamMiddleware=Kk.createEngineStream=void 0;const Jk=Qk(Vk);Kk.createEngineStream=Jk.default;const Xk=Qk($k);Kk.createStreamMiddleware=Xk.default;var eS=Sk,tS=Ok,nS=Yb(Object.freeze({__proto__:null,default:{}})),rS=function(){},iS=/^v?\.0/.test(Vb.version),oS=function(e){return"function"==typeof e},sS=function(e){e()},aS=function(e,t){return e.pipe(t)},lS=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(TM,"__esModule",{value:!0}),TM.StreamProvider=TM.AbstractStreamProvider=void 0;const uS=lS(qk),cS=Hk,hS=Kk,dS=lS((function(){var e,t=Array.prototype.slice.call(arguments),n=oS(t[t.length-1]||rS)&&t.pop()||rS;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map((function(i,o){var s=o0,(function(t){e||(e=t),t&&r.forEach(sS),s||(r.forEach(sS),n(e))}))}));return t.reduce(aS)})),fS=lS(pA),pS=mA,mS=uw;class gS extends mS.BaseProvider{constructor(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:i}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!cS.duplex(e))throw new Error(fS.default.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new uS.default;dS.default(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=hS.createStreamMiddleware({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),dS.default(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",(t=>{const{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):pS.EMITTED_NOTIFICATIONS.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(new Error(fS.default.errors.permanentlyDisconnected()))}))}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;(null==t?void 0:t.stack)&&(n+=`\n${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){pS.isValidChainId(e)&&pS.isValidNetworkVersion(t)?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(fS.default.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}}TM.AbstractStreamProvider=gS,TM.StreamProvider=class extends gS{async initialize(){return this._initializeStateAsync()}},function(e){var t=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=void 0;const n=_w,r=_M,i=t(pA),o=mA,s=TM;e.MetaMaskInpageProviderStreamName="metamask-provider";class a extends s.AbstractStreamProvider{constructor(t,{jsonRpcStreamName:n=e.MetaMaskInpageProviderStreamName,logger:i=console,maxEventListeners:s,shouldSendMetadata:a}={}){if(super(t,{jsonRpcStreamName:n,logger:i,maxEventListeners:s,rpcMiddleware:o.getDefaultExternalMiddleware(i)}),this._sentWarnings={enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},this._initializeStateAsync(),this.networkVersion=null,this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",(e=>{const{method:t}=e;o.EMITTED_NOTIFICATIONS.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))})),a)if("complete"===document.readyState)r.sendSiteMetadata(this._rpcEngine,this._log);else{const e=()=>{r.sendSiteMetadata(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),this.networkVersion&&!e&&(this.networkVersion=null)}_warnOfDeprecation(e){var t;!1===(null===(t=this._sentWarnings)||void 0===t?void 0:t.events[e])&&(this._log.warn(i.default.warnings.events[e]),this._sentWarnings.events[e]=!0)}enable(){return this._sentWarnings.enable||(this._log.warn(i.default.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise(((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},o.getRpcPromiseCallback(e,t))}catch(e){t(e)}}))}send(e,t){return this._sentWarnings.send||(this._log.warn(i.default.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise(((n,r)=>{try{this._rpcRequest({method:e,params:t},o.getRpcPromiseCallback(n,r,!1))}catch(e){r(e)}}))}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress||null;break;case"eth_uninstallFilter":this._rpcRequest(e,o.NOOP),t=!0;break;case"net_version":t=this.networkVersion||null;break;default:throw new Error(i.default.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise((e=>{this.on("_initialized",(()=>e()))})),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw n.ethErrors.rpc.invalidRequest({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise(((t,n)=>{this._rpcRequest(e,o.getRpcPromiseCallback(t,n))}))}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(i.default.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==this.networkVersion&&(this.networkVersion=t,this._state.initialized&&this.emit("networkChanged",this.networkVersion))}}e.MetaMaskInpageProvider=a}(AM);var vS=Wb&&Wb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(RA,"__esModule",{value:!0}),RA.createExternalExtensionProvider=void 0;const yS=vS(oM),bS=wM,wS=AM,AS=TM,_S=mA,ES=vS({CHROME_ID:"nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX_ID:"webextension@metamask.io"}),MS=bS.detect();RA.createExternalExtensionProvider=function(){let e;try{const t=function(){switch(null==MS?void 0:MS.name){case"chrome":default:return ES.default.CHROME_ID;case"firefox":return ES.default.FIREFOX_ID}}(),n=chrome.runtime.connect(t),r=new yS.default(n);e=new AS.StreamProvider(r,{jsonRpcStreamName:wS.MetaMaskInpageProviderStreamName,logger:console,rpcMiddleware:_S.getDefaultExternalMiddleware(console)}),e.initialize()}catch(e){throw console.dir("MetaMask connect error.",e),e}return e};var kS={},SS={};Object.defineProperty(SS,"__esModule",{value:!0}),SS.shimWeb3=void 0,SS.shimWeb3=function(e,t=console){let n=!1,r=!1;if(!window.web3){const i="__isMetaMaskShim__";let o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,s,...a)=>("currentProvider"!==s||n?"currentProvider"===s||s===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch((e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)}))):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,s,...a)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}},Object.defineProperty(kS,"__esModule",{value:!0}),kS.setGlobalProvider=kS.initializeProvider=void 0;const xS=AM,CS=SS;function TS(e){window.ethereum=e,window.dispatchEvent(new Event("ethereum#initialized"))}kS.initializeProvider=function({connectionStream:e,jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i=!0,shouldSetOnWindow:o=!0,shouldShimWeb3:s=!1}){const a=new xS.MetaMaskInpageProvider(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,shouldSendMetadata:i}),l=new Proxy(a,{deleteProperty:()=>!0});return o&&TS(l),s&&CS.shimWeb3(l,n),l},kS.setGlobalProvider=TS,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StreamProvider=e.shimWeb3=e.setGlobalProvider=e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=e.initializeProvider=e.createExternalExtensionProvider=e.BaseProvider=void 0;const t=uw;Object.defineProperty(e,"BaseProvider",{enumerable:!0,get:function(){return t.BaseProvider}});const n=RA;Object.defineProperty(e,"createExternalExtensionProvider",{enumerable:!0,get:function(){return n.createExternalExtensionProvider}});const r=kS;Object.defineProperty(e,"initializeProvider",{enumerable:!0,get:function(){return r.initializeProvider}}),Object.defineProperty(e,"setGlobalProvider",{enumerable:!0,get:function(){return r.setGlobalProvider}});const i=AM;Object.defineProperty(e,"MetaMaskInpageProvider",{enumerable:!0,get:function(){return i.MetaMaskInpageProvider}}),Object.defineProperty(e,"MetaMaskInpageProviderStreamName",{enumerable:!0,get:function(){return i.MetaMaskInpageProviderStreamName}});const o=SS;Object.defineProperty(e,"shimWeb3",{enumerable:!0,get:function(){return o.shimWeb3}});const s=TM;Object.defineProperty(e,"StreamProvider",{enumerable:!0,get:function(){return s.StreamProvider}})}(lw);class OS extends lw.MetaMaskInpageProvider{constructor({connectionStream:e,shouldSendMetadata:t,debug:n=!1,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.debug=!1,this.autoRequestAccounts=!1,this.providerStateRequested=!1,n&&console.debug(`SDKProvider::constructor debug=${n} autoRequestAccounts=${r}`),this.autoRequestAccounts=r,this.debug=n}forceInitializeState(){return t(this,void 0,void 0,(function*(){return this.debug&&console.debug(`SDKProvider::forceInitializeState() autoRequestAccounts=${this.autoRequestAccounts}`),this._initializeStateAsync()}))}getState(){return this._state}handleDisconnect({terminate:e=!1}){this.debug&&console.debug(`SDKProvider::handleDisconnect() cleaning up provider state terminate=${e}`,this),e&&(this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0,this._state.initialized=!1),this._handleAccountsChanged([]),this._state.isConnected=!1,this.emit("disconnect",_w.ethErrors.provider.disconnected()),this.providerStateRequested=!1}_initializeStateAsync(){var e;return t(this,void 0,void 0,(function*(){if(this.debug&&console.debug("SDKProvider::_initializeStateAsync()"),this.providerStateRequested)this.debug&&console.debug("SDKProvider::_initializeStateAsync() initialization already in progress");else{let t;this.providerStateRequested=!0;try{t=yield this.request({method:"metamask_getProviderState"})}catch(e){return this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e),void(this.providerStateRequested=!1)}if(this.debug&&console.debug(`SDKProvider::_initializeStateAsync state selectedAddress=${this.selectedAddress} `,t),0===(null===(e=null==t?void 0:t.accounts)||void 0===e?void 0:e.length))if(this.debug&&console.debug("SDKProvider::_initializeStateAsync initial state doesn't contain accounts"),this.selectedAddress)this.debug&&console.debug("SDKProvider::_initializeStateAsync using this.selectedAddress instead"),t.accounts=[this.selectedAddress];else{this.debug&&console.debug("SDKProvider::_initializeStateAsync Fetch accounts remotely.");const e=yield this.request({method:"eth_requestAccounts",params:[]});t.accounts=e}this._initializeState(t),this.providerStateRequested=!1}}))}_initializeState(e){return this.debug&&console.debug("SDKProvider::_initializeState() set state._initialized to false"),this._state.initialized=!1,super._initializeState(e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.debug&&console.debug(`SDKProvider::_handleChainChanged chainId=${e} networkVersion=${t}`);let n=t;t||(console.info("forced network version to prevent provider error"),n="1"),this._state.isConnected=!0,this.emit("connect",{chainId:e}),super._handleChainChanged({chainId:e,networkVersion:n})}}class RS{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r,debug:i=!1}){this.debug=!1,this.debug=i;const o=new OS({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1,debug:i});this.debug=i;const s=new Proxy(o,{deleteProperty:()=>!0});this.provider=s,e&&"undefined"!=typeof window&&lw.setGlobalProvider(this.provider),r&&"undefined"!=typeof window&&lw.shimWeb3(this.provider),this.provider.on("_initialized",(()=>{const e={chainId:this.provider.chainId,isConnected:this.provider.isConnected(),isMetaNask:this.provider.isMetaMask,selectedAddress:this.provider.selectedAddress,networkVersion:this.provider.networkVersion};this.debug&&console.info("Ethereum provider initialized",e)}))}static init(e){var t;return e.debug&&console.debug("Ethereum::init()"),this.instance=new RS(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){RS.instance=void 0}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}var PS,NS;!function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-modbile",e.ReactNative="react-native"}(PS||(PS={})),function(e){e.Disabled="Disabled",e.Temporary="Temporary",e.UntilResponse="UntilResponse"}(NS||(NS={}));const LS=()=>"wakeLock"in navigator,IS=()=>"undefined"!=typeof navigator&&parseFloat(`${(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]}`.replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream;class BS{constructor(){this.enabled=!1,this._eventsAdded=!1}start(){if(this.enabled=!1,console.debug(`WakeLockManager::start() hasNativeWakeLock=${LS()}`),LS()&&!this._eventsAdded){this._eventsAdded=!0,this._wakeLock=void 0;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else IS()?this.noSleepTimer=void 0:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","MetaMask SDK - Listening for responses"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo&&(this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})))})))}_addSourceToVideo(e,t,n){const r=document.createElement("source");r.src=n,r.type=`video/${t}`,e.appendChild(r)}isEnabled(){return this.enabled}enable(){var e;if(this.enabled&&this.disable(),this.start(),LS())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0})).catch((()=>(this.enabled=!1,!1)));if(IS())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();if(this.noSleepVideo){const t=null===(e=this.noSleepVideo)||void 0===e?void 0:e.play();return this.enabled=!0,t.then((()=>!0)).catch((()=>!1))}return this.enabled=!0,Promise.resolve()}disable(){if(this.enabled){if(LS())this._wakeLock&&this._wakeLock.release(),this._wakeLock=void 0;else if(IS())this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=void 0);else try{if(!this.noSleepVideo)return;this.noSleepVideo.firstChild&&(this.noSleepVideo.removeChild(this.noSleepVideo.firstChild),this.noSleepVideo.load()),this.noSleepVideo.pause(),this.noSleepVideo.src="",this.noSleepVideo.remove()}catch(e){console.log(e)}this.enabled=!1}}}class DS{constructor({useDeepLink:e,preferredOpenLink:t,wakeLockStatus:n=NS.Temporary,debug:r=!1}){this.wakeLock=new BS,this.wakeLockStatus=NS.Temporary,this.wakeLockFeatureActive=!1,this.useDeeplink=!1,this.debug=!1,this.platformType=this.getPlatformType(),this.useDeeplink=e,this.preferredOpenLink=t,this.wakeLockStatus=n,this.debug=r}static init(e){return DS.instance=new DS(e),DS.instance}static getInstance(){if(!DS.instance)throw new Error("Platform not initialied - call Platform.init() first.");return DS.instance}enableWakeLock(){if(this.wakeLockStatus===NS.Disabled)return;this.wakeLock.enable();const e=this.wakeLockStatus===NS.Temporary?2e3:2e4;this.wakeLockTimer=setTimeout((()=>{this.disableWakeLock()}),e),this.wakeLockFeatureActive||this.wakeLockStatus!==NS.UntilResponse||(this.wakeLockFeatureActive=!0,window.addEventListener("focus",(()=>this.disableWakeLock())))}disableWakeLock(){this.wakeLockStatus!==NS.Disabled&&(this.wakeLockTimer&&clearTimeout(this.wakeLockTimer),this.wakeLock.disable())}openDeeplink(e,t,n){this.debug&&(console.debug(`Platform::openDeepLink universalLink --\x3e ${e}`),console.debug(`Platform::openDeepLink deepLink --\x3e ${t}`)),this.isBrowser()&&this.enableWakeLock();try{if(this.preferredOpenLink)return void this.preferredOpenLink(e,n);if("undefined"!=typeof window){let n;n=this.useDeeplink?window.open(t,"_blank"):window.open(e,"_blank"),setTimeout((()=>{var e;return null===(e=null==n?void 0:n.close)||void 0===e?void 0:e.call(n)}),500)}}catch(e){console.log("Platform::openDeepLink() can't open link",e)}}isReactNative(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product}isMetaMaskInstalled(){const e=RS.getProvider()||(null===window||void 0===window?void 0:window.ethereum);return this.debug&&console.debug(`Platform::isMetaMaskInstalled isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}isMobile(){var e,t;const n=Jb.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&Boolean(window.ReactNativeWebView)&&Boolean(navigator.userAgent.endsWith("MetaMaskMobile"))}isMobileWeb(){return this.platformType===PS.MobileWeb}isNotBrowser(){var e;return"undefined"==typeof window||!(null===window||void 0===window?void 0:window.navigator)||void 0!==n.g&&"ReactNative"===(null===(e=null===n.g||void 0===n.g?void 0:n.g.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null===navigator||void 0===navigator?void 0:navigator.product)}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.useDeeplink}getPlatformType(){return this.platformType?this.platformType:this.isNotBrowser()?PS.NonBrowser:this.isMetaMaskMobileWebView()?PS.MetaMaskMobileWebview:this.isMobile()?PS.MobileWeb:PS.DesktopWeb}}class jS{constructor({preferDesktop:e,remote:t,debug:n=!1}){this.isInstalling=!1,this.hasInstalled=!1,this.resendRequest=null,this.preferDesktop=!1,this.debug=!1,this.preferDesktop=e,this.remote=t,this.debug=n}static init(e){return jS.instance=new jS(e),jS.instance}static getInstance(){if(!jS.instance)throw new Error("MetaMask installer not initialized - call MetaMaskInstaller.init() first.");return jS.instance}startDesktopOnboarding(){this.debug&&console.debug("MetamaskInstaller::startDesktopOnboarding()"),RS.destroy(),delete window.ethereum,(new aw).startOnboarding()}redirectToProperInstall(){return t(this,void 0,void 0,(function*(){const e=DS.getInstance().getPlatformType();if(this.debug&&console.debug(`MetamaskInstaller::redirectToProperInstall() platform=${e} this.preferDesktop=${this.preferDesktop}`),e===PS.MetaMaskMobileWebview)return alert("Please save your seedphrase and try to reinstall MetaMask Mobile"),!1;if(e===PS.DesktopWeb&&(this.isInstalling=!0,this.preferDesktop))return this.startDesktopOnboarding(),!1;this.isInstalling=!0;try{const e=yield this.remote.startConnection();return e&&(this.isInstalling=!1,this.hasInstalled=!0),e}catch(e){console.error("An error occured",e)}return!1}))}checkInstallation(){return t(this,void 0,void 0,(function*(){const e=DS.getInstance().isMetaMaskInstalled();return this.debug&&console.log(`MetamaskInstaller::checkInstallation() isInstalled=${e}`),!!e||(yield this.redirectToProperInstall())}))}start({wait:e=!1}){return t(this,void 0,void 0,(function*(){return this.debug&&console.debug(`MetamaskInstaller::start() wait=${e}`),e&&(yield(1e3,new Promise((e=>{setTimeout((()=>{e(!0)}),1e3)})))),yield this.checkInstallation()}))}}const FS={eth_requestAccounts:!0,eth_sendTransaction:!0,eth_signTransaction:!0,eth_sign:!0,personal_sign:!0,eth_signTypedData:!0,eth_signTypedData_v3:!0,eth_signTypedData_v4:!0,wallet_watchAsset:!0,wallet_addEthereumChain:!0,wallet_switchEthereumChain:!0},US=".sdk-comm";var qS;!function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(qS||(qS={}));class zS extends ZE{constructor({name:t,remote:n,debug:r}){super({objectMode:!0}),this._name=t,this.remote=n,this.debug=r,this._onMessage=this._onMessage.bind(this),this.remote.on(e.EventType.MESSAGE,this._onMessage)}_write(e,n,r){var i,o,s;return t(this,void 0,void 0,(function*(){const t=DS.getInstance(),n=this.remote.isReady(),a=this.remote.isConnected(),l=this.remote.isPaused(),u=this.remote.isReady(),c=RS.getProvider(),h=this.remote.getChannelId();if(this.debug&&console.debug(`RPCMS::_write isRemoteReady=${n}\n } channelId=${h} isSocketConnected=${a} isRemotePaused=${l} providerConnected=${c.isConnected()}`),!h)return this.debug&&console.warn("Invalid channel id -- undefined"),r();this.debug&&console.debug(`RPCMS::_write remote.isPaused()=${this.remote.isPaused()} ready=${u} socketConnected=${a}`,e);try{let n;WA.isBuffer(e)?(n=e.toJSON(),n._isBuffer=!0):n=e;const l=null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.method;if(this.remote.sendMessage(null==n?void 0:n.data).catch((e=>{console.warn("RCPMS::_write cannot send message",e)})),!t.isSecure())return this.debug&&console.log(`RCPMS::_write unsecure platform for method ${l} -- return callback`),r();if(this.debug&&console.log(`RCPMS::_write sending delayed method ${l}`),!a&&!u)return this.debug&&console.debug(`RCPMS::_write invalid connection status targetMethod=${l} socketConnected=${a} ready=${u} providerConnected=${c.isConnected()}\n\n`),r();if(!a&&u)return console.warn("RCPMS::_write invalid socket status -- shouln't happen"),r();const d=null!==(s=null===(o=this.remote.getKeyInfo())||void 0===o?void 0:o.ecies.public)&&void 0!==s?s:"",f=encodeURI(`channelId=${h}&pubkey=${d}&comm=socket`);FS[l]?(this.debug&&console.debug(`RCPMS::_write redirect link for '${l}' socketConnected=${a}`,`connect?${f}`),t.openDeeplink(`https://metamask.app.link/connect?${f}`,`metamask://connect?${f}`,"_self")):this.remote.isPaused()?(this.debug&&console.debug(`RCPMS::_write MM is PAUSED! deeplink with connect! targetMethod=${l}`),t.openDeeplink(`https://metamask.app.link/connect?redirect=true&${f}`,`metamask://connect?redirect=true&${f}`,"_self")):console.debug(`RCPMS::_write method ${l} doesn't need redirect.`)}catch(e){return this.debug&&console.error("RCPMS::_write error",e),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()}))}_read(){}_onMessage(e){try{if(this.debug&&console.debug("[RCPMS] _onMessage ",e),!e||"object"!=typeof e)return;if("object"!=typeof(null==e?void 0:e.data))return;if(!(null==e?void 0:e.name))return;if((null==e?void 0:e.name)!==qS.PROVIDER)return;if(WA.isBuffer(e)){const t=WA.from(e);this.push(t)}else this.push(e)}catch(e){this.debug&&console.debug("RCPMS ignore message error",e)}}start(){}}class HS extends ZE{constructor({name:e,wcConnector:t}){super({objectMode:!0}),this._alreadySubscribed=!1,this._name=e,this.wcConnector=t}_write(e,t,n){var r;if(!this.wcConnector.isConnected())return n();try{let t;WA.isBuffer(e)?(t=e.toJSON(),t._isBuffer=!0):t=e,this.wcConnector.sendCustomRequest(null==t?void 0:t.data).then((e=>{const n={data:{name:qS.PROVIDER,data:{id:t.data.id,jsonrpc:"2.0",result:e}},target:qS.INPAGE};this._onMessage(n)})).catch((e=>{const n={data:{name:qS.PROVIDER,data:{id:t.data.id,jsonrpc:"2.0",error:e.toString()}},target:qS.INPAGE};this._onMessage(n)}));const n=DS.getInstance(),i=n.getPlatformType()===PS.DesktopWeb,o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.method;FS[o]&&!i&&n.openDeeplink("https://metamask.app.link/","metamask://","_self")}catch(e){return n(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return n()}_read(){}_onMessage(e){const t=e.data;if(t&&"object"==typeof t&&t.data&&"object"==typeof t.data&&(!e.target||e.target===this._name))if(WA.isBuffer(t)){delete t._isBuffer;const e=WA.from(t);this.push(e)}else this.push(t)}setProviderState({chainId:e,accounts:t}){const n={data:{name:qS.PROVIDER,data:{method:"metamask_chainChanged",params:{chainId:`0x${parseInt(e,10).toString(16)}`,networkVersion:e.toString()}}},target:qS.INPAGE},r={data:{name:qS.PROVIDER,data:{method:"metamask_accountsChanged",params:[t[0]]}},target:qS.INPAGE};this._onMessage(n),this._onMessage(r)}subscribeToConnectionEvents(){this.wcConnector.forceRestart&&(this.wcConnector.killSession(),this.wcConnector.forceRestart=!1),this.wcConnector.isConnected()&&(provider._state.initialized=!0,provider._initializeState()),this._alreadySubscribed||(this.wcConnector.on("connect",((e,t)=>{if(e)throw e;const{accounts:n,chainId:r}=t.params[0];this.setProviderState({chainId:r,accounts:n})})),this.wcConnector.on("session_update",((e,t)=>{if(e)throw e;const{accounts:n,chainId:r}=t.params[0];this.setProviderState({accounts:n,chainId:r})})),this.wcConnector.on("disconnect",(e=>{if(e)throw e;location.reload()})),this._alreadySubscribed=!0)}start(){this.subscribeToConnectionEvents()}}const KS=({checkInstallationOnAllCalls:n=!1,communicationLayerPreference:r,platformType:i,injectProvider:o,shouldShimWeb3:s,installer:a,remoteConnection:l,walletConnect:u,debug:c})=>{const h=(({name:t,communicationLayerPreference:n,remoteConnection:r,walletConnect:i,debug:o})=>{if(n===e.CommunicationLayerPreference.WALLETCONNECT&&i)return new HS({name:t,wcConnector:i.getConnector()});if(!r||!(null==r?void 0:r.getConnector()))throw new Error("Missing remote conenction parameter");return new zS({name:t,remote:null==r?void 0:r.getConnector(),debug:o})})({name:qS.INPAGE,target:qS.CONTENT_SCRIPT,communicationLayerPreference:r,remoteConnection:l,walletConnect:u,debug:c}),d=!(!o||i===PS.NonBrowser);h.start();const f=RS.init({shouldSetOnWindow:d,connectionStream:h,shouldShimWeb3:s,debug:c}),p=(e,r,i,o)=>t(void 0,void 0,void 0,(function*(){const t=DS.getInstance().isMetaMaskInstalled(),s=null==l?void 0:l.isConnected(),{selectedAddress:u}=RS.getProvider();o&&console.debug(`initializeProvider::sendRequest() method=${e} selectedAddress=${u} isInstalled=${t} checkInstallationOnAllCalls=${n} socketConnected=${s}`);const c=DS.getInstance();if((!t||t&&!s)&&"metamask_getProviderState"!==e){if("eth_requestAccounts"===e||n){if(yield a.start({wait:!1}))return i(...r)}else if(c.isSecure())return i(...r);throw new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}return yield i(...r)})),{request:m}=f;f.request=(...e)=>t(void 0,void 0,void 0,(function*(){return p(null==e?void 0:e[0].method,e,m,c)}));const{send:g}=f;return f.send=(...e)=>t(void 0,void 0,void 0,(function*(){return p(null==e?void 0:e[0],e,g,c)})),f};var VS,WS={},$S={exports:{}};function YS(){return VS||(VS=1,function(e,t){self,e.exports=(()=>{var e={192:(e,t)=>{var n,r,i=function(){var e=function(e,t){var n=e,r=s[t],i=null,o=0,l=null,g=[],v={},b=function(e,t){i=function(e){for(var t=new Array(e),n=0;n=7&&E(e),null==l&&(l=S(n,r,g)),k(l,t)},w=function(e,t){for(var n=-1;n<=7;n+=1)if(!(e+n<=-1||o<=e+n))for(var r=-1;r<=7;r+=1)t+r<=-1||o<=t+r||(i[e+n][t+r]=0<=n&&n<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==n||6==n)||2<=n&&n<=4&&2<=r&&r<=4)},A=function(){for(var e=8;e>r&1);i[Math.floor(r/3)][r%3+o-8-3]=s}for(r=0;r<18;r+=1)s=!e&&1==(t>>r&1),i[r%3+o-8-3][Math.floor(r/3)]=s},M=function(e,t){for(var n=r<<3|t,s=a.getBCHTypeInfo(n),l=0;l<15;l+=1){var u=!e&&1==(s>>l&1);l<6?i[l][8]=u:l<8?i[l+1][8]=u:i[o-15+l][8]=u}for(l=0;l<15;l+=1)u=!e&&1==(s>>l&1),l<8?i[8][o-l-1]=u:l<9?i[8][15-l-1+1]=u:i[8][15-l-1]=u;i[o-8][8]=!e},k=function(e,t){for(var n=-1,r=o-1,s=7,l=0,u=a.getMaskFunction(t),c=o-1;c>0;c-=2)for(6==c&&(c-=1);;){for(var h=0;h<2;h+=1)if(null==i[r][c-h]){var d=!1;l>>s&1)),u(r,c-h)&&(d=!d),i[r][c-h]=d,-1==(s-=1)&&(l+=1,s=7)}if((r+=n)<0||o<=r){r-=n,n=-n;break}}},S=function(e,t,n){for(var r=c.getRSBlocks(e,t),i=h(),o=0;o8*l)throw"code length overflow. ("+i.getLengthInBits()+">"+8*l+")";for(i.getLengthInBits()+4<=8*l&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*l||(i.put(236,8),i.getLengthInBits()>=8*l));)i.put(17,8);return function(e,t){for(var n=0,r=0,i=0,o=new Array(t.length),s=new Array(t.length),l=0;l=0?p.getAt(m):0}}var g=0;for(d=0;dr)&&(e=r,t=n)}return t}())},v.createTableTag=function(e,t){e=e||2;var n="";n+='',n+="";for(var r=0;r";for(var i=0;i';n+=""}return(n+="")+"
"},v.createSvgTag=function(e,t,n,r){var i={};"object"==typeof arguments[0]&&(e=(i=arguments[0]).cellSize,t=i.margin,n=i.alt,r=i.title),e=e||2,t=void 0===t?4*e:t,(n="string"==typeof n?{text:n}:n||{}).text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-title":null;var o,s,a,l,u=v.getModuleCount()*e+2*t,c="";for(l="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",c+=''+x(r.text)+"":"",c+=n.text?''+x(n.text)+"":"",c+='',c+='"},v.createDataURL=function(e,t){e=e||2,t=void 0===t?4*e:t;var n=v.getModuleCount()*e+2*t,r=t,i=n-t;return y(n,n,(function(t,n){if(r<=t&&t"};var x=function(e){for(var t="",n=0;n":t+=">";break;case"&":t+="&";break;case'"':t+=""";break;default:t+=r}}return t};return v.createASCII=function(e,t){if((e=e||1)<2)return function(e){e=void 0===e?2:e;var t,n,r,i,o,s=1*v.getModuleCount()+2*e,a=e,l=s-e,u={"██":"█","█ ":"▀"," █":"▄"," ":" "},c={"██":"▀","█ ":"▀"," █":" "," ":" "},h="";for(t=0;t=l?c[o]:u[o];h+="\n"}return s%2&&e>0?h.substring(0,h.length-s-1)+Array(s+1).join("▀"):h.substring(0,h.length-1)}(t);e-=1,t=void 0===t?2*e:t;var n,r,i,o,s=v.getModuleCount()*e+2*t,a=t,l=s-t,u=Array(e+1).join("██"),c=Array(e+1).join(" "),h="",d="";for(n=0;n>>8),t.push(255&s)):t.push(r)}}return t}};var t,n,r,i,o,s={L:1,M:0,Q:3,H:2},a=(t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,r=7973,o=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t},(i={}).getBCHTypeInfo=function(e){for(var t=e<<10;o(t)-o(n)>=0;)t^=n<=0;)t^=r<5&&(n+=3+o-5)}for(r=0;r=256;)t-=255;return e[t]}}}();function u(e,t){if(void 0===e.length)throw e.length+"/"+t;var n=function(){for(var n=0;n>>7-t%8&1)},put:function(e,t){for(var r=0;r>>t-r-1&1))},getLengthInBits:function(){return t},putBit:function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1}};return n},d=function(e){var t=e,n={getMode:function(){return 1},getLength:function(e){return t.length},write:function(e){for(var n=t,i=0;i+2>>8&255)+(255&i),e.put(i,13),n+=2}if(n>>8)},writeBytes:function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i0&&(t+=","),t+=e[n];return t+"]"}};return t},v=function(e){var t=e,n=0,r=0,i=0,o={read:function(){for(;i<8;){if(n>=t.length){if(0==i)return-1;throw"unexpected end of file./"+i}var e=t.charAt(n);if(n+=1,"="==e)return i=0,-1;e.match(/^\s$/)||(r=r<<6|s(e.charCodeAt(0)),i+=6)}var o=r>>>i-8&255;return i-=8,o}},s=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return o},y=function(e,t,n){for(var r=function(e,t){var n=e,r=t,i=new Array(e*t),o={setPixel:function(e,t,r){i[t*n+e]=r},write:function(e){e.writeString("GIF87a"),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(","),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);var t=s(2);e.writeByte(2);for(var i=0;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(";")}},s=function(e){for(var t=1<>>t!=0)throw"length over";for(;u+t>=8;)l.writeByte(255&(e<>>=8-u,c=0,u=0;c|=e<0&&l.writeByte(c)}});d.write(t,r);var f=0,p=String.fromCharCode(i[f]);for(f+=1;f=6;)o(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(o(e<<6-t),e=0,t=0),n%3!=0)for(var i=3-n%3,s=0;s>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(e)},void 0===(r="function"==typeof(n=function(){return i})?n.apply(t,[]):n)||(e.exports=r)},676:(e,t,n)=>{n.d(t,{default:()=>P});var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2||o&&s||a&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&a?c=Math.PI/2:a&&s?c=Math.PI:s&&l&&(c=-Math.PI/2),void this._basicCornerRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,a?c=Math.PI/2:s?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawExtraRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,l=i?+i(0,1):0,u=o+s+a+l;if(0!==u)if(u>2||o&&s||a&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&a?c=Math.PI/2:a&&s?c=Math.PI:s&&l&&(c=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,a?c=Math.PI/2:s?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawClassy=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+s+a+l?o||a?s||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e.prototype._drawClassyRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,a=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+s+a+l?o||a?s||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e}();var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]r||i&&i=(t-o.hideXDots)/2&&e<(t+o.hideXDots)/2&&n>=(t-o.hideYDots)/2&&n<(t+o.hideYDots)/2||(null===(r=y[e])||void 0===r?void 0:r[n])||(null===(i=y[e-t+7])||void 0===i?void 0:i[n])||(null===(s=y[e])||void 0===s?void 0:s[n-t+7])||(null===(a=b[e])||void 0===a?void 0:a[n])||(null===(l=b[e-t+7])||void 0===l?void 0:l[n])||(null===(u=b[e])||void 0===u?void 0:u[n-t+7]))})),this.drawCorners(),this._options.image?[4,this.drawImage({width:o.width,height:o.height,count:t,dotSize:i})]:[3,4];case 3:f.sent(),f.label=4;case 4:return[2]}}))}))},e.prototype.drawBackground=function(){var e,t,n,r=this._element,i=this._options;if(r){var o=null===(e=i.backgroundOptions)||void 0===e?void 0:e.gradient,s=null===(t=i.backgroundOptions)||void 0===t?void 0:t.color;if((o||s)&&this._createColor({options:o,color:s,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"background-color"}),null===(n=i.backgroundOptions)||void 0===n?void 0:n.round){var a=Math.min(i.width,i.height),l=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),l.setAttribute("x",String((i.width-a)/2)),l.setAttribute("y",String((i.height-a)/2)),l.setAttribute("width",String(a)),l.setAttribute("height",String(a)),l.setAttribute("rx",String(a/2*i.backgroundOptions.round)),this._backgroundClipPath.appendChild(l)}}},e.prototype.drawDots=function(e){var t,n,r=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var s=Math.min(i.width,i.height)-2*i.margin,a=i.shape===m?s/Math.sqrt(2):s,l=Math.floor(a/o),u=Math.floor((i.width-o*l)/2),h=Math.floor((i.height-o*l)/2),d=new c({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(t=i.dotsOptions)||void 0===t?void 0:t.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(var f=function(t){for(var i=function(i){return e&&!e(t,i)?"continue":(null===(n=p._qr)||void 0===n?void 0:n.isDark(t,i))?(d.draw(u+t*l,h+i*l,l,(function(n,s){return!(t+n<0||i+s<0||t+n>=o||i+s>=o)&&!(e&&!e(t+n,i+s))&&!!r._qr&&r._qr.isDark(t+n,i+s)})),void(d._element&&p._dotsClipPath&&p._dotsClipPath.appendChild(d._element))):"continue"},s=0;s=v-1&&g<=y-v&&E>=v-1&&E<=y-v||Math.sqrt((g-_)*(g-_)+(E-_)*(E-_))>_?A[g][E]=0:A[g][E]=this._qr.isDark(E-2*v<0?E:E>=o?E-2*v:E-v,g-2*v<0?g:g>=o?g-2*v:g-v)?1:0}var M=function(e){for(var t=function(t){if(!A[e][t])return"continue";d.draw(b+e*l,w+t*l,l,(function(n,r){var i;return!!(null===(i=A[e+n])||void 0===i?void 0:i[t+r])})),d._element&&k._dotsClipPath&&k._dotsClipPath.appendChild(d._element)},n=0;ns?a:s,c=document.createElementNS("http://www.w3.org/2000/svg","rect");if(c.setAttribute("x",String(i)),c.setAttribute("y",String(o)),c.setAttribute("height",String(s)),c.setAttribute("width",String(a)),c.setAttribute("clip-path","url('#clip-path-"+l+"')"),t){var h;if("radial"===t.type)(h=document.createElementNS("http://www.w3.org/2000/svg","radialGradient")).setAttribute("id",l),h.setAttribute("gradientUnits","userSpaceOnUse"),h.setAttribute("fx",String(i+a/2)),h.setAttribute("fy",String(o+s/2)),h.setAttribute("cx",String(i+a/2)),h.setAttribute("cy",String(o+s/2)),h.setAttribute("r",String(u/2));else{var d=((t.rotation||0)+r)%(2*Math.PI),f=(d+2*Math.PI)%(2*Math.PI),p=i+a/2,m=o+s/2,g=i+a/2,v=o+s/2;f>=0&&f<=.25*Math.PI||f>1.75*Math.PI&&f<=2*Math.PI?(p-=a/2,m-=s/2*Math.tan(d),g+=a/2,v+=s/2*Math.tan(d)):f>.25*Math.PI&&f<=.75*Math.PI?(m-=s/2,p-=a/2/Math.tan(d),v+=s/2,g+=a/2/Math.tan(d)):f>.75*Math.PI&&f<=1.25*Math.PI?(p+=a/2,m+=s/2*Math.tan(d),g-=a/2,v-=s/2*Math.tan(d)):f>1.25*Math.PI&&f<=1.75*Math.PI&&(m+=s/2,p+=a/2/Math.tan(d),v-=s/2,g-=a/2/Math.tan(d)),(h=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",l),h.setAttribute("gradientUnits","userSpaceOnUse"),h.setAttribute("x1",String(Math.round(p))),h.setAttribute("y1",String(Math.round(m))),h.setAttribute("x2",String(Math.round(g))),h.setAttribute("y2",String(Math.round(v)))}t.colorStops.forEach((function(e){var t=e.offset,n=e.color,r=document.createElementNS("http://www.w3.org/2000/svg","stop");r.setAttribute("offset",100*t+"%"),r.setAttribute("stop-color",n),h.appendChild(r)})),c.setAttribute("fill","url('#"+l+"')"),this._defs.appendChild(h)}else n&&c.setAttribute("fill",n);this._element.appendChild(c)},e}(),A="canvas";for(var _={},E=0;E<=40;E++)_[E]=E;const M={type:A,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:_[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMath.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=k({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=S(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=k({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=S(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=k({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=S(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=k({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=S(t.backgroundOptions.gradient))),t}var C=n(192),T=n.n(C),O=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},R=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\r\n'+r],{type:"image/svg+xml"})]):[2,new Promise((function(n){return t.toBlob(n,"image/"+e,1)}))]:[2,null]}}))}))},e.prototype.download=function(e){return O(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(a){switch(a.label){case 0:if(!this._qr)throw"QR code is empty";return t="png",n="qr","string"==typeof e?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof e&&null!==e&&(e.name&&(n=e.name),e.extension&&(t=e.extension)),[4,this._getElement(t)];case 1:return(r=a.sent())?("svg"===t.toLowerCase()?(i=new XMLSerializer,o='\r\n'+(o=i.serializeToString(r)),s("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o),n+".svg")):s(r.toDataURL("image/"+t),n+"."+t),[2]):[2]}}))}))},e}()}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(676)})().default}($S)),$S.exports}!function(e,t){!function(e){var t,n,r={exports:{}},i={},o={exports:{}};"production"===Vb.env.NODE_ENV?r.exports=function(){if(t)return i;t=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}function y(){}function b(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=v.prototype;var w=b.prototype=new y;w.constructor=b,m(w,v.prototype),w.isPureReactComponent=!0;var A=Array.isArray,_=Object.prototype.hasOwnProperty,E={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function k(t,n,r){var i,o={},s=null,a=null;if(null!=n)for(i in void 0!==n.ref&&(a=n.ref),void 0!==n.key&&(s=""+n.key),n)_.call(n,i)&&!M.hasOwnProperty(i)&&(o[i]=n[i]);var l=arguments.length-2;if(1===l)o.children=r;else if(11?t-1:0),r=1;r1?t-1:0),r=1;r1){for(var c=Array(u),h=0;h1){for(var d=Array(h),f=0;f import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",r),"default"in r||P("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",r),r.default}throw e._result}function be(e){return"string"==typeof e||"function"==typeof e||!!(e===i||e===s||T||e===o||e===c||e===h||C||e===p||k||S||x)||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===a||e.$$typeof===l||e.$$typeof===u||e.$$typeof===ve||void 0!==e.getModuleId)}function we(){var e=y.current;return null===e&&P("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}ve=Symbol.for("react.module.reference");var Ae,_e,Ee,Me,ke,Se,xe,Ce=0;function Te(){}Te.__reactDisabledLog=!0;var Oe,Re=O.ReactCurrentDispatcher;function Pe(e,t,n){if(void 0===Oe)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);Oe=r&&r[1]||""}return"\n"+Oe+e}var Ne,Le=!1,Ie="function"==typeof WeakMap?WeakMap:Map;function Be(e,t){if(!e||Le)return"";var n,r=Ne.get(e);if(void 0!==r)return r;Le=!0;var i,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=Re.current,Re.current=null,function(){if(0===Ce){Ae=console.log,_e=console.info,Ee=console.warn,Me=console.error,ke=console.group,Se=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ce++}();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(e){n=e}Reflect.construct(e,[],s)}else{try{s.call()}catch(e){n=e}e.call(s.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),l=n.stack.split("\n"),u=a.length-1,c=l.length-1;u>=1&&c>=0&&a[u]!==l[c];)c--;for(;u>=1&&c>=0;u--,c--)if(a[u]!==l[c]){if(1!==u||1!==c)do{if(u--,--c<0||a[u]!==l[c]){var h="\n"+a[u].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),"function"==typeof e&&Ne.set(e,h),h}}while(u>=1&&c>=0);break}}}finally{Le=!1,Re.current=i,function(){if(0==--Ce){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:Ae}),info:D({},e,{value:_e}),warn:D({},e,{value:Ee}),error:D({},e,{value:Me}),group:D({},e,{value:ke}),groupCollapsed:D({},e,{value:Se}),groupEnd:D({},e,{value:xe})})}Ce<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var d=e?e.displayName||e.name:"",f=d?Pe(d):"";return"function"==typeof e&&Ne.set(e,f),f}function De(e,t,n){if(null==e)return"";if("function"==typeof e)return Be(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return Pe(e);switch(e){case c:return Pe("Suspense");case h:return Pe("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return Be(e.render,!1);case d:return De(e.type,t,n);case f:var r=e,i=r._payload,o=r._init;try{return De(o(i),t,n)}catch(e){}}return""}Ne=new Ie;var je,Fe={},Ue=O.ReactDebugCurrentFrame;function qe(e){if(e){var t=e._owner,n=De(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(n)}else Ue.setExtraStackFrame(null)}function ze(e){if(e){var t=e._owner;M(De(e.type,e._source,t?t.type:null))}else M(null)}function He(){if(A.current){var e=Q(A.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}je=!1;var Ke={};function Ve(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=He();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!Ke[n]){Ke[n]=!0;var r="";e&&e._owner&&e._owner!==A.current&&(r=" It was passed a child from "+Q(e._owner.type)+"."),ze(e),P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),ze(null)}}}function We(e,t){if("object"==typeof e)if($(e))for(var n=0;n",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,P("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var c=se.apply(this,arguments);if(null==c)return c;if(a)for(var h=2;h ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}Qe(t)}((function(){0===i.length?(w.current=null,n(t)):tt(t,n,r)}))}catch(e){r(e)}else n(t)}var nt=!1;function rt(e){if(!nt){nt=!0;var t=0;try{for(;t is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return n||(n=!0,P("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){i||(R("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),i=!0)}}}),t.Consumer=o,t._currentRenderer=null,t._currentRenderer2=null,t},t.createElement=it,t.createFactory=function(e){var t=Ye.bind(null,e);return t.type=e,Ge||(Ge=!0,R("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return R("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){null!=e&&e.$$typeof===d?P("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?P("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&P("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||P("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,n={$$typeof:u,render:e};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(n){t=n,e.name||e.displayName||(e.displayName=n)}}),n},t.isValidElement=le,t.lazy=function(e){var t,n,r={$$typeof:f,_payload:{_status:-1,_result:e},_init:ye};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){P("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){P("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},t.memo=function(e,t){be(e)||P("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var n,r={$$typeof:d,type:e,compare:void 0===t?null:t};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(t){n=t,e.name||e.displayName||(e.displayName=t)}}),r},t.startTransition=function(e,t){var n=b.transition;b.transition={};var r=b.transition;b.transition._updatedFibers=new Set;try{e()}finally{b.transition=n,null===n&&r._updatedFibers&&(r._updatedFibers.size>10&&R("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),r._updatedFibers.clear())}},t.unstable_act=function(e){var t=Je;Je++,null===w.current&&(w.current=[]);var n,r=w.isBatchingLegacy;try{if(w.isBatchingLegacy=!0,n=e(),!r&&w.didScheduleLegacyUpdate){var i=w.current;null!==i&&(w.didScheduleLegacyUpdate=!1,rt(i))}}catch(e){throw et(t),e}finally{w.isBatchingLegacy=r}if(null!==n&&"object"==typeof n&&"function"==typeof n.then){var o=n,s=!1,a={then:function(e,n){s=!0,o.then((function(r){et(t),0===Je?tt(r,e,n):e(r)}),(function(e){et(t),n(e)}))}};return Xe||"undefined"==typeof Promise||Promise.resolve().then((function(){})).then((function(){s||(Xe=!0,P("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))})),a}var l=n;if(et(t),0===Je){var u=w.current;return null!==u&&(rt(u),w.current=null),{then:function(e,t){null===w.current?(w.current=[],tt(l,e,t)):e(l)}}}return{then:function(e,t){e(l)}}},t.useCallback=function(e,t){return we().useCallback(e,t)},t.useContext=function(e){var t=we();if(void 0!==e._context){var n=e._context;n.Consumer===e?P("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):n.Provider===e&&P("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},t.useDebugValue=function(e,t){return we().useDebugValue(e,t)},t.useDeferredValue=function(e){return we().useDeferredValue(e)},t.useEffect=function(e,t){return we().useEffect(e,t)},t.useId=function(){return we().useId()},t.useImperativeHandle=function(e,t,n){return we().useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return we().useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return we().useLayoutEffect(e,t)},t.useMemo=function(e,t){return we().useMemo(e,t)},t.useReducer=function(e,t,n){return we().useReducer(e,t,n)},t.useRef=function(e){return we().useRef(e)},t.useState=function(e){return we().useState(e)},t.useSyncExternalStore=function(e,t,n){return we().useSyncExternalStore(e,t,n)},t.useTransition=function(){return we().useTransition()},t.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(o,o.exports)),o.exports);var s,a,l,u,c=r.exports,h=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(c),d=function(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}({__proto__:null,default:h},[c]),f={exports:{}},p={},m={exports:{}},g={},v={};function y(){return l||(l=1,"production"===Vb.env.NODE_ENV?m.exports=(s||(s=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0>>1,o=e[r];if(!(0>>1;ri(l,n))ui(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[a]=n,r=a);else{if(!(ui(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,h=null,d=3,f=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(l,i)}i=n(u)}}function w(e){if(m=!1,b(e),!p)if(null!==n(l))p=!0,P(A);else{var t=n(u);null!==t&&N(w,t.startTime-e)}}function A(t,i){p=!1,m&&(m=!1,v(k),k=-1),f=!0;var o=d;try{for(b(i),h=n(l);null!==h&&(!(h.expirationTime>i)||t&&!C());){var s=h.callback;if("function"==typeof s){h.callback=null,d=h.priorityLevel;var a=s(h.expirationTime<=i);i=e.unstable_now(),"function"==typeof a?h.callback=a:h===n(l)&&r(l),b(i)}else r(l);h=n(l)}if(null!==h)var c=!0;else{var g=n(u);null!==g&&N(w,g.startTime-i),c=!1}return c}finally{h=null,d=o,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var _,E=!1,M=null,k=-1,S=5,x=-1;function C(){return!(e.unstable_now()-xe||125s?(r.sortIndex=o,t(u,r),null===n(l)&&r===n(u)&&(m?(v(k),k=-1):m=!0,N(w,o-s))):(r.sortIndex=a,t(l,r),p||f||(p=!0,P(A))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}}}(g)),g):m.exports=(a||(a=1,function(e){"production"!==Vb.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=!1,n=!1;function r(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;r>0;){var i=r-1>>>1,o=e[i];if(!(s(o,t)>0))return;e[i]=t,e[r]=o,r=i}}(e,t,n)}function i(e){return 0===e.length?null:e[0]}function o(e){if(0===e.length)return null;var t=e[0],n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var r=0,i=e.length,o=i>>>1;rs)||n&&!T());){var a=f.callback;if("function"==typeof a){f.callback=null,p=f.priorityLevel;var l=a(f.expirationTime<=s);s=e.unstable_now(),"function"==typeof l?f.callback=l:f===i(c)&&o(c),A(s)}else o(c);f=i(c)}if(null!==f)return!0;var u=i(h);return null!==u&&I(_,u.startTime-s),!1}(r,s)}finally{f=null,p=a,m=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var M=!1,k=null,S=-1,x=5,C=-1;function T(){return!(e.unstable_now()-C125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=e>0?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return i(c)},e.unstable_next=function(e){var t;switch(p){case 1:case 2:case 3:t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},e.unstable_scheduleCallback=function(t,n,o){var s,a,l=e.unstable_now();if("object"==typeof o&&null!==o){var u=o.delay;s="number"==typeof u&&u>0?l+u:l}else s=l;switch(t){case 1:a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}var f=s+a,p={id:d++,callback:n,priorityLevel:t,startTime:s,expirationTime:f,sortIndex:-1};return s>l?(p.sortIndex=s,r(h,p),null===i(c)&&p===i(h)&&(v?B():v=!0,I(_,s-l))):(p.sortIndex=f,r(c,p),g||m||(g=!0,L(E))),p},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(v)),v)),m.exports}var b,w={};"production"===Vb.env.NODE_ENV?(function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){if("production"!==Vb.env.NODE_ENV)throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}}(),f.exports=function(){if(u)return p;u=1;var e=c,t=y();function n(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n",t=ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return he(e,t)}))}:he);function fe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},me=["Webkit","ms","Moz","O"];function ge(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||pe.hasOwnProperty(e)&&pe[e]?(""+t).trim():t+"px"}function ve(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(pe).forEach((function(e){me.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pe[t]=pe[e]}))}));var ye=j({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function be(e,t){if(t){if(ye[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(n(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(n(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(n(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(n(62))}}function we(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ae=null;function _e(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ee=null,Me=null,ke=null;function Se(e){if(e=vi(e)){if("function"!=typeof Ee)throw Error(n(280));var t=e.stateNode;t&&(t=bi(t),Ee(e.stateNode,e.type,t))}}function xe(e){Me?ke?ke.push(e):ke=[e]:Me=e}function Ce(){if(Me){var e=Me,t=ke;if(ke=Me=null,Se(e),t)for(e=0;e>>=0)?32:31-(lt(e)/ut|0)|0},lt=Math.log,ut=Math.LN2,ct=64,ht=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ft(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=268435455&n;if(0!==s){var a=s&~i;0!==a?r=dt(a):0!=(o&=s)&&(r=dt(o))}else 0!=(s=n&~i)?r=dt(s):0!==o&&(r=dt(o));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&0!=(4194240&o)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function yt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-at(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-at(n),i=1<=Nn),Bn=String.fromCharCode(32),Dn=!1;function jn(e,t){switch(e){case"keyup":return-1!==Rn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Un=!1,qn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qn[e.type]:"textarea"===t}function Hn(e,t,n,r){xe(r),0<(t=Kr(t,"onChange")).length&&(n=new hn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Kn=null,Vn=null;function Wn(e){Br(e,0)}function $n(e){if(Y(yi(e)))return e}function Yn(e,t){if("change"===e)return t}var Gn=!1;if(a){var Zn;if(a){var Qn="oninput"in document;if(!Qn){var Jn=document.createElement("div");Jn.setAttribute("oninput","return;"),Qn="function"==typeof Jn.oninput}Zn=Qn}else Zn=!1;Gn=Zn&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ar(r)}}function ur(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ur(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function cr(){for(var e=window,t=G();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=G((e=t.contentWindow).document)}return t}function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function dr(e){var t=cr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ur(n.ownerDocument.documentElement,n)){if(null!==r&&hr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=void 0===r.end?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=lr(n,o);var s=lr(n,r);i&&s&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n=document.documentMode,pr=null,mr=null,gr=null,vr=!1;function yr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;vr||null==pr||pr!==G(r)||(r="selectionStart"in(r=pr)&&hr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},gr&&sr(gr,r)||(gr=r,0<(r=Kr(mr,"onSelect")).length&&(t=new hn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=pr)))}function br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wr={animationend:br("Animation","AnimationEnd"),animationiteration:br("Animation","AnimationIteration"),animationstart:br("Animation","AnimationStart"),transitionend:br("Transition","TransitionEnd")},Ar={},_r={};function Er(e){if(Ar[e])return Ar[e];if(!wr[e])return e;var t,n=wr[e];for(t in n)if(n.hasOwnProperty(t)&&t in _r)return Ar[e]=n[t];return e}a&&(_r=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);var Mr=Er("animationend"),kr=Er("animationiteration"),Sr=Er("animationstart"),xr=Er("transitionend"),Cr=new Map,Tr="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Or(e,t){Cr.set(e,t),o(t,[e])}for(var Rr=0;RrAi||(e.current=wi[Ai],wi[Ai]=null,Ai--)}function Mi(e,t){Ai++,wi[Ai]=e.current,e.current=t}var ki={},Si=_i(ki),xi=_i(!1),Ci=ki;function Ti(e,t){var n=e.type.contextTypes;if(!n)return ki;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Oi(e){return null!=e.childContextTypes}function Ri(){Ei(xi),Ei(Si)}function Pi(e,t,r){if(Si.current!==ki)throw Error(n(168));Mi(Si,t),Mi(xi,r)}function Ni(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return r;for(var o in i=i.getChildContext())if(!(o in t))throw Error(n(108,K(e)||"Unknown",o));return j({},r,i)}function Li(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,Ci=Si.current,Mi(Si,e),Mi(xi,xi.current),!0}function Ii(e,t,r){var i=e.stateNode;if(!i)throw Error(n(169));r?(e=Ni(e,t,Ci),i.__reactInternalMemoizedMergedChildContext=e,Ei(xi),Ei(Si),Mi(Si,e)):Ei(xi),Mi(xi,r)}var Bi=null,Di=!1,ji=!1;function Fi(e){null===Bi?Bi=[e]:Bi.push(e)}function Ui(){if(!ji&&null!==Bi){ji=!0;var e=0,t=wt;try{var n=Bi;for(wt=1;e>=s,i-=s,Yi=1<<32-at(t)+i|n<m?(g=h,h=null):g=h.sibling;var v=f(n,h,a[m],l);if(null===v){null===h&&(h=g);break}e&&h&&null===v.alternate&&t(n,h),o=s(v,o,m),null===c?u=v:c.sibling=v,c=v,h=g}if(m===a.length)return r(n,h),no&&Zi(n,m),u;if(null===h){for(;mg?(v=m,m=null):v=m.sibling;var b=f(o,m,y.value,u);if(null===b){null===m&&(m=v);break}e&&m&&null===b.alternate&&t(o,m),a=s(b,a,g),null===h?c=b:h.sibling=b,h=b,m=v}if(y.done)return r(o,m),no&&Zi(o,g),c;if(null===m){for(;!y.done;g++,y=l.next())null!==(y=d(o,y.value,u))&&(a=s(y,a,g),null===h?c=y:h.sibling=y,h=y);return no&&Zi(o,g),c}for(m=i(o,m);!y.done;g++,y=l.next())null!==(y=p(m,o,g,y.value,u))&&(e&&null!==y.alternate&&m.delete(null===y.key?g:y.key),a=s(y,a,g),null===h?c=y:h.sibling=y,h=y);return e&&m.forEach((function(e){return t(o,e)})),no&&Zi(o,g),c}return function e(n,i,s,l){if("object"==typeof s&&null!==s&&s.type===M&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case _:e:{for(var u=s.key,c=i;null!==c;){if(c.key===u){if((u=s.type)===M){if(7===c.tag){r(n,c.sibling),(i=o(c,s.props.children)).return=n,n=i;break e}}else if(c.elementType===u||"object"==typeof u&&null!==u&&u.$$typeof===N&&$o(u)===c.type){r(n,c.sibling),(i=o(c,s.props)).ref=Vo(n,c,s),i.return=n,n=i;break e}r(n,c);break}t(n,c),c=c.sibling}s.type===M?((i=Lu(s.props.children,n.mode,l,s.key)).return=n,n=i):((l=Nu(s.type,s.key,s.props,null,n.mode,l)).ref=Vo(n,i,s),l.return=n,n=l)}return a(n);case E:e:{for(c=s.key;null!==i;){if(i.key===c){if(4===i.tag&&i.stateNode.containerInfo===s.containerInfo&&i.stateNode.implementation===s.implementation){r(n,i.sibling),(i=o(i,s.children||[])).return=n,n=i;break e}r(n,i);break}t(n,i),i=i.sibling}(i=Du(s,n.mode,l)).return=n,n=i}return a(n);case N:return e(n,i,(c=s._init)(s._payload),l)}if(ne(s))return m(n,i,s,l);if(B(s))return g(n,i,s,l);Wo(n,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==i&&6===i.tag?(r(n,i.sibling),(i=o(i,s)).return=n,n=i):(r(n,i),(i=Bu(s,n.mode,l)).return=n,n=i),a(n)):r(n,i)}}var Go=Yo(!0),Zo=Yo(!1),Qo={},Jo=_i(Qo),Xo=_i(Qo),es=_i(Qo);function ts(e){if(e===Qo)throw Error(n(174));return e}function ns(e,t){switch(Mi(es,t),Mi(Xo,e),Mi(Jo,Qo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ue(null,"");break;default:t=ue(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Ei(Jo),Mi(Jo,t)}function rs(){Ei(Jo),Ei(Xo),Ei(es)}function is(e){ts(es.current);var t=ts(Jo.current),n=ue(t,e.type);t!==n&&(Mi(Xo,e),Mi(Jo,n))}function os(e){Xo.current===e&&(Ei(Jo),Ei(Xo))}var ss=_i(0);function as(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ls=[];function us(){for(var e=0;en?n:4,e(!0);var r=hs.transition;hs.transition={};try{e(!1),t()}finally{wt=n,hs.transition=r}}function Js(){return ks().memoizedState}function Xs(e,t,n){var r=eu(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ta(e)?na(t,n):null!==(n=xo(e,t,n,r))&&(tu(n,e,r,Xl()),ra(n,t,r))}function ea(e,t,n){var r=eu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ta(e))na(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,or(a,s)){var l=t.interleaved;return null===l?(i.next=i,So(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(e){}null!==(n=xo(e,t,i,r))&&(tu(n,e,r,i=Xl()),ra(n,t,r))}}function ta(e){var t=e.alternate;return e===fs||null!==t&&t===fs}function na(e,t){vs=gs=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ra(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}var ia={readContext:Mo,useCallback:ws,useContext:ws,useEffect:ws,useImperativeHandle:ws,useInsertionEffect:ws,useLayoutEffect:ws,useMemo:ws,useReducer:ws,useRef:ws,useState:ws,useDebugValue:ws,useDeferredValue:ws,useTransition:ws,useMutableSource:ws,useSyncExternalStore:ws,useId:ws,unstable_isNewReconciler:!1},oa={readContext:Mo,useCallback:function(e,t){return Ms().memoizedState=[e,void 0===t?null:t],e},useContext:Mo,useEffect:qs,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Fs(4194308,4,Vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Fs(4,2,e,t)},useMemo:function(e,t){var n=Ms();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ms();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Xs.bind(null,fs,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Ms().memoizedState=e},useState:Bs,useDebugValue:$s,useDeferredValue:function(e){return Ms().memoizedState=e},useTransition:function(){var e=Bs(!1),t=e[0];return e=Qs.bind(null,e[1]),Ms().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=fs,o=Ms();if(no){if(void 0===r)throw Error(n(407));r=r()}else{if(r=t(),null===Cl)throw Error(n(349));0!=(30&ds)||Rs(i,t,r)}o.memoizedState=r;var s={value:r,getSnapshot:t};return o.queue=s,qs(Ns.bind(null,i,s,e),[e]),i.flags|=2048,Ds(9,Ps.bind(null,i,s,r,t),void 0,null),r},useId:function(){var e=Ms(),t=Cl.identifierPrefix;if(no){var n=Gi;t=":"+t+"R"+(n=(Yi&~(1<<32-at(Yi)-1)).toString(32)+n),0<(n=ys++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=bs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},sa={readContext:Mo,useCallback:Ys,useContext:Mo,useEffect:zs,useImperativeHandle:Ws,useInsertionEffect:Hs,useLayoutEffect:Ks,useMemo:Gs,useReducer:xs,useRef:js,useState:function(){return xs(Ss)},useDebugValue:$s,useDeferredValue:function(e){return Zs(ks(),ps.memoizedState,e)},useTransition:function(){return[xs(Ss)[0],ks().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Os,useId:Js,unstable_isNewReconciler:!1},aa={readContext:Mo,useCallback:Ys,useContext:Mo,useEffect:zs,useImperativeHandle:Ws,useInsertionEffect:Hs,useLayoutEffect:Ks,useMemo:Gs,useReducer:Cs,useRef:js,useState:function(){return Cs(Ss)},useDebugValue:$s,useDeferredValue:function(e){var t=ks();return null===ps?t.memoizedState=e:Zs(t,ps.memoizedState,e)},useTransition:function(){return[Cs(Ss)[0],ks().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Os,useId:Js,unstable_isNewReconciler:!1};function la(e,t){try{var n="",r=t;do{n+=z(r),r=r.return}while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i,digest:null}}function ua(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function ca(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}var ha="function"==typeof WeakMap?WeakMap:Map;function da(e,t,n){(n=Po(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Hl||(Hl=!0,Kl=r),ca(0,t)},n}function fa(e,t,n){(n=Po(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ca(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){ca(0,t),"function"!=typeof r&&(null===Vl?Vl=new Set([this]):Vl.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function pa(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new ha;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Mu.bind(null,e,t,n),t.then(e,e))}function ma(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function ga(e,t,n,r,i){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Po(-1,1)).tag=2,No(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var va=A.ReactCurrentOwner,ya=!1;function ba(e,t,n,r){t.child=null===e?Zo(t,null,n,r):Go(t,e.child,n,r)}function wa(e,t,n,r,i){n=n.render;var o=t.ref;return Eo(t,i),r=_s(e,t,n,r,o,i),n=Es(),null===e||ya?(no&&n&&Ji(t),t.flags|=1,ba(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Aa(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Ru(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Nu(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,_a(e,t,o,r,i))}if(o=e.child,0==(e.lanes&i)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:sr)(s,r)&&e.ref===t.ref)return Ha(e,t,i)}return t.flags|=1,(e=Pu(o,r)).ref=t.ref,e.return=t,t.child=e}function _a(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(sr(o,r)&&e.ref===t.ref){if(ya=!1,t.pendingProps=r=o,0==(e.lanes&i))return t.lanes=e.lanes,Ha(e,t,i);0!=(131072&e.flags)&&(ya=!0)}}return ka(e,t,n,r,i)}function Ea(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Mi(Pl,Rl),Rl|=n;else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Mi(Pl,Rl),Rl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Mi(Pl,Rl),Rl|=r}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Mi(Pl,Rl),Rl|=r;return ba(e,t,i,n),t.child}function Ma(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ka(e,t,n,r,i){var o=Oi(n)?Ci:Si.current;return o=Ti(t,o),Eo(t,i),n=_s(e,t,n,r,o,i),r=Es(),null===e||ya?(no&&r&&Ji(t),t.flags|=1,ba(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Sa(e,t,n,r,i){if(Oi(n)){var o=!0;Li(t)}else o=!1;if(Eo(t,i),null===t.stateNode)za(e,t),zo(t,n,r),Ko(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,u=n.contextType;u="object"==typeof u&&null!==u?Mo(u):Ti(t,u=Oi(n)?Ci:Si.current);var c=n.getDerivedStateFromProps,h="function"==typeof c||"function"==typeof s.getSnapshotBeforeUpdate;h||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==r||l!==u)&&Ho(t,s,r,u),To=!1;var d=t.memoizedState;s.state=d,Bo(t,r,s,i),l=t.memoizedState,a!==r||d!==l||xi.current||To?("function"==typeof c&&(Fo(t,n,c,r),l=t.memoizedState),(a=To||qo(t,n,a,r,d,l,u))?(h||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=u,r=a):("function"==typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Ro(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:mo(t.type,a),s.props=u,h=t.pendingProps,d=s.context,l="object"==typeof(l=n.contextType)&&null!==l?Mo(l):Ti(t,l=Oi(n)?Ci:Si.current);var f=n.getDerivedStateFromProps;(c="function"==typeof f||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==h||d!==l)&&Ho(t,s,r,l),To=!1,d=t.memoizedState,s.state=d,Bo(t,r,s,i);var p=t.memoizedState;a!==h||d!==p||xi.current||To?("function"==typeof f&&(Fo(t,n,f,r),p=t.memoizedState),(u=To||qo(t,n,u,r,d,p,l)||!1)?(c||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,p,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),s.props=r,s.state=p,s.context=l,r=u):("function"!=typeof s.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return xa(e,t,n,r,o,i)}function xa(e,t,n,r,i,o){Ma(e,t);var s=0!=(128&t.flags);if(!r&&!s)return i&&Ii(t,n,!1),Ha(e,t,o);r=t.stateNode,va.current=t;var a=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=Go(t,e.child,null,o),t.child=Go(t,null,a,o)):ba(e,t,a,o),t.memoizedState=r.state,i&&Ii(t,n,!0),t.child}function Ca(e){var t=e.stateNode;t.pendingContext?Pi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Pi(0,t.context,!1),ns(e,t.containerInfo)}function Ta(e,t,n,r,i){return ho(),fo(i),t.flags|=256,ba(e,t,n,r),t.child}var Oa,Ra,Pa,Na,La={dehydrated:null,treeContext:null,retryLane:0};function Ia(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ba(e,t,r){var i,o=t.pendingProps,s=ss.current,a=!1,l=0!=(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&0!=(2&s)),i?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Mi(ss,1&s),null===e)return ao(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,a?(o=t.mode,a=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==a?(a.childLanes=0,a.pendingProps=l):a=Iu(l,o,0,null),e=Lu(e,o,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ia(r),t.memoizedState=La,e):Da(t,l));if(null!==(s=e.memoizedState)&&null!==(i=s.dehydrated))return function(e,t,r,i,o,s,a){if(r)return 256&t.flags?(t.flags&=-257,ja(e,t,a,i=ua(Error(n(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=i.fallback,o=t.mode,i=Iu({mode:"visible",children:i.children},o,0,null),(s=Lu(s,o,a,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,0!=(1&t.mode)&&Go(t,e.child,null,a),t.child.memoizedState=Ia(a),t.memoizedState=La,s);if(0==(1&t.mode))return ja(e,t,a,null);if("$!"===o.data){if(i=o.nextSibling&&o.nextSibling.dataset)var l=i.dgst;return i=l,ja(e,t,a,i=ua(s=Error(n(419)),i,void 0))}if(l=0!=(a&e.childLanes),ya||l){if(null!==(i=Cl)){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(i.suspendedLanes|a))?0:o)&&o!==s.retryLane&&(s.retryLane=o,Co(e,o),tu(i,e,o,-1))}return pu(),ja(e,t,a,i=ua(Error(n(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=Su.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,to=ai(o.nextSibling),eo=t,no=!0,ro=null,null!==e&&(Vi[Wi++]=Yi,Vi[Wi++]=Gi,Vi[Wi++]=$i,Yi=e.id,Gi=e.overflow,$i=t),(t=Da(t,i.children)).flags|=4096,t)}(e,t,l,o,i,s,r);if(a){a=o.fallback,l=t.mode,i=(s=e.child).sibling;var u={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==s?((o=t.child).childLanes=0,o.pendingProps=u,t.deletions=null):(o=Pu(s,u)).subtreeFlags=14680064&s.subtreeFlags,null!==i?a=Pu(i,a):(a=Lu(a,l,r,null)).flags|=2,a.return=t,o.return=t,o.sibling=a,t.child=o,o=a,a=t.child,l=null===(l=e.child.memoizedState)?Ia(r):{baseLanes:l.baseLanes|r,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=e.childLanes&~r,t.memoizedState=La,o}return e=(a=e.child).sibling,o=Pu(a,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=r),o.return=t,o.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=o,t.memoizedState=null,o}function Da(e,t){return(t=Iu({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ja(e,t,n,r){return null!==r&&fo(r),Go(t,e.child,null,n),(e=Da(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Fa(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),_o(e.return,t,n)}function Ua(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function qa(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(ba(e,t,r.children,n),0!=(2&(r=ss.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Fa(e,n,t);else if(19===e.tag)Fa(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Mi(ss,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===as(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ua(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===as(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ua(t,!0,n,null,o);break;case"together":Ua(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function za(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ha(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Il|=t.lanes,0==(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(n(153));if(null!==t.child){for(r=Pu(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Pu(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function Ka(e,t){if(!no)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Va(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wa(e,t,r){var o=t.pendingProps;switch(Xi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Va(t),null;case 1:case 17:return Oi(t.type)&&Ri(),Va(t),null;case 3:return o=t.stateNode,rs(),Ei(xi),Ei(Si),us(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),null!==e&&null!==e.child||(uo(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==ro&&(ou(ro),ro=null))),Ra(e,t),Va(t),null;case 5:os(t);var s=ts(es.current);if(r=t.type,null!==e&&null!=t.stateNode)Pa(e,t,r,o,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(null===t.stateNode)throw Error(n(166));return Va(t),null}if(e=ts(Jo.current),uo(t)){o=t.stateNode,r=t.type;var a=t.memoizedProps;switch(o[ci]=t,o[hi]=a,e=0!=(1&t.mode),r){case"dialog":Dr("cancel",o),Dr("close",o);break;case"iframe":case"object":case"embed":Dr("load",o);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(r,{is:o.is}):(e=l.createElement(r),"select"===r&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,r),e[ci]=t,e[hi]=o,Oa(e,t,!1,!1),t.stateNode=e;e:{switch(l=we(r,o),r){case"dialog":Dr("cancel",e),Dr("close",e),s=o;break;case"iframe":case"object":case"embed":Dr("load",e),s=o;break;case"video":case"audio":for(s=0;sql&&(t.flags|=128,o=!0,Ka(a,!1),t.lanes=4194304)}else{if(!o)if(null!==(e=as(l))){if(t.flags|=128,o=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),Ka(a,!0),null===a.tail&&"hidden"===a.tailMode&&!l.alternate&&!no)return Va(t),null}else 2*Je()-a.renderingStartTime>ql&&1073741824!==r&&(t.flags|=128,o=!0,Ka(a,!1),t.lanes=4194304);a.isBackwards?(l.sibling=t.child,t.child=l):(null!==(r=a.last)?r.sibling=l:t.child=l,a.last=l)}return null!==a.tail?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Je(),t.sibling=null,r=ss.current,Mi(ss,o?1&r|2:1&r),t):(Va(t),null);case 22:case 23:return cu(),o=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==o&&(t.flags|=8192),o&&0!=(1&t.mode)?0!=(1073741824&Rl)&&(Va(t),6&t.subtreeFlags&&(t.flags|=8192)):Va(t),null;case 24:case 25:return null}throw Error(n(156,t.tag))}function $a(e,t){switch(Xi(t),t.tag){case 1:return Oi(t.type)&&Ri(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return rs(),Ei(xi),Ei(Si),us(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return os(t),null;case 13:if(Ei(ss),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(n(340));ho()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ei(ss),null;case 4:return rs(),null;case 10:return Ao(t.type._context),null;case 22:case 23:return cu(),null;default:return null}}Oa=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ra=function(){},Pa=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ts(Jo.current);var s,a=null;switch(n){case"input":o=Z(e,o),r=Z(e,r),a=[];break;case"select":o=j({},o,{value:void 0}),r=j({},r,{value:void 0}),a=[];break;case"textarea":o=ie(e,o),r=ie(e,r),a=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Qr)}for(c in be(n,r),n=null,o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&null!=o[c])if("style"===c){var l=o[c];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(i.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in r){var u=r[c];if(l=null!=o?o[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(null!=u||null!=l))if("style"===c)if(l){for(s in l)!l.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&l[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(a||(a=[]),a.push(c,n)),n=u;else"dangerouslySetInnerHTML"===c?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(a=a||[]).push(c,u)):"children"===c?"string"!=typeof u&&"number"!=typeof u||(a=a||[]).push(c,""+u):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(i.hasOwnProperty(c)?(null!=u&&"onScroll"===c&&Dr("scroll",e),a||l===u||(a=[])):(a=a||[]).push(c,u))}n&&(a=a||[]).push("style",n);var c=a;(t.updateQueue=c)&&(t.flags|=4)}},Na=function(e,t,n,r){n!==r&&(t.flags|=4)};var Ya=!1,Ga=!1,Za="function"==typeof WeakSet?WeakSet:Set,Qa=null;function Ja(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Eu(e,t,n)}else n.current=null}function Xa(e,t,n){try{n()}catch(n){Eu(e,t,n)}}var el=!1;function tl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&Xa(t,n,o)}i=i.next}while(i!==r)}}function nl(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function rl(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function il(e){var t=e.alternate;null!==t&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&(delete t[ci],delete t[hi],delete t[fi],delete t[pi],delete t[mi]),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ol(e){return 5===e.tag||3===e.tag||4===e.tag}function sl(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ol(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function al(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Qr));else if(4!==r&&null!==(e=e.child))for(al(e,t,n),e=e.sibling;null!==e;)al(e,t,n),e=e.sibling}function ll(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ll(e,t,n),e=e.sibling;null!==e;)ll(e,t,n),e=e.sibling}var ul=null,cl=!1;function hl(e,t,n){for(n=n.child;null!==n;)dl(e,t,n),n=n.sibling}function dl(e,t,n){if(st&&"function"==typeof st.onCommitFiberUnmount)try{st.onCommitFiberUnmount(ot,n)}catch(e){}switch(n.tag){case 5:Ga||Ja(n,t);case 6:var r=ul,i=cl;ul=null,hl(e,t,n),cl=i,null!==(ul=r)&&(cl?(e=ul,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):ul.removeChild(n.stateNode));break;case 18:null!==ul&&(cl?(e=ul,n=n.stateNode,8===e.nodeType?si(e.parentNode,n):1===e.nodeType&&si(e,n),Ht(e)):si(ul,n.stateNode));break;case 4:r=ul,i=cl,ul=n.stateNode.containerInfo,cl=!0,hl(e,t,n),ul=r,cl=i;break;case 0:case 11:case 14:case 15:if(!Ga&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!=(2&o)||0!=(4&o))&&Xa(n,t,s),i=i.next}while(i!==r)}hl(e,t,n);break;case 1:if(!Ga&&(Ja(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Eu(n,t,e)}hl(e,t,n);break;case 21:hl(e,t,n);break;case 22:1&n.mode?(Ga=(r=Ga)||null!==n.memoizedState,hl(e,t,n),Ga=r):hl(e,t,n);break;default:hl(e,t,n)}}function fl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Za),t.forEach((function(t){var r=xu.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function pl(e,t){var r=t.deletions;if(null!==r)for(var i=0;io&&(o=a),i&=~s}if(i=o,10<(i=(120>(i=Je()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*El(i/1960))-i)){e.timeoutHandle=ti(wu.bind(null,e,Fl,zl),i);break}wu(e,Fl,zl);break;default:throw Error(n(329))}}}return nu(e,Je()),e.callbackNode===r?ru.bind(null,e):null}function iu(e,t){var n=jl;return e.current.memoizedState.isDehydrated&&(hu(e,t).flags|=256),2!==(e=mu(e,t))&&(t=Fl,Fl=n,null!==t&&ou(t)),e}function ou(e){null===Fl?Fl=e:Fl.push.apply(Fl,e)}function su(e,t){for(t&=~Dl,t&=~Bl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0e?16:e,null===$l)var i=!1;else{if(e=$l,$l=null,Yl=0,0!=(6&xl))throw Error(n(331));var o=xl;for(xl|=4,Qa=e.current;null!==Qa;){var s=Qa,a=s.child;if(0!=(16&Qa.flags)){var l=s.deletions;if(null!==l){for(var u=0;uJe()-Ul?hu(e,0):Dl|=n),nu(e,t)}function ku(e,t){0===t&&(0==(1&e.mode)?t=1:(t=ht,0==(130023424&(ht<<=1))&&(ht=4194304)));var n=Xl();null!==(e=Co(e,t))&&(yt(e,t,n),nu(e,n))}function Su(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),ku(e,n)}function xu(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,o=e.memoizedState;null!==o&&(r=o.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(n(314))}null!==i&&i.delete(t),ku(e,r)}function Cu(e,t){return Ye(e,t)}function Tu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ou(e,t,n,r){return new Tu(e,t,n,r)}function Ru(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Pu(e,t){var n=e.alternate;return null===n?((n=Ou(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Nu(e,t,r,i,o,s){var a=2;if(i=e,"function"==typeof e)Ru(e)&&(a=1);else if("string"==typeof e)a=5;else e:switch(e){case M:return Lu(r.children,o,s,t);case k:a=8,o|=8;break;case S:return(e=Ou(12,r,t,2|o)).elementType=S,e.lanes=s,e;case O:return(e=Ou(13,r,t,o)).elementType=O,e.lanes=s,e;case R:return(e=Ou(19,r,t,o)).elementType=R,e.lanes=s,e;case L:return Iu(r,o,s,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case x:a=10;break e;case C:a=9;break e;case T:a=11;break e;case P:a=14;break e;case N:a=16,i=null;break e}throw Error(n(130,null==e?e:typeof e,""))}return(t=Ou(a,r,t,o)).elementType=e,t.type=i,t.lanes=s,t}function Lu(e,t,n,r){return(e=Ou(7,e,r,t)).lanes=n,e}function Iu(e,t,n,r){return(e=Ou(22,e,r,t)).elementType=L,e.lanes=n,e.stateNode={isHidden:!1},e}function Bu(e,t,n){return(e=Ou(6,e,null,t)).lanes=n,e}function Du(e,t,n){return(t=Ou(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ju(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vt(0),this.expirationTimes=vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Fu(e,t,n,r,i,o,s,a,l){return e=new ju(e,t,n,a,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Ou(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oo(o),e}function Uu(e){if(!e)return ki;e:{if(He(e=e._reactInternals)!==e||1!==e.tag)throw Error(n(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Oi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(n(171))}if(1===e.tag){var r=e.type;if(Oi(r))return Ni(e,r,t)}return t}function qu(e,t,n,r,i,o,s,a,l){return(e=Fu(n,r,!0,e,0,o,0,a,l)).context=Uu(null),n=e.current,(o=Po(r=Xl(),i=eu(n))).callback=null!=t?t:null,No(n,o,i),e.current.lanes=i,yt(e,i,r),nu(e,r),e}function zu(e,t,n,r){var i=t.current,o=Xl(),s=eu(i);return n=Uu(n),null===t.context?t.context=n:t.pendingContext=n,(t=Po(o,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=No(i,t,s))&&(tu(e,i,s,o),Lo(e,i,s)),s}function Hu(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Ku(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n1?t-1:0),i=1;i1?t-1:0),i=1;i2&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])}function me(e,t,n,r){if(null!==n&&n.type===re)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":if(r)return!1;if(null!==n)return!n.acceptsBooleans;var i=e.toLowerCase().slice(0,5);return"data-"!==i&&"aria-"!==i;default:return!1}}function ge(e,t,n,r){if(null==t)return!0;if(me(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case ie:return!t;case oe:return!1===t;case se:return isNaN(t);case ae:return isNaN(t)||t<1}return!1}function ve(e){return be.hasOwnProperty(e)?be[e]:null}function ye(e,t,n,r,i,o,s){this.acceptsBooleans=2===t||t===ie||t===oe,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var be={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((function(e){be[e]=new ye(e,re,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0],n=e[1];be[t]=new ye(t,1,!1,n,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){be[e]=new ye(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){be[e]=new ye(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((function(e){be[e]=new ye(e,ie,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){be[e]=new ye(e,ie,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){be[e]=new ye(e,oe,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){be[e]=new ye(e,ae,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){be[e]=new ye(e,se,!1,e.toLowerCase(),null,!1,!1)}));var we=/[\-\:]([a-z])/g,Ae=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((function(e){var t=e.replace(we,Ae);be[t]=new ye(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((function(e){var t=e.replace(we,Ae);be[t]=new ye(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(we,Ae);be[t]=new ye(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){be[e]=new ye(e,1,!1,e.toLowerCase(),null,!1,!1)})),be.xlinkHref=new ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){be[e]=new ye(e,1,!1,e.toLowerCase(),null,!0,!0)}));var _e=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,Ee=!1;function Me(e){!Ee&&_e.test(e)&&(Ee=!0,o("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(e)))}function ke(e,t,n,r){if(r.mustUseProperty)return e[r.propertyName];te(n,t),r.sanitizeURL&&Me(""+n);var i=r.attributeName,o=null;if(r.type===oe){if(e.hasAttribute(i)){var s=e.getAttribute(i);return""===s||(ge(t,n,r,!1)?s:s===""+n?n:s)}}else if(e.hasAttribute(i)){if(ge(t,n,r,!1))return e.getAttribute(i);if(r.type===ie)return n;o=e.getAttribute(i)}return ge(t,n,r,!1)?null===o?n:o:o===""+n?n:o}function Se(e,t,n,r){if(fe(t)){if(!e.hasAttribute(t))return void 0===n?void 0:null;var i=e.getAttribute(t);return te(n,t),i===""+n?n:i}}function xe(e,t,n,r){var i=ve(t);if(!pe(t,i,r))if(ge(t,n,i,r)&&(n=null),r||null===i){if(fe(t)){var o=t;null===n?e.removeAttribute(o):(te(n,t),e.setAttribute(o,""+n))}}else if(i.mustUseProperty){var s=i.propertyName;if(null===n){var a=i.type;e[s]=a!==ie&&""}else e[s]=n}else{var l=i.attributeName,u=i.attributeNamespace;if(null===n)e.removeAttribute(l);else{var c,h=i.type;h===ie||h===oe&&!0===n?c="":(te(n,l),c=""+n,i.sanitizeURL&&Me(c.toString())),u?e.setAttributeNS(u,l,c):e.setAttribute(l,c)}}}var Ce=Symbol.for("react.element"),Te=Symbol.for("react.portal"),Oe=Symbol.for("react.fragment"),Re=Symbol.for("react.strict_mode"),Pe=Symbol.for("react.profiler"),Ne=Symbol.for("react.provider"),Le=Symbol.for("react.context"),Ie=Symbol.for("react.forward_ref"),Be=Symbol.for("react.suspense"),De=Symbol.for("react.suspense_list"),je=Symbol.for("react.memo"),Fe=Symbol.for("react.lazy"),Ue=Symbol.for("react.offscreen"),qe=Symbol.iterator,ze="@@iterator";function He(e){if(null===e||"object"!=typeof e)return null;var t=qe&&e[qe]||e[ze];return"function"==typeof t?t:null}var Ke,Ve,We,$e,Ye,Ge,Ze,Qe=Object.assign,Je=0;function Xe(){}Xe.__reactDisabledLog=!0;var et,tt=n.ReactCurrentDispatcher;function nt(e,t,n){if(void 0===et)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);et=r&&r[1]||""}return"\n"+et+e}var rt,it=!1,ot="function"==typeof WeakMap?WeakMap:Map;function st(e,t){if(!e||it)return"";var n,r=rt.get(e);if(void 0!==r)return r;it=!0;var i,s=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=tt.current,tt.current=null,function(){if(0===Je){Ke=console.log,Ve=console.info,We=console.warn,$e=console.error,Ye=console.group,Ge=console.groupCollapsed,Ze=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Je++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var l=t.stack.split("\n"),u=n.stack.split("\n"),c=l.length-1,h=u.length-1;c>=1&&h>=0&&l[c]!==u[h];)h--;for(;c>=1&&h>=0;c--,h--)if(l[c]!==u[h]){if(1!==c||1!==h)do{if(c--,--h<0||l[c]!==u[h]){var d="\n"+l[c].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),"function"==typeof e&&rt.set(e,d),d}}while(c>=1&&h>=0);break}}}finally{it=!1,tt.current=i,function(){if(0==--Je){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Qe({},e,{value:Ke}),info:Qe({},e,{value:Ve}),warn:Qe({},e,{value:We}),error:Qe({},e,{value:$e}),group:Qe({},e,{value:Ye}),groupCollapsed:Qe({},e,{value:Ge}),groupEnd:Qe({},e,{value:Ze})})}Je<0&&o("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=s}var f=e?e.displayName||e.name:"",p=f?nt(f):"";return"function"==typeof e&&rt.set(e,p),p}function at(e,t,n){return st(e,!1)}function lt(e,t,n){if(null==e)return"";if("function"==typeof e)return st(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return nt(e);switch(e){case Be:return nt("Suspense");case De:return nt("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case Ie:return at(e.render);case je:return lt(e.type,t,n);case Fe:var i=e,o=i._payload,s=i._init;try{return lt(s(o),t,n)}catch(e){}}return""}function ut(e){switch(e._debugOwner&&e._debugOwner.type,e._debugSource,e.tag){case f:return nt(e.type);case S:return nt("Lazy");case E:return nt("Suspense");case T:return nt("SuspenseList");case a:case u:case k:return at(e.type);case A:return at(e.type.render);case l:return st(e.type,!0);default:return""}}function ct(e){try{var t="",n=e;do{t+=ut(n),n=n.return}while(n);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function ht(e){return e.displayName||"Context"}function dt(e){if(null==e)return null;if("number"==typeof e.tag&&o("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case Oe:return"Fragment";case Te:return"Portal";case Pe:return"Profiler";case Re:return"StrictMode";case Be:return"Suspense";case De:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case Le:return ht(e)+".Consumer";case Ne:return ht(e._context)+".Provider";case Ie:return function(e,t,n){var r=e.displayName;if(r)return r;var i=t.displayName||t.name||"";return""!==i?n+"("+i+")":n}(e,e.render,"ForwardRef");case je:var t=e.displayName||null;return null!==t?t:dt(e.type)||"Memo";case Fe:var n=e,r=n._payload,i=n._init;try{return dt(i(r))}catch(e){return null}}return null}function ft(e){return e.displayName||"Context"}function pt(e){var t,n,r,i,o=e.tag,s=e.type;switch(o){case N:return"Cache";case v:return ft(s)+".Consumer";case b:return ft(s._context)+".Provider";case C:return"DehydratedFragment";case A:return t=s,r="ForwardRef",i=(n=s.render).displayName||n.name||"",t.displayName||(""!==i?r+"("+i+")":r);case m:return"Fragment";case f:return s;case d:return"Portal";case h:return"Root";case p:return"Text";case S:return dt(s);case g:return s===Re?"StrictMode":"Mode";case R:return"Offscreen";case _:return"Profiler";case O:return"Scope";case E:return"Suspense";case T:return"SuspenseList";case L:return"TracingMarker";case l:case a:case x:case u:case M:case k:if("function"==typeof s)return s.displayName||s.name||null;if("string"==typeof s)return s}return null}rt=new ot;var mt=n.ReactDebugCurrentFrame,gt=null,vt=!1;function yt(){if(null===gt)return null;var e=gt._debugOwner;return null!=e?pt(e):null}function bt(){return null===gt?"":ct(gt)}function wt(){mt.getCurrentStack=null,gt=null,vt=!1}function At(e){mt.getCurrentStack=null===e?null:bt,gt=e,vt=!1}function _t(e){vt=e}function Et(e){return""+e}function Mt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return ne(e),e;default:return""}}var kt={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0};function St(e,t){kt[t.type]||t.onChange||t.onInput||t.readOnly||t.disabled||null==t.value||o("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`."),t.onChange||t.readOnly||t.disabled||null==t.checked||o("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")}function xt(e){var t=e.type,n=e.nodeName;return n&&"input"===n.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ct(e){return e._valueTracker}function Tt(e){Ct(e)||(e._valueTracker=function(e){var t=xt(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);ne(e[t]);var r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){ne(e),r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable});var s={getValue:function(){return r},setValue:function(e){ne(e),r=""+e},stopTracking:function(){!function(e){e._valueTracker=null}(e),delete e[t]}};return s}}(e))}function Ot(e){if(!e)return!1;var t=Ct(e);if(!t)return!0;var n=t.getValue(),r=function(e){var t="";return e?t=xt(e)?e.checked?"true":"false":e.value:t}(e);return r!==n&&(t.setValue(r),!0)}function Rt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var Pt=!1,Nt=!1,Lt=!1,It=!1;function Bt(e){return"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}function Dt(e,t){var n=e,r=t.checked;return Qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:n._wrapperState.initialChecked})}function jt(e,t){St(0,t),void 0===t.checked||void 0===t.defaultChecked||Nt||(o("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",yt()||"A component",t.type),Nt=!0),void 0===t.value||void 0===t.defaultValue||Pt||(o("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",yt()||"A component",t.type),Pt=!0);var n=e,r=null==t.defaultValue?"":t.defaultValue;n._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:Mt(null!=t.value?t.value:r),controlled:Bt(t)}}function Ft(e,t){var n=e,r=t.checked;null!=r&&xe(n,"checked",r,!1)}function Ut(e,t){var n=e,r=Bt(t);n._wrapperState.controlled||!r||It||(o("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),It=!0),!n._wrapperState.controlled||r||Lt||(o("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),Lt=!0),Ft(e,t);var i=Mt(t.value),s=t.type;if(null!=i)"number"===s?(0===i&&""===n.value||n.value!=i)&&(n.value=Et(i)):n.value!==Et(i)&&(n.value=Et(i));else if("submit"===s||"reset"===s)return void n.removeAttribute("value");t.hasOwnProperty("value")?zt(n,t.type,i):t.hasOwnProperty("defaultValue")&&zt(n,t.type,Mt(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(n.defaultChecked=!!t.defaultChecked)}function qt(e,t,n){var r=e;if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!("submit"!==i&&"reset"!==i||void 0!==t.value&&null!==t.value))return;var o=Et(r._wrapperState.initialValue);n||o!==r.value&&(r.value=o),r.defaultValue=o}var s=r.name;""!==s&&(r.name=""),r.defaultChecked=!r.defaultChecked,r.defaultChecked=!!r._wrapperState.initialChecked,""!==s&&(r.name=s)}function zt(e,t,n){"number"===t&&Rt(e.ownerDocument)===e||(null==n?e.defaultValue=Et(e._wrapperState.initialValue):e.defaultValue!==Et(n)&&(e.defaultValue=Et(n)))}var Ht=!1,Kt=!1,Vt=!1;function Wt(t,n){null==n.value&&("object"==typeof n.children&&null!==n.children?e.Children.forEach(n.children,(function(e){null!=e&&"string"!=typeof e&&"number"!=typeof e&&(Kt||(Kt=!0,o("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to