From f9002df490999527579957b7d1cc4cc2d0053c44 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Mon, 12 Nov 2018 11:15:36 -0800 Subject: [PATCH] updated cryptofill for safari ECDH --- assets/cryptofill.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/cryptofill.js b/assets/cryptofill.js index 55499a14..03a80ebc 100644 --- a/assets/cryptofill.js +++ b/assets/cryptofill.js @@ -1,4 +1,10 @@ -var liner=function(e){function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var t={};return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=16)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){function n(e){for(var r,t=e,n=/[^%](%\d+)/g,a=[];r=n.exec(t);)a.push({arg:r[1],index:r.index});for(var o=a.length-1;o>=0;o--){var i=a[o],s=i.arg.substring(1),c=i.index+1;t=t.substring(0,c)+arguments[+s]+t.substring(c+1+s.length)}return t=t.replace("%%","%")}function a(e){var r;r="string"==typeof e?{name:e}:e,p.checkAlgorithm(r);var t=e;return t.hash&&(t.hash=a(t.hash)),r}function o(e,r){if(!e)throw new s("Parameter '"+r+"' is required and cant be empty");if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return new Uint8Array(e);if(ArrayBuffer.isView(e)){var t=e.map(function(e){return e});return new Uint8Array(t.buffer)}if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new s("Incoming parameter '"+r+"' has wrong data type. Must be ArrayBufferView or ArrayBuffer")}t.d(r,"WebCryptoError",function(){return s}),t.d(r,"AlgorithmError",function(){return c}),t.d(r,"CryptoKeyError",function(){return u}),t.d(r,"PrepareAlgorithm",function(){return a}),t.d(r,"PrepareData",function(){return o}),t.d(r,"BaseCrypto",function(){return p}),t.d(r,"AlgorithmNames",function(){return h}),t.d(r,"Base64Url",function(){return y}),t.d(r,"SubtleCrypto",function(){return x}),t.d(r,"Aes",function(){return A}),t.d(r,"AesAlgorithmError",function(){return m}),t.d(r,"AesWrapKey",function(){return w}),t.d(r,"AesEncrypt",function(){return v}),t.d(r,"AesECB",function(){return g}),t.d(r,"AesCBC",function(){return C}),t.d(r,"AesCTR",function(){return k}),t.d(r,"AesGCM",function(){return d}),t.d(r,"AesKW",function(){return b}),t.d(r,"RsaKeyGenParamsError",function(){return G}),t.d(r,"RsaHashedImportParamsError",function(){return M}),t.d(r,"Rsa",function(){return B}),t.d(r,"RsaSSA",function(){return T}),t.d(r,"RsaPSSParamsError",function(){return D}),t.d(r,"RsaPSS",function(){return j}),t.d(r,"RsaOAEPParamsError",function(){return W}),t.d(r,"RsaOAEP",function(){return H}),t.d(r,"EcKeyGenParamsError",function(){return U}),t.d(r,"Ec",function(){return _}),t.d(r,"EcAlgorithmError",function(){return K}),t.d(r,"EcDSA",function(){return S}),t.d(r,"EcDH",function(){return O}),t.d(r,"ShaAlgorithms",function(){return E}),t.d(r,"Sha",function(){return P});var i=t(8),s=function(e){function r(r){for(var t=[],a=1;a0&&e.length<=128))throw new m(m.PARAM_WRONG_VALUE,"length","number [1-128]")},r.ALG_NAME=h.AesCTR,r}(v),d=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithmParams=function(e){if(this.checkAlgorithm(e),e.additionalData&&!(ArrayBuffer.isView(e.additionalData)||e.additionalData instanceof ArrayBuffer))throw new m(m.PARAM_WRONG_TYPE,"additionalData","ArrayBufferView or ArrayBuffer");if(!e.iv)throw new m(m.PARAM_REQUIRED,"iv");if(!(ArrayBuffer.isView(e.iv)||e.iv instanceof ArrayBuffer))throw new m(m.PARAM_WRONG_TYPE,"iv","ArrayBufferView or ArrayBuffer");if(e.tagLength){if(![32,64,96,104,112,120,128].some(function(r){return r===e.tagLength}))throw new m(m.PARAM_WRONG_VALUE,"tagLength","32, 64, 96, 104, 112, 120 or 128")}},r.ALG_NAME=h.AesGCM,r}(v),b=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithmParams=function(e){this.checkAlgorithm(e)},r.ALG_NAME=h.AesKW,r.KEY_USAGES=["wrapKey","unwrapKey"],r}(w),E=[h.Sha1,h.Sha256,h.Sha384,h.Sha512].join(" | "),P=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithm=function(r){var t;switch(t="string"==typeof r?{name:r}:r,e.checkAlgorithm.call(this,t),t.name.toUpperCase()){case h.Sha1:case h.Sha256:case h.Sha384:case h.Sha512:break;default:throw new c(c.WRONG_ALG_NAME,t.name,E)}},r.digest=function(e,r){var t=this;return new Promise(function(r,n){t.checkAlgorithm(e),r(void 0)})},r}(p),U=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.code=9,r}return Object(i.a)(r,e),r}(c),_=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithm=function(e){if(e.name.toUpperCase()!==this.ALG_NAME.toUpperCase())throw new c(c.WRONG_ALG_NAME,e.name,this.ALG_NAME)},r.checkKeyGenParams=function(e){if(!e.namedCurve)throw new U(U.PARAM_REQUIRED,"namedCurve");if("string"!=typeof e.namedCurve)throw new U(U.PARAM_WRONG_TYPE,"namedCurve","string");switch(e.namedCurve.toUpperCase()){case"P-256":case"K-256":case"P-384":case"P-521":break;default:throw new U(U.PARAM_WRONG_VALUE,"namedCurve","K-256, P-256, P-384 or P-521")}},r.checkKeyGenUsages=function(e){var r=this;e.forEach(function(e){var t=0;for(t;t0&&e.length<=512))throw new c(c.PARAM_WRONG_VALUE,"length","more 0 and less than 512")},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t=256&&r<=16384)||r%8)throw new G(G.PARAM_WRONG_VALUE,"modulusLength"," a multiple of 8 bits and >= 256 and <= 16384");var t=e.publicExponent;if(!t)throw new G(G.PARAM_REQUIRED,"publicExponent");if(!ArrayBuffer.isView(t))throw new G(G.PARAM_WRONG_TYPE,"publicExponent","ArrayBufferView");if(3!==t[0]&&(1!==t[0]||0!==t[1]||1!==t[2]))throw new G(G.PARAM_WRONG_VALUE,"publicExponent","Uint8Array([3]) | Uint8Array([1, 0, 1])");if(!e.hash)throw new G(G.PARAM_REQUIRED,"hash",E);P.checkAlgorithm(e.hash)},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t>>16&65535,n=65535&e,a=r>>>16&65535,o=65535&r;return n*o+(t*o+n*a<<16>>>0)|0})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){this.algorithm=e.algorithm,e.type&&(this.type=e.type),this.extractable=e.extractable,this.usages=e.usages}return e}();r.CryptoKey=n},function(e,r,t){"use strict";function n(){var e={name:"Unknown",version:"0"};try{var t=self.navigator.userAgent,n=void 0;(n=/edge\/([\d\.]+)/i.exec(t))?(e.name=r.Browser.Edge,e.version=n[1]):/msie/i.test(t)?(e.name=r.Browser.IE,e.version=/msie ([\d\.]+)/i.exec(t)[1]):/Trident/i.test(t)?(e.name=r.Browser.IE,e.version=/rv:([\d\.]+)/i.exec(t)[1]):/chrome/i.test(t)?(e.name=r.Browser.Chrome,e.version=/chrome\/([\d\.]+)/i.exec(t)[1]):/safari/i.test(t)?(e.name=r.Browser.Safari,e.version=/version\/([\d\.]+)/i.exec(t)[1]):/firefox/i.test(t)&&(e.name=r.Browser.Firefox,e.version=/firefox\/([\d\.]+)/i.exec(t)[1])}catch(e){}return e}function a(e){for(var r=new Uint8Array(e.length),t=0;t=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function i(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g=49?h-49+10:h>=17?h-17+10:h}return e}function m(a){for(var b=new Array(a.bitLength()),c=0;c>>e}return b}function n(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function p(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function q(a,b,c){var d=new r;return d.mulp(a,b,c)}function r(a,b){this.x=a,this.y=b}function t(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function u(){t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){t.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){t.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){t.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function z(a){y.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(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)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var g;try{g=a("buffer").Buffer}catch(a){}f.isBN=function(b){return b instanceof f||null!==b&&"object"==typeof b&&b.constructor.wordSize===f.wordSize&&Array.isArray(b.words)},f.max=function(b,c){return b.cmp(c)>0?b:c},f.min=function(b,c){return b.cmp(c)<0?b:c},f.prototype._init=function(b,c,e){if("number"==typeof b)return this._initNumber(b,c,e);if("object"==typeof b)return this._initArray(b,c,e);"hex"===c&&(c=16),d(c===(0|c)&&c>=2&&c<=36),b=b.toString().replace(/\s+/g,"");var f=0;"-"===b[0]&&f++,16===c?this._parseHex(b,f):this._parseBase(b,c,f),"-"===b[0]&&(this.negative=1),this.strip(),"le"===e&&this._initArray(this.toArray(),c,e)},f.prototype._initNumber=function(b,c,e){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[67108863&b],this.length=1):b<4503599627370496?(this.words=[67108863&b,b/67108864&67108863],this.length=2):(d(b<9007199254740992),this.words=[67108863&b,b/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),c,e)},f.prototype._initArray=function(b,c,e){if(d("number"==typeof b.length),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var f=0;f=0;f-=3)h=b[f]|b[f-1]<<8|b[f-2]<<16,this.words[g]|=h<>>26-i&67108863,i+=24,i>=26&&(i-=26,g++);else if("le"===e)for(f=0,g=0;f>>26-i&67108863,i+=24,i>=26&&(i-=26,g++);return this.strip()},f.prototype._parseHex=function(b,c){this.length=Math.ceil((b.length-c)/6),this.words=new Array(this.length);for(var d=0;d=c;d-=6)f=h(b,d,d+6),this.words[e]|=f<>>26-g&4194303,g+=24,g>=26&&(g-=26,e++);d+6!==c&&(f=h(b,c,d+6),this.words[e]|=f<>>26-g&4194303),this.strip()},f.prototype._parseBase=function(b,c,d){this.words=[0],this.length=1;for(var e=0,f=1;f<=67108863;f*=c)e++;e--,f=f/c|0;for(var g=b.length-d,h=g%e,j=Math.min(g,g-h)+d,k=0,l=d;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},f.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?""};var j=["","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"],k=[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];f.prototype.toString=function(b,c){b=b||10,c=0|c||1;var e;if(16===b||"hex"===b){e="";for(var f=0,g=0,h=0;h>>24-f&16777215,e=0!==g||h!==this.length-1?j[6-m.length]+m+e:m+e,f+=2,f>=26&&(f-=26,h--)}for(0!==g&&(e=g.toString(16)+e);e.length%c!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(b===(0|b)&&b>=2&&b<=36){var n=k[b],o=l[b];e="";var p=this.clone();for(p.negative=0;!p.isZero();){var q=p.modn(o).toString(b);p=p.idivn(o),e=p.isZero()?q+e:j[n-q.length]+q+e}for(this.isZero()&&(e="0"+e);e.length%c!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}d(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var b=this.words[0];return 2===this.length?b+=67108864*this.words[1]:3===this.length&&1===this.words[2]?b+=4503599627370496+67108864*this.words[1]:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-b:b},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(b,c){return d("undefined"!=typeof g),this.toArrayLike(g,b,c)},f.prototype.toArray=function(b,c){return this.toArrayLike(Array,b,c)},f.prototype.toArrayLike=function(b,c,e){var f=this.byteLength(),g=e||Math.max(1,f);d(f<=g,"byte array longer than desired length"),d(g>0,"Requested array length <= 0"),this.strip();var j,k,h="le"===c,i=new b(g),l=this.clone();if(h){for(k=0;!l.isZero();k++)j=l.andln(255),l.iushrn(8),i[k]=j;for(;k=4096&&(d+=13,c>>>=13),c>=64&&(d+=7,c>>>=7),c>=8&&(d+=4,c>>>=4),c>=2&&(d+=2,c>>>=2),d+c},f.prototype._zeroBits=function(b){if(0===b)return 26;var c=b,d=0;return 0===(8191&c)&&(d+=13,c>>>=13),0===(127&c)&&(d+=7,c>>>=7),0===(15&c)&&(d+=4,c>>>=4),0===(3&c)&&(d+=2,c>>>=2),0===(1&c)&&d++,d},f.prototype.bitLength=function(){var b=this.words[this.length-1],c=this._countBits(b);return 26*(this.length-1)+c},f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,c=0;cb.length?this.clone().ior(b):b.clone().ior(this)},f.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},f.prototype.iuand=function(b){var c;c=this.length>b.length?b:this;for(var d=0;db.length?this.clone().iand(b):b.clone().iand(this)},f.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},f.prototype.iuxor=function(b){var c,d;this.length>b.length?(c=this,d=b):(c=b,d=this);for(var e=0;eb.length?this.clone().ixor(b):b.clone().ixor(this)},f.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},f.prototype.inotn=function(b){d("number"==typeof b&&b>=0);var c=0|Math.ceil(b/26),e=b%26;this._expand(c),e>0&&c--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-e),this.strip()},f.prototype.notn=function(b){return this.clone().inotn(b)},f.prototype.setn=function(b,c){d("number"==typeof b&&b>=0);var e=b/26|0,f=b%26;return this._expand(e+1),c?this.words[e]=this.words[e]|1<b.length?(d=this,e=b):(d=b,e=this);for(var f=0,g=0;g>>26;for(;0!==f&&g>>26;if(this.length=d.length,0!==f)this.words[this.length]=f,this.length++;else if(d!==this)for(;gb.length?this.clone().iadd(b):b.clone().iadd(this)},f.prototype.isub=function(b){if(0!==b.negative){b.negative=0;var c=this.iadd(b);return b.negative=1,c._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var d=this.cmp(b);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;var e,f;d>0?(e=this,f=b):(e=b,f=this);for(var g=0,h=0;h>26,this.words[h]=67108863&c;for(;0!==g&&h>26,this.words[h]=67108863&c;if(0===g&&h>>13,o=0|e[1],p=8191&o,q=o>>>13,r=0|e[2],s=8191&r,t=r>>>13,u=0|e[3],v=8191&u,w=u>>>13,x=0|e[4],y=8191&x,z=x>>>13,A=0|e[5],B=8191&A,C=A>>>13,D=0|e[6],E=8191&D,F=D>>>13,G=0|e[7],H=8191&G,I=G>>>13,J=0|e[8],K=8191&J,L=J>>>13,M=0|e[9],N=8191&M,O=M>>>13,P=0|f[0],Q=8191&P,R=P>>>13,S=0|f[1],T=8191&S,U=S>>>13,V=0|f[2],W=8191&V,X=V>>>13,Y=0|f[3],Z=8191&Y,$=Y>>>13,_=0|f[4],aa=8191&_,ba=_>>>13,ca=0|f[5],da=8191&ca,ea=ca>>>13,fa=0|f[6],ga=8191&fa,ha=fa>>>13,ia=0|f[7],ja=8191&ia,ka=ia>>>13,la=0|f[8],ma=8191&la,na=la>>>13,oa=0|f[9],pa=8191&oa,qa=oa>>>13;d.negative=b.negative^c.negative,d.length=19,i=Math.imul(m,Q),j=Math.imul(m,R),j=j+Math.imul(n,Q)|0,k=Math.imul(n,R);var ra=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(ra>>>26)|0,ra&=67108863,i=Math.imul(p,Q),j=Math.imul(p,R),j=j+Math.imul(q,Q)|0,k=Math.imul(q,R),i=i+Math.imul(m,T)|0,j=j+Math.imul(m,U)|0,j=j+Math.imul(n,T)|0,k=k+Math.imul(n,U)|0;var sa=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(sa>>>26)|0,sa&=67108863,i=Math.imul(s,Q),j=Math.imul(s,R),j=j+Math.imul(t,Q)|0,k=Math.imul(t,R),i=i+Math.imul(p,T)|0,j=j+Math.imul(p,U)|0,j=j+Math.imul(q,T)|0,k=k+Math.imul(q,U)|0,i=i+Math.imul(m,W)|0,j=j+Math.imul(m,X)|0,j=j+Math.imul(n,W)|0,k=k+Math.imul(n,X)|0;var ta=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(ta>>>26)|0,ta&=67108863,i=Math.imul(v,Q),j=Math.imul(v,R),j=j+Math.imul(w,Q)|0,k=Math.imul(w,R),i=i+Math.imul(s,T)|0,j=j+Math.imul(s,U)|0,j=j+Math.imul(t,T)|0,k=k+Math.imul(t,U)|0,i=i+Math.imul(p,W)|0,j=j+Math.imul(p,X)|0,j=j+Math.imul(q,W)|0,k=k+Math.imul(q,X)|0,i=i+Math.imul(m,Z)|0,j=j+Math.imul(m,$)|0,j=j+Math.imul(n,Z)|0,k=k+Math.imul(n,$)|0;var ua=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(ua>>>26)|0,ua&=67108863,i=Math.imul(y,Q),j=Math.imul(y,R),j=j+Math.imul(z,Q)|0,k=Math.imul(z,R),i=i+Math.imul(v,T)|0,j=j+Math.imul(v,U)|0,j=j+Math.imul(w,T)|0,k=k+Math.imul(w,U)|0,i=i+Math.imul(s,W)|0,j=j+Math.imul(s,X)|0,j=j+Math.imul(t,W)|0,k=k+Math.imul(t,X)|0,i=i+Math.imul(p,Z)|0,j=j+Math.imul(p,$)|0,j=j+Math.imul(q,Z)|0,k=k+Math.imul(q,$)|0,i=i+Math.imul(m,aa)|0,j=j+Math.imul(m,ba)|0,j=j+Math.imul(n,aa)|0,k=k+Math.imul(n,ba)|0;var va=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(va>>>26)|0,va&=67108863,i=Math.imul(B,Q),j=Math.imul(B,R),j=j+Math.imul(C,Q)|0,k=Math.imul(C,R),i=i+Math.imul(y,T)|0,j=j+Math.imul(y,U)|0,j=j+Math.imul(z,T)|0,k=k+Math.imul(z,U)|0,i=i+Math.imul(v,W)|0,j=j+Math.imul(v,X)|0,j=j+Math.imul(w,W)|0,k=k+Math.imul(w,X)|0,i=i+Math.imul(s,Z)|0,j=j+Math.imul(s,$)|0,j=j+Math.imul(t,Z)|0,k=k+Math.imul(t,$)|0,i=i+Math.imul(p,aa)|0,j=j+Math.imul(p,ba)|0,j=j+Math.imul(q,aa)|0,k=k+Math.imul(q,ba)|0,i=i+Math.imul(m,da)|0,j=j+Math.imul(m,ea)|0,j=j+Math.imul(n,da)|0,k=k+Math.imul(n,ea)|0;var wa=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(wa>>>26)|0,wa&=67108863,i=Math.imul(E,Q),j=Math.imul(E,R),j=j+Math.imul(F,Q)|0,k=Math.imul(F,R),i=i+Math.imul(B,T)|0,j=j+Math.imul(B,U)|0,j=j+Math.imul(C,T)|0,k=k+Math.imul(C,U)|0,i=i+Math.imul(y,W)|0,j=j+Math.imul(y,X)|0,j=j+Math.imul(z,W)|0,k=k+Math.imul(z,X)|0,i=i+Math.imul(v,Z)|0,j=j+Math.imul(v,$)|0,j=j+Math.imul(w,Z)|0,k=k+Math.imul(w,$)|0,i=i+Math.imul(s,aa)|0,j=j+Math.imul(s,ba)|0,j=j+Math.imul(t,aa)|0,k=k+Math.imul(t,ba)|0,i=i+Math.imul(p,da)|0,j=j+Math.imul(p,ea)|0,j=j+Math.imul(q,da)|0,k=k+Math.imul(q,ea)|0,i=i+Math.imul(m,ga)|0,j=j+Math.imul(m,ha)|0,j=j+Math.imul(n,ga)|0,k=k+Math.imul(n,ha)|0;var xa=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(xa>>>26)|0,xa&=67108863,i=Math.imul(H,Q),j=Math.imul(H,R),j=j+Math.imul(I,Q)|0,k=Math.imul(I,R),i=i+Math.imul(E,T)|0,j=j+Math.imul(E,U)|0,j=j+Math.imul(F,T)|0,k=k+Math.imul(F,U)|0,i=i+Math.imul(B,W)|0,j=j+Math.imul(B,X)|0,j=j+Math.imul(C,W)|0,k=k+Math.imul(C,X)|0,i=i+Math.imul(y,Z)|0,j=j+Math.imul(y,$)|0,j=j+Math.imul(z,Z)|0,k=k+Math.imul(z,$)|0,i=i+Math.imul(v,aa)|0,j=j+Math.imul(v,ba)|0,j=j+Math.imul(w,aa)|0,k=k+Math.imul(w,ba)|0,i=i+Math.imul(s,da)|0,j=j+Math.imul(s,ea)|0,j=j+Math.imul(t,da)|0,k=k+Math.imul(t,ea)|0,i=i+Math.imul(p,ga)|0,j=j+Math.imul(p,ha)|0,j=j+Math.imul(q,ga)|0,k=k+Math.imul(q,ha)|0,i=i+Math.imul(m,ja)|0,j=j+Math.imul(m,ka)|0,j=j+Math.imul(n,ja)|0,k=k+Math.imul(n,ka)|0;var ya=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(ya>>>26)|0,ya&=67108863,i=Math.imul(K,Q),j=Math.imul(K,R),j=j+Math.imul(L,Q)|0,k=Math.imul(L,R),i=i+Math.imul(H,T)|0,j=j+Math.imul(H,U)|0,j=j+Math.imul(I,T)|0,k=k+Math.imul(I,U)|0,i=i+Math.imul(E,W)|0,j=j+Math.imul(E,X)|0,j=j+Math.imul(F,W)|0,k=k+Math.imul(F,X)|0,i=i+Math.imul(B,Z)|0,j=j+Math.imul(B,$)|0,j=j+Math.imul(C,Z)|0,k=k+Math.imul(C,$)|0,i=i+Math.imul(y,aa)|0,j=j+Math.imul(y,ba)|0,j=j+Math.imul(z,aa)|0,k=k+Math.imul(z,ba)|0,i=i+Math.imul(v,da)|0,j=j+Math.imul(v,ea)|0,j=j+Math.imul(w,da)|0,k=k+Math.imul(w,ea)|0,i=i+Math.imul(s,ga)|0,j=j+Math.imul(s,ha)|0,j=j+Math.imul(t,ga)|0,k=k+Math.imul(t,ha)|0,i=i+Math.imul(p,ja)|0,j=j+Math.imul(p,ka)|0,j=j+Math.imul(q,ja)|0,k=k+Math.imul(q,ka)|0,i=i+Math.imul(m,ma)|0,j=j+Math.imul(m,na)|0,j=j+Math.imul(n,ma)|0,k=k+Math.imul(n,na)|0;var za=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(za>>>26)|0,za&=67108863,i=Math.imul(N,Q),j=Math.imul(N,R),j=j+Math.imul(O,Q)|0,k=Math.imul(O,R),i=i+Math.imul(K,T)|0,j=j+Math.imul(K,U)|0,j=j+Math.imul(L,T)|0,k=k+Math.imul(L,U)|0,i=i+Math.imul(H,W)|0,j=j+Math.imul(H,X)|0,j=j+Math.imul(I,W)|0,k=k+Math.imul(I,X)|0,i=i+Math.imul(E,Z)|0,j=j+Math.imul(E,$)|0,j=j+Math.imul(F,Z)|0,k=k+Math.imul(F,$)|0,i=i+Math.imul(B,aa)|0,j=j+Math.imul(B,ba)|0,j=j+Math.imul(C,aa)|0,k=k+Math.imul(C,ba)|0,i=i+Math.imul(y,da)|0,j=j+Math.imul(y,ea)|0,j=j+Math.imul(z,da)|0,k=k+Math.imul(z,ea)|0,i=i+Math.imul(v,ga)|0,j=j+Math.imul(v,ha)|0,j=j+Math.imul(w,ga)|0,k=k+Math.imul(w,ha)|0,i=i+Math.imul(s,ja)|0,j=j+Math.imul(s,ka)|0,j=j+Math.imul(t,ja)|0,k=k+Math.imul(t,ka)|0,i=i+Math.imul(p,ma)|0,j=j+Math.imul(p,na)|0,j=j+Math.imul(q,ma)|0,k=k+Math.imul(q,na)|0,i=i+Math.imul(m,pa)|0,j=j+Math.imul(m,qa)|0,j=j+Math.imul(n,pa)|0,k=k+Math.imul(n,qa)|0;var Aa=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Aa>>>26)|0,Aa&=67108863,i=Math.imul(N,T),j=Math.imul(N,U),j=j+Math.imul(O,T)|0,k=Math.imul(O,U),i=i+Math.imul(K,W)|0,j=j+Math.imul(K,X)|0,j=j+Math.imul(L,W)|0,k=k+Math.imul(L,X)|0,i=i+Math.imul(H,Z)|0,j=j+Math.imul(H,$)|0,j=j+Math.imul(I,Z)|0,k=k+Math.imul(I,$)|0,i=i+Math.imul(E,aa)|0,j=j+Math.imul(E,ba)|0,j=j+Math.imul(F,aa)|0,k=k+Math.imul(F,ba)|0,i=i+Math.imul(B,da)|0,j=j+Math.imul(B,ea)|0,j=j+Math.imul(C,da)|0,k=k+Math.imul(C,ea)|0,i=i+Math.imul(y,ga)|0,j=j+Math.imul(y,ha)|0,j=j+Math.imul(z,ga)|0,k=k+Math.imul(z,ha)|0,i=i+Math.imul(v,ja)|0,j=j+Math.imul(v,ka)|0,j=j+Math.imul(w,ja)|0,k=k+Math.imul(w,ka)|0,i=i+Math.imul(s,ma)|0,j=j+Math.imul(s,na)|0,j=j+Math.imul(t,ma)|0,k=k+Math.imul(t,na)|0,i=i+Math.imul(p,pa)|0,j=j+Math.imul(p,qa)|0,j=j+Math.imul(q,pa)|0,k=k+Math.imul(q,qa)|0;var Ba=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ba>>>26)|0,Ba&=67108863,i=Math.imul(N,W),j=Math.imul(N,X),j=j+Math.imul(O,W)|0,k=Math.imul(O,X),i=i+Math.imul(K,Z)|0,j=j+Math.imul(K,$)|0,j=j+Math.imul(L,Z)|0,k=k+Math.imul(L,$)|0,i=i+Math.imul(H,aa)|0,j=j+Math.imul(H,ba)|0,j=j+Math.imul(I,aa)|0,k=k+Math.imul(I,ba)|0,i=i+Math.imul(E,da)|0,j=j+Math.imul(E,ea)|0,j=j+Math.imul(F,da)|0,k=k+Math.imul(F,ea)|0,i=i+Math.imul(B,ga)|0,j=j+Math.imul(B,ha)|0,j=j+Math.imul(C,ga)|0,k=k+Math.imul(C,ha)|0,i=i+Math.imul(y,ja)|0,j=j+Math.imul(y,ka)|0,j=j+Math.imul(z,ja)|0,k=k+Math.imul(z,ka)|0,i=i+Math.imul(v,ma)|0,j=j+Math.imul(v,na)|0,j=j+Math.imul(w,ma)|0,k=k+Math.imul(w,na)|0,i=i+Math.imul(s,pa)|0,j=j+Math.imul(s,qa)|0,j=j+Math.imul(t,pa)|0,k=k+Math.imul(t,qa)|0;var Ca=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,i=Math.imul(N,Z),j=Math.imul(N,$),j=j+Math.imul(O,Z)|0,k=Math.imul(O,$),i=i+Math.imul(K,aa)|0,j=j+Math.imul(K,ba)|0,j=j+Math.imul(L,aa)|0,k=k+Math.imul(L,ba)|0,i=i+Math.imul(H,da)|0,j=j+Math.imul(H,ea)|0,j=j+Math.imul(I,da)|0,k=k+Math.imul(I,ea)|0,i=i+Math.imul(E,ga)|0,j=j+Math.imul(E,ha)|0,j=j+Math.imul(F,ga)|0,k=k+Math.imul(F,ha)|0,i=i+Math.imul(B,ja)|0,j=j+Math.imul(B,ka)|0,j=j+Math.imul(C,ja)|0,k=k+Math.imul(C,ka)|0,i=i+Math.imul(y,ma)|0,j=j+Math.imul(y,na)|0,j=j+Math.imul(z,ma)|0,k=k+Math.imul(z,na)|0,i=i+Math.imul(v,pa)|0,j=j+Math.imul(v,qa)|0,j=j+Math.imul(w,pa)|0,k=k+Math.imul(w,qa)|0;var Da=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Da>>>26)|0,Da&=67108863,i=Math.imul(N,aa),j=Math.imul(N,ba),j=j+Math.imul(O,aa)|0,k=Math.imul(O,ba),i=i+Math.imul(K,da)|0,j=j+Math.imul(K,ea)|0,j=j+Math.imul(L,da)|0,k=k+Math.imul(L,ea)|0,i=i+Math.imul(H,ga)|0,j=j+Math.imul(H,ha)|0,j=j+Math.imul(I,ga)|0,k=k+Math.imul(I,ha)|0,i=i+Math.imul(E,ja)|0,j=j+Math.imul(E,ka)|0,j=j+Math.imul(F,ja)|0,k=k+Math.imul(F,ka)|0,i=i+Math.imul(B,ma)|0,j=j+Math.imul(B,na)|0,j=j+Math.imul(C,ma)|0,k=k+Math.imul(C,na)|0,i=i+Math.imul(y,pa)|0,j=j+Math.imul(y,qa)|0,j=j+Math.imul(z,pa)|0,k=k+Math.imul(z,qa)|0;var Ea=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ea>>>26)|0,Ea&=67108863,i=Math.imul(N,da),j=Math.imul(N,ea),j=j+Math.imul(O,da)|0,k=Math.imul(O,ea),i=i+Math.imul(K,ga)|0,j=j+Math.imul(K,ha)|0,j=j+Math.imul(L,ga)|0,k=k+Math.imul(L,ha)|0,i=i+Math.imul(H,ja)|0,j=j+Math.imul(H,ka)|0,j=j+Math.imul(I,ja)|0,k=k+Math.imul(I,ka)|0,i=i+Math.imul(E,ma)|0,j=j+Math.imul(E,na)|0,j=j+Math.imul(F,ma)|0,k=k+Math.imul(F,na)|0,i=i+Math.imul(B,pa)|0,j=j+Math.imul(B,qa)|0,j=j+Math.imul(C,pa)|0,k=k+Math.imul(C,qa)|0;var Fa=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,i=Math.imul(N,ga),j=Math.imul(N,ha),j=j+Math.imul(O,ga)|0,k=Math.imul(O,ha),i=i+Math.imul(K,ja)|0,j=j+Math.imul(K,ka)|0,j=j+Math.imul(L,ja)|0,k=k+Math.imul(L,ka)|0,i=i+Math.imul(H,ma)|0,j=j+Math.imul(H,na)|0,j=j+Math.imul(I,ma)|0,k=k+Math.imul(I,na)|0,i=i+Math.imul(E,pa)|0,j=j+Math.imul(E,qa)|0,j=j+Math.imul(F,pa)|0,k=k+Math.imul(F,qa)|0;var Ga=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,i=Math.imul(N,ja),j=Math.imul(N,ka),j=j+Math.imul(O,ja)|0,k=Math.imul(O,ka),i=i+Math.imul(K,ma)|0,j=j+Math.imul(K,na)|0,j=j+Math.imul(L,ma)|0,k=k+Math.imul(L,na)|0,i=i+Math.imul(H,pa)|0,j=j+Math.imul(H,qa)|0,j=j+Math.imul(I,pa)|0,k=k+Math.imul(I,qa)|0;var Ha=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,i=Math.imul(N,ma),j=Math.imul(N,na),j=j+Math.imul(O,ma)|0,k=Math.imul(O,na),i=i+Math.imul(K,pa)|0,j=j+Math.imul(K,qa)|0,j=j+Math.imul(L,pa)|0,k=k+Math.imul(L,qa)|0;var Ia=(h+i|0)+((8191&j)<<13)|0;h=(k+(j>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i=Math.imul(N,pa),j=Math.imul(N,qa),j=j+Math.imul(O,pa)|0,k=Math.imul(O,qa);var Ja=(h+i|0)+((8191&j)<<13)|0;return h=(k+(j>>>13)|0)+(Ja>>>26)|0,Ja&=67108863,g[0]=ra,g[1]=sa,g[2]=ta,g[3]=ua,g[4]=va,g[5]=wa,g[6]=xa,g[7]=ya,g[8]=za,g[9]=Aa,g[10]=Ba,g[11]=Ca,g[12]=Da,g[13]=Ea,g[14]=Fa,g[15]=Ga,g[16]=Ha,g[17]=Ia,g[18]=Ja,0!==h&&(g[19]=h,d.length++),d};Math.imul||(o=n),f.prototype.mulTo=function(b,c){var d,e=this.length+b.length;return d=10===this.length&&10===b.length?o(this,b,c):e<63?n(this,b,c):e<1024?p(this,b,c):q(this,b,c)},r.prototype.makeRBT=function(b){for(var c=new Array(b),d=f.prototype._countBits(b)-1,e=0;e>=1;return e},r.prototype.permute=function(b,c,d,e,f,g){for(var h=0;h>>=1)f++;return 1<>>=13,e[2*h+1]=8191&g,g>>>=13;for(h=2*c;h>=26,c+=f/67108864|0,c+=g>>>26,this.words[e]=67108863&g}return 0!==c&&(this.words[e]=c,this.length++),this},f.prototype.muln=function(b){return this.clone().imuln(b)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(b){var c=m(b);if(0===c.length)return new f(1);for(var d=this,e=0;e=0);var g,c=b%26,e=(b-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var h=0;for(g=0;g>>26-c}h&&(this.words[g]=h,this.length++)}if(0!==e){for(g=this.length-1;g>=0;g--)this.words[g+e]=this.words[g];for(g=0;g=0);var f;f=c?(c-c%26)/26:0;var g=b%26,h=Math.min((b-g)/26,this.length),i=67108863^67108863>>>g<h)for(this.length-=h,k=0;k=0&&(0!==l||k>=f);k--){var m=0|this.words[k];this.words[k]=l<<26-g|m>>>g,l=m&i}return j&&0!==l&&(j.words[j.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(b,c,e){return d(0===this.negative),this.iushrn(b,c,e)},f.prototype.shln=function(b){return this.clone().ishln(b)},f.prototype.ushln=function(b){return this.clone().iushln(b)},f.prototype.shrn=function(b){return this.clone().ishrn(b)},f.prototype.ushrn=function(b){return this.clone().iushrn(b)},f.prototype.testn=function(b){d("number"==typeof b&&b>=0);var c=b%26,e=(b-c)/26,f=1<=0);var c=b%26,e=(b-c)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==c&&e++,this.length=Math.min(e,this.length),0!==c){var f=67108863^67108863>>>c<=67108864;c++)this.words[c]-=67108864,c===this.length-1?this.words[c+1]=1:this.words[c+1]++;return this.length=Math.max(this.length,c+1),this},f.prototype.isubn=function(b){if(d("number"==typeof b),d(b<67108864),b<0)return this.iaddn(-b);if(0!==this.negative)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var c=0;c>26)-(j/67108864|0),this.words[g+e]=67108863&h}for(;g>26,this.words[g+e]=67108863&h;if(0===i)return this.strip();for(d(i===-1),i=0,g=0;g>26,this.words[g]=67108863&h;return this.negative=1,this.strip()},f.prototype._wordDiv=function(b,c){var d=this.length-b.length,e=this.clone(),g=b,h=0|g.words[g.length-1],i=this._countBits(h);d=26-i,0!==d&&(g=g.ushln(d),e.iushln(d),h=0|g.words[g.length-1]);var k,j=e.length-g.length;if("mod"!==c){k=new f(null),k.length=j+1,k.words=new Array(k.length);for(var l=0;l=0;n--){var o=67108864*(0|e.words[g.length+n])+(0|e.words[g.length+n-1]);for(o=Math.min(o/h|0,67108863),e._ishlnsubmul(g,o,n);0!==e.negative;)o--,e.negative=0,e._ishlnsubmul(g,1,n),e.isZero()||(e.negative^=1);k&&(k.words[n]=o)}return k&&k.strip(),e.strip(),"div"!==c&&0!==d&&e.iushrn(d),{div:k||null,mod:e}},f.prototype.divmod=function(b,c,e){if(d(!b.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var g,h,i;return 0!==this.negative&&0===b.negative?(i=this.neg().divmod(b,c),"mod"!==c&&(g=i.div.neg()),"div"!==c&&(h=i.mod.neg(),e&&0!==h.negative&&h.iadd(b)),{div:g,mod:h}):0===this.negative&&0!==b.negative?(i=this.divmod(b.neg(),c),"mod"!==c&&(g=i.div.neg()), +{div:g,mod:i.mod}):0!==(this.negative&b.negative)?(i=this.neg().divmod(b.neg(),c),"div"!==c&&(h=i.mod.neg(),e&&0!==h.negative&&h.isub(b)),{div:i.div,mod:h}):b.length>this.length||this.cmp(b)<0?{div:new f(0),mod:this}:1===b.length?"div"===c?{div:this.divn(b.words[0]),mod:null}:"mod"===c?{div:null,mod:new f(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new f(this.modn(b.words[0]))}:this._wordDiv(b,c)},f.prototype.div=function(b){return this.divmod(b,"div",!1).div},f.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},f.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},f.prototype.divRound=function(b){var c=this.divmod(b);if(c.mod.isZero())return c.div;var d=0!==c.div.negative?c.mod.isub(b):c.mod,e=b.ushrn(1),f=b.andln(1),g=d.cmp(e);return g<0||1===f&&0===g?c.div:0!==c.div.negative?c.div.isubn(1):c.div.iaddn(1)},f.prototype.modn=function(b){d(b<=67108863);for(var c=(1<<26)%b,e=0,f=this.length-1;f>=0;f--)e=(c*e+(0|this.words[f]))%b;return e},f.prototype.idivn=function(b){d(b<=67108863);for(var c=0,e=this.length-1;e>=0;e--){var f=(0|this.words[e])+67108864*c;this.words[e]=f/b|0,c=f%b}return this.strip()},f.prototype.divn=function(b){return this.clone().idivn(b)},f.prototype.egcd=function(b){d(0===b.negative),d(!b.isZero());var c=this,e=b.clone();c=0!==c.negative?c.umod(b):c.clone();for(var g=new f(1),h=new f(0),i=new f(0),j=new f(1),k=0;c.isEven()&&e.isEven();)c.iushrn(1),e.iushrn(1),++k;for(var l=e.clone(),m=c.clone();!c.isZero();){for(var n=0,o=1;0===(c.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(c.iushrn(n);n-- >0;)(g.isOdd()||h.isOdd())&&(g.iadd(l),h.isub(m)),g.iushrn(1),h.iushrn(1);for(var p=0,q=1;0===(e.words[0]&q)&&p<26;++p,q<<=1);if(p>0)for(e.iushrn(p);p-- >0;)(i.isOdd()||j.isOdd())&&(i.iadd(l),j.isub(m)),i.iushrn(1),j.iushrn(1);c.cmp(e)>=0?(c.isub(e),g.isub(i),h.isub(j)):(e.isub(c),i.isub(g),j.isub(h))}return{a:i,b:j,gcd:e.iushln(k)}},f.prototype._invmp=function(b){d(0===b.negative),d(!b.isZero());var c=this,e=b.clone();c=0!==c.negative?c.umod(b):c.clone();for(var g=new f(1),h=new f(0),i=e.clone();c.cmpn(1)>0&&e.cmpn(1)>0;){for(var j=0,k=1;0===(c.words[0]&k)&&j<26;++j,k<<=1);if(j>0)for(c.iushrn(j);j-- >0;)g.isOdd()&&g.iadd(i),g.iushrn(1);for(var l=0,m=1;0===(e.words[0]&m)&&l<26;++l,m<<=1);if(l>0)for(e.iushrn(l);l-- >0;)h.isOdd()&&h.iadd(i),h.iushrn(1);c.cmp(e)>=0?(c.isub(e),g.isub(h)):(e.isub(c),h.isub(g))}var n;return n=0===c.cmpn(1)?g:h,n.cmpn(0)<0&&n.iadd(b),n},f.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var c=this.clone(),d=b.clone();c.negative=0,d.negative=0;for(var e=0;c.isEven()&&d.isEven();e++)c.iushrn(1),d.iushrn(1);for(;;){for(;c.isEven();)c.iushrn(1);for(;d.isEven();)d.iushrn(1);var f=c.cmp(d);if(f<0){var g=c;c=d,d=g}else if(0===f||0===d.cmpn(1))break;c.isub(d)}return d.iushln(e)},f.prototype.invm=function(b){return this.egcd(b).a.umod(b)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(b){return this.words[0]&b},f.prototype.bincn=function(b){d("number"==typeof b);var c=b%26,e=(b-c)/26,f=1<>>26,i&=67108863,this.words[h]=i}return 0!==g&&(this.words[h]=g,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(b){var c=b<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;this.strip();var e;if(this.length>1)e=1;else{c&&(b=-b),d(b<=67108863,"Number is too big");var f=0|this.words[0];e=f===b?0:fb.length)return 1;if(this.length=0;d--){var e=0|this.words[d],f=0|b.words[d];if(e!==f){ef&&(c=1);break}}return c},f.prototype.gtn=function(b){return 1===this.cmpn(b)},f.prototype.gt=function(b){return 1===this.cmp(b)},f.prototype.gten=function(b){return this.cmpn(b)>=0},f.prototype.gte=function(b){return this.cmp(b)>=0},f.prototype.ltn=function(b){return this.cmpn(b)===-1},f.prototype.lt=function(b){return this.cmp(b)===-1},f.prototype.lten=function(b){return this.cmpn(b)<=0},f.prototype.lte=function(b){return this.cmp(b)<=0},f.prototype.eqn=function(b){return 0===this.cmpn(b)},f.prototype.eq=function(b){return 0===this.cmp(b)},f.red=function(b){return new y(b)},f.prototype.toRed=function(b){return d(!this.red,"Already a number in reduction context"),d(0===this.negative,"red works only with positives"),b.convertTo(this)._forceRed(b)},f.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(b){return this.red=b,this},f.prototype.forceRed=function(b){return d(!this.red,"Already a number in reduction context"),this._forceRed(b)},f.prototype.redAdd=function(b){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},f.prototype.redIAdd=function(b){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},f.prototype.redSub=function(b){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},f.prototype.redISub=function(b){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},f.prototype.redShl=function(b){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},f.prototype.redMul=function(b){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},f.prototype.redIMul=function(b){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},f.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(b){return d(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var s={k256:null,p224:null,p192:null,p25519:null};t.prototype._tmp=function(){var b=new f(null);return b.words=new Array(Math.ceil(this.n/13)),b},t.prototype.ireduce=function(b){var d,c=b;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),d=c.bitLength();while(d>this.n);var e=d0?c.isub(this.p):c.strip(),c},t.prototype.split=function(b,c){b.iushrn(this.n,0,c)},t.prototype.imulK=function(b){return b.imul(this.k)},e(u,t),u.prototype.split=function(b,c){for(var d=4194303,e=Math.min(b.length,9),f=0;f>>22,g=h}g>>>=22,b.words[f-10]=g,0===g&&b.length>10?b.length-=10:b.length-=9},u.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var c=0,d=0;d>>=26,b.words[d]=f,c=e}return 0!==c&&(b.words[b.length++]=c),b},f._prime=function a(b){if(s[b])return s[b];var a;if("k256"===b)a=new u;else if("p224"===b)a=new v;else if("p192"===b)a=new w;else{if("p25519"!==b)throw new Error("Unknown prime "+b);a=new x}return s[b]=a,a},y.prototype._verify1=function(b){d(0===b.negative,"red works only with positives"),d(b.red,"red works only with red numbers")},y.prototype._verify2=function(b,c){d(0===(b.negative|c.negative),"red works only with positives"),d(b.red&&b.red===c.red,"red works only with red numbers")},y.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},y.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},y.prototype.add=function(b,c){this._verify2(b,c);var d=b.add(c);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},y.prototype.iadd=function(b,c){this._verify2(b,c);var d=b.iadd(c);return d.cmp(this.m)>=0&&d.isub(this.m),d},y.prototype.sub=function(b,c){this._verify2(b,c);var d=b.sub(c);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},y.prototype.isub=function(b,c){this._verify2(b,c);var d=b.isub(c);return d.cmpn(0)<0&&d.iadd(this.m),d},y.prototype.shl=function(b,c){return this._verify1(b),this.imod(b.ushln(c))},y.prototype.imul=function(b,c){return this._verify2(b,c),this.imod(b.imul(c))},y.prototype.mul=function(b,c){return this._verify2(b,c),this.imod(b.mul(c))},y.prototype.isqr=function(b){return this.imul(b,b.clone())},y.prototype.sqr=function(b){return this.mul(b,b)},y.prototype.sqrt=function(b){if(b.isZero())return b.clone();var c=this.m.andln(3);if(d(c%2===1),3===c){var e=this.m.add(new f(1)).iushrn(2);return this.pow(b,e)}for(var g=this.m.subn(1),h=0;!g.isZero()&&0===g.andln(1);)h++,g.iushrn(1);d(!g.isZero());var i=new f(1).toRed(this),j=i.redNeg(),k=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new f(2*l*l).toRed(this);0!==this.pow(l,k).cmp(j);)l.redIAdd(j);for(var m=this.pow(l,g),n=this.pow(b,g.addn(1).iushrn(1)),o=this.pow(b,g),p=h;0!==o.cmp(i);){for(var q=o,r=0;0!==q.cmp(i);r++)q=q.redSqr();d(r=0;g--){for(var l=c.words[g],m=k-1;m>=0;m--){var n=l>>m&1;h!==e[0]&&(h=this.sqr(h)),0!==n||0!==i?(i<<=1,i|=n,j++,(j===d||0===g&&0===m)&&(h=this.mul(h,e[i]),j=0,i=0)):j=0}k=26}return h},y.prototype.convertTo=function(b){var c=b.umod(this.m);return c===b?c.clone():c},y.prototype.convertFrom=function(b){var c=b.clone();return c.red=null,c},f.mont=function(b){return new z(b)},e(z,y),z.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},z.prototype.convertFrom=function(b){var c=this.imod(b.mul(this.rinv));return c.red=null,c},z.prototype.imul=function(b,c){if(b.isZero()||c.isZero())return b.words[0]=0,b.length=1,b;var d=b.imul(c),e=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=d.isub(e).iushrn(this.shift),g=f;return f.cmp(this.m)>=0?g=f.isub(this.m):f.cmpn(0)<0&&(g=f.iadd(this.m)),g._forceRed(this)},z.prototype.mul=function(b,c){if(b.isZero()||c.isZero())return new f(0)._forceRed(this);var d=b.mul(c),e=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=d.isub(e).iushrn(this.shift),h=g;return g.cmp(this.m)>=0?h=g.isub(this.m):g.cmpn(0)<0&&(h=g.iadd(this.m)),h._forceRed(this)},z.prototype.invm=function(b){var c=this.imod(b._invmp(this.m).mul(this.r2));return c._forceRed(this)}}("undefined"==typeof b||b,this)},{}],2:[function(a,b,c){"use strict";var d=c;d.version=a("../package.json").version,d.utils=a("./elliptic/utils"),d.rand=a("brorand"),d.hmacDRBG=a("./elliptic/hmac-drbg"),d.curve=a("./elliptic/curve"),d.curves=a("./elliptic/curves"),d.ec=a("./elliptic/ec"),d.eddsa=a("./elliptic/eddsa")},{"../package.json":26,"./elliptic/curve":5,"./elliptic/curves":8,"./elliptic/ec":9,"./elliptic/eddsa":12,"./elliptic/hmac-drbg":15,"./elliptic/utils":17,brorand:18}],3:[function(a,b,c){"use strict";function j(a,b){this.type=a,this.p=new d(b.p,16),this.red=b.prime?d.red(b.prime):d.mont(this.p),this.zero=new d(0).toRed(this.red),this.one=new d(1).toRed(this.red),this.two=new d(2).toRed(this.red),this.n=b.n&&new d(b.n,16),this.g=b.g&&this.pointFromJSON(b.g,b.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function k(a,b){this.curve=a,this.type=b,this.precomputed=null}var d=a("bn.js"),e=a("../../elliptic"),f=e.utils,g=f.getNAF,h=f.getJSF,i=f.assert;b.exports=j,j.prototype.point=function(){throw new Error("Not implemented")},j.prototype.validate=function(){throw new Error("Not implemented")},j.prototype._fixedNafMul=function(b,c){i(b.precomputed);var d=b._getDoubles(),e=g(c,1),f=(1<=j;c--)k=(k<<1)+e[c];h.push(k)}for(var l=this.jpoint(null,null,null),m=this.jpoint(null,null,null),n=f;n>0;n--){for(var j=0;j=0;k--){for(var c=0;k>=0&&0===h[k];k--)c++;if(k>=0&&c++,j=j.dblp(c),k<0)break;var l=h[k];i(0!==l),j="affine"===b.type?l>0?j.mixedAdd(f[l-1>>1]):j.mixedAdd(f[-l-1>>1].neg()):l>0?j.add(f[l-1>>1]):j.add(f[-l-1>>1].neg())}return"affine"===b.type?j.toP():j},j.prototype._wnafMulAdd=function(b,c,d,e,f){for(var i=this._wnafT1,j=this._wnafT2,k=this._wnafT3,l=0,m=0;m=1;m-=2){var p=m-1,q=m;if(1===i[p]&&1===i[q]){var r=[c[p],null,null,c[q]];0===c[p].y.cmp(c[q].y)?(r[1]=c[p].add(c[q]),r[2]=c[p].toJ().mixedAdd(c[q].neg())):0===c[p].y.cmp(c[q].y.redNeg())?(r[1]=c[p].toJ().mixedAdd(c[q]),r[2]=c[p].add(c[q].neg())):(r[1]=c[p].toJ().mixedAdd(c[q]),r[2]=c[p].toJ().mixedAdd(c[q].neg()));var s=[-3,-1,-5,-7,0,7,5,1,3],t=h(d[p],d[q]);l=Math.max(t[0].length,l),k[p]=new Array(l),k[q]=new Array(l);for(var u=0;u=0;m--){for(var z=0;m>=0;){for(var A=!0,u=0;u=0&&z++,x=x.dblp(z),m<0)break;for(var u=0;u0?n=j[u][B-1>>1]:B<0&&(n=j[u][-B-1>>1].neg()),x="affine"===n.type?x.mixedAdd(n):x.add(n))}}for(var m=0;m=Math.ceil((b.bitLength()+1)/c.step)},k.prototype._getDoubles=function(b,c){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var d=[this],e=this,f=0;f":""},k.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},k.prototype._extDbl=function(){var b=this.x.redSqr(),c=this.y.redSqr(),d=this.z.redSqr();d=d.redIAdd(d);var e=this.curve._mulA(b),f=this.x.redAdd(this.y).redSqr().redISub(b).redISub(c),g=e.redAdd(c),h=g.redSub(d),i=e.redSub(c),j=f.redMul(h),k=g.redMul(i),l=f.redMul(i),m=h.redMul(g);return this.curve.point(j,k,m,l)},k.prototype._projDbl=function(){var e,f,g,b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var h=this.curve._mulA(c),i=h.redAdd(d);if(this.zOne)e=b.redSub(c).redSub(d).redMul(i.redSub(this.curve.two)),f=i.redMul(h.redSub(d)),g=i.redSqr().redSub(i).redSub(i);else{var j=this.z.redSqr(),k=i.redSub(j).redISub(j);e=b.redSub(c).redISub(d).redMul(k),f=i.redMul(h.redSub(d)),g=i.redMul(k)}}else{var h=c.redAdd(d),j=this.curve._mulC(this.c.redMul(this.z)).redSqr(),k=h.redSub(j).redSub(j);e=this.curve._mulC(b.redISub(h)).redMul(k),f=this.curve._mulC(h).redMul(c.redISub(d)),g=h.redMul(k)}return this.curve.point(e,f,g)},k.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},k.prototype._extAdd=function(b){var c=this.y.redSub(this.x).redMul(b.y.redSub(b.x)),d=this.y.redAdd(this.x).redMul(b.y.redAdd(b.x)),e=this.t.redMul(this.curve.dd).redMul(b.t),f=this.z.redMul(b.z.redAdd(b.z)),g=d.redSub(c),h=f.redSub(e),i=f.redAdd(e),j=d.redAdd(c),k=g.redMul(h),l=i.redMul(j),m=g.redMul(j),n=h.redMul(i);return this.curve.point(k,l,n,m)},k.prototype._projAdd=function(b){var l,m,c=this.z.redMul(b.z),d=c.redSqr(),e=this.x.redMul(b.x),f=this.y.redMul(b.y),g=this.curve.d.redMul(e).redMul(f),h=d.redSub(g),i=d.redAdd(g),j=this.x.redAdd(this.y).redMul(b.x.redAdd(b.y)).redISub(e).redISub(f),k=c.redMul(h).redMul(j);return this.curve.twisted?(l=c.redMul(i).redMul(f.redSub(this.curve._mulA(e))),m=h.redMul(i)):(l=c.redMul(i).redMul(f.redSub(e)),m=this.curve._mulC(h).redMul(i)),this.curve.point(k,l,m)},k.prototype.add=function(b){return this.isInfinity()?b:b.isInfinity()?this:this.curve.extended?this._extAdd(b):this._projAdd(b)},k.prototype.mul=function(b){return this._hasDoubles(b)?this.curve._fixedNafMul(this,b):this.curve._wnafMul(this,b)},k.prototype.mulAdd=function(b,c,d){return this.curve._wnafMulAdd(1,[this,c],[b,d],2,!1)},k.prototype.jmulAdd=function(b,c,d){return this.curve._wnafMulAdd(1,[this,c],[b,d],2,!0)},k.prototype.normalize=function(){if(this.zOne)return this;var b=this.z.redInvm();return this.x=this.x.redMul(b),this.y=this.y.redMul(b),this.t&&(this.t=this.t.redMul(b)),this.z=this.curve.one,this.zOne=!0,this},k.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},k.prototype.getX=function(){return this.normalize(),this.x.fromRed()},k.prototype.getY=function(){return this.normalize(),this.y.fromRed()},k.prototype.eq=function(b){return this===b||0===this.getX().cmp(b.getX())&&0===this.getY().cmp(b.getY())},k.prototype.eqXToP=function(b){var c=b.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(c))return!0;for(var d=b.clone(),e=this.curve.redN.redMul(this.z);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(c.redIAdd(e),0===this.x.cmp(c))return!0}return!1},k.prototype.toP=k.prototype.normalize,k.prototype.mixedAdd=k.prototype.add},{"../../elliptic":2,"../curve":5,"bn.js":1,inherits:25}],5:[function(a,b,c){"use strict";var d=c;d.base=a("./base"),d.short=a("./short"),d.mont=a("./mont"),d.edwards=a("./edwards")},{"./base":3,"./edwards":4,"./mont":6,"./short":7}],6:[function(a,b,c){"use strict";function j(a){g.call(this,"mont",a),this.a=new e(a.a,16).toRed(this.red),this.b=new e(a.b,16).toRed(this.red),this.i4=new e(4).toRed(this.red).redInvm(),this.two=new e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function k(a,b,c){g.BasePoint.call(this,a,"projective"),null===b&&null===c?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new e(b,16),this.z=new e(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var d=a("../curve"),e=a("bn.js"),f=a("inherits"),g=d.base,h=a("../../elliptic"),i=h.utils;f(j,g),b.exports=j,j.prototype.validate=function(b){var c=b.normalize().x,d=c.redSqr(),e=d.redMul(c).redAdd(d.redMul(this.a)).redAdd(c),f=e.redSqrt();return 0===f.redSqr().cmp(e)},f(k,g.BasePoint),j.prototype.decodePoint=function(b,c){return this.point(i.toArray(b,c),1)},j.prototype.point=function(b,c){return new k(this,b,c)},j.prototype.pointFromJSON=function(b){return k.fromJSON(this,b)},k.prototype.precompute=function(){},k.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},k.fromJSON=function(b,c){return new k(b,c[0],c[1]||b.one)},k.prototype.inspect=function(){return this.isInfinity()?"":""},k.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},k.prototype.dbl=function(){var b=this.x.redAdd(this.z),c=b.redSqr(),d=this.x.redSub(this.z),e=d.redSqr(),f=c.redSub(e),g=c.redMul(e),h=f.redMul(e.redAdd(this.curve.a24.redMul(f)));return this.curve.point(g,h)},k.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},k.prototype.diffAdd=function(b,c){var d=this.x.redAdd(this.z),e=this.x.redSub(this.z),f=b.x.redAdd(b.z),g=b.x.redSub(b.z),h=g.redMul(d),i=f.redMul(e),j=c.z.redMul(h.redAdd(i).redSqr()),k=c.x.redMul(h.redISub(i).redSqr());return this.curve.point(j,k)},k.prototype.mul=function(b){for(var c=b.clone(),d=this,e=this.curve.point(null,null),f=this,g=[];0!==c.cmpn(0);c.iushrn(1))g.push(c.andln(1));for(var h=g.length-1;h>=0;h--)0===g[h]?(d=d.diffAdd(e,f),e=e.dbl()):(e=d.diffAdd(e,f),d=d.dbl());return e},k.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},k.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},k.prototype.eq=function(b){return 0===this.getX().cmp(b.getX())},k.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},k.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":2,"../curve":5,"bn.js":1,inherits:25}],7:[function(a,b,c){"use strict";function j(a){h.call(this,"short",a),this.a=new f(a.a,16).toRed(this.red),this.b=new f(a.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(a),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function k(a,b,c,d){h.BasePoint.call(this,a,"affine"),null===b&&null===c?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(b,16),this.y=new f(c,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(a,b,c,d){h.BasePoint.call(this,a,"jacobian"),null===b&&null===c&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new f(0)):(this.x=new f(b,16),this.y=new f(c,16),this.z=new f(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var d=a("../curve"),e=a("../../elliptic"),f=a("bn.js"),g=a("inherits"),h=d.base,i=e.utils.assert;g(j,h),b.exports=j,j.prototype._getEndomorphism=function(b){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var c,d;if(b.beta)c=new f(b.beta,16).toRed(this.red);else{var e=this._getEndoRoots(this.p);c=e[0].cmp(e[1])<0?e[0]:e[1],c=c.toRed(this.red)}if(b.lambda)d=new f(b.lambda,16);else{var g=this._getEndoRoots(this.n);0===this.g.mul(g[0]).x.cmp(this.g.x.redMul(c))?d=g[0]:(d=g[1],i(0===this.g.mul(d).x.cmp(this.g.x.redMul(c))))}var h;return h=b.basis?b.basis.map(function(a){return{a:new f(a.a,16),b:new f(a.b,16)}}):this._getEndoBasis(d),{beta:c,lambda:d,basis:h}}},j.prototype._getEndoRoots=function(b){var c=b===this.p?this.red:f.mont(b),d=new f(2).toRed(c).redInvm(),e=d.redNeg(),g=new f(3).toRed(c).redNeg().redSqrt().redMul(d),h=e.redAdd(g).fromRed(),i=e.redSub(g).fromRed();return[h,i]},j.prototype._getEndoBasis=function(b){for(var k,l,m,n,o,p,q,s,t,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=b,e=this.n.clone(),g=new f(1),h=new f(0),i=new f(0),j=new f(1),r=0;0!==d.cmpn(0);){var u=e.div(d);s=e.sub(u.mul(d)),t=i.sub(u.mul(g));var v=j.sub(u.mul(h));if(!m&&s.cmp(c)<0)k=q.neg(),l=g,m=s.neg(),n=t;else if(m&&2===++r)break;q=s,e=d,d=s,i=g,g=t,j=h,h=v}o=s.neg(),p=t;var w=m.sqr().add(n.sqr()),x=o.sqr().add(p.sqr());return x.cmp(w)>=0&&(o=k,p=l),m.negative&&(m=m.neg(),n=n.neg()),o.negative&&(o=o.neg(),p=p.neg()),[{a:m,b:n},{a:o,b:p}]},j.prototype._endoSplit=function(b){var c=this.endo.basis,d=c[0],e=c[1],f=e.b.mul(b).divRound(this.n),g=d.b.neg().mul(b).divRound(this.n),h=f.mul(d.a),i=g.mul(e.a),j=f.mul(d.b),k=g.mul(e.b),l=b.sub(h).sub(i),m=j.add(k).neg();return{k1:l,k2:m}},j.prototype.pointFromX=function(b,c){b=new f(b,16),b.red||(b=b.toRed(this.red));var d=b.redSqr().redMul(b).redIAdd(b.redMul(this.a)).redIAdd(this.b),e=d.redSqrt();if(0!==e.redSqr().redSub(d).cmp(this.zero))throw new Error("invalid point");var g=e.fromRed().isOdd();return(c&&!g||!c&&g)&&(e=e.redNeg()),this.point(b,e)},j.prototype.validate=function(b){if(b.inf)return!0;var c=b.x,d=b.y,e=this.a.redMul(c),f=c.redSqr().redMul(c).redIAdd(e).redIAdd(this.b);return 0===d.redSqr().redISub(f).cmpn(0)},j.prototype._endoWnafMulAdd=function(b,c,d){for(var e=this._endoWnafT1,f=this._endoWnafT2,g=0;g":""},k.prototype.isInfinity=function(){return this.inf},k.prototype.add=function(b){if(this.inf)return b;if(b.inf)return this;if(this.eq(b))return this.dbl();if(this.neg().eq(b))return this.curve.point(null,null);if(0===this.x.cmp(b.x))return this.curve.point(null,null);var c=this.y.redSub(b.y);0!==c.cmpn(0)&&(c=c.redMul(this.x.redSub(b.x).redInvm()));var d=c.redSqr().redISub(this.x).redISub(b.x),e=c.redMul(this.x.redSub(d)).redISub(this.y);return this.curve.point(d,e)},k.prototype.dbl=function(){if(this.inf)return this;var b=this.y.redAdd(this.y);if(0===b.cmpn(0))return this.curve.point(null,null);var c=this.curve.a,d=this.x.redSqr(),e=b.redInvm(),f=d.redAdd(d).redIAdd(d).redIAdd(c).redMul(e),g=f.redSqr().redISub(this.x.redAdd(this.x)),h=f.redMul(this.x.redSub(g)).redISub(this.y);return this.curve.point(g,h)},k.prototype.getX=function(){return this.x.fromRed()},k.prototype.getY=function(){ +return this.y.fromRed()},k.prototype.mul=function(b){return b=new f(b,16),this._hasDoubles(b)?this.curve._fixedNafMul(this,b):this.curve.endo?this.curve._endoWnafMulAdd([this],[b]):this.curve._wnafMul(this,b)},k.prototype.mulAdd=function(b,c,d){var e=[this,c],f=[b,d];return this.curve.endo?this.curve._endoWnafMulAdd(e,f):this.curve._wnafMulAdd(1,e,f,2)},k.prototype.jmulAdd=function(b,c,d){var e=[this,c],f=[b,d];return this.curve.endo?this.curve._endoWnafMulAdd(e,f,!0):this.curve._wnafMulAdd(1,e,f,2,!0)},k.prototype.eq=function(b){return this===b||this.inf===b.inf&&(this.inf||0===this.x.cmp(b.x)&&0===this.y.cmp(b.y))},k.prototype.neg=function(b){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(b&&this.precomputed){var d=this.precomputed,e=function(a){return a.neg()};c.precomputed={naf:d.naf&&{wnd:d.naf.wnd,points:d.naf.points.map(e)},doubles:d.doubles&&{step:d.doubles.step,points:d.doubles.points.map(e)}}}return c},k.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var b=this.curve.jpoint(this.x,this.y,this.curve.one);return b},g(l,h.BasePoint),j.prototype.jpoint=function(b,c,d){return new l(this,b,c,d)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var b=this.z.redInvm(),c=b.redSqr(),d=this.x.redMul(c),e=this.y.redMul(c).redMul(b);return this.curve.point(d,e)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(b){if(this.isInfinity())return b;if(b.isInfinity())return this;var c=b.z.redSqr(),d=this.z.redSqr(),e=this.x.redMul(c),f=b.x.redMul(d),g=this.y.redMul(c.redMul(b.z)),h=b.y.redMul(d.redMul(this.z)),i=e.redSub(f),j=g.redSub(h);if(0===i.cmpn(0))return 0!==j.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var k=i.redSqr(),l=k.redMul(i),m=e.redMul(k),n=j.redSqr().redIAdd(l).redISub(m).redISub(m),o=j.redMul(m.redISub(n)).redISub(g.redMul(l)),p=this.z.redMul(b.z).redMul(i);return this.curve.jpoint(n,o,p)},l.prototype.mixedAdd=function(b){if(this.isInfinity())return b.toJ();if(b.isInfinity())return this;var c=this.z.redSqr(),d=this.x,e=b.x.redMul(c),f=this.y,g=b.y.redMul(c).redMul(this.z),h=d.redSub(e),i=f.redSub(g);if(0===h.cmpn(0))return 0!==i.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var j=h.redSqr(),k=j.redMul(h),l=d.redMul(j),m=i.redSqr().redIAdd(k).redISub(l).redISub(l),n=i.redMul(l.redISub(m)).redISub(f.redMul(k)),o=this.z.redMul(h);return this.curve.jpoint(m,n,o)},l.prototype.dblp=function(b){if(0===b)return this;if(this.isInfinity())return this;if(!b)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var c=this,d=0;d=0)return!1;if(d.redIAdd(f),0===this.x.cmp(d))return!0}return!1},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":2,"../curve":5,"bn.js":1,inherits:25}],8:[function(a,b,c){"use strict";function h(a){"short"===a.type?this.curve=new f.curve.short(a):"edwards"===a.type?this.curve=new f.curve.edwards(a):this.curve=new f.curve.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,g(this.g.validate(),"Invalid curve"),g(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(a,b){Object.defineProperty(d,a,{configurable:!0,enumerable:!0,get:function(){var c=new h(b);return Object.defineProperty(d,a,{configurable:!0,enumerable:!0,value:c}),c}})}var d=c,e=a("hash.js"),f=a("../elliptic"),g=f.utils.assert;d.PresetCurve=h,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:e.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:e.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:e.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:e.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:e.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:e.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:e.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var j;try{j=a("./precomputed/secp256k1")}catch(a){j=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:e.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",j]})},{"../elliptic":2,"./precomputed/secp256k1":16,"hash.js":19}],9:[function(a,b,c){"use strict";function j(a){return this instanceof j?("string"==typeof a&&(g(e.curves.hasOwnProperty(a),"Unknown curve "+a),a=e.curves[a]),a instanceof e.curves.PresetCurve&&(a={curve:a}),this.curve=a.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=a.curve.g,this.g.precompute(a.curve.n.bitLength()+1),void(this.hash=a.hash||a.curve.hash)):new j(a)}var d=a("bn.js"),e=a("../../elliptic"),f=e.utils,g=f.assert,h=a("./key"),i=a("./signature");b.exports=j,j.prototype.keyPair=function(b){return new h(this,b)},j.prototype.keyFromPrivate=function(b,c){return h.fromPrivate(this,b,c)},j.prototype.keyFromPublic=function(b,c){return h.fromPublic(this,b,c)},j.prototype.genKeyPair=function(b){b||(b={});for(var c=new e.hmacDRBG({hash:this.hash,pers:b.pers,entropy:b.entropy||e.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),f=this.n.byteLength(),g=this.n.sub(new d(2));;){var h=new d(c.generate(f));if(!(h.cmp(g)>0))return h.iaddn(1),this.keyFromPrivate(h)}},j.prototype._truncateToN=function(b,c){var d=8*b.byteLength()-this.n.bitLength();return d>0&&(b=b.ushrn(d)),!c&&b.cmp(this.n)>=0?b.sub(this.n):b},j.prototype.sign=function(b,c,f,g){"object"==typeof f&&(g=f,f=null),g||(g={}),c=this.keyFromPrivate(c,f),b=this._truncateToN(new d(b,16));for(var h=this.n.byteLength(),j=c.getPrivate().toArray("be",h),k=b.toArray("be",h),l=new e.hmacDRBG({hash:this.hash,entropy:j,nonce:k,pers:g.pers,persEnc:g.persEnc}),m=this.n.sub(new d(1)),n=0;!0;n++){var o=g.k?g.k(n):new d(l.generate(this.n.byteLength()));if(o=this._truncateToN(o,!0),!(o.cmpn(1)<=0||o.cmp(m)>=0)){var p=this.g.mul(o);if(!p.isInfinity()){var q=p.getX(),r=q.umod(this.n);if(0!==r.cmpn(0)){var s=o.invm(this.n).mul(r.mul(c.getPrivate()).iadd(b));if(s=s.umod(this.n),0!==s.cmpn(0)){var t=(p.getY().isOdd()?1:0)|(0!==q.cmp(r)?2:0);return g.canonical&&s.cmp(this.nh)>0&&(s=this.n.sub(s),t^=1),new i({r:r,s:s,recoveryParam:t})}}}}}},j.prototype.verify=function(b,c,e,f){b=this._truncateToN(new d(b,16)),e=this.keyFromPublic(e,f),c=new i(c,"hex");var g=c.r,h=c.s;if(g.cmpn(1)<0||g.cmp(this.n)>=0)return!1;if(h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var j=h.invm(this.n),k=j.mul(b).umod(this.n),l=j.mul(g).umod(this.n);if(!this.curve._maxwellTrick){var m=this.g.mulAdd(k,e.getPublic(),l);return!m.isInfinity()&&0===m.getX().umod(this.n).cmp(g)}var m=this.g.jmulAdd(k,e.getPublic(),l);return!m.isInfinity()&&m.eqXToP(g)},j.prototype.recoverPubKey=function(a,b,c,e){g((3&c)===c,"The recovery param is more than two bits"),b=new i(b,e);var f=this.n,h=new d(a),j=b.r,k=b.s,l=1&c,m=c>>1;if(j.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");j=m?this.curve.pointFromX(j.add(this.curve.n),l):this.curve.pointFromX(j,l);var n=b.r.invm(f),o=f.sub(h).mul(n).umod(f),p=k.mul(n).umod(f);return this.g.mulAdd(o,j,p)},j.prototype.getKeyRecoveryParam=function(a,b,c,d){if(b=new i(b,d),null!==b.recoveryParam)return b.recoveryParam;for(var e=0;e<4;e++){var f;try{f=this.recoverPubKey(a,b,e)}catch(a){continue}if(f.eq(c))return e}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":2,"./key":10,"./signature":11,"bn.js":1}],10:[function(a,b,c){"use strict";function e(a,b){this.ec=a,this.priv=null,this.pub=null,b.priv&&this._importPrivate(b.priv,b.privEnc),b.pub&&this._importPublic(b.pub,b.pubEnc)}var d=a("bn.js");b.exports=e,e.fromPublic=function(b,c,d){return c instanceof e?c:new e(b,{pub:c,pubEnc:d})},e.fromPrivate=function(b,c,d){return c instanceof e?c:new e(b,{priv:c,privEnc:d})},e.prototype.validate=function(){var b=this.getPublic();return b.isInfinity()?{result:!1,reason:"Invalid public key"}:b.validate()?b.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},e.prototype.getPublic=function(b,c){return"string"==typeof b&&(c=b,b=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),c?this.pub.encode(c,b):this.pub},e.prototype.getPrivate=function(b){return"hex"===b?this.priv.toString(16,2):this.priv},e.prototype._importPrivate=function(b,c){this.priv=new d(b,c||16),this.priv=this.priv.umod(this.ec.curve.n)},e.prototype._importPublic=function(b,c){return b.x||b.y?void(this.pub=this.ec.curve.point(b.x,b.y)):void(this.pub=this.ec.curve.decodePoint(b,c))},e.prototype.derive=function(b){return b.mul(this.priv).getX()},e.prototype.sign=function(b,c,d){return this.ec.sign(b,this,c,d)},e.prototype.verify=function(b,c){return this.ec.verify(b,c,this)},e.prototype.inspect=function(){return""}},{"bn.js":1}],11:[function(a,b,c){"use strict";function h(a,b){return a instanceof h?a:void(this._importDER(a,b)||(g(a.r&&a.s,"Signature without r or s"),this.r=new d(a.r,16),this.s=new d(a.s,16),void 0===a.recoveryParam?this.recoveryParam=null:this.recoveryParam=a.recoveryParam))}function i(){this.place=0}function j(a,b){var c=a[b.place++];if(!(128&c))return c;for(var d=15&c,e=0,f=0,g=b.place;f>>3);for(a.push(128|c);--c;)a.push(b>>>(c<<3)&255);a.push(b)}var d=a("bn.js"),e=a("../../elliptic"),f=e.utils,g=f.assert;b.exports=h,h.prototype._importDER=function(b,c){b=f.toArray(b,c);var e=new i;if(48!==b[e.place++])return!1;var g=j(b,e);if(g+e.place!==b.length)return!1;if(2!==b[e.place++])return!1;var h=j(b,e),k=b.slice(e.place,h+e.place);if(e.place+=h,2!==b[e.place++])return!1;var l=j(b,e);if(b.length!==l+e.place)return!1;var m=b.slice(e.place,l+e.place);return 0===k[0]&&128&k[1]&&(k=k.slice(1)),0===m[0]&&128&m[1]&&(m=m.slice(1)),this.r=new d(k),this.s=new d(m),this.recoveryParam=null,!0},h.prototype.toDER=function(b){var c=this.r.toArray(),d=this.s.toArray();for(128&c[0]&&(c=[0].concat(c)),128&d[0]&&(d=[0].concat(d)),c=k(c),d=k(d);!(d[0]||128&d[1]);)d=d.slice(1);var e=[2];l(e,c.length),e=e.concat(c),e.push(2),l(e,d.length);var g=e.concat(d),h=[48];return l(h,g.length),h=h.concat(g),f.encode(h,b)}},{"../../elliptic":2,"bn.js":1}],12:[function(a,b,c){"use strict";function k(a){if(g("ed25519"===a,"only tested with ed25519 so far"),!(this instanceof k))return new k(a);var a=e.curves[a].curve;this.curve=a,this.g=a.g,this.g.precompute(a.n.bitLength()+1),this.pointClass=a.point().constructor,this.encodingLength=Math.ceil(a.n.bitLength()/8),this.hash=d.sha512}var d=a("hash.js"),e=a("../../elliptic"),f=e.utils,g=f.assert,h=f.parseBytes,i=a("./key"),j=a("./signature");b.exports=k,k.prototype.sign=function(b,c){b=h(b);var d=this.keyFromSecret(c),e=this.hashInt(d.messagePrefix(),b),f=this.g.mul(e),g=this.encodePoint(f),i=this.hashInt(g,d.pubBytes(),b).mul(d.priv()),j=e.add(i).umod(this.curve.n);return this.makeSignature({R:f,S:j,Rencoded:g})},k.prototype.verify=function(b,c,d){b=h(b),c=this.makeSignature(c);var e=this.keyFromPublic(d),f=this.hashInt(c.Rencoded(),e.pubBytes(),b),g=this.g.mul(c.S()),i=c.R().add(e.pub().mul(f));return i.eq(g)},k.prototype.hashInt=function(){for(var b=this.hash(),c=0;c=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(b,c,d)}var d=a("hash.js"),e=a("../elliptic"),f=e.utils,g=f.assert;b.exports=h,h.prototype._init=function(b,c,d){var e=b.concat(c).concat(d);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var f=0;f=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(b.concat(d||[])),this.reseed=1},h.prototype.generate=function(b,c,d,e){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof c&&(e=d,d=c,c=null),d&&(d=f.toArray(d,e),this._update(d));for(var g=[];g.length>8,g=255&e;f?c.push(f,g):c.push(g)}return c}function g(a){return 1===a.length?"0"+a:a}function h(a){for(var b="",c=0;c=0;){var f;if(e.isOdd()){var g=e.andln(d-1);f=g>(d>>1)-1?(d>>1)-g:g,e.isubn(f)}else f=0;c.push(f);for(var h=0!==e.cmpn(0)&&0===e.andln(d-1)?b+1:1,i=1;i0||b.cmpn(-e)>0;){var f=a.andln(3)+d&3,g=b.andln(3)+e&3;3===f&&(f=-1),3===g&&(g=-1);var h;if(0===(1&f))h=0;else{var i=a.andln(7)+d&7;h=3!==i&&5!==i||2!==g?f:-f}c[0].push(h);var j;if(0===(1&g))j=0;else{var i=b.andln(7)+e&7;j=3!==i&&5!==i||2!==f?g:-g}c[1].push(j),2*d===h+1&&(d=1-d),2*e===j+1&&(e=1-e),a.iushrn(1),b.iushrn(1)}return c}function k(a,b,c){var d="_"+b;a.prototype[b]=function(){return void 0!==this[d]?this[d]:this[d]=c.call(this)}}function l(a){return"string"==typeof a?d.toArray(a,"hex"):a}function m(a){return new e(a,"hex","le")}var d=c,e=a("bn.js");d.assert=function(b,c){if(!b)throw new Error(c||"Assertion failed")},d.toArray=f,d.zero2=g,d.toHex=h,d.encode=function(b,c){return"hex"===c?h(b):b},d.getNAF=i,d.getJSF=j,d.cachedProperty=k,d.parseBytes=l,d.intFromLE=m},{"bn.js":1}],18:[function(a,b,c){function e(a){this.rand=a}var d;if(b.exports=function(b){return d||(d=new e(null)),d.generate(b)},b.exports.Rand=e,e.prototype.generate=function(b){return this._rand(b)},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(b){var c=new Uint8Array(b);return self.crypto.getRandomValues(c),c}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(b){var c=new Uint8Array(b);return self.msCrypto.getRandomValues(c),c}:e.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var f=a("crypto");e.prototype._rand=function(b){return f.randomBytes(b)}}catch(a){e.prototype._rand=function(b){for(var c=new Uint8Array(b),d=0;d=this._delta8){b=this.pending;var d=b.length%this._delta8;this.pending=b.slice(b.length-d,b.length),0===this.pending.length&&(this.pending=null),b=e.join32(b,0,b.length-d,this.endian);for(var f=0;f>>24&255,e[f++]=b>>>16&255,e[f++]=b>>>8&255,e[f++]=255&b}else{e[f++]=255&b,e[f++]=b>>>8&255,e[f++]=b>>>16&255,e[f++]=b>>>24&255,e[f++]=0,e[f++]=0,e[f++]=0,e[f++]=0;for(var g=8;gthis.blockSize&&(b=(new this.Hash).update(b).digest()),g(b.length<=this.blockSize);for(var c=b.length;c>>3}function L(a){return g(a,17)^g(a,19)^a>>>10}function M(a,b,c,d){return 0===a?F(b,c,d):1===a||3===a?H(b,c,d):2===a?G(b,c,d):void 0}function N(a,b,c,d,e,f){var g=a&c^~a&e;return g<0&&(g+=4294967296),g}function O(a,b,c,d,e,f){var g=b&d^~b&f;return g<0&&(g+=4294967296),g}function P(a,b,c,d,e,f){var g=a&c^a&e^c&e;return g<0&&(g+=4294967296),g}function Q(a,b,c,d,e,f){var g=b&d^b&f^d&f;return g<0&&(g+=4294967296),g}function R(a,b){var c=l(a,b,28),d=l(b,a,2),e=l(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function S(a,b){var c=m(a,b,28),d=m(b,a,2),e=m(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function T(a,b){var c=l(a,b,14),d=l(a,b,18),e=l(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function U(a,b){var c=m(a,b,14),d=m(a,b,18),e=m(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function V(a,b){var c=l(a,b,1),d=l(a,b,8),e=n(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function W(a,b){var c=m(a,b,1),d=m(a,b,8),e=o(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function X(a,b){var c=l(a,b,19),d=l(b,a,29),e=n(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}function Y(a,b){var c=m(a,b,19),d=m(b,a,29),e=o(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}var d=a("../hash"),e=d.utils,f=e.assert,g=e.rotr32,h=e.rotl32,i=e.sum32,j=e.sum32_4,k=e.sum32_5,l=e.rotr64_hi,m=e.rotr64_lo,n=e.shr64_hi,o=e.shr64_lo,p=e.sum64,q=e.sum64_hi,r=e.sum64_lo,s=e.sum64_4_hi,t=e.sum64_4_lo,u=e.sum64_5_hi,v=e.sum64_5_lo,w=d.common.BlockHash,x=[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],y=[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],z=[1518500249,1859775393,2400959708,3395469782];e.inherits(A,w),c.sha256=A,A.blockSize=512,A.outSize=256,A.hmacStrength=192,A.padLength=64,A.prototype._update=function(b,c){for(var d=this.W,e=0;e<16;e++)d[e]=b[c+e];for(;e>8,g=255&e;f?c.push(f,g):c.push(g)}else for(var d=0;d>>24|a>>>8&65280|a<<8&16711680|(255&a)<<24;return b>>>0}function i(a,b){for(var c="",d=0;d>>0}return f}function m(a,b){for(var c=new Array(4*a.length),d=0,e=0;d>>24,c[e+1]=f>>>16&255,c[e+2]=f>>>8&255,c[e+3]=255&f):(c[e+3]=f>>>24,c[e+2]=f>>>16&255,c[e+1]=f>>>8&255,c[e]=255&f)}return c}function n(a,b){return a>>>b|a<<32-b}function o(a,b){return a<>>32-b}function p(a,b){return a+b>>>0}function q(a,b,c){return a+b+c>>>0}function r(a,b,c,d){return a+b+c+d>>>0}function s(a,b,c,d,e){return a+b+c+d+e>>>0}function t(a,b){if(!a)throw new Error(b||"Assertion failed")}function u(a,b,c,d){var e=a[b],f=a[b+1],g=d+f>>>0,h=(g>>0,a[b+1]=g}function v(a,b,c,d){var e=b+d>>>0,f=(e>>0}function w(a,b,c,d){var e=b+d;return e>>>0}function x(a,b,c,d,e,f,g,h){var i=0,j=b;j=j+d>>>0,i+=j>>0,i+=j>>0,i+=j>>0}function y(a,b,c,d,e,f,g,h){var i=b+d+f+h;return i>>>0}function z(a,b,c,d,e,f,g,h,i,j){var k=0,l=b;l=l+d>>>0,k+=l>>0,k+=l>>0,k+=l>>0,k+=l>>0}function A(a,b,c,d,e,f,g,h,i,j){var k=b+d+f+h+j;return k>>>0}function B(a,b,c){var d=b<<32-c|a>>>c;return d>>>0}function C(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}function D(a,b,c){return a>>>c}function E(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}var d=c,e=a("inherits");d.toArray=f,d.toHex=g,d.htonl=h,d.toHex32=i,d.zero2=j,d.zero8=k,d.join32=l,d.split32=m,d.rotr32=n,d.rotl32=o,d.sum32=p,d.sum32_3=q,d.sum32_4=r,d.sum32_5=s,d.assert=t,d.inherits=e,c.sum64=u,c.sum64_hi=v,c.sum64_lo=w,c.sum64_4_hi=x,c.sum64_4_lo=y,c.sum64_5_hi=z,c.sum64_5_lo=A,c.rotr64_hi=B,c.rotr64_lo=C,c.shr64_hi=D,c.shr64_lo=E},{inherits:25}],25:[function(a,b,c){"function"==typeof Object.create?b.exports=function(b,c){b.super_=c,b.prototype=Object.create(c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(b,c){b.super_=c;var d=function(){};d.prototype=c.prototype,b.prototype=new d,b.prototype.constructor=b}},{}],26:[function(a,b,c){b.exports={name:"elliptic",version:"6.3.2",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",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:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"}}},{}]},{},[2])(2)}); + +var liner=function(e){function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var t={};return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=17)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){function n(e){for(var r,t=e,n=/[^%](%\d+)/g,a=[];r=n.exec(t);)a.push({arg:r[1],index:r.index});for(var o=a.length-1;o>=0;o--){var i=a[o],s=i.arg.substring(1),c=i.index+1;t=t.substring(0,c)+arguments[+s]+t.substring(c+1+s.length)}return t=t.replace("%%","%")}function a(e){var r;r="string"==typeof e?{name:e}:e,p.checkAlgorithm(r);var t=e;return t.hash&&(t.hash=a(t.hash)),r}function o(e,r){if(!e)throw new s("Parameter '"+r+"' is required and cant be empty");if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return new Uint8Array(e);if(ArrayBuffer.isView(e)){var t=e.map(function(e){return e});return new Uint8Array(t.buffer)}if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new s("Incoming parameter '"+r+"' has wrong data type. Must be ArrayBufferView or ArrayBuffer")}t.d(r,"WebCryptoError",function(){return s}),t.d(r,"AlgorithmError",function(){return c}),t.d(r,"CryptoKeyError",function(){return u}),t.d(r,"PrepareAlgorithm",function(){return a}),t.d(r,"PrepareData",function(){return o}),t.d(r,"BaseCrypto",function(){return p}),t.d(r,"AlgorithmNames",function(){return h}),t.d(r,"Base64Url",function(){return y}),t.d(r,"SubtleCrypto",function(){return W}),t.d(r,"Aes",function(){return m}),t.d(r,"AesAlgorithmError",function(){return A}),t.d(r,"AesWrapKey",function(){return w}),t.d(r,"AesEncrypt",function(){return v}),t.d(r,"AesECB",function(){return g}),t.d(r,"AesCBC",function(){return C}),t.d(r,"AesCTR",function(){return d}),t.d(r,"AesGCM",function(){return k}),t.d(r,"AesKW",function(){return b}),t.d(r,"RsaKeyGenParamsError",function(){return G}),t.d(r,"RsaHashedImportParamsError",function(){return M}),t.d(r,"Rsa",function(){return B}),t.d(r,"RsaSSA",function(){return T}),t.d(r,"RsaPSSParamsError",function(){return D}),t.d(r,"RsaPSS",function(){return x}),t.d(r,"RsaOAEPParamsError",function(){return j}),t.d(r,"RsaOAEP",function(){return H}),t.d(r,"EcKeyGenParamsError",function(){return U}),t.d(r,"Ec",function(){return _}),t.d(r,"EcAlgorithmError",function(){return K}),t.d(r,"EcDSA",function(){return O}),t.d(r,"EcDH",function(){return S}),t.d(r,"ShaAlgorithms",function(){return E}),t.d(r,"Sha",function(){return P});var i=t(8),s=function(e){function r(r){for(var t=[],a=1;a0&&e.length<=128))throw new A(A.PARAM_WRONG_VALUE,"length","number [1-128]")},r.ALG_NAME=h.AesCTR,r}(v),k=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithmParams=function(e){if(this.checkAlgorithm(e),e.additionalData&&!(ArrayBuffer.isView(e.additionalData)||e.additionalData instanceof ArrayBuffer))throw new A(A.PARAM_WRONG_TYPE,"additionalData","ArrayBufferView or ArrayBuffer");if(!e.iv)throw new A(A.PARAM_REQUIRED,"iv");if(!(ArrayBuffer.isView(e.iv)||e.iv instanceof ArrayBuffer))throw new A(A.PARAM_WRONG_TYPE,"iv","ArrayBufferView or ArrayBuffer");if(e.tagLength){if(![32,64,96,104,112,120,128].some(function(r){return r===e.tagLength}))throw new A(A.PARAM_WRONG_VALUE,"tagLength","32, 64, 96, 104, 112, 120 or 128")}},r.ALG_NAME=h.AesGCM,r}(v),b=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithmParams=function(e){this.checkAlgorithm(e)},r.ALG_NAME=h.AesKW,r.KEY_USAGES=["wrapKey","unwrapKey"],r}(w),E=[h.Sha1,h.Sha256,h.Sha384,h.Sha512].join(" | "),P=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithm=function(r){var t;switch(t="string"==typeof r?{name:r}:r,e.checkAlgorithm.call(this,t),t.name.toUpperCase()){case h.Sha1:case h.Sha256:case h.Sha384:case h.Sha512:break;default:throw new c(c.WRONG_ALG_NAME,t.name,E)}},r.digest=function(e,r){var t=this;return new Promise(function(r,n){t.checkAlgorithm(e),r(void 0)})},r}(p),U=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.code=9,r}return Object(i.a)(r,e),r}(c),_=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Object(i.a)(r,e),r.checkAlgorithm=function(e){if(e.name.toUpperCase()!==this.ALG_NAME.toUpperCase())throw new c(c.WRONG_ALG_NAME,e.name,this.ALG_NAME)},r.checkKeyGenParams=function(e){if(!e.namedCurve)throw new U(U.PARAM_REQUIRED,"namedCurve");if("string"!=typeof e.namedCurve)throw new U(U.PARAM_WRONG_TYPE,"namedCurve","string");switch(e.namedCurve.toUpperCase()){case"P-256":case"K-256":case"P-384":case"P-521":break;default:throw new U(U.PARAM_WRONG_VALUE,"namedCurve","K-256, P-256, P-384 or P-521")}},r.checkKeyGenUsages=function(e){var r=this;e.forEach(function(e){var t=0;for(t;t0&&e.length<=512))throw new c(c.PARAM_WRONG_VALUE,"length","more 0 and less than 512")},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t=256&&r<=16384)||r%8)throw new G(G.PARAM_WRONG_VALUE,"modulusLength"," a multiple of 8 bits and >= 256 and <= 16384");var t=e.publicExponent;if(!t)throw new G(G.PARAM_REQUIRED,"publicExponent");if(!ArrayBuffer.isView(t))throw new G(G.PARAM_WRONG_TYPE,"publicExponent","ArrayBufferView");if(3!==t[0]&&(1!==t[0]||0!==t[1]||1!==t[2]))throw new G(G.PARAM_WRONG_VALUE,"publicExponent","Uint8Array([3]) | Uint8Array([1, 0, 1])");if(!e.hash)throw new G(G.PARAM_REQUIRED,"hash",E);P.checkAlgorithm(e.hash)},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t>>16&65535,n=65535&e,a=r>>>16&65535,o=65535&r;return n*o+(t*o+n*a<<16>>>0)|0})},function(e,r,t){"use strict";function n(){var e={name:"Unknown",version:"0"};try{var t=self.navigator.userAgent,n=void 0;(n=/edge\/([\d\.]+)/i.exec(t))?(e.name=r.Browser.Edge,e.version=n[1]):/msie/i.test(t)?(e.name=r.Browser.IE,e.version=/msie ([\d\.]+)/i.exec(t)[1]):/Trident/i.test(t)?(e.name=r.Browser.IE,e.version=/rv:([\d\.]+)/i.exec(t)[1]):/chrome/i.test(t)?(e.name=r.Browser.Chrome,e.version=/chrome\/([\d\.]+)/i.exec(t)[1]):/safari/i.test(t)?(e.name=r.Browser.Safari,e.version=/version\/([\d\.]+)/i.exec(t)[1]):/firefox/i.test(t)&&(e.name=r.Browser.Firefox,e.version=/firefox\/([\d\.]+)/i.exec(t)[1])}catch(e){}return e}function a(e){for(var r=new Uint8Array(e.length),t=0;t-1&&("public"===e.type||"secret"===e.type)&&e.usages.push(t)}),["sign","decrypt","unwrapKey","deriveKey","deriveBits"].forEach(function(t){r.indexOf(t)>-1&&("private"===e.type||"secret"===e.type)&&e.usages.push(t)})))})}function s(e,r,t){if(r&&w.BrowserInfo().name===w.Browser.IE){"extractable"in e&&(e.ext=e.extractable,delete e.extractable);var n=null;switch(r.name.toUpperCase()){case h.AlgorithmNames.AesECB.toUpperCase():case h.AlgorithmNames.AesCBC.toUpperCase():case h.AlgorithmNames.AesGCM.toUpperCase():n=v.AesCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,r.name.toUpperCase())}n&&!e.alg&&(e.alg=n.alg2jwk(r)),"key_ops"in e||(e.key_ops=t)}}function c(e){w.BrowserInfo().name===w.Browser.IE&&("ext"in e&&(e.extractable=e.ext,delete e.ext),delete e.key_ops,delete e.alg)}function u(e){var r=/AppleWebKit\/(\d+)/.exec(self.navigator.userAgent);return e.toUpperCase()===h.AlgorithmNames.RsaOAEP&&r&&parseInt(r[1],10)<604}var p=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var h=t(0),f=t(0),y=t(0),l=t(3),A=t(2),m=t(1),w=t(5),v=t(11),g=t(12),C=t(13),k=t(14),d=t(15),b=[],E=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return p(r,e),r.prototype.generateKey=function(r,t,n){var o,s=this,c=arguments;return e.prototype.generateKey.apply(this,c).then(function(e){if(o=y.PrepareAlgorithm(r),!(w.BrowserInfo().name===w.Browser.Edge&&o.name.toUpperCase()===h.AlgorithmNames.AesGCM||u(o.name))&&l.nativeSubtle)try{return l.nativeSubtle.generateKey.apply(l.nativeSubtle,c).catch(function(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")})}catch(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")}}).then(function(e){if(e){var c=Promise.resolve(e);if(w.BrowserInfo().name===w.Browser.Safari&&(o.name.toUpperCase()===h.AlgorithmNames.EcDH.toUpperCase()||o.name.toUpperCase()===h.AlgorithmNames.EcDSA.toUpperCase())){var u=e.publicKey;c=c.then(function(){return s.exportKey("jwk",u).then(function(a){return s.exportKey("spki",u).then(function(o){for(var i=h.Base64Url.decode(a.x),c=h.Base64Url.decode(a.y),u=i.length+c.length,p=new Uint8Array(o),f=0;f-1&&("public"===e.type||"secret"===e.type)&&e.usages.push(t)}),["sign","decrypt","unwrapKey","deriveKey","deriveBits"].forEach(function(t){r.indexOf(t)>-1&&("private"===e.type||"secret"===e.type)&&e.usages.push(t)})))})}function s(e,r,t){if(r&&w.BrowserInfo().name===w.Browser.IE){"extractable"in e&&(e.ext=e.extractable,delete e.extractable);var n=null;switch(r.name.toUpperCase()){case h.AlgorithmNames.AesECB.toUpperCase():case h.AlgorithmNames.AesCBC.toUpperCase():case h.AlgorithmNames.AesGCM.toUpperCase():n=v.AesCrypto;break;default:throw new A.LinerError(A.LinerError.UNSUPPORTED_ALGORITHM,r.name.toUpperCase())}n&&!e.alg&&(e.alg=n.alg2jwk(r)),"key_ops"in e||(e.key_ops=t)}}function c(e){w.BrowserInfo().name===w.Browser.IE&&("ext"in e&&(e.extractable=e.ext,delete e.ext),delete e.key_ops,delete e.alg)}function u(e){var r=/AppleWebKit\/(\d+)/.exec(self.navigator.userAgent);return e.toUpperCase()===h.AlgorithmNames.RsaOAEP&&r&&parseInt(r[1],10)<604}var p=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var h=t(0),f=t(0),y=t(0),l=t(4),m=t(2),A=t(1),w=t(5),v=t(11),g=t(12),C=t(13),d=t(14),k=t(15),b=t(16),E=[],P=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return p(r,e),r.prototype.generateKey=function(r,t,n){var o,s=this,c=arguments;return e.prototype.generateKey.apply(this,c).then(function(e){if(o=y.PrepareAlgorithm(r),!(w.BrowserInfo().name===w.Browser.Edge&&o.name.toUpperCase()===h.AlgorithmNames.AesGCM||u(o.name))&&l.nativeSubtle)try{return l.nativeSubtle.generateKey.apply(l.nativeSubtle,c).catch(function(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")})}catch(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")}}).then(function(e){if(e){var c=Promise.resolve(e);if(w.BrowserInfo().name===w.Browser.Safari&&(o.name.toUpperCase()===h.AlgorithmNames.EcDH.toUpperCase()||o.name.toUpperCase()===h.AlgorithmNames.EcDSA.toUpperCase())){var u=e.publicKey;c=c.then(function(){return s.exportKey("jwk",u).then(function(a){return s.exportKey("spki",u).then(function(o){for(var i=h.Base64Url.decode(a.x),c=h.Base64Url.decode(a.y),u=i.length+c.length,p=new Uint8Array(o),f=0;f32?o>48?66:48:32,t.length32?o>48?66:48:32,t.length/232?o>48?66:48:32,a.length-1)t=r.replace("-","").toLowerCase();else{if("K-256"!==r)throw new c.LinerError("Unsupported named curve '"+e+"'");t="secp256k1"}return t},r}(s.BaseCrypto);r.EcCrypto=h;var f=t(2)},function(e,r,t){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),o=t(1),i=t(3),s=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.importKey=function(e,r,t,n,a){return Promise.resolve().then(function(){var e=new Uint8Array(r),o=new i.CryptoKey({type:"secret",algorithm:t,extractable:n,usages:a});return o.key=e,o})},r.deriveBits=function(e,r,t){return Promise.resolve().then(function(){var n,i=new Uint8Array(e.salt),s=e.iterations,c=t/8,u="string"==typeof e.hash?e.hash:e.hash.name;switch(u.toUpperCase()){case a.AlgorithmNames.Sha512.toUpperCase():n=asmCrypto.PBKDF2_HMAC_SHA512.bytes(r.key,i,s,c);break;case a.AlgorithmNames.Sha256.toUpperCase():n=asmCrypto.PBKDF2_HMAC_SHA256.bytes(r.key,i,s,c);break;case a.AlgorithmNames.Sha1.toUpperCase():n=asmCrypto.PBKDF2_HMAC_SHA1.bytes(r.key,i,s,c);break;default:throw new o.LinerError(o.LinerError.UNSUPPORTED_ALGORITHM,u)}return n.buffer})},r.deriveKey=function(e,r,t,n,i){var s=this;return Promise.resolve().then(function(){var n=0;switch(t.name.toUpperCase()){case a.AlgorithmNames.AesCBC.toUpperCase():case a.AlgorithmNames.AesCTR.toUpperCase():case a.AlgorithmNames.AesGCM.toUpperCase():case a.AlgorithmNames.AesKW.toUpperCase():n=t.length;break;case a.AlgorithmNames.Hmac.toUpperCase():n=512;break;default:throw new o.LinerError(o.LinerError.UNSUPPORTED_ALGORITHM,t.name)}return s.deriveBits(e,r,n)}).then(function(e){return(new c.Crypto).subtle.importKey("raw",new Uint8Array(e),t,n,i)})},r}(a.BaseCrypto);r.Pbkdf2Crypto=s;var c=t(2)},function(e,r,t){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),o=t(3),i=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.importKey=function(e,r,t,n,i){return Promise.resolve().then(function(){var s;if("jwk"===e.toLowerCase()){var c=r;s=a.Base64Url.decode(c.k)}else s=new Uint8Array(r);var u=new o.CryptoKey({type:"secret",algorithm:t,extractable:n,usages:i});return u.key=s,u})},r.sign=function(e,r,t){return Promise.resolve().then(function(){return asmCrypto.HMAC_SHA256.bytes(t,r.key).buffer})},r.exportKey=function(e,r){return Promise.resolve().then(function(){var t=r.key;if("jwk"===e.toLowerCase()){return{alg:"HS256",kty:"oct",k:a.Base64Url.encode(t),key_ops:r.usages,ext:r.extractable}}return t.buffer})},r}(a.BaseCrypto);r.HmacCrypto=i},function(e,r,t){"use strict";function n(e,r){return asmCrypto.HMAC_SHA256.bytes(e,r)}function a(e,r,t){for(var n=e.length,a=Math.ceil(r/n),o=new Uint8Array(n*a+t.length+1),i=0,s=0,c=0;c>>7);return n^=99}r||function(){t=[],e=[];var s,i,n=1;for(s=0;s<255;s++)t[s]=n,i=128&n,n<<=1,n&=255,128===i&&(n^=27),n^=t[s],e[t[s]]=s;t[255]=t[0],e[0]=0,r=!0}(),i=[],n=[],a=[[],[],[],[]],h=[[],[],[],[]];for(var c=0;c<256;c++){var u=o(c);i[c]=u,n[u]=c,a[0][c]=s(2,u)<<24|u<<16|u<<8|s(3,u),h[0][u]=s(14,c)<<24|s(9,c)<<16|s(13,c)<<8|s(11,c);for(var f=1;f<4;f++)a[f][c]=a[f-1][c]>>>8|a[f-1][c]<<24,h[f][u]=h[f-1][u]>>>8|h[f-1][u]<<24}}var c=function(t,e){o();var r=new Uint32Array(e);r.set(i,512),r.set(n,768);for(var s=0;s<4;s++)r.set(a[s],4096+1024*s>>2),r.set(h[s],8192+1024*s>>2);var c=function(t,e,r){"use asm";var s=0,i=0,n=0,a=0,h=0,o=0,c=0,u=0,f=0,l=0,p=0,w=0,y=0,_=0,d=0,A=0,v=0,x=0,E=0,g=0,m=0;var b=new t.Uint32Array(r),S=new t.Uint8Array(r);function C(t,e,r,h,o,c,u,f){t=t|0;e=e|0;r=r|0;h=h|0;o=o|0;c=c|0;u=u|0;f=f|0;var l=0,p=0,w=0,y=0,_=0,d=0,A=0,v=0;l=r|0x400,p=r|0x800,w=r|0xc00;o=o^b[(t|0)>>2],c=c^b[(t|4)>>2],u=u^b[(t|8)>>2],f=f^b[(t|12)>>2];for(v=16;(v|0)<=h<<4;v=v+16|0){y=b[(r|o>>22&1020)>>2]^b[(l|c>>14&1020)>>2]^b[(p|u>>6&1020)>>2]^b[(w|f<<2&1020)>>2]^b[(t|v|0)>>2],_=b[(r|c>>22&1020)>>2]^b[(l|u>>14&1020)>>2]^b[(p|f>>6&1020)>>2]^b[(w|o<<2&1020)>>2]^b[(t|v|4)>>2],d=b[(r|u>>22&1020)>>2]^b[(l|f>>14&1020)>>2]^b[(p|o>>6&1020)>>2]^b[(w|c<<2&1020)>>2]^b[(t|v|8)>>2],A=b[(r|f>>22&1020)>>2]^b[(l|o>>14&1020)>>2]^b[(p|c>>6&1020)>>2]^b[(w|u<<2&1020)>>2]^b[(t|v|12)>>2];o=y,c=_,u=d,f=A}s=b[(e|o>>22&1020)>>2]<<24^b[(e|c>>14&1020)>>2]<<16^b[(e|u>>6&1020)>>2]<<8^b[(e|f<<2&1020)>>2]^b[(t|v|0)>>2],i=b[(e|c>>22&1020)>>2]<<24^b[(e|u>>14&1020)>>2]<<16^b[(e|f>>6&1020)>>2]<<8^b[(e|o<<2&1020)>>2]^b[(t|v|4)>>2],n=b[(e|u>>22&1020)>>2]<<24^b[(e|f>>14&1020)>>2]<<16^b[(e|o>>6&1020)>>2]<<8^b[(e|c<<2&1020)>>2]^b[(t|v|8)>>2],a=b[(e|f>>22&1020)>>2]<<24^b[(e|o>>14&1020)>>2]<<16^b[(e|c>>6&1020)>>2]<<8^b[(e|u<<2&1020)>>2]^b[(t|v|12)>>2]}function M(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;C(0x0000,0x0800,0x1000,m,t,e,r,s)}function U(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;var n=0;C(0x0400,0x0c00,0x2000,m,t,s,r,e);n=i,i=a,a=n}function H(t,e,r,f){t=t|0;e=e|0;r=r|0;f=f|0;C(0x0000,0x0800,0x1000,m,h^t,o^e,c^r,u^f);h=s,o=i,c=n,u=a}function T(t,e,r,f){t=t|0;e=e|0;r=r|0;f=f|0;var l=0;C(0x0400,0x0c00,0x2000,m,t,f,r,e);l=i,i=a,a=l;s=s^h,i=i^o,n=n^c,a=a^u;h=t,o=e,c=r,u=f}function D(t,e,r,f){t=t|0;e=e|0;r=r|0;f=f|0;C(0x0000,0x0800,0x1000,m,h,o,c,u);h=s=s^t,o=i=i^e,c=n=n^r,u=a=a^f}function k(t,e,r,f){t=t|0;e=e|0;r=r|0;f=f|0;C(0x0000,0x0800,0x1000,m,h,o,c,u);s=s^t,i=i^e,n=n^r,a=a^f;h=t,o=e,c=r,u=f}function G(t,e,r,f){t=t|0;e=e|0;r=r|0;f=f|0;C(0x0000,0x0800,0x1000,m,h,o,c,u);h=s,o=i,c=n,u=a;s=s^t,i=i^e,n=n^r,a=a^f}function I(t,e,r,h){t=t|0;e=e|0;r=r|0;h=h|0;C(0x0000,0x0800,0x1000,m,f,l,p,w);w=~A&w|A&w+1;p=~d&p|d&p+((w|0)==0);l=~_&l|_&l+((p|0)==0);f=~y&f|y&f+((l|0)==0);s=s^t;i=i^e;n=n^r;a=a^h}function Z(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;var i=0,n=0,a=0,f=0,l=0,p=0,w=0,y=0,_=0,d=0;t=t^h,e=e^o,r=r^c,s=s^u;i=v|0,n=x|0,a=E|0,f=g|0;for(;(_|0)<128;_=_+1|0){if(i>>>31){l=l^t,p=p^e,w=w^r,y=y^s}i=i<<1|n>>>31,n=n<<1|a>>>31,a=a<<1|f>>>31,f=f<<1;d=s&1;s=s>>>1|r<<31,r=r>>>1|e<<31,e=e>>>1|t<<31,t=t>>>1;if(d)t=t^0xe1000000}h=l,o=p,c=w,u=y}function P(t){t=t|0;m=t}function B(t,e,r,h){t=t|0;e=e|0;r=r|0;h=h|0;s=t,i=e,n=r,a=h}function z(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;h=t,o=e,c=r,u=s}function O(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;f=t,l=e,p=r,w=s}function q(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;y=t,_=e,d=r,A=s}function L(t,e,r,s){t=t|0;e=e|0;r=r|0;s=s|0;w=~A&w|A&s,p=~d&p|d&r,l=~_&l|_&e,f=~y&f|y&t}function R(t){t=t|0;if(t&15)return-1;S[t|0]=s>>>24,S[t|1]=s>>>16&255,S[t|2]=s>>>8&255,S[t|3]=s&255,S[t|4]=i>>>24,S[t|5]=i>>>16&255,S[t|6]=i>>>8&255,S[t|7]=i&255,S[t|8]=n>>>24,S[t|9]=n>>>16&255,S[t|10]=n>>>8&255,S[t|11]=n&255,S[t|12]=a>>>24,S[t|13]=a>>>16&255,S[t|14]=a>>>8&255,S[t|15]=a&255;return 16}function K(t){t=t|0;if(t&15)return-1;S[t|0]=h>>>24,S[t|1]=h>>>16&255,S[t|2]=h>>>8&255,S[t|3]=h&255,S[t|4]=o>>>24,S[t|5]=o>>>16&255,S[t|6]=o>>>8&255,S[t|7]=o&255,S[t|8]=c>>>24,S[t|9]=c>>>16&255,S[t|10]=c>>>8&255,S[t|11]=c&255,S[t|12]=u>>>24,S[t|13]=u>>>16&255,S[t|14]=u>>>8&255,S[t|15]=u&255;return 16}function N(){M(0,0,0,0);v=s,x=i,E=n,g=a}function F(t,e,r){t=t|0;e=e|0;r=r|0;var h=0;if(e&15)return-1;while((r|0)>=16){V[t&7](S[e|0]<<24|S[e|1]<<16|S[e|2]<<8|S[e|3],S[e|4]<<24|S[e|5]<<16|S[e|6]<<8|S[e|7],S[e|8]<<24|S[e|9]<<16|S[e|10]<<8|S[e|11],S[e|12]<<24|S[e|13]<<16|S[e|14]<<8|S[e|15]);S[e|0]=s>>>24,S[e|1]=s>>>16&255,S[e|2]=s>>>8&255,S[e|3]=s&255,S[e|4]=i>>>24,S[e|5]=i>>>16&255,S[e|6]=i>>>8&255,S[e|7]=i&255,S[e|8]=n>>>24,S[e|9]=n>>>16&255,S[e|10]=n>>>8&255,S[e|11]=n&255,S[e|12]=a>>>24,S[e|13]=a>>>16&255,S[e|14]=a>>>8&255,S[e|15]=a&255;h=h+16|0,e=e+16|0,r=r-16|0}return h|0}function j(t,e,r){t=t|0;e=e|0;r=r|0;var s=0;if(e&15)return-1;while((r|0)>=16){W[t&1](S[e|0]<<24|S[e|1]<<16|S[e|2]<<8|S[e|3],S[e|4]<<24|S[e|5]<<16|S[e|6]<<8|S[e|7],S[e|8]<<24|S[e|9]<<16|S[e|10]<<8|S[e|11],S[e|12]<<24|S[e|13]<<16|S[e|14]<<8|S[e|15]);s=s+16|0,e=e+16|0,r=r-16|0}return s|0}var V=[M,U,H,T,D,k,G,I];var W=[H,Z];return{set_rounds:P,set_state:B,set_iv:z,set_nonce:O,set_mask:q,set_counter:L,get_state:R,get_iv:K,gcm_init:N,cipher:F,mac:j}}({Uint8Array:Uint8Array,Uint32Array:Uint32Array},t,e);return c.set_key=function(t,e,s,n,a,o,u,f,l){var p=r.subarray(0,60),w=r.subarray(256,316);p.set([e,s,n,a,o,u,f,l]);for(var y=t,_=1;y<4*t+28;y++){var d=p[y-1];(y%t==0||8===t&&y%t==4)&&(d=i[d>>>24]<<24^i[d>>>16&255]<<16^i[d>>>8&255]<<8^i[255&d]),y%t==0&&(d=d<<8^d>>>24^_<<24,_=_<<1^(128&_?27:0)),p[y]=p[y-t]^d}for(var A=0;A=y-4?d:h[0][i[d>>>24]]^h[1][i[d>>>16&255]]^h[2][i[d>>>8&255]]^h[3][i[255&d]];c.set_rounds(t+5)},c};return c.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},c.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},c.MAC={CBC:0,GCM:1},c.HEAP_DATA=16384,c}(),r=new Uint8Array(1048576),s=e(null,r.buffer);function i(){var t=Error.apply(this,arguments);this.message=t.message,this.stack=t.stack}function n(){var t=Error.apply(this,arguments);this.message=t.message,this.stack=t.stack}function a(){var t=Error.apply(this,arguments);this.message=t.message,this.stack=t.stack}function h(t,e){e=!!e;for(var r=t.length,s=new Uint8Array(e?4*r:r),i=0,n=0;i=r)throw new Error("Malformed string, low surrogate expected at position "+i);a=(55296^a)<<10|65536|56320^t.charCodeAt(i)}else if(!e&&a>>>8)throw new Error("Wide characters are not allowed.");!e||a<=127?s[n++]=a:a<=2047?(s[n++]=192|a>>6,s[n++]=128|63&a):a<=65535?(s[n++]=224|a>>12,s[n++]=128|a>>6&63,s[n++]=128|63&a):(s[n++]=240|a>>18,s[n++]=128|a>>12&63,s[n++]=128|a>>6&63,s[n++]=128|63&a)}return s.subarray(0,n)}function o(t){for(var e="",r=0;r=192&&a<224&&i+1=224&&a<240&&i+2=240&&a<248&&i+3>10,s[n++]=56320|1023&h)}}var o="";for(i=0;i>2,r.getUint32(0),r.getUint32(4),r.getUint32(8),r.getUint32(12),e>16?r.getUint32(16):0,e>16?r.getUint32(20):0,e>24?r.getUint32(24):0,e>24?r.getUint32(28):0),this.key=t}else if(!this.key)throw new Error("key is required")}AES_CTR_set_options(t,e,r){if(void 0!==r){if(r<8||r>48)throw new n("illegal counter size");this.counterSize=r;var s=Math.pow(2,r)-1;this.asm.set_mask(0,0,s/4294967296|0,0|s)}else this.counterSize=r=48,this.asm.set_mask(0,0,65535,4294967295);if(void 0===t)throw new Error("nonce is required");if(!p(t))throw new TypeError("unexpected nonce type");var i=t.length;if(!i||i>16)throw new n("illegal nonce size");this.nonce=t;var a=new DataView(new ArrayBuffer(16));if(new Uint8Array(a.buffer).set(t),this.asm.set_nonce(a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)),void 0!==e){if(!u(e))throw new TypeError("unexpected counter type");if(e<0||e>=Math.pow(2,r))throw new n("illegal counter value");this.counter=e,this.asm.set_counter(0,0,e/4294967296|0,0|e)}else this.counter=0}AES_set_iv(t){if(void 0!==t){if(!p(t))throw new TypeError("unexpected iv type");if(16!==t.length)throw new n("illegal iv size");var e=new DataView(t.buffer,t.byteOffset,t.byteLength);this.iv=t,this.asm.set_iv(e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12))}else this.iv=null,this.asm.set_iv(0,0,0,0)}AES_set_padding(t){this.padding=void 0===t||!!t}AES_reset(t,e,r){return this.result=null,this.pos=0,this.len=0,this.AES_set_key(t),this.AES_set_iv(e),this.AES_set_padding(r),this}AES_Encrypt_process(t){if(!p(t))throw new TypeError("data isn't of expected type");for(var r=this.asm,s=this.heap,i=e.ENC[this.mode],n=e.HEAP_DATA,a=this.pos,h=this.len,o=0,c=t.length||0,u=0,f=0,l=new Uint8Array(h+c&-16);c>0;)h+=f=y(s,a+h,t,o,c),o+=f,c-=f,(f=r.cipher(i,n+a,h))&&l.set(s.subarray(a,a+f),u),u+=f,f0;)h+=w=y(s,a+h,t,o,c),o+=w,c-=w,(w=r.cipher(i,n+a,h-(c?0:l)))&&_.set(s.subarray(a,a+w),u),u+=w,w0){if(f%16){if(this.hasOwnProperty("padding"))throw new n("data length must be a multiple of the block size");f+=16-f%16}if(i.cipher(o,c+u,f),this.hasOwnProperty("padding")&&this.padding){var p=h[u+l-1];if(p<1||p>16||p>l)throw new a("bad padding");for(var w=0,y=p;y>1;y--)w|=p^h[u+l-y];if(w)throw new a("bad padding");l-=p}}var _=new Uint8Array(s+l);return s>0&&_.set(r),l>0&&_.set(h.subarray(u,u+l),s),this.result=_,this.pos=0,this.len=0,this}}var d=68719476704;class A extends _{constructor(t,e,r,s,i,n){super(t,void 0,!1,i,n),this.nonce=null,this.adata=null,this.iv=null,this.counter=1,this.tagSize=16,this.mode="GCM",this.BLOCK_SIZE=16,this.reset(t,s,e,r)}reset(t,e,r,s){return this.AES_GCM_reset(t,e,r,s)}encrypt(t){return this.AES_GCM_encrypt(t)}decrypt(t){return this.AES_GCM_decrypt(t)}AES_GCM_Encrypt_process(t){if(!p(t))throw new TypeError("data isn't of expected type");var r=0,s=t.length||0,i=this.asm,n=this.heap,a=this.counter,h=this.pos,o=this.len,c=0,u=o+s&-16,f=0;if((a-1<<4)+o+s>d)throw new RangeError("counter overflow");for(var l=new Uint8Array(u);s>0;)o+=f=y(n,h+o,t,r,s),r+=f,s-=f,f=i.cipher(e.ENC.CTR,e.HEAP_DATA+h,o),(f=i.mac(e.MAC.GCM,e.HEAP_DATA+h,f))&&l.set(n.subarray(h,h+f),c),a+=f>>>4,c+=f,f>>29,r[4]=u>>>21,r[5]=u>>>13&255,r[6]=u>>>5&255,r[7]=u<<3&255,r[8]=r[9]=r[10]=0,r[11]=f>>>29,r[12]=f>>>21&255,r[13]=f>>>13&255,r[14]=f>>>5&255,r[15]=f<<3&255,t.mac(e.MAC.GCM,e.HEAP_DATA,16),t.get_iv(e.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(e.ENC.CTR,e.HEAP_DATA,16),o.set(r.subarray(0,i),h),this.result=o,this.counter=1,this.pos=0,this.len=0,this}AES_GCM_Decrypt_process(t){if(!p(t))throw new TypeError("data isn't of expected type");var r=0,s=t.length||0,i=this.asm,n=this.heap,a=this.counter,h=this.tagSize,o=this.pos,c=this.len,u=0,f=c+s>h?c+s-h&-16:0,l=c+s-f,w=0;if((a-1<<4)+c+s>d)throw new RangeError("counter overflow");for(var _=new Uint8Array(f);s>l;)c+=w=y(n,o+c,t,r,s-l),r+=w,s-=w,w=i.mac(e.MAC.GCM,e.HEAP_DATA+o,w),(w=i.cipher(e.DEC.CTR,e.HEAP_DATA+o,w))&&_.set(n.subarray(o,o+w),u),a+=w>>>4,u+=w,o=0,c=0;return s>0&&(c+=y(n,0,t,r,s)),this.result=_,this.counter=a,this.pos=o,this.len=c,this}AES_GCM_Decrypt_finish(){var t=this.asm,r=this.heap,s=this.tagSize,n=this.adata,h=this.counter,o=this.pos,c=this.len,u=c-s;if(c>>29,r[4]=w>>>21,r[5]=w>>>13&255,r[6]=w>>>5&255,r[7]=w<<3&255,r[8]=r[9]=r[10]=0,r[11]=y>>>29,r[12]=y>>>21&255,r[13]=y>>>13&255,r[14]=y>>>5&255,r[15]=y<<3&255,t.mac(e.MAC.GCM,e.HEAP_DATA,16),t.get_iv(e.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(e.ENC.CTR,e.HEAP_DATA,16);var _=0;for(p=0;p16)throw new n("illegal tagSize value");this.tagSize=r}else this.tagSize=16;if(void 0===s)throw new Error("nonce is required");if(!p(s))throw new TypeError("unexpected nonce type");this.nonce=s;var f=s.length||0,l=new Uint8Array(16);12!==f?(this._gcm_mac_process(s),c[0]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=0,c[11]=f>>>29,c[12]=f>>>21&255,c[13]=f>>>13&255,c[14]=f>>>5&255,c[15]=f<<3&255,o.mac(e.MAC.GCM,e.HEAP_DATA,16),o.get_iv(e.HEAP_DATA),o.set_iv(),l.set(c.subarray(0,16))):(l.set(s),l[15]=1);var w=new DataView(l.buffer);if(this.gamma0=w.getUint32(12),o.set_nonce(w.getUint32(0),w.getUint32(4),w.getUint32(8),0),o.set_mask(0,0,0,4294967295),void 0!==i&&null!==i){if(!p(i))throw new TypeError("unexpected adata type");if(i.length>d)throw new n("illegal adata length");i.length?(this.adata=i,this._gcm_mac_process(i)):this.adata=null}else this.adata=null;if(void 0!==a){if(!u(a))throw new TypeError("counter must be a number");if(a<1||a>4294967295)throw new RangeError("counter must be a positive 32-bit integer");this.counter=a,o.set_counter(0,0,0,this.gamma0+a|0)}else this.counter=1,o.set_counter(0,0,0,this.gamma0+1|0);if(void 0!==h){if(!u(h))throw new TypeError("iv must be a number");this.iv=h,this.AES_set_iv(h)}return this}_gcm_mac_process(t){for(var r=this.heap,s=this.asm,i=0,n=t.length||0,a=0;n>0;){for(i+=a=y(r,0,t,i,n),n-=a;15&a;)r[a++]=0;s.mac(e.MAC.GCM,e.HEAP_DATA,a)}}}A.encrypt=function(t,e,i,n,a){if(void 0===t)throw new SyntaxError("data required");if(void 0===e)throw new SyntaxError("key required");if(void 0===i)throw new SyntaxError("nonce required");return new A(e,i,n,a,r,s).encrypt(t).result},A.decrypt=function(t,e,i,n,a){if(void 0===t)throw new SyntaxError("data required");if(void 0===e)throw new SyntaxError("key required");if(void 0===i)throw new SyntaxError("nonce required");return new A(e,i,n,a,r,s).decrypt(t).result};class v{constructor(t){if(!(t=t||{}).hash)throw new SyntaxError("option 'hash' is required");if(!t.hash.HASH_SIZE)throw new SyntaxError("option 'hash' supplied doesn't seem to be a valid hash function");return this.hash=t.hash,this.BLOCK_SIZE=this.hash.BLOCK_SIZE,this.HMAC_SIZE=this.hash.HASH_SIZE,this.key=null,this.verify=null,this.result=null,void 0===t.password&&void 0===t.verify||this.reset(t),this}reset(t){var e=(t=t||{}).password;if(null===this.key&&!f(e)&&!e)throw new i("no key is associated with the instance");this.result=null,this.hash.reset(),(e||f(e))&&(this.key=x(this.hash,e));for(var r=new Uint8Array(this.key),s=0;st.BLOCK_SIZE?r.set(t.reset().process(e).finish().result):r.set(e),r}var E=64,g=32;function m(t){t=t||{},this.heap=w(Uint8Array,t.heap),this.asm=t.asm||function(t,e,r){"use asm";var s=0,i=0,n=0,a=0,h=0,o=0,c=0,u=0,f=0,l=0,p=0,w=0,y=0,_=0,d=0,A=0,v=0,x=0,E=0,g=0,m=0,b=0,S=0,C=0,M=0,U=0,H=new t.Uint8Array(r);function T(t,e,r,f,l,p,w,y,_,d,A,v,x,E,g,m){t=t|0;e=e|0;r=r|0;f=f|0;l=l|0;p=p|0;w=w|0;y=y|0;_=_|0;d=d|0;A=A|0;v=v|0;x=x|0;E=E|0;g=g|0;m=m|0;var b=0,S=0,C=0,M=0,U=0,H=0,T=0,D=0;b=s;S=i;C=n;M=a;U=h;H=o;T=c;D=u;D=t+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0x428a2f98|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;T=e+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0x71374491|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;H=r+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0xb5c0fbcf|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;U=f+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0xe9b5dba5|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;M=l+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x3956c25b|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;C=p+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0x59f111f1|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;S=w+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x923f82a4|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;b=y+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0xab1c5ed5|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;D=_+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0xd807aa98|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;T=d+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0x12835b01|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;H=A+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0x243185be|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;U=v+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0x550c7dc3|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;M=x+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x72be5d74|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;C=E+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0x80deb1fe|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;S=g+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x9bdc06a7|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;b=m+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0xc19bf174|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+t+d|0;D=t+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0xe49b69c1|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;e=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+e+A|0;T=e+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0xefbe4786|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;r=(f>>>7^f>>>18^f>>>3^f<<25^f<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+r+v|0;H=r+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0x0fc19dc6|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;f=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+f+x|0;U=f+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0x240ca1cc|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;l=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+E|0;M=l+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x2de92c6f|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;p=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(f>>>17^f>>>19^f>>>10^f<<15^f<<13)+p+g|0;C=p+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0x4a7484aa|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;w=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+w+m|0;S=w+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x5cb0a9dc|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;y=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+t|0;b=y+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0x76f988da|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;_=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+_+e|0;D=_+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0x983e5152|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;d=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+d+r|0;T=d+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0xa831c66d|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;A=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+A+f|0;H=A+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0xb00327c8|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;v=(x>>>7^x>>>18^x>>>3^x<<25^x<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+v+l|0;U=v+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0xbf597fc7|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;x=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+x+p|0;M=x+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0xc6e00bf3|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;E=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+E+w|0;C=E+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0xd5a79147|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;g=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(x>>>17^x>>>19^x>>>10^x<<15^x<<13)+g+y|0;S=g+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x06ca6351|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;m=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+m+_|0;b=m+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0x14292967|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+t+d|0;D=t+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0x27b70a85|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;e=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+e+A|0;T=e+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0x2e1b2138|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;r=(f>>>7^f>>>18^f>>>3^f<<25^f<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+r+v|0;H=r+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0x4d2c6dfc|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;f=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+f+x|0;U=f+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0x53380d13|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;l=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+E|0;M=l+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x650a7354|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;p=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(f>>>17^f>>>19^f>>>10^f<<15^f<<13)+p+g|0;C=p+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0x766a0abb|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;w=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+w+m|0;S=w+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x81c2c92e|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;y=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+t|0;b=y+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0x92722c85|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;_=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+_+e|0;D=_+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0xa2bfe8a1|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;d=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+d+r|0;T=d+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0xa81a664b|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;A=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+A+f|0;H=A+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0xc24b8b70|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;v=(x>>>7^x>>>18^x>>>3^x<<25^x<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+v+l|0;U=v+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0xc76c51a3|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;x=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+x+p|0;M=x+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0xd192e819|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;E=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+E+w|0;C=E+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0xd6990624|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;g=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(x>>>17^x>>>19^x>>>10^x<<15^x<<13)+g+y|0;S=g+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0xf40e3585|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;m=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+m+_|0;b=m+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0x106aa070|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+t+d|0;D=t+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0x19a4c116|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;e=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+e+A|0;T=e+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0x1e376c08|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;r=(f>>>7^f>>>18^f>>>3^f<<25^f<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+r+v|0;H=r+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0x2748774c|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;f=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+f+x|0;U=f+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0x34b0bcb5|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;l=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+E|0;M=l+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x391c0cb3|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;p=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(f>>>17^f>>>19^f>>>10^f<<15^f<<13)+p+g|0;C=p+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0x4ed8aa4a|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;w=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+w+m|0;S=w+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0x5b9cca4f|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;y=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+t|0;b=y+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0x682e6ff3|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;_=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+_+e|0;D=_+D+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(T^U&(H^T))+0x748f82ee|0;M=M+D|0;D=D+(b&S^C&(b^S))+(b>>>2^b>>>13^b>>>22^b<<30^b<<19^b<<10)|0;d=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+d+r|0;T=d+T+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(H^M&(U^H))+0x78a5636f|0;C=C+T|0;T=T+(D&b^S&(D^b))+(D>>>2^D>>>13^D>>>22^D<<30^D<<19^D<<10)|0;A=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+A+f|0;H=A+H+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(M^U))+0x84c87814|0;S=S+H|0;H=H+(T&D^b&(T^D))+(T>>>2^T>>>13^T>>>22^T<<30^T<<19^T<<10)|0;v=(x>>>7^x>>>18^x>>>3^x<<25^x<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+v+l|0;U=v+U+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(M^S&(C^M))+0x8cc70208|0;b=b+U|0;U=U+(H&T^D&(H^T))+(H>>>2^H>>>13^H>>>22^H<<30^H<<19^H<<10)|0;x=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+x+p|0;M=x+M+(b>>>6^b>>>11^b>>>25^b<<26^b<<21^b<<7)+(C^b&(S^C))+0x90befffa|0;D=D+M|0;M=M+(U&H^T&(U^H))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;E=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+E+w|0;C=E+C+(D>>>6^D>>>11^D>>>25^D<<26^D<<21^D<<7)+(S^D&(b^S))+0xa4506ceb|0;T=T+C|0;C=C+(M&U^H&(M^U))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;g=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(x>>>17^x>>>19^x>>>10^x<<15^x<<13)+g+y|0;S=g+S+(T>>>6^T>>>11^T>>>25^T<<26^T<<21^T<<7)+(b^T&(D^b))+0xbef9a3f7|0;H=H+S|0;S=S+(C&M^U&(C^M))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;m=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+m+_|0;b=m+b+(H>>>6^H>>>11^H>>>25^H<<26^H<<21^H<<7)+(D^H&(T^D))+0xc67178f2|0;U=U+b|0;b=b+(S&C^M&(S^C))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;s=s+b|0;i=i+S|0;n=n+C|0;a=a+M|0;h=h+U|0;o=o+H|0;c=c+T|0;u=u+D|0}function D(t){t=t|0;T(H[t|0]<<24|H[t|1]<<16|H[t|2]<<8|H[t|3],H[t|4]<<24|H[t|5]<<16|H[t|6]<<8|H[t|7],H[t|8]<<24|H[t|9]<<16|H[t|10]<<8|H[t|11],H[t|12]<<24|H[t|13]<<16|H[t|14]<<8|H[t|15],H[t|16]<<24|H[t|17]<<16|H[t|18]<<8|H[t|19],H[t|20]<<24|H[t|21]<<16|H[t|22]<<8|H[t|23],H[t|24]<<24|H[t|25]<<16|H[t|26]<<8|H[t|27],H[t|28]<<24|H[t|29]<<16|H[t|30]<<8|H[t|31],H[t|32]<<24|H[t|33]<<16|H[t|34]<<8|H[t|35],H[t|36]<<24|H[t|37]<<16|H[t|38]<<8|H[t|39],H[t|40]<<24|H[t|41]<<16|H[t|42]<<8|H[t|43],H[t|44]<<24|H[t|45]<<16|H[t|46]<<8|H[t|47],H[t|48]<<24|H[t|49]<<16|H[t|50]<<8|H[t|51],H[t|52]<<24|H[t|53]<<16|H[t|54]<<8|H[t|55],H[t|56]<<24|H[t|57]<<16|H[t|58]<<8|H[t|59],H[t|60]<<24|H[t|61]<<16|H[t|62]<<8|H[t|63])}function k(t){t=t|0;H[t|0]=s>>>24;H[t|1]=s>>>16&255;H[t|2]=s>>>8&255;H[t|3]=s&255;H[t|4]=i>>>24;H[t|5]=i>>>16&255;H[t|6]=i>>>8&255;H[t|7]=i&255;H[t|8]=n>>>24;H[t|9]=n>>>16&255;H[t|10]=n>>>8&255;H[t|11]=n&255;H[t|12]=a>>>24;H[t|13]=a>>>16&255;H[t|14]=a>>>8&255;H[t|15]=a&255;H[t|16]=h>>>24;H[t|17]=h>>>16&255;H[t|18]=h>>>8&255;H[t|19]=h&255;H[t|20]=o>>>24;H[t|21]=o>>>16&255;H[t|22]=o>>>8&255;H[t|23]=o&255;H[t|24]=c>>>24;H[t|25]=c>>>16&255;H[t|26]=c>>>8&255;H[t|27]=c&255;H[t|28]=u>>>24;H[t|29]=u>>>16&255;H[t|30]=u>>>8&255;H[t|31]=u&255}function G(){s=0x6a09e667;i=0xbb67ae85;n=0x3c6ef372;a=0xa54ff53a;h=0x510e527f;o=0x9b05688c;c=0x1f83d9ab;u=0x5be0cd19;f=l=0}function I(t,e,r,p,w,y,_,d,A,v){t=t|0;e=e|0;r=r|0;p=p|0;w=w|0;y=y|0;_=_|0;d=d|0;A=A|0;v=v|0;s=t;i=e;n=r;a=p;h=w;o=y;c=_;u=d;f=A;l=v}function Z(t,e){t=t|0;e=e|0;var r=0;if(t&63)return-1;while((e|0)>=64){D(t);t=t+64|0;e=e-64|0;r=r+64|0}f=f+r|0;if(f>>>0>>0)l=l+1|0;return r|0}function P(t,e,r){t=t|0;e=e|0;r=r|0;var s=0,i=0;if(t&63)return-1;if(~r)if(r&31)return-1;if((e|0)>=64){s=Z(t,e)|0;if((s|0)==-1)return-1;t=t+s|0;e=e-s|0}s=s+e|0;f=f+e|0;if(f>>>0>>0)l=l+1|0;H[t|e]=0x80;if((e|0)>=56){for(i=e+1|0;(i|0)<64;i=i+1|0)H[t|i]=0x00;D(t);e=0;H[t|0]=0}for(i=e+1|0;(i|0)<59;i=i+1|0)H[t|i]=0;H[t|56]=l>>>21&255;H[t|57]=l>>>13&255;H[t|58]=l>>>5&255;H[t|59]=l<<3&255|f>>>29;H[t|60]=f>>>21&255;H[t|61]=f>>>13&255;H[t|62]=f>>>5&255;H[t|63]=f<<3&255;D(t);if(~r)k(r);return s|0}function B(){s=p;i=w;n=y;a=_;h=d;o=A;c=v;u=x;f=64;l=0}function z(){s=E;i=g;n=m;a=b;h=S;o=C;c=M;u=U;f=64;l=0}function O(t,e,r,H,D,k,I,Z,P,B,z,O,q,L,R,K){t=t|0;e=e|0;r=r|0;H=H|0;D=D|0;k=k|0;I=I|0;Z=Z|0;P=P|0;B=B|0;z=z|0;O=O|0;q=q|0;L=L|0;R=R|0;K=K|0;G();T(t^0x5c5c5c5c,e^0x5c5c5c5c,r^0x5c5c5c5c,H^0x5c5c5c5c,D^0x5c5c5c5c,k^0x5c5c5c5c,I^0x5c5c5c5c,Z^0x5c5c5c5c,P^0x5c5c5c5c,B^0x5c5c5c5c,z^0x5c5c5c5c,O^0x5c5c5c5c,q^0x5c5c5c5c,L^0x5c5c5c5c,R^0x5c5c5c5c,K^0x5c5c5c5c);E=s;g=i;m=n;b=a;S=h;C=o;M=c;U=u;G();T(t^0x36363636,e^0x36363636,r^0x36363636,H^0x36363636,D^0x36363636,k^0x36363636,I^0x36363636,Z^0x36363636,P^0x36363636,B^0x36363636,z^0x36363636,O^0x36363636,q^0x36363636,L^0x36363636,R^0x36363636,K^0x36363636);p=s;w=i;y=n;_=a;d=h;A=o;v=c;x=u;f=64;l=0}function q(t,e,r){t=t|0;e=e|0;r=r|0;var f=0,l=0,p=0,w=0,y=0,_=0,d=0,A=0,v=0;if(t&63)return-1;if(~r)if(r&31)return-1;v=P(t,e,-1)|0;f=s,l=i,p=n,w=a,y=h,_=o,d=c,A=u;z();T(f,l,p,w,y,_,d,A,0x80000000,0,0,0,0,0,0,768);if(~r)k(r);return v|0}function L(t,e,r,f,l){t=t|0;e=e|0;r=r|0;f=f|0;l=l|0;var p=0,w=0,y=0,_=0,d=0,A=0,v=0,x=0,E=0,g=0,m=0,b=0,S=0,C=0,M=0,U=0;if(t&63)return-1;if(~l)if(l&31)return-1;H[t+e|0]=r>>>24;H[t+e+1|0]=r>>>16&255;H[t+e+2|0]=r>>>8&255;H[t+e+3|0]=r&255;q(t,e+4|0,-1)|0;p=E=s,w=g=i,y=m=n,_=b=a,d=S=h,A=C=o,v=M=c,x=U=u;f=f-1|0;while((f|0)>0){B();T(E,g,m,b,S,C,M,U,0x80000000,0,0,0,0,0,0,768);E=s,g=i,m=n,b=a,S=h,C=o,M=c,U=u;z();T(E,g,m,b,S,C,M,U,0x80000000,0,0,0,0,0,0,768);E=s,g=i,m=n,b=a,S=h,C=o,M=c,U=u;p=p^s;w=w^i;y=y^n;_=_^a;d=d^h;A=A^o;v=v^c;x=x^u;f=f-1|0}s=p;i=w;n=y;a=_;h=d;o=A;c=v;u=x;if(~l)k(l);return 0}return{reset:G,init:I,process:Z,finish:P,hmac_reset:B,hmac_init:O,hmac_finish:q,pbkdf2_generate_block:L}}({Uint8Array:Uint8Array},null,this.heap.buffer),this.BLOCK_SIZE=E,this.HASH_SIZE=g,this.reset()}m.BLOCK_SIZE=E,m.HASH_SIZE=g,m.NAME="sha256";var b=m.prototype;b.reset=function(){return this.result=null,this.pos=0,this.len=0,this.asm.reset(),this},b.process=function(t){if(null!==this.result)throw new i("state must be reset before processing new data");if(f(t)&&(t=h(t)),l(t)&&(t=new Uint8Array(t)),!p(t))throw new TypeError("data isn't of expected type");for(var e=this.asm,r=this.heap,s=this.pos,n=this.len,a=0,o=t.length,c=0;o>0;)n+=c=y(r,s+n,t,a,o),a+=c,o-=c,s+=c=e.process(s,n),(n-=c)||(s=0);return this.pos=s,this.len=n,this},b.finish=function(){if(null!==this.result)throw new i("state must be reset before processing new data");return this.asm.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(this.heap.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this};var S=null;class C extends v{constructor(t){(t=t||{}).hash instanceof m||(t.hash=(null===S&&(S=new m({heapSize:1048576})),S)),super(t)}reset(t){t=t||{},this.result=null,this.hash.reset();var e=t.password;if(void 0!==e){f(e)&&(e=h(e));var r=this.key=x(this.hash,e);this.hash.reset().asm.hmac_init(r[0]<<24|r[1]<<16|r[2]<<8|r[3],r[4]<<24|r[5]<<16|r[6]<<8|r[7],r[8]<<24|r[9]<<16|r[10]<<8|r[11],r[12]<<24|r[13]<<16|r[14]<<8|r[15],r[16]<<24|r[17]<<16|r[18]<<8|r[19],r[20]<<24|r[21]<<16|r[22]<<8|r[23],r[24]<<24|r[25]<<16|r[26]<<8|r[27],r[28]<<24|r[29]<<16|r[30]<<8|r[31],r[32]<<24|r[33]<<16|r[34]<<8|r[35],r[36]<<24|r[37]<<16|r[38]<<8|r[39],r[40]<<24|r[41]<<16|r[42]<<8|r[43],r[44]<<24|r[45]<<16|r[46]<<8|r[47],r[48]<<24|r[49]<<16|r[50]<<8|r[51],r[52]<<24|r[53]<<16|r[54]<<8|r[55],r[56]<<24|r[57]<<16|r[58]<<8|r[59],r[60]<<24|r[61]<<16|r[62]<<8|r[63])}else this.hash.asm.hmac_reset();var s=t.verify;return void 0!==s?this._hmac_init_verify(s):this.verify=null,this}finish(){if(null===this.key)throw new i("no key is associated with the instance");if(null!==this.result)throw new i("state must be reset before processing new data");var t=this.hash,e=this.hash.asm,r=this.hash.heap;e.hmac_finish(t.pos,t.len,0);var s=this.verify,n=new Uint8Array(g);if(n.set(r.subarray(0,g)),s)if(s.length===n.length){for(var a=0,h=0;h>>24&255,a>>>16&255,a>>>8&255,255&a])).finish().result);this.result.set(c.subarray(0,o),h);for(var u=1;u