UNPKG

g1lib

Version:

An ubiquitous static javascript toolbox lib for Ǧ1 / Duniter ecosystem with reliability in mind.

1 lines 110 kB
import Le from"stream";import In from"http";import rr from"url";import $n from"whatwg-url";import Yf from"https";import ot from"zlib";import*as Hf from"crypto";const Kf="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye=Ct(Kf),Dn=Ct("0123456789abcdef"),gn=Ct(Mn),It={encode:e=>{const t=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e),n=Math.ceil(t.length/3)*3,r=new Uint8Array(n);r.set(t);const f=gn.encode(r).split(""),i=n*4/3;for(;f.length<i;)f.unshift(Mn[0]);for(let o=0;o<n-t.length;o++)f[f.length-1-o]="=";return f.join("")},decode:e=>{const t=gn.decode(e.replace(/=/g,"A")),n=Math.ceil(3*e.length/4),r=(e.match(/=/g)||[]).length,f=t.length-n;return t.slice(f,t.length-r)}};function Ct(e){const t={ALPHABET_MAP:{},BASE:e.length,LEADER:e.charAt(0),ALPHABET:e};for(let n=0;n<t.ALPHABET.length;n++){const r=t.ALPHABET.charAt(n);if(t.ALPHABET_MAP[r]!==void 0)throw new TypeError(r+" is ambiguous");t.ALPHABET_MAP[r]=n}return{encode:n=>kf(n,t),decode:n=>Gf(n,t)}}function kf(e,t){if(e.length===0)return"";const n=[0];for(let f of e){for(let i=0;i<n.length;++i)f+=n[i]<<8,n[i]=f%t.BASE,f=f/t.BASE|0;for(;f>0;)n.push(f%t.BASE),f=f/t.BASE|0}let r="";for(let f=0;e[f]===0&&f<e.length-1;++f)r+=t.LEADER;for(let f=n.length-1;f>=0;--f)r+=t.ALPHABET[n[f]];return r}function Zf(e,t){if(typeof e!="string")throw new TypeError("Expected String");if(e.length===0)return new Uint8Array(0);const n=[0];for(const r of e){const f=t.ALPHABET_MAP[r];if(f===void 0)return;let i=f;for(let o=0;o<n.length;++o)i+=n[o]*t.BASE,n[o]=i&255,i>>=8;for(;i>0;)n.push(i&255),i>>=8}for(let r=0;e[r]===t.LEADER&&r<e.length-1;++r)n.push(0);return new Uint8Array(n.reverse())}function Gf(e,t){const n=Zf(e,t);if(n)return n;throw new Error("Non-base"+t.BASE+" character")}var Ii=Object.freeze({__proto__:null,b58:ye,b16:Dn,default:Ct,b64:It,basex:Ct});var qf=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),f=0,t=0;t<n;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,f++)r[f]=i[o];return r};function Vf(e,t,n){var r=n===void 0?{}:n,f=r.N,i=f===void 0?16384:f,o=r.logN,a=r.r,c=a===void 0?8:a,h=r.p,l=h===void 0?1:h,A=r.dkLen,b=A===void 0?32:A,y=r.interruptStep,m=y===void 0?0:y,U=r.encoding;return new Promise(function(C,P){if(!o&&!i)return P(new Error("scrypt: missing N or logN parameter"));if(o||o===0){if(o<1||o>31)return P(new Error("scrypt: logN must be between 1 and 31"));i=1<<o>>>0}else{if(i<2||i>kt)return P(new Error("scrypt: N is out of range"));if(i&i-1)return P(Error("scrypt: N is not a power of 2"))}if(l<1)return P(new Error("scrypt: invalid p"));if(c<1)return P(new Error("scrypt: invalid r"));Wf({password:e,salt:t,N:i,r:c,p:l,dkLen:b,interruptStep:m,encoding:U},C)})}function Wf(e,t){var n=e.password,r=e.salt,f=e.N,i=e.r,o=e.p,a=e.dkLen,c=e.interruptStep,h=e.encoding;function l(u){var s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=1779033703,p=3144134277,L=1013904242,N=2773480762,k=1359893119,K=2600822924,V=528734635,Z=1541459225,X=new Array(64);function ee(We){for(var Ut=0,S=We.length;S>=64;){var ge=g,ve=p,me=L,Pe=N,ue=k,Se=K,Te=V,Re=Z,ce=void 0,ne=void 0,Ee=void 0,Ae=void 0,Ue=void 0;for(ne=0;ne<16;ne++)Ee=Ut+ne*4,X[ne]=(We[Ee]&255)<<24|(We[Ee+1]&255)<<16|(We[Ee+2]&255)<<8|We[Ee+3]&255;for(ne=16;ne<64;ne++)ce=X[ne-2],Ae=(ce>>>17|ce<<32-17)^(ce>>>19|ce<<32-19)^ce>>>10,ce=X[ne-15],Ue=(ce>>>7|ce<<32-7)^(ce>>>18|ce<<32-18)^ce>>>3,X[ne]=(Ae+X[ne-7]|0)+(Ue+X[ne-16]|0)|0;for(ne=0;ne<64;ne++)Ae=(((ue>>>6|ue<<32-6)^(ue>>>11|ue<<32-11)^(ue>>>25|ue<<32-25))+(ue&Se^~ue&Te)|0)+(Re+(s[ne]+X[ne]|0)|0)|0,Ue=((ge>>>2|ge<<32-2)^(ge>>>13|ge<<32-13)^(ge>>>22|ge<<32-22))+(ge&ve^ge&me^ve&me)|0,Re=Te,Te=Se,Se=ue,ue=Pe+Ae|0,Pe=me,me=ve,ve=ge,ge=Ae+Ue|0;g=g+ge|0,p=p+ve|0,L=L+me|0,N=N+Pe|0,k=k+ue|0,K=K+Se|0,V=V+Te|0,Z=Z+Re|0,Ut+=64,S-=64}}ee(u);var Q,re=u.length%64,fe=u.length/536870912|0,ie=u.length<<3,oe=re<56?56:120,we=u.slice(u.length-re,u.length);for(we.push(128),Q=re+1;Q<oe;Q++)we.push(0);return we.push(fe>>>24&255),we.push(fe>>>16&255),we.push(fe>>>8&255),we.push(fe>>>0&255),we.push(ie>>>24&255),we.push(ie>>>16&255),we.push(ie>>>8&255),we.push(ie>>>0&255),ee(we),[g>>>24&255,g>>>16&255,g>>>8&255,g>>>0&255,p>>>24&255,p>>>16&255,p>>>8&255,p>>>0&255,L>>>24&255,L>>>16&255,L>>>8&255,L>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,k>>>24&255,k>>>16&255,k>>>8&255,k>>>0&255,K>>>24&255,K>>>16&255,K>>>8&255,K>>>0&255,V>>>24&255,V>>>16&255,V>>>8&255,V>>>0&255,Z>>>24&255,Z>>>16&255,Z>>>8&255,Z>>>0&255]}function A(u,s,g){u.length>64&&(u=l(u.push?u:qf(u)));var p,L=64+s.length+4,N=new Array(L),k=new Array(64),K=[];for(p=0;p<64;p++)N[p]=54;for(p=0;p<u.length;p++)N[p]^=u[p];for(p=0;p<s.length;p++)N[64+p]=s[p];for(p=L-4;p<L;p++)N[p]=0;for(p=0;p<64;p++)k[p]=92;for(p=0;p<u.length;p++)k[p]^=u[p];function V(){for(var Z=L-1;Z>=L-4;Z--){if(N[Z]++,N[Z]<=255)return;N[Z]=0}}for(;g>=32;)V(),K=K.concat(l(k.concat(l(N)))),g-=32;return g>0&&(V(),K=K.concat(l(k.concat(l(N))).slice(0,g))),K}function b(u,s,g,p){var L=u[0]^s[g++],N=u[1]^s[g++],k=u[2]^s[g++],K=u[3]^s[g++],V=u[4]^s[g++],Z=u[5]^s[g++],X=u[6]^s[g++],ee=u[7]^s[g++],Q=u[8]^s[g++],re=u[9]^s[g++],fe=u[10]^s[g++],ie=u[11]^s[g++],oe=u[12]^s[g++],we=u[13]^s[g++],We=u[14]^s[g++],Ut=u[15]^s[g++],S,ge,ve=L,me=N,Pe=k,ue=K,Se=V,Te=Z,Re=X,ce=ee,ne=Q,Ee=re,Ae=fe,Ue=ie,rt=oe,nt=we,ft=We,it=Ut;for(ge=0;ge<8;ge+=2)S=ve+rt,Se^=S<<7|S>>>32-7,S=Se+ve,ne^=S<<9|S>>>32-9,S=ne+Se,rt^=S<<13|S>>>32-13,S=rt+ne,ve^=S<<18|S>>>32-18,S=Te+me,Ee^=S<<7|S>>>32-7,S=Ee+Te,nt^=S<<9|S>>>32-9,S=nt+Ee,me^=S<<13|S>>>32-13,S=me+nt,Te^=S<<18|S>>>32-18,S=Ae+Re,ft^=S<<7|S>>>32-7,S=ft+Ae,Pe^=S<<9|S>>>32-9,S=Pe+ft,Re^=S<<13|S>>>32-13,S=Re+Pe,Ae^=S<<18|S>>>32-18,S=it+Ue,ue^=S<<7|S>>>32-7,S=ue+it,ce^=S<<9|S>>>32-9,S=ce+ue,Ue^=S<<13|S>>>32-13,S=Ue+ce,it^=S<<18|S>>>32-18,S=ve+ue,me^=S<<7|S>>>32-7,S=me+ve,Pe^=S<<9|S>>>32-9,S=Pe+me,ue^=S<<13|S>>>32-13,S=ue+Pe,ve^=S<<18|S>>>32-18,S=Te+Se,Re^=S<<7|S>>>32-7,S=Re+Te,ce^=S<<9|S>>>32-9,S=ce+Re,Se^=S<<13|S>>>32-13,S=Se+ce,Te^=S<<18|S>>>32-18,S=Ae+Ee,Ue^=S<<7|S>>>32-7,S=Ue+Ae,ne^=S<<9|S>>>32-9,S=ne+Ue,Ee^=S<<13|S>>>32-13,S=Ee+ne,Ae^=S<<18|S>>>32-18,S=it+ft,rt^=S<<7|S>>>32-7,S=rt+it,nt^=S<<9|S>>>32-9,S=nt+rt,ft^=S<<13|S>>>32-13,S=ft+nt,it^=S<<18|S>>>32-18;s[p++]=u[0]=ve+L|0,s[p++]=u[1]=me+N|0,s[p++]=u[2]=Pe+k|0,s[p++]=u[3]=ue+K|0,s[p++]=u[4]=Se+V|0,s[p++]=u[5]=Te+Z|0,s[p++]=u[6]=Re+X|0,s[p++]=u[7]=ce+ee|0,s[p++]=u[8]=ne+Q|0,s[p++]=u[9]=Ee+re|0,s[p++]=u[10]=Ae+fe|0,s[p++]=u[11]=Ue+ie|0,s[p++]=u[12]=rt+oe|0,s[p++]=u[13]=nt+we|0,s[p++]=u[14]=ft+We|0,s[p++]=u[15]=it+Ut|0}function y(u,s,g,p,L){for(;L--;)u[s++]=g[p++]}function m(u,s,g,p,L){for(;L--;)u[s++]^=g[p++]}function U(u,s,g,p,L){y(u,0,s,g+(2*L-1)*16,16);for(var N=0;N<2*L;N+=2)b(u,s,g+N*16,p+N*8),b(u,s,g+N*16+16,p+N*8+L*16)}function C(u,s,g){return u[s+(2*g-1)*16]}function P(u){for(var s=[],g=0;g<u.length;g++){var p=u.charCodeAt(g);if(p<128)s.push(p);else if(p<2048)s.push(192|p>>6),s.push(128|p&63);else if(p<55296)s.push(224|p>>12),s.push(128|p>>6&63),s.push(128|p&63);else{if(g>=u.length-1)throw new Error("invalid string");g++,p=(p&1023)<<10,p|=u.charCodeAt(g)&1023,p+=65536,s.push(240|p>>18),s.push(128|p>>12&63),s.push(128|p>>6&63),s.push(128|p&63)}}return s}function I(u){for(var s="0123456789abcdef".split(""),g=u.length,p=[],L=0;L<g;L++)p.push(s[u[L]>>>4&15]),p.push(s[u[L]>>>0&15]);return p.join("")}function D(u){for(var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),g=u.length,p=[],L=0,N,k,K,V;L<g;)N=L<g?u[L++]:0,k=L<g?u[L++]:0,K=L<g?u[L++]:0,V=(N<<16)+(k<<8)+K,p.push(s[V>>>3*6&63]),p.push(s[V>>>2*6&63]),p.push(s[V>>>1*6&63]),p.push(s[V>>>0*6&63]);return g%3>0&&(p[p.length-1]="=",g%3===1&&(p[p.length-2]="=")),p.join("")}var B,R,O,z;if(i*o>=1<<30||i>kt/128/o||i>kt/256||f>kt/128/i)throw new Error("scrypt: parameters are too large");typeof n=="string"&&(n=P(n)),typeof r=="string"&&(r=P(r)),typeof Int32Array<"u"?(B=new Int32Array(64*i),R=new Int32Array(32*f*i),z=new Int32Array(16)):(B=[],R=[],z=new Array(16)),O=A(n,r,o*128*i);var j=0,F=32*i;function x(u){for(var s=0;s<32*i;s++){var g=u+s*4;B[j+s]=(O[g+3]&255)<<24|(O[g+2]&255)<<16|(O[g+1]&255)<<8|(O[g+0]&255)<<0}}function d(u,s){for(var g=u;g<s;g+=2)y(R,g*(32*i),B,j,32*i),U(z,B,j,F,i),y(R,(g+1)*(32*i),B,F,32*i),U(z,B,F,j,i)}function E(u,s){for(var g=u;g<s;g+=2){var p=C(B,j,i)&f-1;m(B,j,R,p*(32*i),32*i),U(z,B,j,F,i),p=C(B,F,i)&f-1,m(B,F,R,p*(32*i),32*i),U(z,B,F,j,i)}}function w(u){for(var s=0;s<32*i;s++){var g=B[j+s];O[u+s*4+0]=g>>>0&255,O[u+s*4+1]=g>>>8&255,O[u+s*4+2]=g>>>16&255,O[u+s*4+3]=g>>>24&255}}var v=typeof setImmediate<"u"?setImmediate:setTimeout;function T(u,s,g,p,L){(function N(){v(function(){p(u,u+g<s?u+g:s),u+=g,u<s?N():L()})})()}function H(u){var s=A(n,O,a);return u==="base64"?D(s):u==="hex"?I(s):u==="binary"?new Uint8Array(s):s}function G(){for(var u=0;u<o;u++)x(u*128*i),d(0,f),E(0,f),w(u*128*i);t(H(h))}function q(u){x(u*128*i),T(0,f,c*2,d,function(){T(0,f,c*2,E,function(){w(u*128*i),u+1<o?v(function(){q(u+1)}):t(H(h))})})}c<=0?G():q(0)}var kt=-1>>>0;var qt="input is invalid type";typeof process=="object"&&process.versions&&process.versions.node;var $="0123456789abcdef".split(""),Xf=[-2147483648,8388608,32768,128],ze=[24,16,8,0],Yt=[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],Vt=["hex","array","digest","arrayBuffer"],le=[],wn=function(e,t){return function(n){return new xe(t,!0).update(n)[e]()}};function nr(e){var t=wn("hex",e);t.create=function(){return new xe(e)},t.update=function(f){return t.create().update(f)};for(var n=0;n<Vt.length;++n){var r=Vt[n];t[r]=wn(r,e)}return t}var vn=function(e,t){return function(n,r){return new fr(n,t,!0).update(r)[e]()}},Yn=function(e){var t=vn("hex",e);t.create=function(f){return new fr(f,e)},t.update=function(f,i){return t.create(f).update(i)};for(var n=0;n<Vt.length;++n){var r=Vt[n];t[r]=vn(r,e)}return t};function xe(e,t){t?(le[0]=le[16]=le[1]=le[2]=le[3]=le[4]=le[5]=le[6]=le[7]=le[8]=le[9]=le[10]=le[11]=le[12]=le[13]=le[14]=le[15]=0,this.blocks=le):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}xe.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if(n!=="string"){if(n==="object"){if(e===null)throw new Error(qt);e=new Uint8Array(e)}else throw new Error(qt);t=!0}for(var r,f=0,i,o=e.length,a=this.blocks;f<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(i=this.start;f<o&&i<64;++f)a[i>>2]|=e[f]<<ze[i++&3];else for(i=this.start;f<o&&i<64;++f)r=e.charCodeAt(f),r<128?a[i>>2]|=r<<ze[i++&3]:r<2048?(a[i>>2]|=(192|r>>6)<<ze[i++&3],a[i>>2]|=(128|r&63)<<ze[i++&3]):r<55296||r>=57344?(a[i>>2]|=(224|r>>12)<<ze[i++&3],a[i>>2]|=(128|r>>6&63)<<ze[i++&3],a[i>>2]|=(128|r&63)<<ze[i++&3]):(r=65536+((r&1023)<<10|e.charCodeAt(++f)&1023),a[i>>2]|=(240|r>>18)<<ze[i++&3],a[i>>2]|=(128|r>>12&63)<<ze[i++&3],a[i>>2]|=(128|r>>6&63)<<ze[i++&3],a[i>>2]|=(128|r&63)<<ze[i++&3]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};xe.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Xf[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}};xe.prototype.hash=function(){var e=this.h0,t=this.h1,n=this.h2,r=this.h3,f=this.h4,i=this.h5,o=this.h6,a=this.h7,c=this.blocks,h,l,A,b,y,m,U,C,P,I,D;for(h=16;h<64;++h)y=c[h-15],l=(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3,y=c[h-2],A=(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10,c[h]=c[h-16]+l+c[h-7]+A<<0;for(D=t&n,h=0;h<64;h+=4)this.first?(this.is224?(C=300032,y=c[0]-1413257819,a=y-150054599<<0,r=y+24177077<<0):(C=704751109,y=c[0]-210244248,a=y-1521486534<<0,r=y+143694565<<0),this.first=!1):(l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),A=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7),C=e&t,b=C^e&n^D,U=f&i^~f&o,y=a+A+U+Yt[h]+c[h],m=l+b,a=r+y<<0,r=y+m<<0),l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),A=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),P=r&e,b=P^r&t^C,U=a&f^~a&i,y=o+A+U+Yt[h+1]+c[h+1],m=l+b,o=n+y<<0,n=y+m<<0,l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),A=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),I=n&r,b=I^n&e^P,U=o&a^~o&f,y=i+A+U+Yt[h+2]+c[h+2],m=l+b,i=t+y<<0,t=y+m<<0,l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),A=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),D=t&n,b=D^t&r^I,U=i&o^~i&a,y=f+A+U+Yt[h+3]+c[h+3],m=l+b,f=e+y<<0,e=y+m<<0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+f<<0,this.h5=this.h5+i<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0};xe.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,f=this.h4,i=this.h5,o=this.h6,a=this.h7,c=$[e>>28&15]+$[e>>24&15]+$[e>>20&15]+$[e>>16&15]+$[e>>12&15]+$[e>>8&15]+$[e>>4&15]+$[e&15]+$[t>>28&15]+$[t>>24&15]+$[t>>20&15]+$[t>>16&15]+$[t>>12&15]+$[t>>8&15]+$[t>>4&15]+$[t&15]+$[n>>28&15]+$[n>>24&15]+$[n>>20&15]+$[n>>16&15]+$[n>>12&15]+$[n>>8&15]+$[n>>4&15]+$[n&15]+$[r>>28&15]+$[r>>24&15]+$[r>>20&15]+$[r>>16&15]+$[r>>12&15]+$[r>>8&15]+$[r>>4&15]+$[r&15]+$[f>>28&15]+$[f>>24&15]+$[f>>20&15]+$[f>>16&15]+$[f>>12&15]+$[f>>8&15]+$[f>>4&15]+$[f&15]+$[i>>28&15]+$[i>>24&15]+$[i>>20&15]+$[i>>16&15]+$[i>>12&15]+$[i>>8&15]+$[i>>4&15]+$[i&15]+$[o>>28&15]+$[o>>24&15]+$[o>>20&15]+$[o>>16&15]+$[o>>12&15]+$[o>>8&15]+$[o>>4&15]+$[o&15];return this.is224||(c+=$[a>>28&15]+$[a>>24&15]+$[a>>20&15]+$[a>>16&15]+$[a>>12&15]+$[a>>8&15]+$[a>>4&15]+$[a&15]),c};xe.prototype.toString=xe.prototype.hex;xe.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,f=this.h4,i=this.h5,o=this.h6,a=this.h7,c=[e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,f>>24&255,f>>16&255,f>>8&255,f&255,i>>24&255,i>>16&255,i>>8&255,i&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||c.push(a>>24&255,a>>16&255,a>>8&255,a&255),c};xe.prototype.array=xe.prototype.digest;xe.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};function fr(e,t,n){var r,f=typeof e;if(f==="string"){var i=[],o=e.length,a=0,c;for(r=0;r<o;++r)c=e.charCodeAt(r),c<128?i[a++]=c:c<2048?(i[a++]=192|c>>6,i[a++]=128|c&63):c<55296||c>=57344?(i[a++]=224|c>>12,i[a++]=128|c>>6&63,i[a++]=128|c&63):(c=65536+((c&1023)<<10|e.charCodeAt(++r)&1023),i[a++]=240|c>>18,i[a++]=128|c>>12&63,i[a++]=128|c>>6&63,i[a++]=128|c&63);e=i}else if(f==="object"){if(e===null)throw new Error(qt);e=new Uint8Array(e)}else throw new Error(qt);e.length>64&&(e=new xe(t,!0).update(e).array());var h=[],l=[];for(r=0;r<64;++r){var A=e[r]||0;h[r]=92^A,l[r]=54^A}xe.call(this,t,n),this.update(l),this.oKeyPad=h,this.inner=!0,this.sharedMemory=n}fr.prototype=new xe;fr.prototype.finalize=function(){if(xe.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();xe.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),xe.prototype.finalize.call(this)}};const Ft=nr();Ft.sha256=Ft;Ft.sha224=nr(!0);Ft.sha256.hmac=Yn();Ft.sha224.hmac=Yn(!0);var Y={},M=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},ir=function(){throw new Error("no PRNG")},Jf=new Uint8Array(16),Hn=new Uint8Array(32);Hn[0]=9;var Cr=M(),vt=M([1]),Qf=M([56129,1]),Kn=M([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),e0=M([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),mn=M([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),En=M([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),t0=M([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function An(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=r&255}function Zr(e,t,n,r,f){var i,o=0;for(i=0;i<f;i++)o|=e[t+i]^n[r+i];return(1&o-1>>>8)-1}function kn(e,t,n,r){return Zr(e,t,n,r,16)}function Gr(e,t,n,r){return Zr(e,t,n,r,32)}function r0(e,t,n,r){for(var f=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,i=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,a=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,h=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,l=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,A=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,b=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,y=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,U=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,C=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,P=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,I=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,D=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,B=f,R=i,O=o,z=a,j=c,F=h,x=l,d=A,E=b,w=y,v=m,T=U,H=C,G=P,q=I,u=D,s,g=0;g<20;g+=2)s=B+H|0,j^=s<<7|s>>>32-7,s=j+B|0,E^=s<<9|s>>>32-9,s=E+j|0,H^=s<<13|s>>>32-13,s=H+E|0,B^=s<<18|s>>>32-18,s=F+R|0,w^=s<<7|s>>>32-7,s=w+F|0,G^=s<<9|s>>>32-9,s=G+w|0,R^=s<<13|s>>>32-13,s=R+G|0,F^=s<<18|s>>>32-18,s=v+x|0,q^=s<<7|s>>>32-7,s=q+v|0,O^=s<<9|s>>>32-9,s=O+q|0,x^=s<<13|s>>>32-13,s=x+O|0,v^=s<<18|s>>>32-18,s=u+T|0,z^=s<<7|s>>>32-7,s=z+u|0,d^=s<<9|s>>>32-9,s=d+z|0,T^=s<<13|s>>>32-13,s=T+d|0,u^=s<<18|s>>>32-18,s=B+z|0,R^=s<<7|s>>>32-7,s=R+B|0,O^=s<<9|s>>>32-9,s=O+R|0,z^=s<<13|s>>>32-13,s=z+O|0,B^=s<<18|s>>>32-18,s=F+j|0,x^=s<<7|s>>>32-7,s=x+F|0,d^=s<<9|s>>>32-9,s=d+x|0,j^=s<<13|s>>>32-13,s=j+d|0,F^=s<<18|s>>>32-18,s=v+w|0,T^=s<<7|s>>>32-7,s=T+v|0,E^=s<<9|s>>>32-9,s=E+T|0,w^=s<<13|s>>>32-13,s=w+E|0,v^=s<<18|s>>>32-18,s=u+q|0,H^=s<<7|s>>>32-7,s=H+u|0,G^=s<<9|s>>>32-9,s=G+H|0,q^=s<<13|s>>>32-13,s=q+G|0,u^=s<<18|s>>>32-18;B=B+f|0,R=R+i|0,O=O+o|0,z=z+a|0,j=j+c|0,F=F+h|0,x=x+l|0,d=d+A|0,E=E+b|0,w=w+y|0,v=v+m|0,T=T+U|0,H=H+C|0,G=G+P|0,q=q+I|0,u=u+D|0,e[0]=B>>>0&255,e[1]=B>>>8&255,e[2]=B>>>16&255,e[3]=B>>>24&255,e[4]=R>>>0&255,e[5]=R>>>8&255,e[6]=R>>>16&255,e[7]=R>>>24&255,e[8]=O>>>0&255,e[9]=O>>>8&255,e[10]=O>>>16&255,e[11]=O>>>24&255,e[12]=z>>>0&255,e[13]=z>>>8&255,e[14]=z>>>16&255,e[15]=z>>>24&255,e[16]=j>>>0&255,e[17]=j>>>8&255,e[18]=j>>>16&255,e[19]=j>>>24&255,e[20]=F>>>0&255,e[21]=F>>>8&255,e[22]=F>>>16&255,e[23]=F>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=d>>>0&255,e[29]=d>>>8&255,e[30]=d>>>16&255,e[31]=d>>>24&255,e[32]=E>>>0&255,e[33]=E>>>8&255,e[34]=E>>>16&255,e[35]=E>>>24&255,e[36]=w>>>0&255,e[37]=w>>>8&255,e[38]=w>>>16&255,e[39]=w>>>24&255,e[40]=v>>>0&255,e[41]=v>>>8&255,e[42]=v>>>16&255,e[43]=v>>>24&255,e[44]=T>>>0&255,e[45]=T>>>8&255,e[46]=T>>>16&255,e[47]=T>>>24&255,e[48]=H>>>0&255,e[49]=H>>>8&255,e[50]=H>>>16&255,e[51]=H>>>24&255,e[52]=G>>>0&255,e[53]=G>>>8&255,e[54]=G>>>16&255,e[55]=G>>>24&255,e[56]=q>>>0&255,e[57]=q>>>8&255,e[58]=q>>>16&255,e[59]=q>>>24&255,e[60]=u>>>0&255,e[61]=u>>>8&255,e[62]=u>>>16&255,e[63]=u>>>24&255}function n0(e,t,n,r){for(var f=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,i=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,a=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,h=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,l=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,A=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,b=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,y=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,U=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,C=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,P=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,I=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,D=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,B=f,R=i,O=o,z=a,j=c,F=h,x=l,d=A,E=b,w=y,v=m,T=U,H=C,G=P,q=I,u=D,s,g=0;g<20;g+=2)s=B+H|0,j^=s<<7|s>>>32-7,s=j+B|0,E^=s<<9|s>>>32-9,s=E+j|0,H^=s<<13|s>>>32-13,s=H+E|0,B^=s<<18|s>>>32-18,s=F+R|0,w^=s<<7|s>>>32-7,s=w+F|0,G^=s<<9|s>>>32-9,s=G+w|0,R^=s<<13|s>>>32-13,s=R+G|0,F^=s<<18|s>>>32-18,s=v+x|0,q^=s<<7|s>>>32-7,s=q+v|0,O^=s<<9|s>>>32-9,s=O+q|0,x^=s<<13|s>>>32-13,s=x+O|0,v^=s<<18|s>>>32-18,s=u+T|0,z^=s<<7|s>>>32-7,s=z+u|0,d^=s<<9|s>>>32-9,s=d+z|0,T^=s<<13|s>>>32-13,s=T+d|0,u^=s<<18|s>>>32-18,s=B+z|0,R^=s<<7|s>>>32-7,s=R+B|0,O^=s<<9|s>>>32-9,s=O+R|0,z^=s<<13|s>>>32-13,s=z+O|0,B^=s<<18|s>>>32-18,s=F+j|0,x^=s<<7|s>>>32-7,s=x+F|0,d^=s<<9|s>>>32-9,s=d+x|0,j^=s<<13|s>>>32-13,s=j+d|0,F^=s<<18|s>>>32-18,s=v+w|0,T^=s<<7|s>>>32-7,s=T+v|0,E^=s<<9|s>>>32-9,s=E+T|0,w^=s<<13|s>>>32-13,s=w+E|0,v^=s<<18|s>>>32-18,s=u+q|0,H^=s<<7|s>>>32-7,s=H+u|0,G^=s<<9|s>>>32-9,s=G+H|0,q^=s<<13|s>>>32-13,s=q+G|0,u^=s<<18|s>>>32-18;e[0]=B>>>0&255,e[1]=B>>>8&255,e[2]=B>>>16&255,e[3]=B>>>24&255,e[4]=F>>>0&255,e[5]=F>>>8&255,e[6]=F>>>16&255,e[7]=F>>>24&255,e[8]=v>>>0&255,e[9]=v>>>8&255,e[10]=v>>>16&255,e[11]=v>>>24&255,e[12]=u>>>0&255,e[13]=u>>>8&255,e[14]=u>>>16&255,e[15]=u>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=w>>>0&255,e[29]=w>>>8&255,e[30]=w>>>16&255,e[31]=w>>>24&255}function Wt(e,t,n,r){r0(e,t,n,r)}function or(e,t,n,r){n0(e,t,n,r)}var at=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Zn(e,t,n,r,f,i,o){var a=new Uint8Array(16),c=new Uint8Array(64),h,l;for(l=0;l<16;l++)a[l]=0;for(l=0;l<8;l++)a[l]=i[l];for(;f>=64;){for(Wt(c,a,o,at),l=0;l<64;l++)e[t+l]=n[r+l]^c[l];for(h=1,l=8;l<16;l++)h=h+(a[l]&255)|0,a[l]=h&255,h>>>=8;f-=64,t+=64,r+=64}if(f>0)for(Wt(c,a,o,at),l=0;l<f;l++)e[t+l]=n[r+l]^c[l];return 0}function Gn(e,t,n,r,f){var i=new Uint8Array(16),o=new Uint8Array(64),a,c;for(c=0;c<16;c++)i[c]=0;for(c=0;c<8;c++)i[c]=r[c];for(;n>=64;){for(Wt(o,i,f,at),c=0;c<64;c++)e[t+c]=o[c];for(a=1,c=8;c<16;c++)a=a+(i[c]&255)|0,i[c]=a&255,a>>>=8;n-=64,t+=64}if(n>0)for(Wt(o,i,f,at),c=0;c<n;c++)e[t+c]=o[c];return 0}function qn(e,t,n,r,f){var i=new Uint8Array(32);or(i,r,f,at);for(var o=new Uint8Array(8),a=0;a<8;a++)o[a]=r[a+16];return Gn(e,t,n,o,i)}function qr(e,t,n,r,f,i,o){var a=new Uint8Array(32);or(a,i,o,at);for(var c=new Uint8Array(8),h=0;h<8;h++)c[h]=i[h+16];return Zn(e,t,n,r,f,c,a)}var sr=function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t,n,r,f,i,o,a,c;t=e[0]&255|(e[1]&255)<<8,this.r[0]=t&8191,n=e[2]&255|(e[3]&255)<<8,this.r[1]=(t>>>13|n<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(n>>>10|r<<6)&7939,f=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|f<<9)&8191,i=e[8]&255|(e[9]&255)<<8,this.r[4]=(f>>>4|i<<12)&255,this.r[5]=i>>>1&8190,o=e[10]&255|(e[11]&255)<<8,this.r[6]=(i>>>14|o<<2)&8191,a=e[12]&255|(e[13]&255)<<8,this.r[7]=(o>>>11|a<<5)&8065,c=e[14]&255|(e[15]&255)<<8,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8};sr.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,f,i,o,a,c,h,l,A,b,y,m,U,C,P,I,D,B,R,O,z=this.h[0],j=this.h[1],F=this.h[2],x=this.h[3],d=this.h[4],E=this.h[5],w=this.h[6],v=this.h[7],T=this.h[8],H=this.h[9],G=this.r[0],q=this.r[1],u=this.r[2],s=this.r[3],g=this.r[4],p=this.r[5],L=this.r[6],N=this.r[7],k=this.r[8],K=this.r[9];n>=16;)f=e[t+0]&255|(e[t+1]&255)<<8,z+=f&8191,i=e[t+2]&255|(e[t+3]&255)<<8,j+=(f>>>13|i<<3)&8191,o=e[t+4]&255|(e[t+5]&255)<<8,F+=(i>>>10|o<<6)&8191,a=e[t+6]&255|(e[t+7]&255)<<8,x+=(o>>>7|a<<9)&8191,c=e[t+8]&255|(e[t+9]&255)<<8,d+=(a>>>4|c<<12)&8191,E+=c>>>1&8191,h=e[t+10]&255|(e[t+11]&255)<<8,w+=(c>>>14|h<<2)&8191,l=e[t+12]&255|(e[t+13]&255)<<8,v+=(h>>>11|l<<5)&8191,A=e[t+14]&255|(e[t+15]&255)<<8,T+=(l>>>8|A<<8)&8191,H+=A>>>5|r,b=0,y=b,y+=z*G,y+=j*(5*K),y+=F*(5*k),y+=x*(5*N),y+=d*(5*L),b=y>>>13,y&=8191,y+=E*(5*p),y+=w*(5*g),y+=v*(5*s),y+=T*(5*u),y+=H*(5*q),b+=y>>>13,y&=8191,m=b,m+=z*q,m+=j*G,m+=F*(5*K),m+=x*(5*k),m+=d*(5*N),b=m>>>13,m&=8191,m+=E*(5*L),m+=w*(5*p),m+=v*(5*g),m+=T*(5*s),m+=H*(5*u),b+=m>>>13,m&=8191,U=b,U+=z*u,U+=j*q,U+=F*G,U+=x*(5*K),U+=d*(5*k),b=U>>>13,U&=8191,U+=E*(5*N),U+=w*(5*L),U+=v*(5*p),U+=T*(5*g),U+=H*(5*s),b+=U>>>13,U&=8191,C=b,C+=z*s,C+=j*u,C+=F*q,C+=x*G,C+=d*(5*K),b=C>>>13,C&=8191,C+=E*(5*k),C+=w*(5*N),C+=v*(5*L),C+=T*(5*p),C+=H*(5*g),b+=C>>>13,C&=8191,P=b,P+=z*g,P+=j*s,P+=F*u,P+=x*q,P+=d*G,b=P>>>13,P&=8191,P+=E*(5*K),P+=w*(5*k),P+=v*(5*N),P+=T*(5*L),P+=H*(5*p),b+=P>>>13,P&=8191,I=b,I+=z*p,I+=j*g,I+=F*s,I+=x*u,I+=d*q,b=I>>>13,I&=8191,I+=E*G,I+=w*(5*K),I+=v*(5*k),I+=T*(5*N),I+=H*(5*L),b+=I>>>13,I&=8191,D=b,D+=z*L,D+=j*p,D+=F*g,D+=x*s,D+=d*u,b=D>>>13,D&=8191,D+=E*q,D+=w*G,D+=v*(5*K),D+=T*(5*k),D+=H*(5*N),b+=D>>>13,D&=8191,B=b,B+=z*N,B+=j*L,B+=F*p,B+=x*g,B+=d*s,b=B>>>13,B&=8191,B+=E*u,B+=w*q,B+=v*G,B+=T*(5*K),B+=H*(5*k),b+=B>>>13,B&=8191,R=b,R+=z*k,R+=j*N,R+=F*L,R+=x*p,R+=d*g,b=R>>>13,R&=8191,R+=E*s,R+=w*u,R+=v*q,R+=T*G,R+=H*(5*K),b+=R>>>13,R&=8191,O=b,O+=z*K,O+=j*k,O+=F*N,O+=x*L,O+=d*p,b=O>>>13,O&=8191,O+=E*g,O+=w*s,O+=v*u,O+=T*q,O+=H*G,b+=O>>>13,O&=8191,b=(b<<2)+b|0,b=b+y|0,y=b&8191,b=b>>>13,m+=b,z=y,j=m,F=U,x=C,d=P,E=I,w=D,v=B,T=R,H=O,t+=16,n-=16;this.h[0]=z,this.h[1]=j,this.h[2]=F,this.h[3]=x,this.h[4]=d,this.h[5]=E,this.h[6]=w,this.h[7]=v,this.h[8]=T,this.h[9]=H};sr.prototype.finish=function(e,t){var n=new Uint16Array(10),r,f,i,o;if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this.h[o]+r,r=n[o]>>>13,n[o]&=8191;for(n[9]-=1<<13,f=(r^1)-1,o=0;o<10;o++)n[o]&=f;for(f=~f,o=0;o<10;o++)this.h[o]=this.h[o]&f|n[o];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,i=this.h[0]+this.pad[0],this.h[0]=i&65535,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=i&65535;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255};sr.prototype.update=function(e,t,n){var r,f;if(this.leftover){for(f=16-this.leftover,f>n&&(f=n),r=0;r<f;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=f,t+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(f=n-n%16,this.blocks(e,t,f),t+=f,n-=f),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};function Vr(e,t,n,r,f,i){var o=new sr(i);return o.update(n,r,f),o.finish(e,t),0}function Vn(e,t,n,r,f,i){var o=new Uint8Array(16);return Vr(o,0,n,r,f,i),kn(e,t,o,0)}function Wr(e,t,n,r,f){var i;if(n<32)return-1;for(qr(e,0,t,0,n,r,f),Vr(e,16,e,32,n-32,e),i=0;i<16;i++)e[i]=0;return 0}function Xr(e,t,n,r,f){var i,o=new Uint8Array(32);if(n<32||(qn(o,0,32,r,f),Vn(t,16,t,32,n-32,o)!==0))return-1;for(qr(e,0,t,0,n,r,f),i=0;i<32;i++)e[i]=0;return 0}function Ke(e,t){var n;for(n=0;n<16;n++)e[n]=t[n]|0}function vr(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-r*65536;e[0]+=r-1+37*(r-1)}function yt(e,t,n){for(var r,f=~(n-1),i=0;i<16;i++)r=f&(e[i]^t[i]),e[i]^=r,t[i]^=r}function ct(e,t){var n,r,f,i=M(),o=M();for(n=0;n<16;n++)o[n]=t[n];for(vr(o),vr(o),vr(o),r=0;r<2;r++){for(i[0]=o[0]-65517,n=1;n<15;n++)i[n]=o[n]-65535-(i[n-1]>>16&1),i[n-1]&=65535;i[15]=o[15]-32767-(i[14]>>16&1),f=i[15]>>16&1,i[14]&=65535,yt(o,i,1-f)}for(n=0;n<16;n++)e[2*n]=o[n]&255,e[2*n+1]=o[n]>>8}function _n(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return ct(n,e),ct(r,t),Gr(n,0,r,0)}function Wn(e){var t=new Uint8Array(32);return ct(t,e),t[0]&1}function Jr(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function Be(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function Fe(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function W(e,t,n){var r,f,i=0,o=0,a=0,c=0,h=0,l=0,A=0,b=0,y=0,m=0,U=0,C=0,P=0,I=0,D=0,B=0,R=0,O=0,z=0,j=0,F=0,x=0,d=0,E=0,w=0,v=0,T=0,H=0,G=0,q=0,u=0,s=n[0],g=n[1],p=n[2],L=n[3],N=n[4],k=n[5],K=n[6],V=n[7],Z=n[8],X=n[9],ee=n[10],Q=n[11],re=n[12],fe=n[13],ie=n[14],oe=n[15];r=t[0],i+=r*s,o+=r*g,a+=r*p,c+=r*L,h+=r*N,l+=r*k,A+=r*K,b+=r*V,y+=r*Z,m+=r*X,U+=r*ee,C+=r*Q,P+=r*re,I+=r*fe,D+=r*ie,B+=r*oe,r=t[1],o+=r*s,a+=r*g,c+=r*p,h+=r*L,l+=r*N,A+=r*k,b+=r*K,y+=r*V,m+=r*Z,U+=r*X,C+=r*ee,P+=r*Q,I+=r*re,D+=r*fe,B+=r*ie,R+=r*oe,r=t[2],a+=r*s,c+=r*g,h+=r*p,l+=r*L,A+=r*N,b+=r*k,y+=r*K,m+=r*V,U+=r*Z,C+=r*X,P+=r*ee,I+=r*Q,D+=r*re,B+=r*fe,R+=r*ie,O+=r*oe,r=t[3],c+=r*s,h+=r*g,l+=r*p,A+=r*L,b+=r*N,y+=r*k,m+=r*K,U+=r*V,C+=r*Z,P+=r*X,I+=r*ee,D+=r*Q,B+=r*re,R+=r*fe,O+=r*ie,z+=r*oe,r=t[4],h+=r*s,l+=r*g,A+=r*p,b+=r*L,y+=r*N,m+=r*k,U+=r*K,C+=r*V,P+=r*Z,I+=r*X,D+=r*ee,B+=r*Q,R+=r*re,O+=r*fe,z+=r*ie,j+=r*oe,r=t[5],l+=r*s,A+=r*g,b+=r*p,y+=r*L,m+=r*N,U+=r*k,C+=r*K,P+=r*V,I+=r*Z,D+=r*X,B+=r*ee,R+=r*Q,O+=r*re,z+=r*fe,j+=r*ie,F+=r*oe,r=t[6],A+=r*s,b+=r*g,y+=r*p,m+=r*L,U+=r*N,C+=r*k,P+=r*K,I+=r*V,D+=r*Z,B+=r*X,R+=r*ee,O+=r*Q,z+=r*re,j+=r*fe,F+=r*ie,x+=r*oe,r=t[7],b+=r*s,y+=r*g,m+=r*p,U+=r*L,C+=r*N,P+=r*k,I+=r*K,D+=r*V,B+=r*Z,R+=r*X,O+=r*ee,z+=r*Q,j+=r*re,F+=r*fe,x+=r*ie,d+=r*oe,r=t[8],y+=r*s,m+=r*g,U+=r*p,C+=r*L,P+=r*N,I+=r*k,D+=r*K,B+=r*V,R+=r*Z,O+=r*X,z+=r*ee,j+=r*Q,F+=r*re,x+=r*fe,d+=r*ie,E+=r*oe,r=t[9],m+=r*s,U+=r*g,C+=r*p,P+=r*L,I+=r*N,D+=r*k,B+=r*K,R+=r*V,O+=r*Z,z+=r*X,j+=r*ee,F+=r*Q,x+=r*re,d+=r*fe,E+=r*ie,w+=r*oe,r=t[10],U+=r*s,C+=r*g,P+=r*p,I+=r*L,D+=r*N,B+=r*k,R+=r*K,O+=r*V,z+=r*Z,j+=r*X,F+=r*ee,x+=r*Q,d+=r*re,E+=r*fe,w+=r*ie,v+=r*oe,r=t[11],C+=r*s,P+=r*g,I+=r*p,D+=r*L,B+=r*N,R+=r*k,O+=r*K,z+=r*V,j+=r*Z,F+=r*X,x+=r*ee,d+=r*Q,E+=r*re,w+=r*fe,v+=r*ie,T+=r*oe,r=t[12],P+=r*s,I+=r*g,D+=r*p,B+=r*L,R+=r*N,O+=r*k,z+=r*K,j+=r*V,F+=r*Z,x+=r*X,d+=r*ee,E+=r*Q,w+=r*re,v+=r*fe,T+=r*ie,H+=r*oe,r=t[13],I+=r*s,D+=r*g,B+=r*p,R+=r*L,O+=r*N,z+=r*k,j+=r*K,F+=r*V,x+=r*Z,d+=r*X,E+=r*ee,w+=r*Q,v+=r*re,T+=r*fe,H+=r*ie,G+=r*oe,r=t[14],D+=r*s,B+=r*g,R+=r*p,O+=r*L,z+=r*N,j+=r*k,F+=r*K,x+=r*V,d+=r*Z,E+=r*X,w+=r*ee,v+=r*Q,T+=r*re,H+=r*fe,G+=r*ie,q+=r*oe,r=t[15],B+=r*s,R+=r*g,O+=r*p,z+=r*L,j+=r*N,F+=r*k,x+=r*K,d+=r*V,E+=r*Z,w+=r*X,v+=r*ee,T+=r*Q,H+=r*re,G+=r*fe,q+=r*ie,u+=r*oe,i+=38*R,o+=38*O,a+=38*z,c+=38*j,h+=38*F,l+=38*x,A+=38*d,b+=38*E,y+=38*w,m+=38*v,U+=38*T,C+=38*H,P+=38*G,I+=38*q,D+=38*u,f=1,r=i+f+65535,f=Math.floor(r/65536),i=r-f*65536,r=o+f+65535,f=Math.floor(r/65536),o=r-f*65536,r=a+f+65535,f=Math.floor(r/65536),a=r-f*65536,r=c+f+65535,f=Math.floor(r/65536),c=r-f*65536,r=h+f+65535,f=Math.floor(r/65536),h=r-f*65536,r=l+f+65535,f=Math.floor(r/65536),l=r-f*65536,r=A+f+65535,f=Math.floor(r/65536),A=r-f*65536,r=b+f+65535,f=Math.floor(r/65536),b=r-f*65536,r=y+f+65535,f=Math.floor(r/65536),y=r-f*65536,r=m+f+65535,f=Math.floor(r/65536),m=r-f*65536,r=U+f+65535,f=Math.floor(r/65536),U=r-f*65536,r=C+f+65535,f=Math.floor(r/65536),C=r-f*65536,r=P+f+65535,f=Math.floor(r/65536),P=r-f*65536,r=I+f+65535,f=Math.floor(r/65536),I=r-f*65536,r=D+f+65535,f=Math.floor(r/65536),D=r-f*65536,r=B+f+65535,f=Math.floor(r/65536),B=r-f*65536,i+=f-1+37*(f-1),f=1,r=i+f+65535,f=Math.floor(r/65536),i=r-f*65536,r=o+f+65535,f=Math.floor(r/65536),o=r-f*65536,r=a+f+65535,f=Math.floor(r/65536),a=r-f*65536,r=c+f+65535,f=Math.floor(r/65536),c=r-f*65536,r=h+f+65535,f=Math.floor(r/65536),h=r-f*65536,r=l+f+65535,f=Math.floor(r/65536),l=r-f*65536,r=A+f+65535,f=Math.floor(r/65536),A=r-f*65536,r=b+f+65535,f=Math.floor(r/65536),b=r-f*65536,r=y+f+65535,f=Math.floor(r/65536),y=r-f*65536,r=m+f+65535,f=Math.floor(r/65536),m=r-f*65536,r=U+f+65535,f=Math.floor(r/65536),U=r-f*65536,r=C+f+65535,f=Math.floor(r/65536),C=r-f*65536,r=P+f+65535,f=Math.floor(r/65536),P=r-f*65536,r=I+f+65535,f=Math.floor(r/65536),I=r-f*65536,r=D+f+65535,f=Math.floor(r/65536),D=r-f*65536,r=B+f+65535,f=Math.floor(r/65536),B=r-f*65536,i+=f-1+37*(f-1),e[0]=i,e[1]=o,e[2]=a,e[3]=c,e[4]=h,e[5]=l,e[6]=A,e[7]=b,e[8]=y,e[9]=m,e[10]=U,e[11]=C,e[12]=P,e[13]=I,e[14]=D,e[15]=B}function Ce(e,t){W(e,t,t)}function Qr(e,t){var n=M(),r;for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)Ce(n,n),r!==2&&r!==4&&W(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function Xn(e,t){var n=M(),r;for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)Ce(n,n),r!==1&&W(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function ar(e,t,n){var r=new Uint8Array(32),f=new Float64Array(80),i,o,a=M(),c=M(),h=M(),l=M(),A=M(),b=M();for(o=0;o<31;o++)r[o]=t[o];for(r[31]=t[31]&127|64,r[0]&=248,Jr(f,n),o=0;o<16;o++)c[o]=f[o],l[o]=a[o]=h[o]=0;for(a[0]=l[0]=1,o=254;o>=0;--o)i=r[o>>>3]>>>(o&7)&1,yt(a,c,i),yt(h,l,i),Be(A,a,h),Fe(a,a,h),Be(h,c,l),Fe(c,c,l),Ce(l,A),Ce(b,a),W(a,h,a),W(h,c,A),Be(A,a,h),Fe(a,a,h),Ce(c,a),Fe(h,l,b),W(a,h,Qf),Be(a,a,l),W(h,h,a),W(a,l,b),W(l,c,f),Ce(c,A),yt(a,c,i),yt(h,l,i);for(o=0;o<16;o++)f[o+16]=a[o],f[o+32]=h[o],f[o+48]=c[o],f[o+64]=l[o];var y=f.subarray(32),m=f.subarray(16);return Qr(y,y),W(m,m,y),ct(e,m),0}function cr(e,t){return ar(e,t,Hn)}function Jn(e,t){return ir(t,32),cr(e,t)}function ur(e,t,n){var r=new Uint8Array(32);return ar(r,n,t),or(e,Jf,r,at)}var Qn=Wr,f0=Xr;function i0(e,t,n,r,f,i){var o=new Uint8Array(32);return ur(o,f,i),Qn(e,t,n,r,o)}function o0(e,t,n,r,f,i){var o=new Uint8Array(32);return ur(o,f,i),f0(e,t,n,r,o)}var Sn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Tn(e,t,n,r){for(var f=new Int32Array(16),i=new Int32Array(16),o,a,c,h,l,A,b,y,m,U,C,P,I,D,B,R,O,z,j,F,x,d,E,w,v,T,H=e[0],G=e[1],q=e[2],u=e[3],s=e[4],g=e[5],p=e[6],L=e[7],N=t[0],k=t[1],K=t[2],V=t[3],Z=t[4],X=t[5],ee=t[6],Q=t[7],re=0;r>=128;){for(j=0;j<16;j++)F=8*j+re,f[j]=n[F+0]<<24|n[F+1]<<16|n[F+2]<<8|n[F+3],i[j]=n[F+4]<<24|n[F+5]<<16|n[F+6]<<8|n[F+7];for(j=0;j<80;j++)if(o=H,a=G,c=q,h=u,l=s,A=g,b=p,y=L,m=N,U=k,C=K,P=V,I=Z,D=X,B=ee,R=Q,x=L,d=Q,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=(s>>>14|Z<<32-14)^(s>>>18|Z<<32-18)^(Z>>>41-32|s<<32-(41-32)),d=(Z>>>14|s<<32-14)^(Z>>>18|s<<32-18)^(s>>>41-32|Z<<32-(41-32)),E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,x=s&g^~s&p,d=Z&X^~Z&ee,E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,x=Sn[j*2],d=Sn[j*2+1],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,x=f[j%16],d=i[j%16],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,O=v&65535|T<<16,z=E&65535|w<<16,x=O,d=z,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=(H>>>28|N<<32-28)^(N>>>34-32|H<<32-(34-32))^(N>>>39-32|H<<32-(39-32)),d=(N>>>28|H<<32-28)^(H>>>34-32|N<<32-(34-32))^(H>>>39-32|N<<32-(39-32)),E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,x=H&G^H&q^G&q,d=N&k^N&K^k&K,E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,y=v&65535|T<<16,R=E&65535|w<<16,x=h,d=P,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=O,d=z,E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,h=v&65535|T<<16,P=E&65535|w<<16,G=o,q=a,u=c,s=h,g=l,p=A,L=b,H=y,k=m,K=U,V=C,Z=P,X=I,ee=D,Q=B,N=R,j%16===15)for(F=0;F<16;F++)x=f[F],d=i[F],E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=f[(F+9)%16],d=i[(F+9)%16],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,O=f[(F+1)%16],z=i[(F+1)%16],x=(O>>>1|z<<32-1)^(O>>>8|z<<32-8)^O>>>7,d=(z>>>1|O<<32-1)^(z>>>8|O<<32-8)^(z>>>7|O<<32-7),E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,O=f[(F+14)%16],z=i[(F+14)%16],x=(O>>>19|z<<32-19)^(z>>>61-32|O<<32-(61-32))^O>>>6,d=(z>>>19|O<<32-19)^(O>>>61-32|z<<32-(61-32))^(z>>>6|O<<32-6),E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,f[F]=v&65535|T<<16,i[F]=E&65535|w<<16;x=H,d=N,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[0],d=t[0],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[0]=H=v&65535|T<<16,t[0]=N=E&65535|w<<16,x=G,d=k,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[1],d=t[1],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[1]=G=v&65535|T<<16,t[1]=k=E&65535|w<<16,x=q,d=K,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[2],d=t[2],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[2]=q=v&65535|T<<16,t[2]=K=E&65535|w<<16,x=u,d=V,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[3],d=t[3],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[3]=u=v&65535|T<<16,t[3]=V=E&65535|w<<16,x=s,d=Z,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[4],d=t[4],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[4]=s=v&65535|T<<16,t[4]=Z=E&65535|w<<16,x=g,d=X,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[5],d=t[5],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[5]=g=v&65535|T<<16,t[5]=X=E&65535|w<<16,x=p,d=ee,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[6],d=t[6],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[6]=p=v&65535|T<<16,t[6]=ee=E&65535|w<<16,x=L,d=Q,E=d&65535,w=d>>>16,v=x&65535,T=x>>>16,x=e[7],d=t[7],E+=d&65535,w+=d>>>16,v+=x&65535,T+=x>>>16,w+=E>>>16,v+=w>>>16,T+=v>>>16,e[7]=L=v&65535|T<<16,t[7]=Q=E&65535|w<<16,re+=128,r-=128}return r}function st(e,t,n){var r=new Int32Array(8),f=new Int32Array(8),i=new Uint8Array(256),o,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,f[0]=4089235720,f[1]=2227873595,f[2]=4271175723,f[3]=1595750129,f[4]=2917565137,f[5]=725511199,f[6]=4215389547,f[7]=327033209,Tn(r,f,t,n),n%=128,o=0;o<n;o++)i[o]=t[a-n+o];for(i[n]=128,n=256-128*(n<112?1:0),i[n-9]=0,An(i,n-8,a/536870912|0,a<<3),Tn(r,f,i,n),o=0;o<8;o++)An(e,8*o,r[o],f[o]);return 0}function Xt(e,t){var n=M(),r=M(),f=M(),i=M(),o=M(),a=M(),c=M(),h=M(),l=M();Fe(n,e[1],e[0]),Fe(l,t[1],t[0]),W(n,n,l),Be(r,e[0],e[1]),Be(l,t[0],t[1]),W(r,r,l),W(f,e[3],t[3]),W(f,f,e0),W(i,e[2],t[2]),Be(i,i,i),Fe(o,r,n),Fe(a,i,f),Be(c,i,f),Be(h,r,n),W(e[0],o,a),W(e[1],h,c),W(e[2],c,a),W(e[3],o,h)}function Un(e,t,n){var r;for(r=0;r<4;r++)yt(e[r],t[r],n)}function en(e,t){var n=M(),r=M(),f=M();Qr(f,t[2]),W(n,t[0],f),W(r,t[1],f),ct(e,r),e[31]^=Wn(n)<<7}function tn(e,t,n){var r,f;for(Ke(e[0],Cr),Ke(e[1],vt),Ke(e[2],vt),Ke(e[3],Cr),f=255;f>=0;--f)r=n[f/8|0]>>(f&7)&1,Un(e,t,r),Xt(t,e),Xt(e,e),Un(e,t,r)}function lr(e,t){var n=[M(),M(),M(),M()];Ke(n[0],mn),Ke(n[1],En),Ke(n[2],vt),W(n[3],mn,En),tn(e,n,t)}function rn(e,t,n){var r=new Uint8Array(64),f=[M(),M(),M(),M()],i;for(n||ir(t,32),st(r,t,32),r[0]&=248,r[31]&=127,r[31]|=64,lr(f,r),en(e,f),i=0;i<32;i++)t[i+32]=e[i];return 0}var Zt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function nn(e,t){var n,r,f,i;for(r=63;r>=32;--r){for(n=0,f=r-32,i=r-12;f<i;++f)t[f]+=n-16*t[r]*Zt[f-(r-32)],n=Math.floor((t[f]+128)/256),t[f]-=n*256;t[f]+=n,t[r]=0}for(n=0,f=0;f<32;f++)t[f]+=n-(t[31]>>4)*Zt[f],n=t[f]>>8,t[f]&=255;for(f=0;f<32;f++)t[f]-=n*Zt[f];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function Fr(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;nn(e,t)}function ef(e,t,n,r){var f=new Uint8Array(64),i=new Uint8Array(64),o=new Uint8Array(64),a,c,h=new Float64Array(64),l=[M(),M(),M(),M()];st(f,r,32),f[0]&=248,f[31]&=127,f[31]|=64;var A=n+64;for(a=0;a<n;a++)e[64+a]=t[a];for(a=0;a<32;a++)e[32+a]=f[32+a];for(st(o,e.subarray(32),n+32),Fr(o),lr(l,o),en(e,l),a=32;a<64;a++)e[a]=r[a];for(st(i,e,n+64),Fr(i),a=0;a<64;a++)h[a]=0;for(a=0;a<32;a++)h[a]=o[a];for(a=0;a<32;a++)for(c=0;c<32;c++)h[a+c]+=i[a]*f[c];return nn(e.subarray(32),h),A}function tf(e,t){var n=M(),r=M(),f=M(),i=M(),o=M(),a=M(),c=M();return Ke(e[2],vt),Jr(e[1],t),Ce(f,e[1]),W(i,f,Kn),Fe(f,f,e[2]),Be(i,e[2],i),Ce(o,i),Ce(a,o),W(c,a,o),W(n,c,f),W(n,n,i),Xn(n,n),W(n,n,f),W(n,n,i),W(n,n,i),W(e[0],n,i),Ce(r,e[0]),W(r,r,i),_n(r,f)&&W(e[0],e[0],t0),Ce(r,e[0]),W(r,r,i),_n(r,f)?-1:(Wn(e[0])===t[31]>>7&&Fe(e[0],Cr,e[0]),W(e[3],e[0],e[1]),0)}function fn(e,t,n,r){var f,i=new Uint8Array(32),o=new Uint8Array(64),a=[M(),M(),M(),M()],c=[M(),M(),M(),M()];if(n<64||tf(c,r))return-1;for(f=0;f<n;f++)e[f]=t[f];for(f=0;f<32;f++)e[f+32]=r[f];if(st(o,e,n),Fr(o),tn(a,c,o),lr(c,t.subarray(32)),Xt(a,c),en(i,a),n-=64,Gr(t,0,i,0)){for(f=0;f<n;f++)e[f]=0;return-1}for(f=0;f<n;f++)e[f]=t[f+64];return n}var on=32,hr=24,Pt=32,mt=16,Rt=32,xr=32,$t=32,Mt=32,sn=32,rf=hr,s0=Pt,a0=mt,Ye=64,xt=32,At=64,an=32,cn=64;Y.lowlevel={crypto_core_hsalsa20:or,crypto_stream_xor:qr,crypto_stream:qn,crypto_stream_salsa20_xor:Zn,crypto_stream_salsa20:Gn,crypto_onetimeauth:Vr,crypto_onetimeauth_verify:Vn,crypto_verify_16:kn,crypto_verify_32:Gr,crypto_secretbox:Wr,crypto_secretbox_open:Xr,crypto_scalarmult:ar,crypto_scalarmult_base:cr,crypto_box_beforenm:ur,crypto_box_afternm:Qn,crypto_box:i0,crypto_box_open:o0,crypto_box_keypair:Jn,crypto_hash:st,crypto_sign:ef,crypto_sign_keypair:rn,crypto_sign_open:fn,crypto_secretbox_KEYBYTES:on,crypto_secretbox_NONCEBYTES:hr,crypto_secretbox_ZEROBYTES:Pt,crypto_secretbox_BOXZEROBYTES:mt,crypto_scalarmult_BYTES:Rt,crypto_scalarmult_SCALARBYTES:xr,crypto_box_PUBLICKEYBYTES:$t,crypto_box_SECRETKEYBYTES:Mt,crypto_box_BEFORENMBYTES:sn,crypto_box_NONCEBYTES:rf,crypto_box_ZEROBYTES:s0,crypto_box_BOXZEROBYTES:a0,crypto_sign_BYTES:Ye,crypto_sign_PUBLICKEYBYTES:xt,crypto_sign_SECRETKEYBYTES:At,crypto_sign_SEEDBYTES:an,crypto_hash_BYTES:cn,gf:M,D:Kn,L:Zt,pack25519:ct,unpack25519:Jr,M:W,A:Be,S:Ce,Z:Fe,pow2523:Xn,add:Xt,set25519:Ke,modL:nn,scalarmult:tn,scalarbase:lr};function nf(e,t){if(e.length!==on)throw new Error("bad key size");if(t.length!==hr)throw new Error("bad nonce size")}function c0(e,t){if(e.length!==$t)throw new Error("bad public key size");if(t.length!==Mt)throw new Error("bad secret key size")}function _e(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function On(e){for(var t=0;t<e.length;t++)e[t]=0}Y.randomBytes=function(e){var t=new Uint8Array(e);return ir(t,e),t};Y.secretbox=function(e,t,n){_e(e,t,n),nf(n,t);for(var r=new Uint8Array(Pt+e.length),f=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+Pt]=e[i];return Wr(f,r,r.length,t,n),f.subarray(mt)};Y.secretbox.open=function(e,t,n){_e(e,t,n),nf(n,t);for(var r=new Uint8Array(mt+e.length),f=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+mt]=e[i];return r.length<32||Xr(f,r,r.length,t,n)!==0?null:f.subarray(Pt)};Y.secretbox.keyLength=on;Y.secretbox.nonceLength=hr;Y.secretbox.overheadLength=mt;Y.scalarMult=function(e,t){if(_e(e,t),e.length!==xr)throw new Error("bad n size");if(t.length!==Rt)throw new Error("bad p size");var n=new Uint8Array(Rt);return ar(n,e,t),n};Y.scalarMult.base=function(e){if(_e(e),e.length!==xr)throw new Error("bad n size");var t=new Uint8Array(Rt);return cr(t,e),t};Y.scalarMult.scalarLength=xr;Y.scalarMult.groupElementLength=Rt;Y.box=function(e,t,n,r){var f=Y.box.before(n,r);return Y.secretbox(e,t,f)};Y.box.before=function(e,t){_e(e,t),c0(e,t);var n=new Uint8Array(sn);return ur(n,e,t),n};Y.box.after=Y.secretbox;Y.box.open=function(e,t,n,r){var f=Y.box.before(n,r);return Y.secretbox.open(e,t,f)};Y.box.open.after=Y.secretbox.open;Y.box.keyPair=function(){var e=new Uint8Array($t),t=new Uint8Array(Mt);return Jn(e,t),{publicKey:e,secretKey:t}};Y.box.keyPair.fromSecretKey=function(e){if(_e(e),e.length!==Mt)throw new Error("bad secret key size");var t=new Uint8Array($t);return cr(t,e),{publicKey:t,secretKey:new Uint8Array(e)}};Y.box.publicKeyLength=$t;Y.box.secretKeyLength=Mt;Y.box.sharedKeyLength=sn;Y.box.nonceLength=rf;Y.box.overheadLength=Y.secretbox.overheadLength;Y.sign=function(e,t){if(_e(e,t),t.length!==At)throw new Error("bad secret key size");var n=new Uint8Array(Ye+e.length);return ef(n,e,e.length,t),n};Y.sign.open=function(e,t){if(_e(e,t),t.length!==xt)throw new Error("bad public key size");var n=new Uint8Array(e.length),r=fn(n,e,e.length,t);if(r<0)return null;for(var f=new Uint8Array(r),i=0;i<f.length;i++)f[i]=n[i];return f};Y.sign.detached=function(e,t){for(var n=Y.sign(e,t),r=new Uint8Array(Ye),f=0;f<r.length;f++)r[f]=n[f];return r};Y.sign.detached.verify=function(e,t,n){if(_e(e,t,n),t.length!==Ye)throw new Error("bad signature size");if(n.length!==xt)throw new Error("bad public key size");var r=new Uint8Array(Ye+e.length),f=new Uint8Array(Ye+e.length),i;for(i=0;i<Ye;i++)r[i]=t[i];for(i=0;i<e.length;i++)r[i+Ye]=e[i];return fn(f,r,r.length,n)>=0};Y.sign.keyPair=function(){var e=new Uint8Array(xt),t=new Uint8Array(At);return rn(e,t),{publicKey:e,secretKey:t}};Y.sign.keyPair.fromSecretKey=function(e){if(_e(e),e.length!==At)throw new Error("bad secret key size");for(var t=new Uint8Array(xt),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}};Y.sign.keyPair.fromSeed=function(e){if(_e(e),e.length!==an)throw new Error("bad seed size");for(var t=new Uint8Array(xt),n=new Uint8Array(At),r=0;r<32;r++)n[r]=e[r];return rn(t,n,!0),{publicKey:t,secretKey:n}};Y.sign.publicKeyLength=xt;Y.sign.secretKeyLength=At;Y.sign.seedLength=an;Y.sign.signatureLength=Ye;Y.hash=function(e){_e(e);var t=new Uint8Array(cn);return st(t,e,e.length),t};Y.hash.hashLength=cn;Y.verify=function(e,t){return _e(e,t),e.length===0||t.length===0||e.length!==t.length?!1:Zr(e,0,t,0,e.length)===0};Y.setPRNG=function(e){ir=e};(function(){var e=typeof self<"u"?self.crypto||self.msCrypto:null;if(e&&e.getRandomValues){var t=65536;Y.setPRNG(function(n,r){var f,i=new Uint8Array(r);for(f=0;f<r;f+=t)e.getRandomValues(i.subarray(f,f+Math.min(r-f,t)));for(f=0;f<r;f++)n[f]=i[f];On(i)})}else typeof requir