>>=26,t.words[i]=n,e=r}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var i=t.add(e);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var i=t.iadd(e);return i.cmp(this.m)>=0&&i.isub(this.m),i},S.prototype.sub=function(t,e){this._verify2(t,e);var i=t.sub(e);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var i=t.isub(e);return i.cmpn(0)<0&&i.iadd(this.m),i},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new n(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);i(!o.isZero());var h=new n(1).toRed(this),a=h.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(a);)f.redIAdd(a);for(var d=this.pow(f,o),l=this.pow(t,o.addn(1).iushrn(1)),c=this.pow(t,o),p=s;0!==c.cmp(h);){for(var m=c,v=0;0!==m.cmp(h);v++)m=m.redSqr();i(v=0;r--){for(var u=e.words[r],f=a-1;f>=0;f--){var d=u>>f&1;o!==i[0]&&(o=this.sqr(o)),0!==d||0!==s?(s<<=1,s|=d,(4===++h||0===r&&0===f)&&(o=this.mul(o,i[s]),h=0,s=0)):h=0}a=26}return o},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},r(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var i=t.mul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=i.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(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)})),o.register("lQohp",(function(t,e){var i;function r(t){this.rand=t}if(t.exports=function(t){return i||(i=new r(null)),i.generate(t)},t.exports.Rand=r,r.prototype.generate=function(t){return this._rand(t)},r.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),i=0;i0&&i.ishrn(r),i}function l(t,e,n){var o,s;do{for(o=i.alloc(0);8*o.length=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function h(t,e){var n=function(t){var e=s(t);return{blinder:e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),o=e.modulus.byteLength(),h=new r(t).mul(n.blinder).umod(e.modulus),a=h.toRed(r.mont(e.prime1)),u=h.toRed(r.mont(e.prime2)),f=e.coefficient,d=e.prime1,l=e.prime2,c=a.redPow(e.exponent1).fromRed(),p=u.redPow(e.exponent2).fromRed(),m=c.isub(p).imul(f).umod(d).imul(l);return p.iadd(m).imul(n.unblinder).umod(e.modulus).toArrayLike(i,"be",o)}h.getr=s,t.exports=h})),o.register("fE5db",(function(t,e){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function n(t,e,i){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var s;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o("1wVs5").Buffer}catch(t){}function h(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,i){var r=h(t,i);return i-1>=e&&(r|=h(t,i-1)<<4),r}function u(t,e,r,n){for(var o=0,s=0,h=Math.min(t.length,r),a=e;a=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&s0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,i){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)n=a(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var o=t.length-i,s=o%r,h=Math.min(o,o-s)+i,a=0,f=i;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(t){n.prototype.inspect=d}else n.prototype.inspect=d;function d(){return(this.red?""}var l=["","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],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];n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==o||s!==this.length-1?l[6-a.length]+a+r:a+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=c[t],f=p[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var m=d.modrn(f).toString(t);r=(d=d.idivn(f)).isZero()?m+r:l[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,a=s/67108864|0;i.words[0]=h;for(var u=1;u>>26,d=67108863&a,l=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);c<=l;c++){var p=u-c|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[c])+d)/67108864|0,d=67108863&s}i.words[u]=0|d,a=0|f}return 0!==a?i.words[u]=0|a:i.length--,i._strip()}n.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},n.prototype._toArrayLikeLE=function(t,e){for(var i=0,r=0,n=0,o=0;n>8&255),i>16&255),6===o?(i>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(i=0&&(t[i--]=s>>8&255),i>=0&&(t[i--]=s>>16&255),6===o?(i>=0&&(t[i--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(i>=0)for(t[i--]=r;i>=0;)t[i--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,i=0;return e>=4096&&(i+=13,e>>>=13),e>=64&&(i+=7,e>>>=7),e>=8&&(i+=4,e>>>=4),e>=2&&(i+=2,e>>>=2),i+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,i=0;return 0==(8191&e)&&(i+=13,e>>>=13),0==(127&e)&&(i+=7,e>>>=7),0==(15&e)&&(i+=4,e>>>=4),0==(3&e)&&(i+=2,e>>>=2),0==(1&e)&&i++,i},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var i=0;it.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,i;this.length>t.length?(e=this,i=t):(e=t,i=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(i=this,r=t):(i=t,r=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,r=t):(i=t,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,c=0|s[1],p=8191&c,m=c>>>13,v=0|s[2],g=8191&v,b=v>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],x=8191&A,E=A>>>13,B=0|s[6],R=8191&B,I=B>>>13,L=0|s[7],T=8191&L,j=L>>>13,O=0|s[8],N=8191&O,q=O>>>13,P=0|s[9],C=8191&P,U=P>>>13,D=0|h[0],z=8191&D,Z=D>>>13,V=0|h[1],F=8191&V,K=V>>>13,H=0|h[2],Y=8191&H,W=H>>>13,J=0|h[3],X=8191&J,G=J>>>13,Q=0|h[4],$=8191&Q,tt=Q>>>13,et=0|h[5],it=8191&et,rt=et>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],at=8191&ht,ut=ht>>>13,ft=0|h[8],dt=8191&ft,lt=ft>>>13,ct=0|h[9],pt=8191&ct,mt=ct>>>13;i.negative=t.negative^e.negative,i.length=19;var vt=(u+(r=Math.imul(d,z))|0)+((8191&(n=(n=Math.imul(d,Z))+Math.imul(l,z)|0))<<13)|0;u=((o=Math.imul(l,Z))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(p,z),n=(n=Math.imul(p,Z))+Math.imul(m,z)|0,o=Math.imul(m,Z);var gt=(u+(r=r+Math.imul(d,F)|0)|0)+((8191&(n=(n=n+Math.imul(d,K)|0)+Math.imul(l,F)|0))<<13)|0;u=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,z),n=(n=Math.imul(g,Z))+Math.imul(b,z)|0,o=Math.imul(b,Z),r=r+Math.imul(p,F)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(m,F)|0,o=o+Math.imul(m,K)|0;var bt=(u+(r=r+Math.imul(d,Y)|0)|0)+((8191&(n=(n=n+Math.imul(d,W)|0)+Math.imul(l,Y)|0))<<13)|0;u=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,z),n=(n=Math.imul(w,Z))+Math.imul(M,z)|0,o=Math.imul(M,Z),r=r+Math.imul(g,F)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(b,F)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,W)|0;var yt=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(n=(n=n+Math.imul(d,G)|0)+Math.imul(l,X)|0))<<13)|0;u=((o=o+Math.imul(l,G)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(S,z),n=(n=Math.imul(S,Z))+Math.imul(k,z)|0,o=Math.imul(k,Z),r=r+Math.imul(w,F)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(g,Y)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,W)|0,r=r+Math.imul(p,X)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,G)|0;var wt=(u+(r=r+Math.imul(d,$)|0)|0)+((8191&(n=(n=n+Math.imul(d,tt)|0)+Math.imul(l,$)|0))<<13)|0;u=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(x,z),n=(n=Math.imul(x,Z))+Math.imul(E,z)|0,o=Math.imul(E,Z),r=r+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,K)|0,r=r+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(g,X)|0,n=(n=n+Math.imul(g,G)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,G)|0,r=r+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(u+(r=r+Math.imul(d,it)|0)|0)+((8191&(n=(n=n+Math.imul(d,rt)|0)+Math.imul(l,it)|0))<<13)|0;u=((o=o+Math.imul(l,rt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(R,z),n=(n=Math.imul(R,Z))+Math.imul(I,z)|0,o=Math.imul(I,Z),r=r+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(E,F)|0,o=o+Math.imul(E,K)|0,r=r+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(w,X)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,it)|0,n=(n=n+Math.imul(p,rt)|0)+Math.imul(m,it)|0,o=o+Math.imul(m,rt)|0;var _t=(u+(r=r+Math.imul(d,ot)|0)|0)+((8191&(n=(n=n+Math.imul(d,st)|0)+Math.imul(l,ot)|0))<<13)|0;u=((o=o+Math.imul(l,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(T,z),n=(n=Math.imul(T,Z))+Math.imul(j,z)|0,o=Math.imul(j,Z),r=r+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(S,X)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,G)|0,r=r+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,it)|0,n=(n=n+Math.imul(g,rt)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(u+(r=r+Math.imul(d,at)|0)|0)+((8191&(n=(n=n+Math.imul(d,ut)|0)+Math.imul(l,at)|0))<<13)|0;u=((o=o+Math.imul(l,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,z),n=(n=Math.imul(N,Z))+Math.imul(q,z)|0,o=Math.imul(q,Z),r=r+Math.imul(T,F)|0,n=(n=n+Math.imul(T,K)|0)+Math.imul(j,F)|0,o=o+Math.imul(j,K)|0,r=r+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(x,X)|0,n=(n=n+Math.imul(x,G)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,G)|0,r=r+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(w,it)|0,n=(n=n+Math.imul(w,rt)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,at)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(r=r+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,lt)|0)+Math.imul(l,dt)|0))<<13)|0;u=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(C,z),n=(n=Math.imul(C,Z))+Math.imul(U,z)|0,o=Math.imul(U,Z),r=r+Math.imul(N,F)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(q,F)|0,o=o+Math.imul(q,K)|0,r=r+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,W)|0,r=r+Math.imul(R,X)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,G)|0,r=r+Math.imul(x,$)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(S,it)|0,n=(n=n+Math.imul(S,rt)|0)+Math.imul(k,it)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,r=r+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ut)|0)+Math.imul(b,at)|0,o=o+Math.imul(b,ut)|0,r=r+Math.imul(p,dt)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(m,dt)|0,o=o+Math.imul(m,lt)|0;var At=(u+(r=r+Math.imul(d,pt)|0)|0)+((8191&(n=(n=n+Math.imul(d,mt)|0)+Math.imul(l,pt)|0))<<13)|0;u=((o=o+Math.imul(l,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,F),n=(n=Math.imul(C,K))+Math.imul(U,F)|0,o=Math.imul(U,K),r=r+Math.imul(N,Y)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(q,Y)|0,o=o+Math.imul(q,W)|0,r=r+Math.imul(T,X)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,G)|0,r=r+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(x,it)|0,n=(n=n+Math.imul(x,rt)|0)+Math.imul(E,it)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,r=r+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,at)|0,o=o+Math.imul(M,ut)|0,r=r+Math.imul(g,dt)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(b,dt)|0,o=o+Math.imul(b,lt)|0;var xt=(u+(r=r+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(C,Y),n=(n=Math.imul(C,W))+Math.imul(U,Y)|0,o=Math.imul(U,W),r=r+Math.imul(N,X)|0,n=(n=n+Math.imul(N,G)|0)+Math.imul(q,X)|0,o=o+Math.imul(q,G)|0,r=r+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,tt)|0,r=r+Math.imul(R,it)|0,n=(n=n+Math.imul(R,rt)|0)+Math.imul(I,it)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,r=r+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ut)|0,r=r+Math.imul(w,dt)|0,n=(n=n+Math.imul(w,lt)|0)+Math.imul(M,dt)|0,o=o+Math.imul(M,lt)|0;var Et=(u+(r=r+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,X),n=(n=Math.imul(C,G))+Math.imul(U,X)|0,o=Math.imul(U,G),r=r+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(q,$)|0,o=o+Math.imul(q,tt)|0,r=r+Math.imul(T,it)|0,n=(n=n+Math.imul(T,rt)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,rt)|0,r=r+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,r=r+Math.imul(x,at)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(E,at)|0,o=o+Math.imul(E,ut)|0,r=r+Math.imul(S,dt)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul(k,dt)|0,o=o+Math.imul(k,lt)|0;var Bt=(u+(r=r+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(C,$),n=(n=Math.imul(C,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),r=r+Math.imul(N,it)|0,n=(n=n+Math.imul(N,rt)|0)+Math.imul(q,it)|0,o=o+Math.imul(q,rt)|0,r=r+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,r=r+Math.imul(R,at)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(I,at)|0,o=o+Math.imul(I,ut)|0,r=r+Math.imul(x,dt)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(E,dt)|0,o=o+Math.imul(E,lt)|0;var Rt=(u+(r=r+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(C,it),n=(n=Math.imul(C,rt))+Math.imul(U,it)|0,o=Math.imul(U,rt),r=r+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,st)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,st)|0,r=r+Math.imul(T,at)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(j,at)|0,o=o+Math.imul(j,ut)|0,r=r+Math.imul(R,dt)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,dt)|0,o=o+Math.imul(I,lt)|0;var It=(u+(r=r+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(C,ot),n=(n=Math.imul(C,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),r=r+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,ut)|0,r=r+Math.imul(T,dt)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(j,dt)|0,o=o+Math.imul(j,lt)|0;var Lt=(u+(r=r+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,mt)|0)+Math.imul(I,pt)|0))<<13)|0;u=((o=o+Math.imul(I,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(C,at),n=(n=Math.imul(C,ut))+Math.imul(U,at)|0,o=Math.imul(U,ut),r=r+Math.imul(N,dt)|0,n=(n=n+Math.imul(N,lt)|0)+Math.imul(q,dt)|0,o=o+Math.imul(q,lt)|0;var Tt=(u+(r=r+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(C,dt),n=(n=Math.imul(C,lt))+Math.imul(U,dt)|0,o=Math.imul(U,lt);var jt=(u+(r=r+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(q,pt)|0))<<13)|0;u=((o=o+Math.imul(q,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863;var Ot=(u+(r=Math.imul(C,pt))|0)+((8191&(n=(n=Math.imul(C,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a[0]=vt,a[1]=gt,a[2]=bt,a[3]=yt,a[4]=wt,a[5]=Mt,a[6]=_t,a[7]=St,a[8]=kt,a[9]=At,a[10]=xt,a[11]=Et,a[12]=Bt,a[13]=Rt,a[14]=It,a[15]=Lt,a[16]=Tt,a[17]=jt,a[18]=Ot,0!==u&&(a[19]=u,i.length++),i};function g(t,e,i){i.negative=e.negative^t.negative,i.length=t.length+e.length;for(var r=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}i.words[o]=h,r=s,s=n}return 0!==r?i.words[o]=r:i.length--,i._strip()}function b(t,e,i){return g(t,e,i)}function y(t,e){this.x=t,this.y=e}Math.imul||(v=m),n.prototype.mulTo=function(t,e){var i=this.length+t.length;return 10===this.length&&10===t.length?v(this,t,e):i<63?m(this,t,e):i<1024?g(this,t,e):b(this,t,e)},y.prototype.makeRBT=function(t){for(var e=new Array(t),i=n.prototype._countBits(t)-1,r=0;r>=1;return r},y.prototype.permute=function(t,e,i,r,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),i=0;i>>n&1}return e}(t);if(0===e.length)return new n(1);for(var i=this,r=0;r=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=n);u--){var d=0|this.words[u];this.words[u]=f<<26-o|d>>>o,f=d&h}return a&&0!==f&&(a.words[a.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(a/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===h)return this._strip();for(i(-1===h),h=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var i=(this.length,t.length),r=this.clone(),o=t,s=0|o.words[o.length-1];0!==(i=26-this._countBits(s))&&(o=o.ushln(i),r.iushln(i),s=0|o.words[o.length-1]);var h,a=r.length-o.length;if("mod"!==e){(h=new n(null)).length=a+1,h.words=new Array(h.length);for(var u=0;u=0;d--){var l=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(l=Math.min(l/s|0,67108863),r._ishlnsubmul(o,l,d);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);h&&(h.words[d]=l)}return h&&h._strip(),r._strip(),"div"!==e&&0!==i&&r.iushrn(i),{div:h||null,mod:r}},n.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,e),"mod"!==e&&(o=h.div.neg()),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),e),"mod"!==e&&(o=h.div.neg()),{div:o,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),e),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,h},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var i=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),n=t.andln(1),o=i.cmp(r);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=67108864%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),h=new n(0),a=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),d=e.clone();!e.isZero();){for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(d)),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;)(h.isOdd()||a.isOdd())&&(h.iadd(f),a.isub(d)),h.iushrn(1),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(h),s.isub(a)):(r.isub(e),h.isub(o),a.isub(s))}return{a:h,b:a,gcd:r.iushln(u)}},n.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),h=new n(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);for(var d=0,l=1;0==(r.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(r.iushrn(d);d-- >0;)h.isOdd()&&h.iadd(a),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(h)):(r.isub(e),h.isub(s))}return(o=0===e.cmpn(1)?s:h).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),i=t.clone();e.negative=0,i.negative=0;for(var r=0;e.isEven()&&i.isEven();r++)e.iushrn(1),i.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=e.cmp(i);if(n<0){var o=e;e=i,i=o}else if(0===n||0===i.cmpn(1))break;e.isub(i)}return i.iushln(r)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;i--){var r=0|this.words[i],n=0|t.words[i];if(r!==n){rn&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new x(t)},n.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function M(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){M.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){M.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){M.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){M.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}M.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},M.prototype.ireduce=function(t){var e,i=t;do{this.split(i,this.tmp),e=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?i.isub(this.p):void 0!==i.strip?i.strip():i._strip(),i},M.prototype.split=function(t,e){t.iushrn(this.n,0,e)},M.prototype.imulK=function(t){return t.imul(this.k)},r(_,M),_.prototype.split=function(t,e){for(var i=4194303,r=Math.min(t.length,9),n=0;n>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,i=0;i>>=26,t.words[i]=n,e=r}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new S;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return w[t]=e,e},x.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var i=t.add(e);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var i=t.iadd(e);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,e){this._verify2(t,e);var i=t.sub(e);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var i=t.isub(e);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new n(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);i(!o.isZero());var h=new n(1).toRed(this),a=h.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(a);)f.redIAdd(a);for(var d=this.pow(f,o),l=this.pow(t,o.addn(1).iushrn(1)),c=this.pow(t,o),p=s;0!==c.cmp(h);){for(var m=c,v=0;0!==m.cmp(h);v++)m=m.redSqr();i(v=0;r--){for(var u=e.words[r],f=a-1;f>=0;f--){var d=u>>f&1;o!==i[0]&&(o=this.sqr(o)),0!==d||0!==s?(s<<=1,s|=d,(4===++h||0===r&&0===f)&&(o=this.mul(o,i[s]),h=0,s=0)):h=0}a=26}return o},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new E(t)},r(E,x),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var i=t.mul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=i.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(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)})),o.register("7AZol",(function(t,e){"use strict";var i=t.exports;i.version=o("2Zf1j").version,i.utils=o("6QeS9"),i.rand=o("lQohp"),i.curve=o("ku149"),i.curves=o("awhMH"),i.ec=o("kfPZx"),i.eddsa=o("krSjs")})),o.register("2Zf1j",(function(t,e){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')})),o.register("6QeS9",(function(t,e){"use strict";var i=t.exports,r=o("ivl6O"),n=o("3HhhI"),s=o("6dCtp");i.assert=n,i.toArray=s.toArray,i.zero2=s.zero2,i.toHex=s.toHex,i.encode=s.encode,i.getNAF=function(t,e,i){var r=new Array(Math.max(t.bitLength(),i)+1);r.fill(0);for(var n=1<(n>>1)-1?(n>>1)-a:a,o.isubn(h)):h=0,r[s]=h,o.iushrn(1)}return r},i.getJSF=function(t,e){var i=[[],[]];t=t.clone(),e=e.clone();for(var r,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,h,a=t.andln(3)+n&3,u=e.andln(3)+o&3;3===a&&(a=-1),3===u&&(u=-1),s=0==(1&a)?0:3!==(r=t.andln(7)+n&7)&&5!==r||2!==u?a:-a,i[0].push(s),h=0==(1&u)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==a?u:-u,i[1].push(h),2*n===s+1&&(n=1-n),2*o===h+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return i},i.cachedProperty=function(t,e,i){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=i.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new r(t,"hex","le")}})),o.register("ivl6O",(function(t,e){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function n(t,e,i){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var s;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o("1wVs5").Buffer}catch(t){}function h(t,e){var i=t.charCodeAt(e);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function a(t,e,i){var r=h(t,i);return i-1>=e&&(r|=h(t,i-1)<<4),r}function u(t,e,i,r){for(var n=0,o=Math.min(t.length,i),s=e;s=49?h-49+10:h>=17?h-17+10:h}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,i){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)n=a(t,e,r)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var o=t.length-i,s=o%r,h=Math.min(o,o-s)+i,a=0,f=i;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,a=s/67108864|0;i.words[0]=h;for(var u=1;u>>26,d=67108863&a,l=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);c<=l;c++){var p=u-c|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[c])+d)/67108864|0,d=67108863&s}i.words[u]=0|d,a=0|f}return 0!==a?i.words[u]=0|a:i.length--,i.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-a.length]+a+r:a+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],c=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(c).toString(t);r=(p=p.idivn(c)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,h,a="le"===e,u=new t(o),f=this.clone();if(a){for(h=0;!f.isZero();h++)s=f.andln(255),f.iushrn(8),u[h]=s;for(;h=4096&&(i+=13,e>>>=13),e>=64&&(i+=7,e>>>=7),e>=8&&(i+=4,e>>>=4),e>=2&&(i+=2,e>>>=2),i+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,i=0;return 0==(8191&e)&&(i+=13,e>>>=13),0==(127&e)&&(i+=7,e>>>=7),0==(15&e)&&(i+=4,e>>>=4),0==(3&e)&&(i+=2,e>>>=2),0==(1&e)&&i++,i},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var i=0;it.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,i;this.length>t.length?(e=this,i=t):(e=t,i=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(i=this,r=t):(i=t,r=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,r=t):(i=t,r=this);for(var o=0,s=0;s