npm.create-ecdh.dc2aa1c71f49a78a7285.0.1.0.js 44 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["npm.create-ecdh"],{"37e6":function(t,i,r){(function(t){!function(t,i){"use strict";function e(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var o;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{o=r(14).Buffer}catch(t){}function s(t,i,r){for(var e=0,n=Math.min(t.length,r),h=i;h<n;h++){var o=t.charCodeAt(h)-48;e<<=4,e|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return e}function u(t,i,r,e){for(var n=0,h=Math.min(t.length,r),o=i;o<h;o++){var s=t.charCodeAt(o)-48;n*=e,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,r){if("number"==typeof t)return this._initNumber(t,i,r);if("object"==typeof t)return this._initArray(t,i,r);"hex"===i&&(i=16),e(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),i,r)},h.prototype._initNumber=function(t,i,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),i,r)},h.prototype._initArray=function(t,i,r){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,o,s=0;if("be"===r)for(n=t.length-1,h=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);else if("le"===r)for(n=0,h=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);return this.strip()},h.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var e,n,h=0;for(r=t.length-6,e=0;r>=i;r-=6)n=s(t,r,r+6),this.words[e]|=n<<h&67108863,this.words[e+1]|=n>>>26-h&4194303,(h+=24)>=26&&(h-=26,e++);r+6!==i&&(n=s(t,i,r+6),this.words[e]|=n<<h&67108863,this.words[e+1]|=n>>>26-h&4194303),this.strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=i)e++;e--,n=n/i|0;for(var h=t.length-r,o=h%e,s=Math.min(h,h-o)+r,a=0,l=r;l<s;l+=e)a=u(t,l,l+e,i),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==o){var m=1;for(a=u(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},h.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},h.prototype.clone=function(){var t=new h(null);return this.copy(t),t},h.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[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 f(t,i,r){r.negative=i.negative^t.negative;var e=t.length+i.length|0;r.length=e,e=e-1|0;var n=0|t.words[0],h=0|i.words[0],o=n*h,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a<e;a++){for(var l=u>>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(h=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}h.prototype.toString=function(t,i){var r;if(i=0|i||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,h=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|h)).toString(16);r=0!==(h=s>>>24-n&16777215)||o!==this.length-1?a[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==h&&(r=h.toString(16)+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],d=m[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?M+r:a[f-M.length]+M+r}for(this.isZero()&&(r="0"+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}e(!1,"Base should be between 2 and 36")},h.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&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return e(void 0!==o),this.toArrayLike(o,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,r){var n=this.byteLength(),h=r||Math.max(1,n);e(n<=h,"byte array longer than desired length"),e(h>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(h),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s<h;s++)a[s]=0}else{for(s=0;s<h-n;s++)a[s]=0;for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[h-s-1]=o}return a},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},h.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return 0!==this.negative},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},h.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},h.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},h.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},h.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var e=0;e<r.length;e++)this.words[e]=i.words[e]^r.words[e];if(this!==i)for(;e<i.length;e++)this.words[e]=i.words[e];return this.length=i.length,this.strip()},h.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},h.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),r=t%26;this._expand(i),r>0&&i--;for(var n=0;n<i;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){e("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=i?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},h.prototype.iadd=function(t){var i,r,e;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0,h=0;h<e.length;h++)i=(0|r.words[h])+(0|e.words[h])+n,this.words[h]=67108863&i,n=i>>>26;for(;0!==n&&h<r.length;h++)i=(0|r.words[h])+n,this.words[h]=67108863&i,n=i>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;h<r.length;h++)this.words[h]=r.words[h];return this},h.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,e=t):(r=t,e=this);for(var h=0,o=0;o<e.length;o++)h=(i=(0|r.words[o])-(0|e.words[o])+h)>>26,this.words[o]=67108863&i;for(;0!==h&&o<r.length;o++)h=(i=(0|r.words[o])+h)>>26,this.words[o]=67108863&i;if(0===h&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,i,r){var e,n,h,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],c=8191&v,g=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,S=0|o[5],x=8191&S,B=S>>>13,Z=0|o[6],R=8191&Z,q=Z>>>13,L=0|o[7],N=8191&L,P=L>>>13,T=0|o[8],I=8191&T,K=T>>>13,z=0|o[9],E=8191&z,O=z>>>13,j=0|s[0],F=8191&j,J=j>>>13,C=0|s[1],D=8191&C,H=C>>>13,U=0|s[2],X=8191&U,G=U>>>13,Q=0|s[3],V=8191&Q,W=Q>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,et=it>>>13,nt=0|s[6],ht=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191&lt,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(e=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,J))+Math.imul(f,F)|0))<<13)|0;a=((h=Math.imul(f,J))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(p,F),n=(n=Math.imul(p,J))+Math.imul(M,F)|0,h=Math.imul(M,J);var ct=(a+(e=e+Math.imul(m,D)|0)|0)+((8191&(n=(n=n+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((h=h+Math.imul(f,H)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,e=Math.imul(c,F),n=(n=Math.imul(c,J))+Math.imul(g,F)|0,h=Math.imul(g,J),e=e+Math.imul(p,D)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(M,D)|0,h=h+Math.imul(M,H)|0;var gt=(a+(e=e+Math.imul(m,X)|0)|0)+((8191&(n=(n=n+Math.imul(m,G)|0)+Math.imul(f,X)|0))<<13)|0;a=((h=h+Math.imul(f,G)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(y,F),n=(n=Math.imul(y,J))+Math.imul(b,F)|0,h=Math.imul(b,J),e=e+Math.imul(c,D)|0,n=(n=n+Math.imul(c,H)|0)+Math.imul(g,D)|0,h=h+Math.imul(g,H)|0,e=e+Math.imul(p,X)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(M,X)|0,h=h+Math.imul(M,G)|0;var wt=(a+(e=e+Math.imul(m,V)|0)|0)+((8191&(n=(n=n+Math.imul(m,W)|0)+Math.imul(f,V)|0))<<13)|0;a=((h=h+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(k,F),n=(n=Math.imul(k,J))+Math.imul(A,F)|0,h=Math.imul(A,J),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(b,D)|0,h=h+Math.imul(b,H)|0,e=e+Math.imul(c,X)|0,n=(n=n+Math.imul(c,G)|0)+Math.imul(g,X)|0,h=h+Math.imul(g,G)|0,e=e+Math.imul(p,V)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(M,V)|0,h=h+Math.imul(M,W)|0;var yt=(a+(e=e+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((h=h+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(x,F),n=(n=Math.imul(x,J))+Math.imul(B,F)|0,h=Math.imul(B,J),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,H)|0)+Math.imul(A,D)|0,h=h+Math.imul(A,H)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,X)|0,h=h+Math.imul(b,G)|0,e=e+Math.imul(c,V)|0,n=(n=n+Math.imul(c,W)|0)+Math.imul(g,V)|0,h=h+Math.imul(g,W)|0,e=e+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,h=h+Math.imul(M,tt)|0;var bt=(a+(e=e+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,et)|0)+Math.imul(f,rt)|0))<<13)|0;a=((h=h+Math.imul(f,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(R,F),n=(n=Math.imul(R,J))+Math.imul(q,F)|0,h=Math.imul(q,J),e=e+Math.imul(x,D)|0,n=(n=n+Math.imul(x,H)|0)+Math.imul(B,D)|0,h=h+Math.imul(B,H)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(A,X)|0,h=h+Math.imul(A,G)|0,e=e+Math.imul(y,V)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,V)|0,h=h+Math.imul(b,W)|0,e=e+Math.imul(c,$)|0,n=(n=n+Math.imul(c,tt)|0)+Math.imul(g,$)|0,h=h+Math.imul(g,tt)|0,e=e+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,et)|0)+Math.imul(M,rt)|0,h=h+Math.imul(M,et)|0;var _t=(a+(e=e+Math.imul(m,ht)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,ht)|0))<<13)|0;a=((h=h+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(N,F),n=(n=Math.imul(N,J))+Math.imul(P,F)|0,h=Math.imul(P,J),e=e+Math.imul(R,D)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(q,D)|0,h=h+Math.imul(q,H)|0,e=e+Math.imul(x,X)|0,n=(n=n+Math.imul(x,G)|0)+Math.imul(B,X)|0,h=h+Math.imul(B,G)|0,e=e+Math.imul(k,V)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,V)|0,h=h+Math.imul(A,W)|0,e=e+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,h=h+Math.imul(b,tt)|0,e=e+Math.imul(c,rt)|0,n=(n=n+Math.imul(c,et)|0)+Math.imul(g,rt)|0,h=h+Math.imul(g,et)|0,e=e+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,ht)|0,h=h+Math.imul(M,ot)|0;var kt=(a+(e=e+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((h=h+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(I,F),n=(n=Math.imul(I,J))+Math.imul(K,F)|0,h=Math.imul(K,J),e=e+Math.imul(N,D)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(P,D)|0,h=h+Math.imul(P,H)|0,e=e+Math.imul(R,X)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(q,X)|0,h=h+Math.imul(q,G)|0,e=e+Math.imul(x,V)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(B,V)|0,h=h+Math.imul(B,W)|0,e=e+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,h=h+Math.imul(A,tt)|0,e=e+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,rt)|0,h=h+Math.imul(b,et)|0,e=e+Math.imul(c,ht)|0,n=(n=n+Math.imul(c,ot)|0)+Math.imul(g,ht)|0,h=h+Math.imul(g,ot)|0,e=e+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,h=h+Math.imul(M,at)|0;var At=(a+(e=e+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((h=h+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(E,F),n=(n=Math.imul(E,J))+Math.imul(O,F)|0,h=Math.imul(O,J),e=e+Math.imul(I,D)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(K,D)|0,h=h+Math.imul(K,H)|0,e=e+Math.imul(N,X)|0,n=(n=n+Math.imul(N,G)|0)+Math.imul(P,X)|0,h=h+Math.imul(P,G)|0,e=e+Math.imul(R,V)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,W)|0,e=e+Math.imul(x,$)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(B,$)|0,h=h+Math.imul(B,tt)|0,e=e+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(A,rt)|0,h=h+Math.imul(A,et)|0,e=e+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,ht)|0,h=h+Math.imul(b,ot)|0,e=e+Math.imul(c,ut)|0,n=(n=n+Math.imul(c,at)|0)+Math.imul(g,ut)|0,h=h+Math.imul(g,at)|0,e=e+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,h=h+Math.imul(M,ft)|0;var St=(a+(e=e+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((h=h+Math.imul(f,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(E,D),n=(n=Math.imul(E,H))+Math.imul(O,D)|0,h=Math.imul(O,H),e=e+Math.imul(I,X)|0,n=(n=n+Math.imul(I,G)|0)+Math.imul(K,X)|0,h=h+Math.imul(K,G)|0,e=e+Math.imul(N,V)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(P,V)|0,h=h+Math.imul(P,W)|0,e=e+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,tt)|0,e=e+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,et)|0)+Math.imul(B,rt)|0,h=h+Math.imul(B,et)|0,e=e+Math.imul(k,ht)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,ht)|0,h=h+Math.imul(A,ot)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,h=h+Math.imul(b,at)|0,e=e+Math.imul(c,mt)|0,n=(n=n+Math.imul(c,ft)|0)+Math.imul(g,mt)|0,h=h+Math.imul(g,ft)|0;var xt=(a+(e=e+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((h=h+Math.imul(M,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(E,X),n=(n=Math.imul(E,G))+Math.imul(O,X)|0,h=Math.imul(O,G),e=e+Math.imul(I,V)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(K,V)|0,h=h+Math.imul(K,W)|0,e=e+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(P,$)|0,h=h+Math.imul(P,tt)|0,e=e+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,et)|0)+Math.imul(q,rt)|0,h=h+Math.imul(q,et)|0,e=e+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(B,ht)|0,h=h+Math.imul(B,ot)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,h=h+Math.imul(A,at)|0,e=e+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,h=h+Math.imul(b,ft)|0;var Bt=(a+(e=e+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,Mt)|0)+Math.imul(g,pt)|0))<<13)|0;a=((h=h+Math.imul(g,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(E,V),n=(n=Math.imul(E,W))+Math.imul(O,V)|0,h=Math.imul(O,W),e=e+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(K,$)|0,h=h+Math.imul(K,tt)|0,e=e+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,et)|0)+Math.imul(P,rt)|0,h=h+Math.imul(P,et)|0,e=e+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(q,ht)|0,h=h+Math.imul(q,ot)|0,e=e+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(B,ut)|0,h=h+Math.imul(B,at)|0,e=e+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,h=h+Math.imul(A,ft)|0;var Zt=(a+(e=e+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((h=h+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,e=Math.imul(E,$),n=(n=Math.imul(E,tt))+Math.imul(O,$)|0,h=Math.imul(O,tt),e=e+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,et)|0)+Math.imul(K,rt)|0,h=h+Math.imul(K,et)|0,e=e+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(P,ht)|0,h=h+Math.imul(P,ot)|0,e=e+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(q,ut)|0,h=h+Math.imul(q,at)|0,e=e+Math.imul(x,mt)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(B,mt)|0,h=h+Math.imul(B,ft)|0;var Rt=(a+(e=e+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((h=h+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,e=Math.imul(E,rt),n=(n=Math.imul(E,et))+Math.imul(O,rt)|0,h=Math.imul(O,et),e=e+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(K,ht)|0,h=h+Math.imul(K,ot)|0,e=e+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(P,ut)|0,h=h+Math.imul(P,at)|0,e=e+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,ft)|0;var qt=(a+(e=e+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((h=h+Math.imul(B,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,e=Math.imul(E,ht),n=(n=Math.imul(E,ot))+Math.imul(O,ht)|0,h=Math.imul(O,ot),e=e+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,at)|0)+Math.imul(K,ut)|0,h=h+Math.imul(K,at)|0,e=e+Math.imul(N,mt)|0,n=(n=n+Math.imul(N,ft)|0)+Math.imul(P,mt)|0,h=h+Math.imul(P,ft)|0;var Lt=(a+(e=e+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((h=h+Math.imul(q,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,e=Math.imul(E,ut),n=(n=Math.imul(E,at))+Math.imul(O,ut)|0,h=Math.imul(O,at),e=e+Math.imul(I,mt)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(K,mt)|0,h=h+Math.imul(K,ft)|0;var Nt=(a+(e=e+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(P,pt)|0))<<13)|0;a=((h=h+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(E,mt),n=(n=Math.imul(E,ft))+Math.imul(O,mt)|0,h=Math.imul(O,ft);var Pt=(a+(e=e+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(K,pt)|0))<<13)|0;a=((h=h+Math.imul(K,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Tt=(a+(e=Math.imul(E,pt))|0)+((8191&(n=(n=Math.imul(E,Mt))+Math.imul(O,pt)|0))<<13)|0;return a=((h=Math.imul(O,Mt))+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,u[0]=vt,u[1]=ct,u[2]=gt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=St,u[10]=xt,u[11]=Bt,u[12]=Zt,u[13]=Rt,u[14]=qt,u[15]=Lt,u[16]=Nt,u[17]=Pt,u[18]=Tt,0!==a&&(u[19]=a,r.length++),r};function p(t,i,r){return(new M).mulp(t,i,r)}function M(t,i){this.x=t,this.y=i}Math.imul||(d=f),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,i):r<63?f(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var e=0,n=0,h=0;h<r.length-1;h++){var o=n;n=0;for(var s=67108863&e,u=Math.min(h,i.length-1),a=Math.max(0,h-t.length+1);a<=u;a++){var l=h-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),n+=(o=(o=o+(m/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[h]=s,e=o,o=n}return 0!==e?r.words[h]=e:r.length--,r.strip()}(this,t,i):p(this,t,i)},M.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,e=0;e<t;e++)i[e]=this.revBin(e,r,t);return i},M.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var e=0,n=0;n<i;n++)e|=(1&t)<<i-n-1,t>>=1;return e},M.prototype.permute=function(t,i,r,e,n,h){for(var o=0;o<h;o++)e[o]=i[t[o]],n[o]=r[t[o]]},M.prototype.transform=function(t,i,r,e,n,h){this.permute(h,t,i,r,e,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var m=u,f=a,d=0;d<o;d++){var p=r[l+d],M=e[l+d],v=r[l+d+o],c=e[l+d+o],g=m*v-f*c;c=m*c+f*v,v=g,r[l+d]=p+v,e[l+d]=M+c,r[l+d+o]=p-v,e[l+d+o]=M-c,d!==s&&(g=u*m-a*f,f=u*f+a*m,m=g)}},M.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),e=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+e},M.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var e=0;e<r/2;e++){var n=t[e];t[e]=t[r-e-1],t[r-e-1]=n,n=i[e],i[e]=-i[r-e-1],i[r-e-1]=-n}},M.prototype.normalize13b=function(t,i){for(var r=0,e=0;e<i/2;e++){var n=8192*Math.round(t[2*e+1]/i)+Math.round(t[2*e]/i)+r;t[e]=67108863&n,r=n<67108864?0:n/67108864|0}return t},M.prototype.convert13b=function(t,i,r,n){for(var h=0,o=0;o<i;o++)h+=0|t[o],r[2*o]=8191&h,h>>>=13,r[2*o+1]=8191&h,h>>>=13;for(o=2*i;o<n;++o)r[o]=0;e(0===h),e(0==(-8192&h))},M.prototype.stub=function(t){for(var i=new Array(t),r=0;r<t;r++)i[r]=0;return i},M.prototype.mulp=function(t,i,r){var e=2*this.guessLen13b(t.length,i.length),n=this.makeRBT(e),h=this.stub(e),o=new Array(e),s=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),m=new Array(e),f=r.words;f.length=e,this.convert13b(t.words,t.length,o,e),this.convert13b(i.words,i.length,a,e),this.transform(o,h,s,u,e,n),this.transform(a,h,l,m,e,n);for(var d=0;d<e;d++){var p=s[d]*l[d]-u[d]*m[d];u[d]=s[d]*m[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,e),this.transform(s,u,f,h,e,n),this.conjugate(f,h,e),this.normalize13b(f,e),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},h.prototype.mul=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},h.prototype.mulf=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),p(this,t,i)},h.prototype.imul=function(t){return this.clone().mulTo(t,this)},h.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var i=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,h=(67108863&n)+(67108863&i);i>>=26,i+=n/67108864|0,i+=h>>>26,this.words[r]=67108863&h}return 0!==i&&(this.words[r]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var e=r/26|0,n=r%26;i[r]=(t.words[e]&1<<n)>>>n}return i}(t);if(0===i.length)return new h(1);for(var r=this,e=0;e<i.length&&0===i[e];e++,r=r.sqr());if(++e<i.length)for(var n=r.sqr();e<i.length;e++,n=n.sqr())0!==i[e]&&(r=r.mul(n));return r},h.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var i,r=t%26,n=(t-r)/26,h=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&h,u=(0|this.words[i])-s<<r;this.words[i]=u|o,o=s>>>26-r}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i<n;i++)this.words[i]=0;this.length+=n}return this.strip()},h.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},h.prototype.iushrn=function(t,i,r){var n;e("number"==typeof t&&t>=0),n=i?(i-i%26)/26:0;var h=t%26,o=Math.min((t-h)/26,this.length),s=67108863^67108863>>>h<<h,u=r;if(n-=o,n=Math.max(0,n),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-h|m>>>h,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,r){return e(0===this.negative),this.iushrn(t,i,r)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26,n=1<<i;return!(this.length<=r)&&!!(this.words[r]&n)},h.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==i&&r++,this.length=Math.min(r,this.length),0!==i){var n=67108863^67108863>>>i<<i;this.words[this.length-1]&=n}return this.strip()},h.prototype.maskn=function(t){return this.clone().imaskn(t)},h.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},h.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(e("number"==typeof t),e(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},h.prototype.addn=function(t){return this.clone().iaddn(t)},h.prototype.subn=function(t){return this.clone().isubn(t)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(t,i,r){var n,h,o=t.length+r;this._expand(o);var s=0;for(n=0;n<t.length;n++){h=(0|this.words[n+r])+s;var u=(0|t.words[n])*i;s=((h-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&h}for(;n<this.length-r;n++)s=(h=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&h;if(0===s)return this.strip();for(e(-1===s),s=0,n=0;n<this.length;n++)s=(h=-(0|this.words[n])+s)>>26,this.words[n]=67108863&h;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),e=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),e.iushln(r),o=0|n.words[n.length-1]);var s,u=e.length-n.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|e.words[n.length+m])+(0|e.words[n.length+m-1]);for(f=Math.min(f/o|0,67108863),e._ishlnsubmul(n,f,m);0!==e.negative;)f--,e.negative=0,e._ishlnsubmul(n,1,m),e.isZero()||(e.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),e.strip(),"div"!==i&&0!==r&&e.iushrn(r),{div:s||null,mod:e}},h.prototype.divmod=function(t,i,r){return e(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(n=s.div.neg()),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i);var n,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,e=t.ushrn(1),n=t.andln(1),h=r.cmp(e);return h<0||1===n&&0===h?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){e(t<=67108863);for(var i=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(i*r+(0|this.words[n]))%t;return r},h.prototype.idivn=function(t){e(t<=67108863);for(var i=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*i;this.words[r]=n/t|0,i=n%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&r.isEven();)i.iushrn(1),r.iushrn(1),++a;for(var l=r.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(m)),n.iushrn(1),o.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;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(r)>=0?(i.isub(r),n.isub(s),o.isub(u)):(r.isub(i),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(a)}},h.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n,o=new h(1),s=new h(0),u=r.clone();i.cmpn(1)>0&&r.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(r.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(r)>=0?(i.isub(r),o.isub(s)):(r.isub(i),s.isub(o))}return(n=0===i.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var e=0;i.isEven()&&r.isEven();e++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var h=i;i=r,r=h}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(e)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){e("number"==typeof t);var i=t%26,r=(t-i)/26,n=1<<i;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var h=n,o=r;0!==h&&o<this.length;o++){var s=0|this.words[o];h=(s+=h)>>>26,s&=67108863,this.words[o]=s}return 0!==h&&(this.words[o]=h,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)i=1;else{r&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:n<t?-1:1}return 0!==this.negative?0|-i:i},h.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},h.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var e=0|this.words[r],n=0|t.words[r];if(e!==n){e<n?i=-1:e>n&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new _(t)},h.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function c(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(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)}c.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},c.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var e=i<this.n?-1:r.ucmp(this.p);return 0===e?(r.words[0]=0,r.length=1):e>0?r.isub(this.p):r.strip(),r},c.prototype.split=function(t,i){t.iushrn(this.n,0,i)},c.prototype.imulK=function(t){return t.imul(this.k)},n(g,c),g.prototype.split=function(t,i){for(var r=4194303,e=Math.min(t.length,9),n=0;n<e;n++)i.words[n]=t.words[n];if(i.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=h&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|h>>>22,h=o}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var e=0|t.words[r];i+=977*e,t.words[r]=67108863&i,i=64*e+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,c),n(y,c),n(b,c),b.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var e=19*(0|t.words[r])+i,n=67108863&e;e>>>=26,t.words[r]=n,i=e}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(v[t])return v[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new w;else if("p192"===t)i=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new b}return v[t]=i,i},_.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,i){e(0==(t.negative|i.negative),"red works only with positives"),e(t.red&&t.red===i.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},_.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},_.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(e(i%2==1),3===i){var r=this.m.add(new h(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);e(!n.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();e(v<p);var c=this.pow(m,new h(1).iushln(p-v-1));f=f.redMul(c),m=c.redSqr(),d=d.redMul(m),p=v}return f},_.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},_.prototype.pow=function(t,i){if(i.isZero())return new h(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new h(1).toRed(this),r[1]=t;for(var e=2;e<r.length;e++)r[e]=this.mul(r[e-1],t);var n=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),e=i.length-1;e>=0;e--){for(var a=i.words[e],l=u-1;l>=0;l--){var m=a>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===e&&0===l)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},_.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},_.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new k(t)},n(k,_),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},k.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),h=n;return n.cmp(this.m)>=0?h=n.isub(this.m):n.cmpn(0)<0&&(h=n.iadd(this.m)),h._forceRed(this)},k.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).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.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r("62e4")(t))},e1d3:function(t,i,r){(function(i){var e=r("3337"),n=r("37e6");t.exports=function(t){return new o(t)};var h={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function o(t){this.curveType=h[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function s(t,r,e){Array.isArray(t)||(t=t.toArray());var n=new i(t);if(e&&n.length<e){var h=new i(e-n.length);h.fill(0),n=i.concat([h,n])}return r?n.toString(r):n}h.p224=h.secp224r1,h.p256=h.secp256r1=h.prime256v1,h.p192=h.secp192r1=h.prime192v1,h.p384=h.secp384r1,h.p521=h.secp521r1,o.prototype.generateKeys=function(t,i){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,i)},o.prototype.computeSecret=function(t,r,e){return r=r||"utf8",i.isBuffer(t)||(t=new i(t,r)),s(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),e,this.curveType.byteLength)},o.prototype.getPublicKey=function(t,i){var r=this.keys.getPublic("compressed"===i,!0);return"hybrid"===i&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,t)},o.prototype.getPrivateKey=function(t){return s(this.keys.getPrivate(),t)},o.prototype.setPublicKey=function(t,r){return r=r||"utf8",i.isBuffer(t)||(t=new i(t,r)),this.keys._importPublic(t),this},o.prototype.setPrivateKey=function(t,r){r=r||"utf8",i.isBuffer(t)||(t=new i(t,r));var e=new n(t);return e=e.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(e),this}}).call(this,r("b639").Buffer)}}]);